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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16674b1619d5cb2e1334f0617770cd2e7367b0e8 | 686 | asm | Assembly | oeis/123/A123658.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/123/A123658.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/123/A123658.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A123658: a(n) = 1 + n^4 + n^6 + n^9 + n^10.
; Submitted by Simon Strandgaard
; 5,1617,79543,1315073,11735001,70591825,322948907,1208225793,3874742893,11001010001,28297158495,67080151297,148467846593,309923269713,615105191251,1168247947265,2134605998037,3768860634193,6453801131783,10752064160001,17474246985385,27767305623377,43227812190843,66045379940353,99182373437501,146596908705105,213517117531567,306775705153793,435214974806673,610173729810001,846068797568675,1161085353721857,1577991762320293,2125096292966993,2837364831953751,3757720575193345,4938548679813497
add $0,1
mov $2,$0
pow $0,4
mov $1,$2
mul $1,$0
pow $2,2
add $2,1
add $2,$1
mul $0,$2
pow $1,2
add $0,$1
add $0,1
| 40.352941 | 491 | 0.814869 |
94e9101a84a49c5bd7137cba69898a1850d907f1 | 2,578 | asm | Assembly | tests/vice-tests/VIC20/viavarious/via1.asm | PhylumChordata/chips-test | 4f80ede2da9952efeb25d3887c768654d2374167 | [
"MIT"
] | 330 | 2017-12-11T21:20:28.000Z | 2022-03-26T08:56:51.000Z | tests/vice-tests/VIC20/viavarious/via1.asm | PhylumChordata/chips-test | 4f80ede2da9952efeb25d3887c768654d2374167 | [
"MIT"
] | 14 | 2019-01-07T23:50:35.000Z | 2022-01-09T13:43:16.000Z | tests/vice-tests/VIC20/viavarious/via1.asm | PhylumChordata/chips-test | 4f80ede2da9952efeb25d3887c768654d2374167 | [
"MIT"
] | 31 | 2018-07-02T06:13:31.000Z | 2022-02-18T16:50:56.000Z | !to "via1.prg", cbm
TESTID = 1
tmp=$fc
addr=$fd
add2=$f9
ERRBUF = $1f00
TMP = $2000 ; measured data on C64 side
DATA = $3000 ; reference data
TESTLEN = $20
NUMTESTS = 14 - 6
TESTSLOC = $1800
DTMP=screenmem
!src "common.asm"
* = TESTSLOC
;-------------------------------------------------------------------------------
; before:
; ---
; in the loop:
; read [Timer A lo | Timer A hi | Timer A lo latch | Timer A hi latch | Timer B lo | Timer B hi]
!zone { ; A
.test ldx #0
.t1b lda viabase+$4 ; Timer A lo
sta DTMP,x
inx
bne .t1b
rts
* = .test+TESTLEN
}
!zone { ; B
.test ldx #0
.t1b lda viabase+$5 ; Timer A hi
sta DTMP,x
inx
bne .t1b
rts
* = .test+TESTLEN
}
!zone { ; C
.test ldx #0
.t1b lda viabase+$6 ; Timer A latch lo
sta DTMP,x
inx
bne .t1b
rts
* = .test+TESTLEN
}
!zone { ; D
.test ldx #0
.t1b lda viabase+$7 ; Timer A latch hi
sta DTMP,x
inx
bne .t1b
rts
* = .test+TESTLEN
}
!zone { ; E
.test ldx #0
.t1b lda viabase+$8 ; Timer B lo
sta DTMP,x
inx
bne .t1b
rts
* = .test+TESTLEN
}
!zone { ; F
.test ldx #0
.t1b lda viabase+$9 ; Timer B hi
sta DTMP,x
inx
bne .t1b
rts
* = .test+TESTLEN
}
;-------------------------------------------------------------------------------
; before:
; start Timer B (switch to count clock cycles)
; in the loop:
; read [Timer B lo | Timer B hi]
!zone { ; G
.test ;lda #$1
;sta $dc0f ; start timer B continuous
lda #%00000000
sta viabase+$b
ldx #0
.t1b lda viabase+$8 ; Timer B lo
sta DTMP,x
inx
bne .t1b
rts
* = .test+TESTLEN
}
!zone { ; H
.test ;lda #$1
;sta $dc0f ; start timer B continuous
lda #%00000000
sta viabase+$b
ldx #0
.t1b lda viabase+$9 ; Timer B hi
sta DTMP,x
inx
bne .t1b
rts
* = .test+TESTLEN
}
;-------------------------------------------------------------------------------
* = DATA
!bin "via1ref.bin", NUMTESTS * $0100, 2
| 19.530303 | 102 | 0.381303 |
713114a698b37254942f80ac3de8238319f3c0ab | 30,817 | asm | Assembly | target/cos_117/disasm/iop_overlay1/INIT.asm | jrrk2/cray-sim | 52c9639808d6890517092637b188282c00cce4f7 | [
"BSL-1.0"
] | 49 | 2020-10-09T12:29:16.000Z | 2022-03-12T02:33:35.000Z | target/cos_117/disasm/iop_overlay1/INIT.asm | jrrk2/cray-sim | 52c9639808d6890517092637b188282c00cce4f7 | [
"BSL-1.0"
] | 1 | 2021-12-29T15:59:25.000Z | 2021-12-29T15:59:25.000Z | target/cos_117/disasm/iop_overlay1/INIT.asm | jrrk2/cray-sim | 52c9639808d6890517092637b188282c00cce4f7 | [
"BSL-1.0"
] | 6 | 2021-04-12T06:10:32.000Z | 2022-02-08T23:11:19.000Z | 0x0000 (0x000000) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0001 (0x000002) 0x2940- f:00024 d: 320 | OR[320] = A
0x0002 (0x000004) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0003 (0x000006) 0x2941- f:00024 d: 321 | OR[321] = A
@ Allocate 92 WORDs of memory
0x0004 (0x000008) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x0005 (0x00000A) 0x294D- f:00024 d: 333 | OR[333] = A
0x0006 (0x00000C) 0x105C- f:00010 d: 92 | A = 92 (0x005C)
0x0007 (0x00000E) 0x294E- f:00024 d: 334 | OR[334] = A
0x0008 (0x000010) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0009 (0x000012) 0x294F- f:00024 d: 335 | OR[335] = A
0x000A (0x000014) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000B (0x000016) 0x2950- f:00024 d: 336 | OR[336] = A
0x000C (0x000018) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x000D (0x00001A) 0x2951- f:00024 d: 337 | OR[337] = A
0x000E (0x00001C) 0x1141- f:00010 d: 321 | A = 321 (0x0141)
0x000F (0x00001E) 0x2952- f:00024 d: 338 | OR[338] = A
0x0010 (0x000020) 0x114D- f:00010 d: 333 | A = 333 (0x014D)
0x0011 (0x000022) 0x5800- f:00054 d: 0 | B = A
0x0012 (0x000024) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0013 (0x000026) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0014 (0x000028) 0x2940- f:00024 d: 320 | OR[320] = A
0x0015 (0x00002A) 0x2140- f:00020 d: 320 | A = OR[320]
0x0016 (0x00002C) 0x8602- f:00103 d: 2 | P = P + 2 (0x0018), A # 0
0x0017 (0x00002E) 0x700B- f:00070 d: 11 | P = P + 11 (0x0022)
0x0018 (0x000030) 0x1007- f:00010 d: 7 | A = 7 (0x0007)
0x0019 (0x000032) 0x294D- f:00024 d: 333 | OR[333] = A
0x001A (0x000034) 0x1001- f:00010 d: 1 | A = 1 (0x0001)
0x001B (0x000036) 0x294E- f:00024 d: 334 | OR[334] = A
0x001C (0x000038) 0x114D- f:00010 d: 333 | A = 333 (0x014D)
0x001D (0x00003A) 0x5800- f:00054 d: 0 | B = A
0x001E (0x00003C) 0x1800-0x6B18 f:00014 d: 0 | A = 27416 (0x6B18)
0x0020 (0x000040) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0021 (0x000042) 0x721D- f:00071 d: 29 | P = P - 29 (0x0004)
0x0022 (0x000044) 0x2141- f:00020 d: 321 | A = OR[321]
0x0023 (0x000046) 0x1428- f:00012 d: 40 | A = A + 40 (0x0028)
0x0024 (0x000048) 0x2942- f:00024 d: 322 | OR[322] = A
0x0025 (0x00004A) 0x2142- f:00020 d: 322 | A = OR[322]
0x0026 (0x00004C) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004)
0x0027 (0x00004E) 0x2943- f:00024 d: 323 | OR[323] = A
0x0028 (0x000050) 0x2143- f:00020 d: 323 | A = OR[323]
0x0029 (0x000052) 0x1418- f:00012 d: 24 | A = A + 24 (0x0018)
0x002A (0x000054) 0x2944- f:00024 d: 324 | OR[324] = A
0x002B (0x000056) 0x2141- f:00020 d: 321 | A = OR[321]
0x002C (0x000058) 0x290E- f:00024 d: 270 | OR[270] = A
0x002D (0x00005A) 0x105C- f:00010 d: 92 | A = 92 (0x005C)
0x002E (0x00005C) 0x290D- f:00024 d: 269 | OR[269] = A
0x002F (0x00005E) 0x210D- f:00020 d: 269 | A = OR[269]
0x0030 (0x000060) 0x8406- f:00102 d: 6 | P = P + 6 (0x0036), A = 0
0x0031 (0x000062) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0032 (0x000064) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0033 (0x000066) 0x2F0D- f:00027 d: 269 | OR[269] = OR[269] - 1
0x0034 (0x000068) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x0035 (0x00006A) 0x7206- f:00071 d: 6 | P = P - 6 (0x002F)
0x0036 (0x00006C) 0x1118- f:00010 d: 280 | A = 280 (0x0118)
0x0037 (0x00006E) 0x5800- f:00054 d: 0 | B = A
0x0038 (0x000070) 0x2141- f:00020 d: 321 | A = OR[321]
0x0039 (0x000072) 0x2945- f:00024 d: 325 | OR[325] = A
0x003A (0x000074) 0x5000- f:00050 d: 0 | A = B
0x003B (0x000076) 0x1740- f:00013 d: 320 | A = A - 320 (0x0140)
0x003C (0x000078) 0x8406- f:00102 d: 6 | P = P + 6 (0x0042), A = 0
0x003D (0x00007A) 0x6000- f:00060 d: 0 | A = OR[B]
0x003E (0x00007C) 0x3945- f:00034 d: 325 | (OR[325]) = A
0x003F (0x00007E) 0x5C00- f:00056 d: 0 | B = B + 1
0x0040 (0x000080) 0x2D45- f:00026 d: 325 | OR[325] = OR[325] + 1
0x0041 (0x000082) 0x7207- f:00071 d: 7 | P = P - 7 (0x003A)
0x0042 (0x000084) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0043 (0x000086) 0x2945- f:00024 d: 325 | OR[325] = A
0x0044 (0x000088) 0x7449- f:00072 d: 73 | R = P + 73 (0x008D)
0x0045 (0x00008A) 0x2143- f:00020 d: 323 | A = OR[323]
0x0046 (0x00008C) 0x2946- f:00024 d: 326 | OR[326] = A
0x0047 (0x00008E) 0x7494- f:00072 d: 148 | R = P + 148 (0x00DB)
0x0048 (0x000090) 0x2144- f:00020 d: 324 | A = OR[324]
0x0049 (0x000092) 0x2946- f:00024 d: 326 | OR[326] = A
0x004A (0x000094) 0x7491- f:00072 d: 145 | R = P + 145 (0x00DB)
@ Call INIT0
0x004B (0x000096) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x004C (0x000098) 0x294D- f:00024 d: 333 | OR[333] = A
0x004D (0x00009A) 0x1800-0x00D6 f:00014 d: 0 | A = 214 (0x00D6)
0x004F (0x00009E) 0x294E- f:00024 d: 334 | OR[334] = A
0x0050 (0x0000A0) 0x2142- f:00020 d: 322 | A = OR[322]
0x0051 (0x0000A2) 0x294F- f:00024 d: 335 | OR[335] = A
0x0052 (0x0000A4) 0x2143- f:00020 d: 323 | A = OR[323]
0x0053 (0x0000A6) 0x2950- f:00024 d: 336 | OR[336] = A
0x0054 (0x0000A8) 0x2144- f:00020 d: 324 | A = OR[324]
0x0055 (0x0000AA) 0x2951- f:00024 d: 337 | OR[337] = A
0x0056 (0x0000AC) 0x114D- f:00010 d: 333 | A = 333 (0x014D)
0x0057 (0x0000AE) 0x5800- f:00054 d: 0 | B = A
0x0058 (0x0000B0) 0x1800-0x6B18 f:00014 d: 0 | A = 27416 (0x6B18)
0x005A (0x0000B4) 0x7C09- f:00076 d: 9 | R = OR[9]
0x005B (0x0000B6) 0x2940- f:00024 d: 320 | OR[320] = A
0x005C (0x0000B8) 0x2140- f:00020 d: 320 | A = OR[320]
0x005D (0x0000BA) 0x8602- f:00103 d: 2 | P = P + 2 (0x005F), A # 0
0x005E (0x0000BC) 0x7002- f:00070 d: 2 | P = P + 2 (0x0060)
0x005F (0x0000BE) 0x701D- f:00070 d: 29 | P = P + 29 (0x007C)
0x0060 (0x0000C0) 0x2140- f:00020 d: 320 | A = OR[320]
0x0061 (0x0000C2) 0x8402- f:00102 d: 2 | P = P + 2 (0x0063), A = 0
0x0062 (0x0000C4) 0x7005- f:00070 d: 5 | P = P + 5 (0x0067)
0x0063 (0x0000C6) 0x1800-0x060F f:00014 d: 0 | A = 1551 (0x060F)
0x0065 (0x0000CA) 0x2947- f:00024 d: 327 | OR[327] = A
0x0066 (0x0000CC) 0x7004- f:00070 d: 4 | P = P + 4 (0x006A)
0x0067 (0x0000CE) 0x1800-0x0621 f:00014 d: 0 | A = 1569 (0x0621)
0x0069 (0x0000D2) 0x2947- f:00024 d: 327 | OR[327] = A
0x006A (0x0000D4) 0x7416- f:00072 d: 22 | R = P + 22 (0x0080)
0x006B (0x0000D6) 0x2141- f:00020 d: 321 | A = OR[321]
0x006C (0x0000D8) 0x8602- f:00103 d: 2 | P = P + 2 (0x006E), A # 0
0x006D (0x0000DA) 0x7009- f:00070 d: 9 | P = P + 9 (0x0076)
@ Free memory
0x006E (0x0000DC) 0x1019- f:00010 d: 25 | A = 25 (0x0019)
0x006F (0x0000DE) 0x294D- f:00024 d: 333 | OR[333] = A
0x0070 (0x0000E0) 0x2141- f:00020 d: 321 | A = OR[321]
0x0071 (0x0000E2) 0x294E- f:00024 d: 334 | OR[334] = A
0x0072 (0x0000E4) 0x114D- f:00010 d: 333 | A = 333 (0x014D)
0x0073 (0x0000E6) 0x5800- f:00054 d: 0 | B = A
0x0074 (0x0000E8) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0075 (0x0000EA) 0x7C09- f:00076 d: 9 | R = OR[9]
@ Return from overlay
0x0076 (0x0000EC) 0x102A- f:00010 d: 42 | A = 42 (0x002A)
0x0077 (0x0000EE) 0x294D- f:00024 d: 333 | OR[333] = A
0x0078 (0x0000F0) 0x114D- f:00010 d: 333 | A = 333 (0x014D)
0x0079 (0x0000F2) 0x5800- f:00054 d: 0 | B = A
0x007A (0x0000F4) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x007B (0x0000F6) 0x7C09- f:00076 d: 9 | R = OR[9]
0x007C (0x0000F8) 0x2140- f:00020 d: 320 | A = OR[320]
0x007D (0x0000FA) 0x2947- f:00024 d: 327 | OR[327] = A
0x007E (0x0000FC) 0x7402- f:00072 d: 2 | R = P + 2 (0x0080)
0x007F (0x0000FE) 0x721F- f:00071 d: 31 | P = P - 31 (0x0060)
@ Call MSGHND
0x0080 (0x000100) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0081 (0x000102) 0x294D- f:00024 d: 333 | OR[333] = A
0x0082 (0x000104) 0x1800-0x002F f:00014 d: 0 | A = 47 (0x002F)
0x0084 (0x000108) 0x294E- f:00024 d: 334 | OR[334] = A
0x0085 (0x00010A) 0x2147- f:00020 d: 327 | A = OR[327]
0x0086 (0x00010C) 0x294F- f:00024 d: 335 | OR[335] = A
0x0087 (0x00010E) 0x114D- f:00010 d: 333 | A = 333 (0x014D)
0x0088 (0x000110) 0x5800- f:00054 d: 0 | B = A
0x0089 (0x000112) 0x1800-0x6B18 f:00014 d: 0 | A = 27416 (0x6B18)
0x008B (0x000116) 0x7C09- f:00076 d: 9 | R = OR[9]
0x008C (0x000118) 0x0200- f:00001 d: 0 | EXIT
0x008D (0x00011A) 0x74D1- f:00072 d: 209 | R = P + 209 (0x015E)
0x008E (0x00011C) 0x74D9- f:00072 d: 217 | R = P + 217 (0x0167)
0x008F (0x00011E) 0x2F45- f:00027 d: 325 | OR[325] = OR[325] - 1
0x0090 (0x000120) 0x2148- f:00020 d: 328 | A = OR[328]
0x0091 (0x000122) 0x1640- f:00013 d: 64 | A = A - 64 (0x0040)
0x0092 (0x000124) 0x8402- f:00102 d: 2 | P = P + 2 (0x0094), A = 0
0x0093 (0x000126) 0x7011- f:00070 d: 17 | P = P + 17 (0x00A4)
0x0094 (0x000128) 0x1800-0x3952 f:00014 d: 0 | A = 14674 (0x3952)
0x0096 (0x00012C) 0x290D- f:00024 d: 269 | OR[269] = A
0x0097 (0x00012E) 0x2142- f:00020 d: 322 | A = OR[322]
0x0098 (0x000130) 0x290E- f:00024 d: 270 | OR[270] = A
0x0099 (0x000132) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x009A (0x000134) 0x290F- f:00024 d: 271 | OR[271] = A
0x009B (0x000136) 0x7006- f:00070 d: 6 | P = P + 6 (0x00A1)
0x009C (0x000138) 0x310D- f:00030 d: 269 | A = (OR[269])
0x009D (0x00013A) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x009E (0x00013C) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x009F (0x00013E) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x00A0 (0x000140) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x00A1 (0x000142) 0x210F- f:00020 d: 271 | A = OR[271]
0x00A2 (0x000144) 0x8E06- f:00107 d: 6 | P = P - 6 (0x009C), A # 0
0x00A3 (0x000146) 0x0200- f:00001 d: 0 | EXIT
0x00A4 (0x000148) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00A5 (0x00014A) 0x294B- f:00024 d: 331 | OR[331] = A
0x00A6 (0x00014C) 0x1008- f:00010 d: 8 | A = 8 (0x0008)
0x00A7 (0x00014E) 0x1601- f:00013 d: 1 | A = A - 1 (0x0001)
0x00A8 (0x000150) 0x2908- f:00024 d: 264 | OR[264] = A
0x00A9 (0x000152) 0x214B- f:00020 d: 331 | A = OR[331]
0x00AA (0x000154) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x00AB (0x000156) 0x8003- f:00100 d: 3 | P = P + 3 (0x00AE), C = 0
0x00AC (0x000158) 0x8402- f:00102 d: 2 | P = P + 2 (0x00AE), A = 0
0x00AD (0x00015A) 0x702A- f:00070 d: 42 | P = P + 42 (0x00D7)
0x00AE (0x00015C) 0x74B9- f:00072 d: 185 | R = P + 185 (0x0167)
0x00AF (0x00015E) 0x2148- f:00020 d: 328 | A = OR[328]
0x00B0 (0x000160) 0x1620- f:00013 d: 32 | A = A - 32 (0x0020)
0x00B1 (0x000162) 0x8404- f:00102 d: 4 | P = P + 4 (0x00B5), A = 0
0x00B2 (0x000164) 0x2148- f:00020 d: 328 | A = OR[328]
0x00B3 (0x000166) 0x8402- f:00102 d: 2 | P = P + 2 (0x00B5), A = 0
0x00B4 (0x000168) 0x7009- f:00070 d: 9 | P = P + 9 (0x00BD)
0x00B5 (0x00016A) 0x214B- f:00020 d: 331 | A = OR[331]
0x00B6 (0x00016C) 0x8402- f:00102 d: 2 | P = P + 2 (0x00B8), A = 0
0x00B7 (0x00016E) 0x7005- f:00070 d: 5 | P = P + 5 (0x00BC)
0x00B8 (0x000170) 0x1800-0x0635 f:00014 d: 0 | A = 1589 (0x0635)
0x00BA (0x000174) 0x2940- f:00024 d: 320 | OR[320] = A
0x00BB (0x000176) 0x723F- f:00071 d: 63 | P = P - 63 (0x007C)
0x00BC (0x000178) 0x0200- f:00001 d: 0 | EXIT
0x00BD (0x00017A) 0x2148- f:00020 d: 328 | A = OR[328]
0x00BE (0x00017C) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x00BF (0x00017E) 0x290D- f:00024 d: 269 | OR[269] = A
0x00C0 (0x000180) 0x214B- f:00020 d: 331 | A = OR[331]
0x00C1 (0x000182) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x00C2 (0x000184) 0x2542- f:00022 d: 322 | A = A + OR[322]
0x00C3 (0x000186) 0x290E- f:00024 d: 270 | OR[270] = A
0x00C4 (0x000188) 0x214B- f:00020 d: 331 | A = OR[331]
0x00C5 (0x00018A) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x00C6 (0x00018C) 0x2908- f:00024 d: 264 | OR[264] = A
0x00C7 (0x00018E) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x00C8 (0x000190) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x00C9 (0x000192) 0x8607- f:00103 d: 7 | P = P + 7 (0x00D0), A # 0
0x00CA (0x000194) 0x310E- f:00030 d: 270 | A = (OR[270])
0x00CB (0x000196) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x00CC (0x000198) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x00CD (0x00019A) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x00CE (0x00019C) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x00CF (0x00019E) 0x7006- f:00070 d: 6 | P = P + 6 (0x00D5)
0x00D0 (0x0001A0) 0x310E- f:00030 d: 270 | A = (OR[270])
0x00D1 (0x0001A2) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x00D3 (0x0001A6) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x00D4 (0x0001A8) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x00D5 (0x0001AA) 0x2D4B- f:00026 d: 331 | OR[331] = OR[331] + 1
0x00D6 (0x0001AC) 0x7230- f:00071 d: 48 | P = P - 48 (0x00A6)
0x00D7 (0x0001AE) 0x1800-0x0635 f:00014 d: 0 | A = 1589 (0x0635)
0x00D9 (0x0001B2) 0x2940- f:00024 d: 320 | OR[320] = A
0x00DA (0x0001B4) 0x725E- f:00071 d: 94 | P = P - 94 (0x007C)
0x00DB (0x0001B6) 0x7483- f:00072 d: 131 | R = P + 131 (0x015E)
0x00DC (0x0001B8) 0x7404- f:00072 d: 4 | R = P + 4 (0x00E0)
0x00DD (0x0001BA) 0x743E- f:00072 d: 62 | R = P + 62 (0x011B)
0x00DE (0x0001BC) 0x746F- f:00072 d: 111 | R = P + 111 (0x014D)
0x00DF (0x0001BE) 0x0200- f:00001 d: 0 | EXIT
0x00E0 (0x0001C0) 0x7487- f:00072 d: 135 | R = P + 135 (0x0167)
0x00E1 (0x0001C2) 0x2148- f:00020 d: 328 | A = OR[328]
0x00E2 (0x0001C4) 0x1640- f:00013 d: 64 | A = A - 64 (0x0040)
0x00E3 (0x0001C6) 0x8402- f:00102 d: 2 | P = P + 2 (0x00E5), A = 0
0x00E4 (0x0001C8) 0x7013- f:00070 d: 19 | P = P + 19 (0x00F7)
0x00E5 (0x0001CA) 0x7482- f:00072 d: 130 | R = P + 130 (0x0167)
0x00E6 (0x0001CC) 0x2148- f:00020 d: 328 | A = OR[328]
0x00E7 (0x0001CE) 0x0A08- f:00005 d: 8 | A = A < 8 (0x0008)
0x00E8 (0x0001D0) 0x2949- f:00024 d: 329 | OR[329] = A
0x00E9 (0x0001D2) 0x747E- f:00072 d: 126 | R = P + 126 (0x0167)
0x00EA (0x0001D4) 0x2149- f:00020 d: 329 | A = OR[329]
0x00EB (0x0001D6) 0x2548- f:00022 d: 328 | A = A + OR[328]
0x00EC (0x0001D8) 0x2949- f:00024 d: 329 | OR[329] = A
0x00ED (0x0001DA) 0x2149- f:00020 d: 329 | A = OR[329]
0x00EE (0x0001DC) 0x1E00-0x4D54 f:00017 d: 0 | A = A - 19796 (0x4D54)
0x00F0 (0x0001E0) 0x8402- f:00102 d: 2 | P = P + 2 (0x00F2), A = 0
0x00F1 (0x0001E2) 0x7006- f:00070 d: 6 | P = P + 6 (0x00F7)
0x00F2 (0x0001E4) 0x1800-0x4D54 f:00014 d: 0 | A = 19796 (0x4D54)
0x00F4 (0x0001E8) 0x3946- f:00034 d: 326 | (OR[326]) = A
0x00F5 (0x0001EA) 0x7406- f:00072 d: 6 | R = P + 6 (0x00FB)
0x00F6 (0x0001EC) 0x0200- f:00001 d: 0 | EXIT
0x00F7 (0x0001EE) 0x1800-0x0633 f:00014 d: 0 | A = 1587 (0x0633)
0x00F9 (0x0001F2) 0x2940- f:00024 d: 320 | OR[320] = A
0x00FA (0x0001F4) 0x727E- f:00071 d: 126 | P = P - 126 (0x007C)
0x00FB (0x0001F6) 0x746C- f:00072 d: 108 | R = P + 108 (0x0167)
0x00FC (0x0001F8) 0x2148- f:00020 d: 328 | A = OR[328]
0x00FD (0x0001FA) 0x1630- f:00013 d: 48 | A = A - 48 (0x0030)
0x00FE (0x0001FC) 0x8007- f:00100 d: 7 | P = P + 7 (0x0105), C = 0
0x00FF (0x0001FE) 0x2148- f:00020 d: 328 | A = OR[328]
0x0100 (0x000200) 0x1639- f:00013 d: 57 | A = A - 57 (0x0039)
0x0101 (0x000202) 0x8003- f:00100 d: 3 | P = P + 3 (0x0104), C = 0
0x0102 (0x000204) 0x8402- f:00102 d: 2 | P = P + 2 (0x0104), A = 0
0x0103 (0x000206) 0x7002- f:00070 d: 2 | P = P + 2 (0x0105)
0x0104 (0x000208) 0x7005- f:00070 d: 5 | P = P + 5 (0x0109)
0x0105 (0x00020A) 0x1800-0x0636 f:00014 d: 0 | A = 1590 (0x0636)
0x0107 (0x00020E) 0x2940- f:00024 d: 320 | OR[320] = A
0x0108 (0x000210) 0x728C- f:00071 d: 140 | P = P - 140 (0x007C)
0x0109 (0x000212) 0x2148- f:00020 d: 328 | A = OR[328]
0x010A (0x000214) 0x1630- f:00013 d: 48 | A = A - 48 (0x0030)
0x010B (0x000216) 0x294A- f:00024 d: 330 | OR[330] = A
0x010C (0x000218) 0x2146- f:00020 d: 326 | A = OR[326]
0x010D (0x00021A) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x010E (0x00021C) 0x2908- f:00024 d: 264 | OR[264] = A
0x010F (0x00021E) 0x214A- f:00020 d: 330 | A = OR[330]
0x0110 (0x000220) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0111 (0x000222) 0x7456- f:00072 d: 86 | R = P + 86 (0x0167)
0x0112 (0x000224) 0x2148- f:00020 d: 328 | A = OR[328]
0x0113 (0x000226) 0x163A- f:00013 d: 58 | A = A - 58 (0x003A)
0x0114 (0x000228) 0x8602- f:00103 d: 2 | P = P + 2 (0x0116), A # 0
0x0115 (0x00022A) 0x7005- f:00070 d: 5 | P = P + 5 (0x011A)
0x0116 (0x00022C) 0x1800-0x0636 f:00014 d: 0 | A = 1590 (0x0636)
0x0118 (0x000230) 0x2940- f:00024 d: 320 | OR[320] = A
0x0119 (0x000232) 0x729D- f:00071 d: 157 | P = P - 157 (0x007C)
0x011A (0x000234) 0x0200- f:00001 d: 0 | EXIT
0x011B (0x000236) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x011C (0x000238) 0x294C- f:00024 d: 332 | OR[332] = A
0x011D (0x00023A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x011E (0x00023C) 0x294B- f:00024 d: 331 | OR[331] = A
0x011F (0x00023E) 0x214B- f:00020 d: 331 | A = OR[331]
0x0120 (0x000240) 0x1604- f:00013 d: 4 | A = A - 4 (0x0004)
0x0121 (0x000242) 0x8003- f:00100 d: 3 | P = P + 3 (0x0124), C = 0
0x0122 (0x000244) 0x8402- f:00102 d: 2 | P = P + 2 (0x0124), A = 0
0x0123 (0x000246) 0x7026- f:00070 d: 38 | P = P + 38 (0x0149)
0x0124 (0x000248) 0x7443- f:00072 d: 67 | R = P + 67 (0x0167)
0x0125 (0x00024A) 0x2148- f:00020 d: 328 | A = OR[328]
0x0126 (0x00024C) 0x1620- f:00013 d: 32 | A = A - 32 (0x0020)
0x0127 (0x00024E) 0x8404- f:00102 d: 4 | P = P + 4 (0x012B), A = 0
0x0128 (0x000250) 0x2148- f:00020 d: 328 | A = OR[328]
0x0129 (0x000252) 0x8402- f:00102 d: 2 | P = P + 2 (0x012B), A = 0
0x012A (0x000254) 0x700F- f:00070 d: 15 | P = P + 15 (0x0139)
0x012B (0x000256) 0x214B- f:00020 d: 331 | A = OR[331]
0x012C (0x000258) 0x8402- f:00102 d: 2 | P = P + 2 (0x012E), A = 0
0x012D (0x00025A) 0x7005- f:00070 d: 5 | P = P + 5 (0x0132)
0x012E (0x00025C) 0x1800-0x0637 f:00014 d: 0 | A = 1591 (0x0637)
0x0130 (0x000260) 0x2940- f:00024 d: 320 | OR[320] = A
0x0131 (0x000262) 0x72B5- f:00071 d: 181 | P = P - 181 (0x007C)
0x0132 (0x000264) 0x2146- f:00020 d: 326 | A = OR[326]
0x0133 (0x000266) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A)
0x0134 (0x000268) 0x2908- f:00024 d: 264 | OR[264] = A
0x0135 (0x00026A) 0x214C- f:00020 d: 332 | A = OR[332]
0x0136 (0x00026C) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0137 (0x00026E) 0x0200- f:00001 d: 0 | EXIT
0x0138 (0x000270) 0x700E- f:00070 d: 14 | P = P + 14 (0x0146)
0x0139 (0x000272) 0x2148- f:00020 d: 328 | A = OR[328]
0x013A (0x000274) 0x1630- f:00013 d: 48 | A = A - 48 (0x0030)
0x013B (0x000276) 0x8007- f:00100 d: 7 | P = P + 7 (0x0142), C = 0
0x013C (0x000278) 0x2148- f:00020 d: 328 | A = OR[328]
0x013D (0x00027A) 0x1639- f:00013 d: 57 | A = A - 57 (0x0039)
0x013E (0x00027C) 0x8003- f:00100 d: 3 | P = P + 3 (0x0141), C = 0
0x013F (0x00027E) 0x8402- f:00102 d: 2 | P = P + 2 (0x0141), A = 0
0x0140 (0x000280) 0x7002- f:00070 d: 2 | P = P + 2 (0x0142)
0x0141 (0x000282) 0x7005- f:00070 d: 5 | P = P + 5 (0x0146)
0x0142 (0x000284) 0x1800-0x0637 f:00014 d: 0 | A = 1591 (0x0637)
0x0144 (0x000288) 0x2940- f:00024 d: 320 | OR[320] = A
0x0145 (0x00028A) 0x72C9- f:00071 d: 201 | P = P - 201 (0x007C)
0x0146 (0x00028C) 0x743C- f:00072 d: 60 | R = P + 60 (0x0182)
0x0147 (0x00028E) 0x2D4B- f:00026 d: 331 | OR[331] = OR[331] + 1
0x0148 (0x000290) 0x7229- f:00071 d: 41 | P = P - 41 (0x011F)
0x0149 (0x000292) 0x1800-0x0637 f:00014 d: 0 | A = 1591 (0x0637)
0x014B (0x000296) 0x2940- f:00024 d: 320 | OR[320] = A
0x014C (0x000298) 0x72D0- f:00071 d: 208 | P = P - 208 (0x007C)
0x014D (0x00029A) 0x2146- f:00020 d: 326 | A = OR[326]
0x014E (0x00029C) 0x2743- f:00023 d: 323 | A = A - OR[323]
0x014F (0x00029E) 0x8402- f:00102 d: 2 | P = P + 2 (0x0151), A = 0
0x0150 (0x0002A0) 0x7008- f:00070 d: 8 | P = P + 8 (0x0158)
0x0151 (0x0002A2) 0x2146- f:00020 d: 326 | A = OR[326]
0x0152 (0x0002A4) 0x1415- f:00012 d: 21 | A = A + 21 (0x0015)
0x0153 (0x0002A6) 0x2908- f:00024 d: 264 | OR[264] = A
0x0154 (0x0002A8) 0x1800-0x4E52 f:00014 d: 0 | A = 20050 (0x4E52)
0x0156 (0x0002AC) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0157 (0x0002AE) 0x7006- f:00070 d: 6 | P = P + 6 (0x015D)
0x0158 (0x0002B0) 0x2146- f:00020 d: 326 | A = OR[326]
0x0159 (0x0002B2) 0x1415- f:00012 d: 21 | A = A + 21 (0x0015)
0x015A (0x0002B4) 0x2908- f:00024 d: 264 | OR[264] = A
0x015B (0x0002B6) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x015C (0x0002B8) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x015D (0x0002BA) 0x0200- f:00001 d: 0 | EXIT
0x015E (0x0002BC) 0x1020- f:00010 d: 32 | A = 32 (0x0020)
0x015F (0x0002BE) 0x2948- f:00024 d: 328 | OR[328] = A
0x0160 (0x0002C0) 0x2148- f:00020 d: 328 | A = OR[328]
0x0161 (0x0002C2) 0x1620- f:00013 d: 32 | A = A - 32 (0x0020)
0x0162 (0x0002C4) 0x8603- f:00103 d: 3 | P = P + 3 (0x0165), A # 0
0x0163 (0x0002C6) 0x7404- f:00072 d: 4 | R = P + 4 (0x0167)
0x0164 (0x0002C8) 0x7204- f:00071 d: 4 | P = P - 4 (0x0160)
0x0165 (0x0002CA) 0x2F45- f:00027 d: 325 | OR[325] = OR[325] - 1
0x0166 (0x0002CC) 0x0200- f:00001 d: 0 | EXIT
0x0167 (0x0002CE) 0x2145- f:00020 d: 325 | A = OR[325]
0x0168 (0x0002D0) 0x1650- f:00013 d: 80 | A = A - 80 (0x0050)
0x0169 (0x0002D2) 0x8402- f:00102 d: 2 | P = P + 2 (0x016B), A = 0
0x016A (0x0002D4) 0x7004- f:00070 d: 4 | P = P + 4 (0x016E)
0x016B (0x0002D6) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x016C (0x0002D8) 0x2948- f:00024 d: 328 | OR[328] = A
0x016D (0x0002DA) 0x7014- f:00070 d: 20 | P = P + 20 (0x0181)
0x016E (0x0002DC) 0x2145- f:00020 d: 325 | A = OR[325]
0x016F (0x0002DE) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x0170 (0x0002E0) 0x2541- f:00022 d: 321 | A = A + OR[321]
0x0171 (0x0002E2) 0x290D- f:00024 d: 269 | OR[269] = A
0x0172 (0x0002E4) 0x310D- f:00030 d: 269 | A = (OR[269])
0x0173 (0x0002E6) 0x290D- f:00024 d: 269 | OR[269] = A
0x0174 (0x0002E8) 0x2145- f:00020 d: 325 | A = OR[325]
0x0175 (0x0002EA) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0176 (0x0002EC) 0x2908- f:00024 d: 264 | OR[264] = A
0x0177 (0x0002EE) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0178 (0x0002F0) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x0179 (0x0002F2) 0x8604- f:00103 d: 4 | P = P + 4 (0x017D), A # 0
0x017A (0x0002F4) 0x210D- f:00020 d: 269 | A = OR[269]
0x017B (0x0002F6) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x017C (0x0002F8) 0x290D- f:00024 d: 269 | OR[269] = A
0x017D (0x0002FA) 0x210D- f:00020 d: 269 | A = OR[269]
0x017E (0x0002FC) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x017F (0x0002FE) 0x2948- f:00024 d: 328 | OR[328] = A
0x0180 (0x000300) 0x2D45- f:00026 d: 325 | OR[325] = OR[325] + 1
0x0181 (0x000302) 0x0200- f:00001 d: 0 | EXIT
0x0182 (0x000304) 0x214C- f:00020 d: 332 | A = OR[332]
0x0183 (0x000306) 0x0A03- f:00005 d: 3 | A = A < 3 (0x0003)
0x0184 (0x000308) 0x2913- f:00024 d: 275 | OR[275] = A
0x0185 (0x00030A) 0x214C- f:00020 d: 332 | A = OR[332]
0x0186 (0x00030C) 0x0A01- f:00005 d: 1 | A = A < 1 (0x0001)
0x0187 (0x00030E) 0x2513- f:00022 d: 275 | A = A + OR[275]
0x0188 (0x000310) 0x294C- f:00024 d: 332 | OR[332] = A
0x0189 (0x000312) 0x2148- f:00020 d: 328 | A = OR[328]
0x018A (0x000314) 0x1630- f:00013 d: 48 | A = A - 48 (0x0030)
0x018B (0x000316) 0x2913- f:00024 d: 275 | OR[275] = A
0x018C (0x000318) 0x214C- f:00020 d: 332 | A = OR[332]
0x018D (0x00031A) 0x2513- f:00022 d: 275 | A = A + OR[275]
0x018E (0x00031C) 0x294C- f:00024 d: 332 | OR[332] = A
0x018F (0x00031E) 0x0200- f:00001 d: 0 | EXIT
0x0190 (0x000320) 0x0000- f:00000 d: 0 | PASS
0x0191 (0x000322) 0x0000- f:00000 d: 0 | PASS
0x0192 (0x000324) 0x0000- f:00000 d: 0 | PASS
0x0193 (0x000326) 0x0000- f:00000 d: 0 | PASS
| 78.215736 | 79 | 0.467437 |
958ee764725cedb1786295b0d55e4cb1b45c38ae | 5,481 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_452_1722.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_452_1722.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_452_1722.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x16d31, %r12
nop
nop
nop
sub $45530, %rbp
mov (%r12), %rsi
nop
nop
xor %r12, %r12
lea addresses_D_ht+0x4829, %r10
and $38443, %rdx
mov $0x6162636465666768, %rbp
movq %rbp, (%r10)
nop
nop
nop
nop
nop
inc %rsi
lea addresses_normal_ht+0x17763, %rax
nop
cmp %r13, %r13
movb $0x61, (%rax)
nop
xor $52262, %r12
lea addresses_WT_ht+0x132d1, %rsi
lea addresses_A_ht+0xc0d1, %rdi
cmp %r12, %r12
mov $34, %rcx
rep movsb
nop
nop
nop
nop
cmp $17432, %r12
lea addresses_UC_ht+0x1aed1, %r12
nop
nop
nop
nop
dec %r10
mov $0x6162636465666768, %rdx
movq %rdx, %xmm3
movups %xmm3, (%r12)
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_UC_ht+0x1d0d1, %r12
xor $45973, %r10
mov (%r12), %r13
nop
nop
nop
nop
nop
and $52756, %rbp
lea addresses_D_ht+0xf861, %rdx
nop
nop
nop
nop
and %rsi, %rsi
movl $0x61626364, (%rdx)
nop
nop
and %rsi, %rsi
lea addresses_D_ht+0x17e63, %rax
nop
xor $10800, %rdi
mov (%rax), %ecx
nop
nop
sub %rbp, %rbp
lea addresses_A_ht+0x1c56b, %rbp
nop
cmp $24705, %r12
movl $0x61626364, (%rbp)
nop
dec %r13
lea addresses_UC_ht+0x178d1, %rsi
lea addresses_UC_ht+0x62c5, %rdi
clflush (%rsi)
nop
nop
nop
nop
sub %rdx, %rdx
mov $1, %rcx
rep movsl
nop
nop
add $63365, %r13
lea addresses_WC_ht+0x58ab, %r10
clflush (%r10)
nop
add %rsi, %rsi
movw $0x6162, (%r10)
inc %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r14
push %r8
push %rax
push %rbp
push %rbx
push %rdx
push %rsi
// Store
lea addresses_D+0x28d1, %rdx
nop
nop
nop
nop
nop
add $720, %rax
mov $0x5152535455565758, %r14
movq %r14, (%rdx)
nop
nop
nop
nop
inc %rax
// Store
mov $0x3dd, %r14
nop
and $3342, %rbp
mov $0x5152535455565758, %rax
movq %rax, %xmm7
vmovaps %ymm7, (%r14)
nop
nop
nop
nop
nop
inc %rdx
// Faulty Load
lea addresses_WT+0x1e0d1, %rdx
nop
nop
nop
nop
and %rax, %rax
mov (%rdx), %rbp
lea oracles, %rbx
and $0xff, %rbp
shlq $12, %rbp
mov (%rbx,%rbp,1), %rbp
pop %rsi
pop %rdx
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r14
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_P', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 1, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'39': 452}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
| 26.478261 | 1,355 | 0.651341 |
d3c702f7875d7afc9433b76ffe30bc64fb034c14 | 79 | asm | Assembly | Tests/yasm-regression/str.asm | 13xforever/x86-assembly-textmate-bundle | f1bb62f77b776d87d0fd85b0276d4237ff72c43c | [
"MIT"
] | 69 | 2015-04-16T18:01:22.000Z | 2022-02-15T07:54:26.000Z | Tests/yasm-regression/str.asm | javiercbk/x86-assembly-textmate-bundle | 62d700e0196f62ef4353a9b95c2e64beb0a6afda | [
"MIT"
] | 17 | 2016-09-20T08:49:09.000Z | 2021-02-19T15:01:04.000Z | Tests/yasm-regression/str.asm | javiercbk/x86-assembly-textmate-bundle | 62d700e0196f62ef4353a9b95c2e64beb0a6afda | [
"MIT"
] | 19 | 2016-05-31T07:11:14.000Z | 2021-07-19T10:17:12.000Z | [bits 32]
str [esp] ; out: 0f 00 0c 24
[bits 16]
str [bp] ; out: 0f 00 4e 00
| 15.8 | 29 | 0.56962 |
674ff3703723cf72dfe9aa9ccd98fe692db4d434 | 295 | asm | Assembly | programs/oeis/102/A102518.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/102/A102518.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/102/A102518.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A102518: a(n) = Sum_{k=0..n} binomial(n, k) * Sum_{j=0..k} binomial(3k, 3j).
; 1,3,27,243,2187,19683,177147,1594323,14348907,129140163,1162261467,10460353203,94143178827,847288609443,7625597484987,68630377364883,617673396283947,5559060566555523
mov $2,$0
mul $2,2
sub $2,1
mov $1,3
pow $1,$2
| 32.777778 | 167 | 0.738983 |
57e9232145306c6d0198a2587aff692446b84044 | 539 | asm | Assembly | examples/2.asm | IonicaBizau/arc-assembler | 8f71d896103c0b3087a80e915edfe8e41c422210 | [
"MIT"
] | 5 | 2015-01-05T17:56:57.000Z | 2017-11-03T18:04:00.000Z | examples/2.asm | IonicaBizau/arc-assembler | 8f71d896103c0b3087a80e915edfe8e41c422210 | [
"MIT"
] | null | null | null | examples/2.asm | IonicaBizau/arc-assembler | 8f71d896103c0b3087a80e915edfe8e41c422210 | [
"MIT"
] | 1 | 2016-02-05T09:53:43.000Z | 2016-02-05T09:53:43.000Z | !
! This program sums two numbers
!
.begin
.org 2048
main: ld [x], %r9 ! load x into r9
ld [y], %r10 ! load y into r10
call sum ! call sum subrutine
st %r11, [z] ! store the result in z
ld [z], %r9
jmpl %r15+4, %r0 ! Done
sum: addcc %r9, %r10, %r11 ! sums the registers r9 and r10 into %r11
jmpl %r15+4, %r0 ! standard return
x: 10
y: -20
z: 0
.end
| 23.434783 | 77 | 0.411874 |
7b5c89755f17c86eb8533592e8a136e11d56f3ca | 5,332 | asm | Assembly | src/kernel/arch/i686/interrupt.asm | shadow-paw/bluemoon | dbcc52f21b02d899358f35e0a2ac1c1ac1981804 | [
"MIT"
] | 3 | 2018-11-18T11:37:26.000Z | 2022-01-09T23:29:18.000Z | src/kernel/arch/i686/interrupt.asm | shadow-paw/bluemoon | dbcc52f21b02d899358f35e0a2ac1c1ac1981804 | [
"MIT"
] | 17 | 2018-11-09T11:42:57.000Z | 2019-04-22T04:55:37.000Z | src/kernel/arch/i686/interrupt.asm | shadow-paw/bluemoon | dbcc52f21b02d899358f35e0a2ac1c1ac1981804 | [
"MIT"
] | 2 | 2018-11-14T17:06:45.000Z | 2018-11-18T08:22:15.000Z | cpu P4
bits 32
%include "kernel.inc"
global idt_init, idt_set
extern INT_00, INT_01, INT_02, INT_03, INT_04, INT_05, INT_06, INT_07
extern INT_08, INT_0A, INT_0B, INT_0C, INT_0D, INT_0E, INT_0F
extern INT_10, INT_11, INT_12, INT_13
section .bss
; ----------------------------------------------
align 4096
idt resq 256 ; 256 interrupts
section .data
; ----------------------------------------------
align 16
idtr dw 256*8-1
dd idt
dw 0
section .text
; ----------------------------------------------
idt_init:
call idt_set, 0x00, dword _INT_00, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x01, dword _INT_01, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x02, dword _INT_02, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x03, dword _INT_03, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x04, dword _INT_04, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x05, dword _INT_05, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x06, dword _INT_06, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x07, dword _INT_07, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x08, dword _INT_08, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x0A, dword _INT_0A, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x0B, dword _INT_0B, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x0C, dword _INT_0C, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x0D, dword _INT_0D, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x0E, dword _INT_0E, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x10, dword _INT_10, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x11, dword _INT_11, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x12, dword _INT_12, 1000111000000000b ; P DPL=0 TYPE=1110
call idt_set, 0x13, dword _INT_13, 1000111000000000b ; P DPL=0 TYPE=1110
lidt [idtr]
ret
; ----------------------------------------------
; idt_set(num, function, access (P:1 DPL:2 0:1 TYPE:4 0:5)
idt_set:
push eax
push ecx
push edx
mov eax, [esp+20]
mov ecx, [esp+24]
mov edx, eax
and eax, 0x0000FFFF
and edx, 0xFFFF0000
or eax, SEG_CODE32_0 << 16
or edx, ecx
mov ecx, [esp+16]
mov [idt +ecx*8], eax
mov [idt +ecx*8+4], edx
pop edx
pop ecx
pop eax
ret
; INT00
; ----------------------------------------------
align 16
_INT_00:
pusha
call INT_00
popa
iretd
; INT01
; ----------------------------------------------
align 16
_INT_01:
pusha
call INT_01
popa
iretd
; INT02
; ----------------------------------------------
align 16
_INT_02:
pusha
call INT_02
popa
iretd
; INT03
; ----------------------------------------------
align 16
_INT_03:
pusha
call INT_03
popa
iretd
; INT04
; ----------------------------------------------
align 16
_INT_04:
pusha
call INT_04
popa
iretd
; INT05
; ----------------------------------------------
align 16
_INT_05:
pusha
call INT_05
popa
iretd
; INT06
; ----------------------------------------------
align 16
_INT_06:
pusha
call INT_06
popa
iretd
; INT07
; ----------------------------------------------
align 16
_INT_07:
pusha
call INT_07
popa
iretd
; INT08
; ----------------------------------------------
align 16
_INT_08:
pusha
call INT_08
popa
iretd
; INT0A
; ----------------------------------------------
align 16
_INT_0A:
pusha
push dword [esp+32]
call INT_0A
add esp, 4
popa
add esp, 4
iretd
; INT0B
; ----------------------------------------------
align 16
_INT_0B:
pusha
push dword [esp+32]
call INT_0B
add esp, 4
popa
add esp, 4
iretd
; INT0C
; ----------------------------------------------
align 16
_INT_0C:
pusha
push dword [esp+32]
call INT_0C
add esp, 4
popa
add esp, 4
iretd
; INT0D
; ----------------------------------------------
align 16
_INT_0D:
pusha
push dword [esp+32]
push dword [esp+40]
call INT_0D
add esp, 8
popa
add esp, 4
iretd
; INT0E
; ----------------------------------------------
align 16
_INT_0E:
pusha
mov eax, cr2
push dword [esp+36]
push eax
push dword [esp+40]
call INT_0E
add esp, 12
popa
add esp, 4
iretd
; INT10
; ----------------------------------------------
align 16
_INT_10:
pusha
call INT_10
popa
iretd
; INT11
; ----------------------------------------------
align 16
_INT_11:
pusha
push dword [esp+32]
call INT_11
add esp, 4
popa
add esp, 4
iretd
; INT12
; ----------------------------------------------
align 16
_INT_12:
pusha
call INT_12
popa
iretd
; INT13
; ----------------------------------------------
align 16
_INT_13:
pusha
call INT_13
popa
iretd
; ----------------------------------------------
| 21.075099 | 82 | 0.472243 |
f2924f4ad7774e2fe71614386af25e6a420e017b | 285 | asm | Assembly | examples/linux64/glue.asm | dcoles/ppci-mirror | 51181db69d933adbb3c5b5ada2bd427d140b1385 | [
"BSD-2-Clause"
] | null | null | null | examples/linux64/glue.asm | dcoles/ppci-mirror | 51181db69d933adbb3c5b5ada2bd427d140b1385 | [
"BSD-2-Clause"
] | null | null | null | examples/linux64/glue.asm | dcoles/ppci-mirror | 51181db69d933adbb3c5b5ada2bd427d140b1385 | [
"BSD-2-Clause"
] | null | null | null |
section reset
global main_main
global bsp_exit
global start
start:
call main_main
call bsp_exit
global bsp_syscall
bsp_syscall:
mov rax, rdi ; abi param 1
mov rdi, rsi ; abi param 2
mov rsi, rdx ; abi param 3
mov rdx, rcx ; abi param 4
syscall
ret
| 13.571429 | 30 | 0.673684 |
47c8db220a12d2e6e95f13f97280503628188cd2 | 1,615 | asm | Assembly | scripts/Route11Gate2F.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | 1 | 2022-02-15T00:19:44.000Z | 2022-02-15T00:19:44.000Z | scripts/Route11Gate2F.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | scripts/Route11Gate2F.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | Route11Gate2F_Script:
jp DisableAutoTextBoxDrawing
Route11Gate2F_TextPointers:
dw Route11GateUpstairsText1
dw Route11GateUpstairsText2
dw Route11GateUpstairsText3
dw Route11GateUpstairsText4
Route11GateUpstairsText1:
text_asm
xor a ; TRADE_FOR_TERRY
ld [wWhichTrade], a
predef DoInGameTradeDialogue
Route11GateUpstairsScriptEnd:
jp TextScriptEnd
Route11GateUpstairsText2:
text_asm
CheckEvent EVENT_GOT_ITEMFINDER, 1
jr c, .got_item
ld a, 30
ldh [hOaksAideRequirement], a
ld a, ITEMFINDER
ldh [hOaksAideRewardItem], a
ld [wd11e], a
call GetItemName
ld h, d
ld l, e
ld de, wOaksAideRewardItemName
ld bc, ITEM_NAME_LENGTH
call CopyData
predef OaksAideScript
ldh a, [hOaksAideResult]
dec a ; OAKS_AIDE_GOT_ITEM?
jr nz, .no_item
SetEvent EVENT_GOT_ITEMFINDER
.got_item
ld hl, Route11GateUpstairsText_494a3
call PrintText
.no_item
jr Route11GateUpstairsScriptEnd
Route11GateUpstairsText_494a3:
text_far _Route11GateUpstairsText_494a3
text_end
Route11GateUpstairsText3:
text_asm
ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP
jp nz, GateUpstairsScript_PrintIfFacingUp
CheckEvent EVENT_BEAT_ROUTE12_SNORLAX
ld hl, BinocularsSnorlaxText
jr z, .print
ld hl, BinocularsNoSnorlaxText
.print
call PrintText
jp TextScriptEnd
BinocularsSnorlaxText:
text_far _BinocularsSnorlaxText
text_end
BinocularsNoSnorlaxText:
text_far _BinocularsNoSnorlaxText
text_end
Route11GateUpstairsText4:
text_asm
ld hl, Route11GateUpstairsText_494d5
jp GateUpstairsScript_PrintIfFacingUp
Route11GateUpstairsText_494d5:
text_far _Route11GateUpstairsText_494d5
text_end
| 20.974026 | 47 | 0.843963 |
b13a96d585eb5a53229ca9e31889e364d248b075 | 5,551 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_1267.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_1267.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_1267.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 %r13
push %r14
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xae2c, %r12
nop
and $48407, %r13
mov $0x6162636465666768, %r14
movq %r14, %xmm7
movups %xmm7, (%r12)
nop
nop
and %rdx, %rdx
lea addresses_WC_ht+0x9259, %rsi
lea addresses_WC_ht+0x922c, %rdi
nop
nop
nop
nop
nop
sub %r11, %r11
mov $15, %rcx
rep movsl
sub %r13, %r13
lea addresses_A_ht+0x13aac, %rdi
nop
nop
nop
nop
and $29124, %r13
mov (%rdi), %dx
nop
nop
nop
nop
nop
sub $44790, %rcx
lea addresses_normal_ht+0x144ec, %rsi
lea addresses_WC_ht+0x197ca, %rdi
nop
add %r13, %r13
mov $127, %rcx
rep movsb
nop
nop
nop
nop
cmp %rdx, %rdx
lea addresses_WT_ht+0x1d62c, %rsi
lea addresses_normal_ht+0x1182c, %rdi
xor $21068, %r14
mov $61, %rcx
rep movsw
add %r14, %r14
lea addresses_A_ht+0x1529c, %rdi
cmp $13192, %rdx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm4
vmovups %ymm4, (%rdi)
nop
nop
nop
xor $19424, %rdi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r14
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %rbp
push %rsi
// Faulty Load
lea addresses_WC+0x3e2c, %r14
nop
nop
nop
nop
and $30679, %r10
vmovups (%r14), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rsi
lea oracles, %r10
and $0xff, %rsi
shlq $12, %rsi
mov (%r10,%rsi,1), %rsi
pop %rsi
pop %rbp
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 9}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 4}}
{'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
*/
| 44.408 | 2,999 | 0.663304 |
a00689be31efc3b89cfe4ba5a5b5e9c3b3678fcd | 153 | asm | Assembly | Lista_2/questaoSete.asm | 0Augusto/ArquiteturadeComputadores2 | 277fdf94028114cd9328dfc5ed2de7cc7bc68393 | [
"Apache-2.0"
] | 1 | 2022-03-03T17:22:21.000Z | 2022-03-03T17:22:21.000Z | Lista_2/questaoSete.asm | 0Augusto/ArquiteturadeComputadores2 | 277fdf94028114cd9328dfc5ed2de7cc7bc68393 | [
"Apache-2.0"
] | null | null | null | Lista_2/questaoSete.asm | 0Augusto/ArquiteturadeComputadores2 | 277fdf94028114cd9328dfc5ed2de7cc7bc68393 | [
"Apache-2.0"
] | null | null | null | .text
.globl main
main :
lw $t0,32($s3) # $t0 recebe A[8]
add $t0,$s2,$t0 # $t0 recebe h + A[8]
sw $t0,48($s3) # armazena o resultado em A[12]
| 15.3 | 49 | 0.562092 |
687ee664d00b1ce0205834826a00f0534c34daea | 154 | asm | Assembly | libsrc/target/x1/graphics/w_plotpixl.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/target/x1/graphics/w_plotpixl.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/target/x1/graphics/w_plotpixl.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ;
; Plot pixel at (x,y) coordinate.
SECTION code_clib
PUBLIC w_plotpixel
defc NEEDplot = 1
.w_plotpixel
INCLUDE "w_pixel.inc"
| 9.625 | 39 | 0.62987 |
a64fc421a789d0719072a3ce1f861ac565ba0dec | 29,557 | asm | Assembly | third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TrapSystemCallHandler.asm | Fimbure/icebox-1 | 0b81992a53e1b410955ca89bdb6f8169d6f2da86 | [
"MIT"
] | 521 | 2019-03-29T15:44:08.000Z | 2022-03-22T09:46:19.000Z | third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TrapSystemCallHandler.asm | Fimbure/icebox-1 | 0b81992a53e1b410955ca89bdb6f8169d6f2da86 | [
"MIT"
] | 30 | 2019-06-04T17:00:49.000Z | 2021-09-08T20:44:19.000Z | third_party/virtualbox/src/VBox/ValidationKit/bootsectors/bs3kit/bs3-mode-TrapSystemCallHandler.asm | Fimbure/icebox-1 | 0b81992a53e1b410955ca89bdb6f8169d6f2da86 | [
"MIT"
] | 99 | 2019-03-29T16:04:13.000Z | 2022-03-28T16:59:34.000Z | ; $Id: bs3-mode-TrapSystemCallHandler.asm $
;; @file
; BS3Kit - System call trap handler.
;
;
; Copyright (C) 2007-2017 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
; VirtualBox OSE distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
;*********************************************************************************************************************************
;* Header Files *
;*********************************************************************************************************************************
%include "bs3kit-template-header.mac"
;*********************************************************************************************************************************
;* External Symbols *
;*********************************************************************************************************************************
BS3_EXTERN_DATA16 g_bBs3CurrentMode
%if TMPL_BITS != 64
BS3_EXTERN_DATA16 g_uBs3CpuDetected
%endif
%if TMPL_BITS == 16
BS3_EXTERN_DATA16 g_uBs3TrapEipHint
%endif
TMPL_BEGIN_TEXT
BS3_EXTERN_CMN Bs3SelProtFar32ToFlat32
BS3_EXTERN_CMN Bs3RegCtxConvertToRingX
BS3_EXTERN_CMN Bs3RegCtxRestore
BS3_EXTERN_CMN Bs3Panic
BS3_BEGIN_TEXT16
extern Bs3PrintStrN_c16_CX_Bytes_At_DS_SI
TMPL_BEGIN_TEXT
;;
; System call handler.
;
; This is an assembly trap handler that is called in response to a system call
; request from 'user' code. The only fixed parameter is [ER]AX which contains
; the system call number. Other registers are assigned on a per system call
; basis, ditto for which registers are preserved and which are used to return
; stuff. Generally, though, we preserve all registers not used as return
; values or otherwise implicitly transformed by the call.
;
; Note! The 16-bit versions of this code must be careful with using extended
; registers as we wish this code to work on real 80286 (maybe even 8086)
; CPUs too!
;
BS3_PROC_BEGIN_MODE Bs3TrapSystemCallHandler, BS3_PBC_NEAR ; Near because we'll probably only ever need this from CGROUP16.
;
; This prologue is kind of complicated because of 80286 and older CPUs
; as well as different requirements for 64-bit and the other modes.
;
%define VAR_CALLER_BP [xBP]
%if TMPL_BITS != 64
%define VAR_CALLER_DS [xBP - xCB]
%endif
%define VAR_CALLER_BX [xBP - sCB*1 - xCB] ; Note! the upper word is not clean on pre-386 (16-bit mode).
%define VAR_CALLER_AX [xBP - sCB*2 - xCB]
%define VAR_CALLER_CX [xBP - sCB*3 - xCB]
%define VAR_CALLER_DX [xBP - sCB*4 - xCB]
%define VAR_CALLER_SI [xBP - sCB*5 - xCB]
%define VAR_CALLER_SI_HI [xBP - sCB*5 - xCB + 2]
%define VAR_CALLER_DI [xBP - sCB*6 - xCB]
%define VAR_CALLER_DI_HI [xBP - sCB*6 - xCB + 2]
%if TMPL_BITS == 16
%define VAR_CALLER_EBP [xBP - sCB*7 - xCB]
%define VAR_CALLER_ESP [xBP - sCB*8 - xCB]
%define VAR_CALLER_EFLAGS [xBP - sCB*9 - xCB]
%define VAR_CALLER_MODE [xBP - sCB*9 - xCB*2]
%define BP_TOP_STACK_EXPR xBP - sCB*9 - xCB*2
%else
%define VAR_CALLER_MODE [xBP - sCB*6 - xCB*2]
%define BP_TOP_STACK_EXPR xBP - sCB*6 - xCB*2
%endif
push xBP
mov xBP, xSP
%if TMPL_BITS == 64
push 0
mov [rsp+2], es
mov [rsp], ds
%else
push ds
%ifdef TMPL_CMN_R86
push BS3_SEL_DATA16
%else
push RT_CONCAT(BS3_SEL_R0_DS,TMPL_BITS)
%endif
pop ds ; DS = BS3KIT_GRPNM_DATA16 or FLAT and we can safely access data
%if TMPL_BITS == 16 && (TMPL_MODE == BS3_MODE_RM || TMPL_MODE == BS3_MODE_PE16)
cmp byte [BS3_DATA16_WRT(g_uBs3CpuDetected)], BS3CPU_80286
jbe .prologue_pre_80386
%endif
%endif
push sBX
push sAX
push sCX
push sDX
push sSI
push sDI
%if TMPL_BITS == 16
push ebp
push esp
pushfd
%if TMPL_MODE == BS3_MODE_RM || TMPL_MODE == BS3_MODE_PE16
jmp .prologue_end
.prologue_pre_80386:
push bx ; dummy
push bx
xor bx, bx
push bx ; dummy
push ax
push bx ; dummy
push cx
push bx ; dummy
push dx
push bx ; dummy
push si
push bx ; dummy
push di
sub sp, 0ch ; dummy
%endif
%endif
.prologue_end:
;
; VAR_CALLER_MODE: Save the current mode (important for v8086 with 16-bit kernel).
;
xor xBX, xBX
mov bl, [BS3_DATA16_WRT(g_bBs3CurrentMode)]
push xBX
;
; Dispatch the system call.
;
cmp ax, BS3_SYSCALL_LAST
ja .invalid_syscall
%if TMPL_BITS == 16
mov bx, ax
shl bx, 1
jmp word [cs:.aoffSyscallHandlers + bx]
%else
movzx ebx, ax
mov ebx, [.aoffSyscallHandlers + ebx * 4]
jmp xBX
%endif
.aoffSyscallHandlers:
%ifdef TMPL_16BIT
dw .invalid_syscall wrt CGROUP16
dw .print_chr wrt CGROUP16
dw .print_str wrt CGROUP16
dw .to_ringX wrt CGROUP16
dw .to_ringX wrt CGROUP16
dw .to_ringX wrt CGROUP16
dw .to_ringX wrt CGROUP16
dw .restore_ctx wrt CGROUP16
%else
dd .invalid_syscall wrt FLAT
dd .print_chr wrt FLAT
dd .print_str wrt FLAT
dd .to_ringX wrt FLAT
dd .to_ringX wrt FLAT
dd .to_ringX wrt FLAT
dd .to_ringX wrt FLAT
dd .restore_ctx wrt FLAT
%endif
;
; Invalid system call.
;
.invalid_syscall:
int3
jmp .return
;
; Print char in the CL register.
;
; We use the vga bios teletype interrupt to do the writing, so we must
; be in some kind of real mode for this to work. 16-bit code segment
; requried for the mode switching code.
;
BS3_BEGIN_TEXT16
BS3_SET_BITS TMPL_BITS
.print_chr:
%if TMPL_BITS != 64
push es
mov di, ss ; Must save and restore SS for supporting 16/32 and 32/16 caller/kernel ring-0 combinations.
%endif
%ifndef TMPL_CMN_R86
; Switch to real mode (20h param scratch area not required).
extern TMPL_NM(Bs3SwitchToRM)
call TMPL_NM(Bs3SwitchToRM)
BS3_SET_BITS 16
%endif
; Print the character, turning '\n' into '\r\n'.
cmp cl, 0ah ; \n
je .print_chr_newline
mov ah, 0eh
mov al, cl
mov bx, 0ff00h
int 10h
jmp .print_chr_done
.print_chr_newline:
mov ax, 0e0dh ; cmd + \r
mov bx, 0ff00h
int 10h
mov ax, 0e0ah ; cmd + \n
mov bx, 0ff00h
int 10h
.print_chr_done:
%ifndef TMPL_CMN_R86
; Switch back (20h param scratch area not required).
extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_rm)
call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_rm)
BS3_SET_BITS TMPL_BITS
%endif
%if TMPL_BITS != 64
mov ss, di
pop es
%endif
jmp .return
TMPL_BEGIN_TEXT
;
; Prints DX chars from the string pointed to by CX:xSI to the screen.
;
; We use the vga bios teletype interrupt to do the writing, so we must
; be in some kind of real mode for this to work. The string must be
; accessible from real mode too.
;
.print_str:
%if TMPL_BITS != 64
push es
%endif
; Convert the incoming pointer to real mode (assuming caller checked
; that real mode can access it).
call .convert_ptr_arg_to_real_mode_ax_si
mov cx, VAR_CALLER_DX
; Switch to real mode (no 20h scratch required)
%ifndef TMPL_CMN_R86
%if TMPL_BITS != 16
jmp .print_str_to_16bit
BS3_BEGIN_TEXT16
.print_str_to_16bit:
BS3_SET_BITS TMPL_BITS
%endif
extern TMPL_NM(Bs3SwitchToRM)
call TMPL_NM(Bs3SwitchToRM)
BS3_SET_BITS 16
%endif
; Call code in Bs3PrintStrN to do the work.
mov ds, ax
call Bs3PrintStrN_c16_CX_Bytes_At_DS_SI
; Switch back (20h param scratch area not required).
%ifndef TMPL_CMN_R86
extern RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_rm)
call RT_CONCAT3(_Bs3SwitchTo,TMPL_MODE_UNAME,_rm)
%if TMPL_BITS != 16
BS3_SET_BITS TMPL_BITS
jmp .print_str_end
TMPL_BEGIN_TEXT
%endif
.print_str_end:
%endif
%if TMPL_BITS != 64
pop es
%endif
jmp .return
;
; Switch the caller to ring-0, ring-1, ring-2 or ring-3.
;
; This implement this by saving the entire register context, calling
; a transformation function (C) and restoring the modified register
; context using a generic worker.
;
.to_ringX:
sub xSP, BS3REGCTX_size
mov xBX, xSP ; xBP = BS3REGCTX pointer.
call .save_context
%if TMPL_BITS == 32
; Convert xBP to flat pointer in 32-bit
push ss
push xBX
call Bs3SelProtFar32ToFlat32
add sSP, 8
mov xBX, xAX
%endif
push xBX ; Save pointer for the final restore call.
; Convert the register context from whatever it is to ring-0.
BONLY64 sub rsp, 10h
mov ax, VAR_CALLER_AX
sub ax, BS3_SYSCALL_TO_RING0
push xAX
BONLY16 push ss
push xBX
BS3_CALL Bs3RegCtxConvertToRingX, 2
add xSP, sCB + xCB BS3_ONLY_64BIT(+ 10h)
; Restore the register context (does not return).
pop xBX ; restore saved pointer.
BONLY64 sub rsp, 18h
BONLY16 push ss
push xBX
BS3_CALL Bs3RegCtxRestore, 1
jmp Bs3Panic
;
; Restore context pointed to by cx:xSI.
;
.restore_ctx:
call .convert_ptr_arg_to_cx_xSI
BONLY64 sub rsp, 10h
mov xDX, VAR_CALLER_DX
push xDX
BONLY16 push cx
push xSI
BS3_CALL Bs3RegCtxRestore, 2
jmp Bs3Panic
;
; Return.
;
.return:
pop xBX ; saved mode
mov [BS3_DATA16_WRT(g_bBs3CurrentMode)], bl
%if TMPL_BITS == 16
and bl, BS3_MODE_CODE_MASK
cmp bl, BS3_MODE_CODE_V86
je .return_to_v8086_from_16bit_krnl
cmp bl, BS3_MODE_CODE_32
je .return_to_32bit_from_16bit_krnl
%if TMPL_MODE == BS3_MODE_RM || TMPL_MODE == BS3_MODE_PE16
cmp byte [BS3_DATA16_WRT(g_uBs3CpuDetected)], BS3CPU_80286
jbe .return_pre_80386
%endif
popfd
pop esp
pop ebp
%endif
pop sDI
pop sSI
pop sDX
pop sCX
pop sAX
pop sBX
%if TMPL_BITS != 64
pop ds
leave
iret
%else
mov es, [rsp+2]
mov ds, [rsp]
leave ; skips ds
iretq
%endif
%if TMPL_BITS == 16
%if TMPL_MODE == BS3_MODE_RM || TMPL_MODE == BS3_MODE_PE16
; Variant of the above for 80286 and older.
.return_pre_80386:
add sp, 0ch
pop di
pop bx ; dummy
pop si
pop bx ; dummy
pop dx
pop bx ; dummy
pop cx
pop bx ; dummy
pop ax
pop bx ; dummy
pop bx ; pushed twice
pop bx
pop ds
pop bp
iret
%endif
.return_to_v8086_from_16bit_krnl:
int3
jmp .return_to_v8086_from_16bit_krnl
;
; Returning to 32-bit code may require us to expand and seed the eip
; and esp addresses in the iret frame since these are truncated when
; using a 16-bit interrupt handler.
;
; Incoming stack: New stack diff cpl:
; bp + 0ah: [ss]
; bp + 08h: [sp] bx + 38h: [ss] New stack same cpl:
; bp + 06h: flags
; bp + 04h: cs bx + 34h: [esp] bx + 30h: eflags
; bp + 02h: ip
; -------------- bx + 30h: eflags bx + 2ch: cs
; bp + 00h: bp
; bp - 02h: ds bx + 2ch: cs bx + 28h: eip
; -------------
; bp - 06h: ebx bx + 28h: eip bx + 26h: bp
; -------------- bx + 24h: ds
; bp - 0ah: eax bx + 26h: bp
; bx + 24h: ds bx + 20h: ebx
; bp - 0eh: ecx
; bx + 20h: ebx bx + 1ch: eax
; bp - 12h: edx
; bx + 1ch: eax bx + 18h: ecx
; bp - 16h: esi
; bx + 18h: ecx bx + 14h: edx
; bp - 1ah: edi
; bx + 14h: edx bx + 10h: esi
; bp - 1eh: esp
; bx + 10h: esi bx + 0ch: edi
; bp - 22h: ebp
; bx + 0ch: edi bx + 08h: esp
; bp - 26h: eflags
; bx + 08h: esp bx + 04h: ebp
;
; bx + 04h: ebp bx + 00h: eflags
;
; bx + 00h: eflags
;
;
; If we're returning to the same CPL, we're still using the stack of
; the 32-bit caller. The high ESP word does not need restoring.
;
; If we're returning to a lower CPL, there on a 16-bit ring-0 stack,
; however, the high ESP word is still that of the caller.
;
.return_to_32bit_from_16bit_krnl:
mov ax, cs
and al, 3
mov ah, 3
and ah, [xBP + xCB*2]
; The iret frame doubles in size, so allocate more stack.
cmp al, ah
je .return_to_32bit_from_16bit_krnl_same_cpl_sub_sp
sub sp, 2*2
.return_to_32bit_from_16bit_krnl_same_cpl_sub_sp:
sub sp, 3*2
mov bx, sp
; Copy the saved registers.
xor di, di
.return_to_32bit_from_16bit_krnl_copy_loop:
mov ecx, [bp + di - 26h]
mov [ss:bx + di], ecx
add di, 4
cmp di, 28h
jb .return_to_32bit_from_16bit_krnl_copy_loop
; Convert the 16-bit iret frame to a 32-bit iret frame.
mov ecx, [BS3_DATA16_WRT(g_uBs3TrapEipHint)]
mov cx, [bp + 02h] ; ip
mov [ss:bx + 28h], ecx
mov ecx, 0f00d0000h
mov cx, [bp + 04h] ; cs
mov [ss:bx + 2ch], ecx
mov ecx, [ss:bx] ; caller eflags
mov cx, [bp + 06h] ; flags
mov [ss:bx + 30h], ecx
cmp al, ah
jz .return_to_32bit_from_16bit_krnl_do_return
mov ecx, [ss:bx + 08h] ; caller esp
mov cx, [bp + 08h] ; sp
mov [ss:bx + 34h], ecx
mov ecx, 0f00d0000h
mov cx, [bp + 0ah] ; ss
mov [ss:bx + 38h], ecx
.return_to_32bit_from_16bit_krnl_do_return:
popfd
pop ecx ; esp - only the high bits!
mov cx, sp
mov esp, ecx
pop ebp
lea bp, [bx + 26h]
pop edi
pop esi
pop edx
pop ecx
pop eax
pop ebx
pop ds
leave
iretd
%endif ; 16-bit
;
; Internal function. ss:xBX = Pointer to register frame (BS3REGCTX).
; @uses xAX
;
.save_context:
%if TMPL_BITS == 16
cmp byte [BS3_DATA16_WRT(g_uBs3CpuDetected)], BS3CPU_80386
jae .save_context_full
;
; 80286 or earlier.
;
; Clear the state area first.
push di
xor di, di
.save_context_16_clear_loop:
mov word [ss:bx + di], 0
mov word [ss:bx + di + 2], 0
mov word [ss:bx + di + 4], 0
mov word [ss:bx + di + 6], 0
add di, 8
cmp di, BS3REGCTX_size
jb .save_context_16_clear_loop
pop di
; Do the 8086/80186/80286 state saving.
mov ax, VAR_CALLER_AX
mov [ss:bx + BS3REGCTX.rax], ax
mov cx, VAR_CALLER_CX
mov [ss:bx + BS3REGCTX.rcx], ax
mov ax, VAR_CALLER_DX
mov [ss:bx + BS3REGCTX.rdx], ax
mov ax, VAR_CALLER_BX
mov [ss:bx + BS3REGCTX.rbx], ax
mov [ss:bx + BS3REGCTX.rsi], si
mov [ss:bx + BS3REGCTX.rdi], di
mov ax, VAR_CALLER_BP
mov [ss:bx + BS3REGCTX.rbp], ax
mov ax, VAR_CALLER_DS
mov [ss:bx + BS3REGCTX.ds], ax
mov [ss:bx + BS3REGCTX.es], es
mov ax, [xBP + xCB]
mov [ss:bx + BS3REGCTX.rip], ax
mov ax, [xBP + xCB*2]
mov [ss:bx + BS3REGCTX.cs], ax
and al, X86_SEL_RPL
mov [ss:bx + BS3REGCTX.bCpl], al
cmp al, 0
je .save_context_16_same
mov ax, [xBP + xCB*4]
mov [ss:bx + BS3REGCTX.rsp], ax
mov ax, [xBP + xCB*5]
mov [ss:bx + BS3REGCTX.ss], ax
jmp .save_context_16_done_stack
.save_context_16_same:
mov ax, bp
add ax, xCB * (1 + 3)
mov [ss:bx + BS3REGCTX.rsp], ax
mov ax, ss
mov [ss:bx + BS3REGCTX.ss], ax
.save_context_16_done_stack:
mov ax, [xBP + xCB*3]
mov [ss:bx + BS3REGCTX.rflags], ax
mov al, VAR_CALLER_MODE
mov [ss:bx + BS3REGCTX.bMode], al
cmp byte [BS3_DATA16_WRT(g_uBs3CpuDetected)], BS3CPU_80286
jne .save_context_16_return
smsw [ss:bx + BS3REGCTX.cr0]
str [ss:bx + BS3REGCTX.tr]
sldt [ss:bx + BS3REGCTX.ldtr]
.save_context_16_return:
or byte [ss:bx + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_AMD64 | BS3REG_CTX_F_NO_CR4
ret
%endif ; TMPL_BITS == 16
;
; 80386 or later.
;
.save_context_full:
; Clear the state area.
push xDI
xor xDI, xDI
AssertCompileSizeAlignment(BS3REGCTX, 16)
.save_context_full_clear_loop:
%if TMPL_BITS != 64
mov dword [ss:xBX + xDI], 0
mov dword [ss:xBX + xDI + 4], 0
add xDI, 8
%else
mov qword [xBX + xDI], 0
mov qword [xBX + xDI + 8], 0
add xDI, 10h
%endif
cmp xDI, BS3REGCTX_size
jb .save_context_full_clear_loop
pop xDI
; Do the 386+ state saving.
%if TMPL_BITS == 16 ; save the high word of registered pushed on the stack.
mov ecx, VAR_CALLER_AX
mov [ss:bx + BS3REGCTX.rax], ecx
mov ecx, VAR_CALLER_CX
mov [ss:bx + BS3REGCTX.rcx], ecx
mov ecx, VAR_CALLER_DX
mov [ss:bx + BS3REGCTX.rdx], ecx
mov ecx, VAR_CALLER_BX
mov [ss:bx + BS3REGCTX.rbx], ecx
mov ecx, VAR_CALLER_EBP
mov [ss:bx + BS3REGCTX.rbp], ecx
mov ecx, VAR_CALLER_ESP
mov [ss:bx + BS3REGCTX.rsp], ecx
mov ecx, VAR_CALLER_SI
mov [ss:bx + BS3REGCTX.rsi], ecx
mov ecx, VAR_CALLER_DI
mov [ss:bx + BS3REGCTX.rdi], ecx
mov ecx, VAR_CALLER_EFLAGS
mov [ss:bx + BS3REGCTX.rflags], ecx
; Seed high EIP word if 32-bit CS.
lar ecx, [bp + 4]
jnz .save_context_full_done_16bit_high_word
test ecx, X86LAR_F_D
jz .save_context_full_done_16bit_high_word
mov ecx, [BS3_DATA16_WRT(g_uBs3TrapEipHint)]
mov [ss:bx + BS3REGCTX.rip], ecx
.save_context_full_done_16bit_high_word:
%endif ; 16-bit
mov xAX, VAR_CALLER_AX
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rax], xAX
mov xCX, VAR_CALLER_CX
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rcx], xCX
mov xAX, VAR_CALLER_DX
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rdx], xAX
mov xAX, VAR_CALLER_BX
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rbx], xAX
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rsi], sSI
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rdi], sDI
mov xAX, VAR_CALLER_BP
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rbp], xAX
%if TMPL_BITS != 64
mov ax, VAR_CALLER_DS
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.ds], ax
%else
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.ds], ds
%endif
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.es], es
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.fs], fs
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.gs], gs
mov xAX, [xBP + xCB]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rip], xAX
mov ax, [xBP + xCB*2]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.cs], ax
%if TMPL_MODE != BS3_MODE_RM
and al, X86_SEL_RPL
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.bCpl], al
cmp al, 0
je .save_context_full_same
mov xAX, [xBP + xCB*4]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rsp], xAX
mov ax, [xBP + xCB*5]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.ss], ax
jmp .save_context_full_done_stack
%else
mov byte [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.bCpl], 0
%endif
.save_context_full_same:
mov xAX, xBP
add xAX, xCB * (1 + 3)
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rsp], xAX
mov ax, ss
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.ss], ax
.save_context_full_done_stack:
mov xAX, [xBP + xCB*3]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rflags], xAX
mov al, VAR_CALLER_MODE
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.bMode], al
%if TMPL_BITS == 64
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.r8], r8
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.r9], r9
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.r10], r10
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.r11], r11
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.r12], r12
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.r13], r13
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.r14], r14
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.r15], r15
%endif
str [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.tr]
sldt [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.ldtr]
mov sAX, cr0
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.cr0], sAX
mov sAX, cr2
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.cr2], sAX
mov sAX, cr3
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.cr3], sAX
%if TMPL_BITS != 64
test byte [BS3_DATA16_WRT(g_uBs3CpuDetected)], (BS3CPU_F_CPUID >> 8)
jnz .have_cr4
or byte [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_CR4
jmp .done_cr4
.have_cr4:
%endif
mov sAX, cr4
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.cr4], sAX
%if TMPL_BITS != 64
.done_cr4:
or byte [ss:xBX + BS3REGCTX.fbFlags], BS3REG_CTX_F_NO_AMD64
; Deal with extended v8086 frame.
%if TMPL_BITS == 32
test dword [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rflags], X86_EFL_VM
jz .save_context_full_return
%else
test byte VAR_CALLER_MODE, BS3_MODE_CODE_V86
jz .save_context_full_return
mov dword [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rflags], X86_EFL_VM
%endif
mov xAX, [xBP + xCB*4]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.rsp], xAX
mov ax, [xBP + xCB*5]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.ss], ax
mov ax, [xBP + xCB*6]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.es], ax
mov ax, [xBP + xCB*7]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.ds], ax
mov ax, [xBP + xCB*8]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.fs], ax
mov ax, [xBP + xCB*9]
mov [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.gs], ax
mov byte [BS3_NOT_64BIT(ss:) xBX + BS3REGCTX.bCpl], 3
jmp .save_context_full_return
%endif ; !64-bit
.save_context_full_return:
ret
%if TMPL_BITS == 16
CPU 286
%endif
;
; Internal function for converting a syscall pointer parameter (cx:xSI)
; to a pointer we can use here in this context.
;
; Returns the result in cx:xSI.
; @uses xAX, xCX, xDX
;
.convert_ptr_arg_to_cx_xSI:
call .convert_ptr_arg_to_flat
%if TMPL_BITS == 16
; Convert to tiled address.
mov si, ax ; offset.
shl dx, X86_SEL_SHIFT
add dx, BS3_SEL_TILED
mov cx, dx
%else
; Just supply a flat selector.
mov xSI, xAX
mov cx, ds
%endif
ret
;
; Internal function for converting a syscall pointer parameter (caller CX:xSI)
; to a real mode pointer.
;
; Returns the result in AX:SI.
; @uses xAX, xCX, xDX
;
.convert_ptr_arg_to_real_mode_ax_si:
call .convert_ptr_arg_to_flat
mov si, ax
%if TMPL_BITS == 16
mov ax, dx
%else
shr eax, 16
%endif
shl ax, 12
ret
;
; Internal function for the above that wraps the Bs3SelProtFar32ToFlat32 call.
;
; @returns eax (32-bit, 64-bit), dx+ax (16-bit).
; @uses eax, ecx, edx
;
.convert_ptr_arg_to_flat:
%if TMPL_BITS == 16
; Convert to (32-bit) flat address first.
test byte VAR_CALLER_MODE, BS3_MODE_CODE_V86
jz .convert_ptr_arg_to_flat_prot_16
mov ax, VAR_CALLER_CX
mov dx, ax
shl ax, 4
shr dx, 12
add ax, VAR_CALLER_SI
adc dx, 0
ret
.convert_ptr_arg_to_flat_prot_16:
push es
push bx
push word VAR_CALLER_CX ; selector
xor ax, ax
test byte VAR_CALLER_MODE, BS3_MODE_CODE_16
jnz .caller_is_16_bit
mov ax, VAR_CALLER_SI_HI
.caller_is_16_bit:
push ax ; offset high
push word VAR_CALLER_SI ; offset low
call Bs3SelProtFar32ToFlat32
add sp, 2*3
pop bx
pop es
ret
%else ; 32 or 64 bit
test byte VAR_CALLER_MODE, BS3_MODE_CODE_V86
jz .convert_ptr_arg_to_cx_xSI_prot
; Convert real mode address to flat address and return it.
movzx eax, word VAR_CALLER_CX
shl eax, 4
movzx edx, word VAR_CALLER_SI
add eax, edx
ret
; Convert to (32-bit) flat address.
.convert_ptr_arg_to_cx_xSI_prot:
%if TMPL_BITS == 64
push r11
push r10
push r9
push r8
sub rsp, 10h
%endif
movzx ecx, word VAR_CALLER_CX
push xCX
mov eax, VAR_CALLER_SI
test byte VAR_CALLER_MODE, BS3_MODE_CODE_16
jz .no_masking_offset
and eax, 0ffffh
.no_masking_offset:
push xAX
BS3_CALL Bs3SelProtFar32ToFlat32,2
add xSP, xCB*2 BS3_ONLY_64BIT(+ 10h)
%if TMPL_BITS == 64
pop r8
pop r9
pop r10
pop r11
%endif
%endif
ret
BS3_PROC_END_MODE Bs3TrapSystemCallHandler
| 33.5875 | 132 | 0.525696 |
4138e09677c421bdd74db36d49e732269cc57e6d | 507 | asm | Assembly | src/test/ref/enum-1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | 2 | 2022-03-01T02:21:14.000Z | 2022-03-01T04:33:35.000Z | src/test/ref/enum-1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/test/ref/enum-1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | // Test of simple enum - three-value enum with specified integer values and increment
// Commodore 64 PRG executable file
.file [name="enum-1.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.const BROKEN = 9
.segment Code
main: {
.label SCREEN = $400
// *SCREEN = state
lda #BROKEN
sta SCREEN
// }
rts
}
| 25.35 | 85 | 0.684418 |
b1b9be0392dd556587deaed00ca65d2ed7a262d8 | 21,952 | asm | Assembly | WRK-V1.2/TOOLS/crt/src/intel/memcpy.asm | intj-t/openvmsft | 0d17fbce8607ab2b880be976c2e86d8cfc3e83bb | [
"Intel"
] | null | null | null | WRK-V1.2/TOOLS/crt/src/intel/memcpy.asm | intj-t/openvmsft | 0d17fbce8607ab2b880be976c2e86d8cfc3e83bb | [
"Intel"
] | null | null | null | WRK-V1.2/TOOLS/crt/src/intel/memcpy.asm | intj-t/openvmsft | 0d17fbce8607ab2b880be976c2e86d8cfc3e83bb | [
"Intel"
] | null | null | null | page ,132
title memcpy - Copy source memory bytes to destination
;***
;memcpy.asm - contains memcpy and memmove routines
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
;Purpose:
; memcpy() copies a source memory buffer to a destination buffer.
; Overlapping buffers are not treated specially, so propogation may occur.
; memmove() copies a source memory buffer to a destination buffer.
; Overlapping buffers are treated specially, to avoid propogation.
;
;*******************************************************************************
.xlist
include cruntime.inc
.list
M_EXIT macro
ret ; _cdecl return
endm ; M_EXIT
CODESEG
extrn _VEC_memcpy:near
extrn __sse2_available:dword
page
;***
;memcpy - Copy source buffer to destination buffer
;
;Purpose:
; memcpy() copies a source memory buffer to a destination memory buffer.
; This routine does NOT recognize overlapping buffers, and thus can lead
; to propogation.
; For cases where propogation must be avoided, memmove() must be used.
;
; Algorithm:
;
; Same as memmove. See Below
;
;
;memmove - Copy source buffer to destination buffer
;
;Purpose:
; memmove() copies a source memory buffer to a destination memory buffer.
; This routine recognize overlapping buffers to avoid propogation.
; For cases where propogation is not a problem, memcpy() can be used.
;
; Algorithm:
;
; void * memmove(void * dst, void * src, size_t count)
; {
; void * ret = dst;
;
; if (dst <= src || dst >= (src + count)) {
; /*
; * Non-Overlapping Buffers
; * copy from lower addresses to higher addresses
; */
; while (count--)
; *dst++ = *src++;
; }
; else {
; /*
; * Overlapping Buffers
; * copy from higher addresses to lower addresses
; */
; dst += count - 1;
; src += count - 1;
;
; while (count--)
; *dst-- = *src--;
; }
;
; return(ret);
; }
;
;
;Entry:
; void *dst = pointer to destination buffer
; const void *src = pointer to source buffer
; size_t count = number of bytes to copy
;
;Exit:
; Returns a pointer to the destination buffer in AX/DX:AX
;
;Uses:
; CX, DX
;
;Exceptions:
;*******************************************************************************
ifdef MEM_MOVE
_MEM_ equ <memmove>
else ; MEM_MOVE
_MEM_ equ <memcpy>
endif ; MEM_MOVE
% public _MEM_
_MEM_ proc \
dst:ptr byte, \
src:ptr byte, \
count:IWORD
; destination pointer
; source pointer
; number of bytes to copy
; push ebp ;U - save old frame pointer
; mov ebp, esp ;V - set new frame pointer
push edi ;U - save edi
push esi ;V - save esi
mov esi,[src] ;U - esi = source
mov ecx,[count] ;V - ecx = number of bytes to move
mov edi,[dst] ;U - edi = dest
;
; Check for overlapping buffers:
; If (dst <= src) Or (dst >= src + Count) Then
; Do normal (Upwards) Copy
; Else
; Do Downwards Copy to avoid propagation
;
mov eax,ecx ;V - eax = byte count...
mov edx,ecx ;U - edx = byte count...
add eax,esi ;V - eax = point past source end
cmp edi,esi ;U - dst <= src ?
jbe short CopyUp ;V - yes, copy toward higher addresses
cmp edi,eax ;U - dst < (src + count) ?
jb CopyDown ;V - yes, copy toward lower addresses
;
; Copy toward higher addresses.
;
CopyUp:
;
; First, see if we can use a "fast" copy SSE2 routine
; block size greater than min threshold?
cmp ecx,0100h
jb Dword_align
; SSE2 supported?
cmp DWORD PTR __sse2_available,0
je Dword_align
; alignments equal?
push edi
push esi
and edi,15
and esi,15
cmp edi,esi
pop esi
pop edi
jne Dword_align
; do fast SSE2 copy, params already on stack
pop esi
pop edi
pop ebp
jmp _VEC_memcpy
; no return
;
; The algorithm for forward moves is to align the destination to a dword
; boundary and so we can move dwords with an aligned destination. This
; occurs in 3 steps.
;
; - move x = ((4 - Dest & 3) & 3) bytes
; - move y = ((L-x) >> 2) dwords
; - move (L - x - y*4) bytes
;
Dword_align:
test edi,11b ;U - destination dword aligned?
jnz short CopyLeadUp ;V - if we are not dword aligned already, align
shr ecx,2 ;U - shift down to dword count
and edx,11b ;V - trailing byte count
cmp ecx,8 ;U - test if small enough for unwind copy
jb short CopyUnwindUp ;V - if so, then jump
rep movsd ;N - move all of our dwords
jmp dword ptr TrailUpVec[edx*4] ;N - process trailing bytes
;
; Code to do optimal memory copies for non-dword-aligned destinations.
;
; The following length check is done for two reasons:
;
; 1. to ensure that the actual move length is greater than any possiale
; alignment move, and
;
; 2. to skip the multiple move logic for small moves where it would
; be faster to move the bytes with one instruction.
;
align @WordSize
CopyLeadUp:
mov eax,edi ;U - get destination offset
mov edx,11b ;V - prepare for mask
sub ecx,4 ;U - check for really short string - sub for adjust
jb short ByteCopyUp ;V - branch to just copy bytes
and eax,11b ;U - get offset within first dword
add ecx,eax ;V - update size after leading bytes copied
jmp dword ptr LeadUpVec[eax*4-4] ;N - process leading bytes
align @WordSize
ByteCopyUp:
jmp dword ptr TrailUpVec[ecx*4+16] ;N - process just bytes
align @WordSize
CopyUnwindUp:
jmp dword ptr UnwindUpVec[ecx*4] ;N - unwind dword copy
align @WordSize
LeadUpVec dd LeadUp1, LeadUp2, LeadUp3
align @WordSize
LeadUp1:
and edx,ecx ;U - trailing byte count
mov al,[esi] ;V - get first byte from source
mov [edi],al ;U - write second byte to destination
mov al,[esi+1] ;V - get second byte from source
mov [edi+1],al ;U - write second byte to destination
mov al,[esi+2] ;V - get third byte from source
shr ecx,2 ;U - shift down to dword count
mov [edi+2],al ;V - write third byte to destination
add esi,3 ;U - advance source pointer
add edi,3 ;V - advance destination pointer
cmp ecx,8 ;U - test if small enough for unwind copy
jb short CopyUnwindUp ;V - if so, then jump
rep movsd ;N - move all of our dwords
jmp dword ptr TrailUpVec[edx*4] ;N - process trailing bytes
align @WordSize
LeadUp2:
and edx,ecx ;U - trailing byte count
mov al,[esi] ;V - get first byte from source
mov [edi],al ;U - write second byte to destination
mov al,[esi+1] ;V - get second byte from source
shr ecx,2 ;U - shift down to dword count
mov [edi+1],al ;V - write second byte to destination
add esi,2 ;U - advance source pointer
add edi,2 ;V - advance destination pointer
cmp ecx,8 ;U - test if small enough for unwind copy
jb short CopyUnwindUp ;V - if so, then jump
rep movsd ;N - move all of our dwords
jmp dword ptr TrailUpVec[edx*4] ;N - process trailing bytes
align @WordSize
LeadUp3:
and edx,ecx ;U - trailing byte count
mov al,[esi] ;V - get first byte from source
mov [edi],al ;U - write second byte to destination
add esi,1 ;V - advance source pointer
shr ecx,2 ;U - shift down to dword count
add edi,1 ;V - advance destination pointer
cmp ecx,8 ;U - test if small enough for unwind copy
jb short CopyUnwindUp ;V - if so, then jump
rep movsd ;N - move all of our dwords
jmp dword ptr TrailUpVec[edx*4] ;N - process trailing bytes
align @WordSize
UnwindUpVec dd UnwindUp0, UnwindUp1, UnwindUp2, UnwindUp3
dd UnwindUp4, UnwindUp5, UnwindUp6, UnwindUp7
UnwindUp7:
mov eax,[esi+ecx*4-28] ;U - get dword from source
;V - spare
mov [edi+ecx*4-28],eax ;U - put dword into destination
UnwindUp6:
mov eax,[esi+ecx*4-24] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4-24],eax ;U - put dword into destination
UnwindUp5:
mov eax,[esi+ecx*4-20] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4-20],eax ;U - put dword into destination
UnwindUp4:
mov eax,[esi+ecx*4-16] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4-16],eax ;U - put dword into destination
UnwindUp3:
mov eax,[esi+ecx*4-12] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4-12],eax ;U - put dword into destination
UnwindUp2:
mov eax,[esi+ecx*4-8] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4-8],eax ;U - put dword into destination
UnwindUp1:
mov eax,[esi+ecx*4-4] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4-4],eax ;U - put dword into destination
lea eax,[ecx*4] ;V - compute update for pointer
add esi,eax ;U - update source pointer
add edi,eax ;V - update destination pointer
UnwindUp0:
jmp dword ptr TrailUpVec[edx*4] ;N - process trailing bytes
;-----------------------------------------------------------------------------
align @WordSize
TrailUpVec dd TrailUp0, TrailUp1, TrailUp2, TrailUp3
align @WordSize
TrailUp0:
mov eax,[dst] ;U - return pointer to destination
pop esi ;V - restore esi
pop edi ;U - restore edi
;V - spare
M_EXIT
align @WordSize
TrailUp1:
mov al,[esi] ;U - get byte from source
;V - spare
mov [edi],al ;U - put byte in destination
mov eax,[dst] ;V - return pointer to destination
pop esi ;U - restore esi
pop edi ;V - restore edi
M_EXIT
align @WordSize
TrailUp2:
mov al,[esi] ;U - get first byte from source
;V - spare
mov [edi],al ;U - put first byte into destination
mov al,[esi+1] ;V - get second byte from source
mov [edi+1],al ;U - put second byte into destination
mov eax,[dst] ;V - return pointer to destination
pop esi ;U - restore esi
pop edi ;V - restore edi
M_EXIT
align @WordSize
TrailUp3:
mov al,[esi] ;U - get first byte from source
;V - spare
mov [edi],al ;U - put first byte into destination
mov al,[esi+1] ;V - get second byte from source
mov [edi+1],al ;U - put second byte into destination
mov al,[esi+2] ;V - get third byte from source
mov [edi+2],al ;U - put third byte into destination
mov eax,[dst] ;V - return pointer to destination
pop esi ;U - restore esi
pop edi ;V - restore edi
M_EXIT
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
;-----------------------------------------------------------------------------
;
; Copy down to avoid propogation in overlapping buffers.
;
align @WordSize
CopyDown:
lea esi,[esi+ecx-4] ;U - point to 4 bytes before src buffer end
lea edi,[edi+ecx-4] ;V - point to 4 bytes before dest buffer end
;
; See if the destination start is dword aligned
;
test edi,11b ;U - test if dword aligned
jnz short CopyLeadDown ;V - if not, jump
shr ecx,2 ;U - shift down to dword count
and edx,11b ;V - trailing byte count
cmp ecx,8 ;U - test if small enough for unwind copy
jb short CopyUnwindDown ;V - if so, then jump
std ;N - set direction flag
rep movsd ;N - move all of our dwords
cld ;N - clear direction flag back
jmp dword ptr TrailDownVec[edx*4] ;N - process trailing bytes
align @WordSize
CopyUnwindDown:
neg ecx ;U - negate dword count for table merging
;V - spare
jmp dword ptr UnwindDownVec[ecx*4+28] ;N - unwind copy
align @WordSize
CopyLeadDown:
mov eax,edi ;U - get destination offset
mov edx,11b ;V - prepare for mask
cmp ecx,4 ;U - check for really short string
jb short ByteCopyDown ;V - branch to just copy bytes
and eax,11b ;U - get offset within first dword
sub ecx,eax ;U - to update size after lead copied
jmp dword ptr LeadDownVec[eax*4-4] ;N - process leading bytes
align @WordSize
ByteCopyDown:
jmp dword ptr TrailDownVec[ecx*4] ;N - process just bytes
align @WordSize
LeadDownVec dd LeadDown1, LeadDown2, LeadDown3
align @WordSize
LeadDown1:
mov al,[esi+3] ;U - load first byte
and edx,ecx ;V - trailing byte count
mov [edi+3],al ;U - write out first byte
sub esi,1 ;V - point to last src dword
shr ecx,2 ;U - shift down to dword count
sub edi,1 ;V - point to last dest dword
cmp ecx,8 ;U - test if small enough for unwind copy
jb short CopyUnwindDown ;V - if so, then jump
std ;N - set direction flag
rep movsd ;N - move all of our dwords
cld ;N - clear direction flag
jmp dword ptr TrailDownVec[edx*4] ;N - process trailing bytes
align @WordSize
LeadDown2:
mov al,[esi+3] ;U - load first byte
and edx,ecx ;V - trailing byte count
mov [edi+3],al ;U - write out first byte
mov al,[esi+2] ;V - get second byte from source
shr ecx,2 ;U - shift down to dword count
mov [edi+2],al ;V - write second byte to destination
sub esi,2 ;U - point to last src dword
sub edi,2 ;V - point to last dest dword
cmp ecx,8 ;U - test if small enough for unwind copy
jb short CopyUnwindDown ;V - if so, then jump
std ;N - set direction flag
rep movsd ;N - move all of our dwords
cld ;N - clear direction flag
jmp dword ptr TrailDownVec[edx*4] ;N - process trailing bytes
align @WordSize
LeadDown3:
mov al,[esi+3] ;U - load first byte
and edx,ecx ;V - trailing byte count
mov [edi+3],al ;U - write out first byte
mov al,[esi+2] ;V - get second byte from source
mov [edi+2],al ;U - write second byte to destination
mov al,[esi+1] ;V - get third byte from source
shr ecx,2 ;U - shift down to dword count
mov [edi+1],al ;V - write third byte to destination
sub esi,3 ;U - point to last src dword
sub edi,3 ;V - point to last dest dword
cmp ecx,8 ;U - test if small enough for unwind copy
jb CopyUnwindDown ;V - if so, then jump
std ;N - set direction flag
rep movsd ;N - move all of our dwords
cld ;N - clear direction flag
jmp dword ptr TrailDownVec[edx*4] ;N - process trailing bytes
;------------------------------------------------------------------
align @WordSize
UnwindDownVec dd UnwindDown7, UnwindDown6, UnwindDown5, UnwindDown4
dd UnwindDown3, UnwindDown2, UnwindDown1, UnwindDown0
UnwindDown7:
mov eax,[esi+ecx*4+28] ;U - get dword from source
;V - spare
mov [edi+ecx*4+28],eax ;U - put dword into destination
UnwindDown6:
mov eax,[esi+ecx*4+24] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4+24],eax ;U - put dword into destination
UnwindDown5:
mov eax,[esi+ecx*4+20] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4+20],eax ;U - put dword into destination
UnwindDown4:
mov eax,[esi+ecx*4+16] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4+16],eax ;U - put dword into destination
UnwindDown3:
mov eax,[esi+ecx*4+12] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4+12],eax ;U - put dword into destination
UnwindDown2:
mov eax,[esi+ecx*4+8] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4+8],eax ;U - put dword into destination
UnwindDown1:
mov eax,[esi+ecx*4+4] ;U(entry)/V(not) - get dword from source
;V(entry) - spare
mov [edi+ecx*4+4],eax ;U - put dword into destination
lea eax,[ecx*4] ;V - compute update for pointer
add esi,eax ;U - update source pointer
add edi,eax ;V - update destination pointer
UnwindDown0:
jmp dword ptr TrailDownVec[edx*4] ;N - process trailing bytes
;-----------------------------------------------------------------------------
align @WordSize
TrailDownVec dd TrailDown0, TrailDown1, TrailDown2, TrailDown3
align @WordSize
TrailDown0:
mov eax,[dst] ;U - return pointer to destination
;V - spare
pop esi ;U - restore esi
pop edi ;V - restore edi
M_EXIT
align @WordSize
TrailDown1:
mov al,[esi+3] ;U - get byte from source
;V - spare
mov [edi+3],al ;U - put byte in destination
mov eax,[dst] ;V - return pointer to destination
pop esi ;U - restore esi
pop edi ;V - restore edi
M_EXIT
align @WordSize
TrailDown2:
mov al,[esi+3] ;U - get first byte from source
;V - spare
mov [edi+3],al ;U - put first byte into destination
mov al,[esi+2] ;V - get second byte from source
mov [edi+2],al ;U - put second byte into destination
mov eax,[dst] ;V - return pointer to destination
pop esi ;U - restore esi
pop edi ;V - restore edi
M_EXIT
align @WordSize
TrailDown3:
mov al,[esi+3] ;U - get first byte from source
;V - spare
mov [edi+3],al ;U - put first byte into destination
mov al,[esi+2] ;V - get second byte from source
mov [edi+2],al ;U - put second byte into destination
mov al,[esi+1] ;V - get third byte from source
mov [edi+1],al ;U - put third byte into destination
mov eax,[dst] ;V - return pointer to destination
pop esi ;U - restore esi
pop edi ;V - restore edi
M_EXIT
_MEM_ endp
end
| 36.344371 | 83 | 0.493212 |
5b6c3327c5c90bebb750c3f35ffdfb96ed3c53a6 | 905 | asm | Assembly | 68k-driver/src/driver_main.asm | atdean/saturn-hello-beep | ad81cfdbb0805e0677b0704bab0bf50bd349f12e | [
"MIT"
] | 1 | 2021-10-17T11:33:33.000Z | 2021-10-17T11:33:33.000Z | 68k-driver/src/driver_main.asm | atdean/saturn-hello-beep | ad81cfdbb0805e0677b0704bab0bf50bd349f12e | [
"MIT"
] | null | null | null | 68k-driver/src/driver_main.asm | atdean/saturn-hello-beep | ad81cfdbb0805e0677b0704bab0bf50bd349f12e | [
"MIT"
] | null | null | null | INCLUDE "inc/header.i"
ORG $000400 ; is this needed? the vector table will occupy exactly the first $400 bytes
entry_point:
bra.w init_scsp
init_scsp:
; TODO :: 68K must wait approx 30µs after SMPC reset for SCSP to init registers
; TODO :: It seems these 3 flags should be set by the SH-2, need to confirm
; Configure SCSP for 4Mbit sound RAM, and 16-bit DAC output (retail Saturn hardware)
move.l #reg_SCSP_M4D8,a0
move.b #%00000010,(a0)
; Set SCSP master volume to -0db (no attenuation)
move.l #reg_SCSP_MVOL,a0
move.b #$0F,(a0)
driver_main_loop:
bra.s run_idle_loop ; for now, just idle until I start implementing functionality
; immediately return from the exception/interrupt
ignore_handler:
rte
; this is just an infinite "no-op" loop. Temp utility function for testing.
run_idle_loop:
bra.s run_idle_loop
__end:
; vim: ft=asm68k
| 27.424242 | 91 | 0.712707 |
8901c607cad4645af0002b834e1775ee41ea1e35 | 364 | asm | Assembly | programs/oeis/269/A269245.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/269/A269245.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/269/A269245.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A269245: Number of times the digit 5 appears in the decimal expansion of n^3.
; 0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,2,1,0,1,0,0,0,0,1,0,1,1,2,1,1,0,0,0,1,1,1,0,0,1,0,1,1,0,0,1,1,1,1,1,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,1,1,0,2,2,0,1,1,2,1,1,1,1,2,0,0,0,2,0,1,1,2
pow $0,3
lpb $0
mov $2,$0
div $0,10
mod $2,10
cmp $2,5
add $1,$2
lpe
mov $0,$1
| 28 | 193 | 0.552198 |
973e9d78cbb7c4a1b3fc38c347ed26537409820f | 572 | asm | Assembly | oeis/098/A098402.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/098/A098402.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/098/A098402.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A098402: a(n) = (0^n + 4^n * binomial(2*n,n))/2.
; 1,4,48,640,8960,129024,1892352,28114944,421724160,6372720640,96865353728,1479398129664,22684104654848,348986225459200,5384358907084800,83278084429578240,1290810308658462720,20045524793284362240,311819274562201190400,4857816066863765913600,75781930643074748252160,1183641583377548448890880,18507850212812575746293760,289688090287501185594163200,4538446747837518574308556800,71162845006092291245158170624,1116709260095602108770174369792,17536471343723529411798293807104
seq $0,98430 ; a(n) = 4^n*(2*n)!/(n!)^2.
dif $0,2
| 95.333333 | 469 | 0.851399 |
ce7b566cb367814a9a4d9cc8896239cdc3299835 | 572 | asm | Assembly | libsrc/graphics/cpc/undrawr.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | 1 | 2018-09-04T23:07:24.000Z | 2018-09-04T23:07:24.000Z | libsrc/graphics/cpc/undrawr.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | libsrc/graphics/cpc/undrawr.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | ;
; Amstrad CPC Graphics Functions
;
; by Stefano Bodrato - Jul 2004
;
;
; $Id: undrawr.asm,v 1.2 2007/07/21 21:28:22 dom Exp $
;
XLIB undrawr
LIB drawr
INCLUDE "#cpcfirm.def"
INCLUDE "graphics/grafix.inc"
.hlsave defw 0
.undrawr
ld a,bcolor
call firmware
defw gra_set_pen
pop hl
ld (hlsave),hl
call drawr
ld hl,(hlsave)
push hl
ld a,fcolor
call firmware
defw gra_set_pen
ret
| 16.342857 | 54 | 0.486014 |
4d90cf18c18d02bf6a2c7022c21cdc1ef79346f5 | 624 | asm | Assembly | oeis/228/A228842.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/228/A228842.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/228/A228842.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A228842: Binomial transform of A014448.
; 2,6,28,144,752,3936,20608,107904,564992,2958336,15490048,81106944,424681472,2223661056,11643240448,60964798464,319215828992,1671435780096,8751751364608,45824765067264,239941584945152,1256350449401856,6578336356630528,34444616342175744,180354352626532352,944347650390491136,4944668491836817408,25890620349458939904,135565048129406369792,709827807378602459136,3716706651753989275648,19460928681009525817344,101898745479041197801472,533548758150209083539456,2793697566985089710030848
mov $1,2
lpb $0
sub $0,1
mul $1,2
sub $1,1
add $2,$1
add $1,$2
mul $2,2
lpe
mov $0,$1
| 44.571429 | 482 | 0.842949 |
c6bf43648ee0c797bbf0a9d9e40cd64a61df8bf2 | 5,536 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca.log_209_1263.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca.log_209_1263.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i9-9900K_12_0xca.log_209_1263.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r15
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x3f70, %rcx
nop
nop
nop
nop
and $3738, %rbx
mov $0x6162636465666768, %rax
movq %rax, (%rcx)
nop
nop
nop
sub %rbp, %rbp
lea addresses_normal_ht+0x18170, %r13
nop
nop
nop
cmp %r15, %r15
movups (%r13), %xmm4
vpextrq $1, %xmm4, %r14
add %rax, %rax
lea addresses_UC_ht+0xc570, %rax
nop
nop
add %rbx, %rbx
mov (%rax), %ecx
xor %rbx, %rbx
lea addresses_WC_ht+0x1bf88, %rsi
lea addresses_WT_ht+0x1b70, %rdi
nop
sub $45721, %r14
mov $116, %rcx
rep movsl
sub %r15, %r15
lea addresses_WT_ht+0x1338, %rsi
lea addresses_WC_ht+0x1e890, %rdi
sub %r14, %r14
mov $74, %rcx
rep movsb
nop
nop
nop
nop
sub $56219, %r15
lea addresses_D_ht+0x3e30, %rsi
lea addresses_A_ht+0x12b0, %rdi
add %rax, %rax
mov $49, %rcx
rep movsl
nop
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_normal_ht+0x1ddbc, %r13
nop
xor $30849, %rdi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm3
and $0xffffffffffffffc0, %r13
vmovntdq %ymm3, (%r13)
nop
cmp %r14, %r14
lea addresses_A_ht+0xd390, %r13
nop
sub $30781, %rax
movw $0x6162, (%r13)
nop
nop
add %rbx, %rbx
lea addresses_normal_ht+0x3670, %rdi
nop
nop
nop
nop
inc %rsi
mov (%rdi), %r15d
and $40661, %rax
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
// REPMOV
mov $0xa70, %rsi
mov $0xcae, %rdi
nop
nop
cmp $56435, %rbp
mov $21, %rcx
rep movsw
nop
nop
nop
xor $4, %rbp
// Load
mov $0x3113c700000001b0, %rcx
nop
nop
nop
nop
nop
cmp $56834, %r13
vmovups (%rcx), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %rdi
// Exception!!!
nop
nop
nop
nop
mov (0), %rbp
nop
nop
nop
nop
nop
cmp $989, %r10
// Store
lea addresses_RW+0x990, %r13
nop
nop
nop
xor %rsi, %rsi
mov $0x5152535455565758, %rcx
movq %rcx, (%r13)
nop
nop
nop
nop
xor $3921, %rcx
// Store
lea addresses_WC+0x1b270, %rbp
nop
nop
nop
xor %rcx, %rcx
mov $0x5152535455565758, %r13
movq %r13, (%rbp)
nop
nop
nop
nop
nop
cmp %rsi, %rsi
// Store
lea addresses_RW+0x3770, %r10
nop
nop
dec %rdi
mov $0x5152535455565758, %rcx
movq %rcx, %xmm2
vmovntdq %ymm2, (%r10)
nop
and $51649, %rcx
// Store
lea addresses_RW+0x1af70, %rsi
xor %r13, %r13
mov $0x5152535455565758, %r9
movq %r9, %xmm2
vmovups %ymm2, (%rsi)
nop
nop
nop
nop
and %r9, %r9
// Faulty Load
lea addresses_RW+0x1af70, %r10
add $47732, %rdi
mov (%r10), %cx
lea oracles, %r13
and $0xff, %rcx
shlq $12, %rcx
mov (%r13,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': True, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_P', 'congruent': 4}, 'dst': {'same': False, 'type': 'addresses_P', 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': True, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_RW', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 3}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 4}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 6}, 'dst': {'same': True, 'type': 'addresses_A_ht', 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': True, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': True, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 8}}
{'58': 209}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
| 22.781893 | 626 | 0.648121 |
a58e253278cb4f84d09ee41703df2457b1967cb8 | 1,348 | asm | Assembly | programs/oeis/264/A264754.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/264/A264754.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/264/A264754.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A264754: Expansion of (1 + 2*x - 2*x^3 + x^4)/((1 - x)^3*(1 + x)^2).
; 1,3,5,7,11,13,19,21,29,31,41,43,55,57,71,73,89,91,109,111,131,133,155,157,181,183,209,211,239,241,271,273,305,307,341,343,379,381,419,421,461,463,505,507,551,553,599,601,649,651,701,703,755,757,811,813,869,871,929,931,991,993,1055,1057,1121,1123,1189,1191,1259,1261,1331,1333,1405,1407,1481,1483,1559,1561,1639,1641,1721,1723,1805,1807,1891,1893,1979,1981,2069,2071,2161,2163,2255,2257,2351,2353,2449,2451,2549,2551,2651,2653,2755,2757,2861,2863,2969,2971,3079,3081,3191,3193,3305,3307,3421,3423,3539,3541,3659,3661,3781,3783,3905,3907,4031,4033,4159,4161,4289,4291,4421,4423,4555,4557,4691,4693,4829,4831,4969,4971,5111,5113,5255,5257,5401,5403,5549,5551,5699,5701,5851,5853,6005,6007,6161,6163,6319,6321,6479,6481,6641,6643,6805,6807,6971,6973,7139,7141,7309,7311,7481,7483,7655,7657,7831,7833,8009,8011,8189,8191,8371,8373,8555,8557,8741,8743,8929,8931,9119,9121,9311,9313,9505,9507,9701,9703,9899,9901,10099,10101,10301,10303,10505,10507,10711,10713,10919,10921,11129,11131,11341,11343,11555,11557,11771,11773,11989,11991,12209,12211,12431,12433,12655,12657,12881,12883,13109,13111,13339,13341,13571,13573,13805,13807,14041,14043,14279,14281,14519,14521,14761,14763,15005,15007,15251,15253,15499,15501,15749,15751
mov $1,$0
div $0,2
bin $0,2
add $1,$0
mul $1,2
add $1,1
| 134.8 | 1,219 | 0.764095 |
acd0a796f2c7f3effc2fa1c3cbc31dc31c6251c7 | 523 | asm | Assembly | programs/oeis/066/A066141.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/066/A066141.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/066/A066141.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A066141: a(n) = n^(n-1) + n + 1.
; 3,5,13,69,631,7783,117657,2097161,43046731,1000000011,25937424613,743008370701,23298085122495,793714773254159,29192926025390641,1152921504606846993,48661191875666868499,2185911559738696531987,104127350297911241532861,5242880000000000000000021,278218429446951548637196423,15519448971100888972574851095,907846434775996175406740561353,55572324035428505185378394701849,3552713678800500929355621337890651,236773830007967588876795164938469403
mov $2,1
add $2,$0
pow $2,$0
add $0,$2
add $0,2
| 58.111111 | 438 | 0.860421 |
8ff1d5036be78df6805ba17d26f4030993813247 | 91 | asm | Assembly | libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sdcc/sin.asm | ahjelm/z88dk | c4de367f39a76b41f6390ceeab77737e148178fa | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sdcc/sin.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/math/float/am9511/lam32/c/sdcc/sin.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION code_fp_am9511
PUBLIC _sin
EXTERN cam32_sdcc_sin
defc _sin = cam32_sdcc_sin
| 11.375 | 27 | 0.802198 |
03a1217d82e7ed9216e97d9dd6ff6b1a07fbab9e | 21,537 | asm | Assembly | z80src/z80dis.asm | qoelet/z80pack | c8845396636e7316d449b4107c5c7ab98fffbc1a | [
"MIT"
] | 85 | 2018-02-26T02:45:55.000Z | 2022-03-27T00:04:54.000Z | z80src/z80dis.asm | lawrencewoodman/z80pack | d57e3b50cd796e3f562c569a8270b4586999b12a | [
"MIT"
] | 76 | 2018-03-02T12:38:11.000Z | 2022-01-28T11:46:02.000Z | z80src/z80dis.asm | lawrencewoodman/z80pack | d57e3b50cd796e3f562c569a8270b4586999b12a | [
"MIT"
] | 25 | 2018-02-24T15:50:23.000Z | 2022-03-07T11:23:10.000Z | TITLE 'Z80-Disassembler'
; Hardware-unabhaengiger, ROM-faehiger Z80-Disassembler
;
; Die Adresse, ab der disassembliert serden soll, ist in der
; 16-Bit Speicherzelle DADR abzulegen. Danach kann eines der
; Entrys DISSCR (Ausgabe eines Bildschirms) oder DISLIN
; (Ausgabe einer Zeile) aufgerufen werden. Da die Folgeadressen
; durch das Programm ebenfalls wieder in der Speicherzelle
; DADR abgelegt werden, ist mehrfacher Aufruf ohne Laden
; von neuen Adressen moeglich.
; Zur Ausgabe muss ein Unterprogramm mit dem Namen PRTSTR
; erstellt werden, dem in HL die Adresse eines Null-terminierten
; Strings uebergeben wird.
;
; 27-JUN-89 Udo Munk
LPP EQU 15 ; Anzahl Zeilen/Bildschirm Ausgabe
MNEPOS EQU 11H ; Offset des Mnemonics in Ausgabe-Workspace
; Disassembliere einen Bildschirm voll
DISSCR: LD B,LPP ; einen Bildschirm mit LPP Zeilen
$DLP1: PUSH BC ; disassemblieren
CALL DISLIN
POP BC
DJNZ $DLP1
RET
; Disassembliere eine Zeile
DISLIN: CALL CLWO ; Workspace fuer eine Zeile Ausgabe loeschen
LD HL,WRKS ; Adresse der Ausgabe-Workspace -> HL
LD DE,(DADR) ; Disassemblier-Adresse -> DE
CALL PRBY ; Adresse in DE ausgeben
INC HL ; Blank ausgeben
LD (PRTMP),HL ; vordere Printposition retten
LD C,0 ; Steuerflag loeschen
DEC DE ; laufende Adr.-1 -> DE
$DL13: CALL PRNB ; laufendes Byte ausgeben
LD A,(DE) ; laufendes Byte -> A
LD B,A ; und in B retten
CP 0EDH ; Preafix ED ?
JR NZ,$DL14
SET 4,C ; ja, ED-Flag setzen
JR $DL13 ; und naechstes Byte bearbeiten
$DL14: CP 0FDH ; Preafix FD ?
JR NZ,$DL15
SET 6,C ; ja, FD-Flag setzen
JR $DL16 ; und Index-Flag setzen
$DL15: CP 0DDH ; Preafix DD ?
JR NZ,$DL17
$DL16: SET 5,C ; Index-Flag fuer IX/IY-Adressierung setzen
LD HL,(PRTMP) ; vordere Printposition -> HL
JR $DL13 ; naechstes Byte bearbeiten
$DL17: LD HL,WRKS+MNEPOS ; HL auf Operator Position setzen
; nach Praefix CB
CB: LD A,B ; Befehlsbyte aus B holen
CP 0CBH ; Preafix CB ?
JP NZ,OHNE
INC DE ; ja, Pointer auf naechstes Byte setzen
BIT 5,C ; IX/IY-Flag ?
JR Z,$DL18
INC DE ; ja, Pointer auf naechstes Byte setzen
$DL18: LD A,(DE) ; naechstes Byte -> A
LD B,A ; und in B retten
PUSH DE ; Disassemblieradr. retten
LD D,MNETAB > 8 ; High-Byte Operatorentabelle -> D
LD E,0E8H ; DE = Pointer auf "SET"
CP 0C0H ; SET ?
JR NC,$DL19
LD E,0E4H ; nein, DE = Pointer auf "RES"
CP 80H ; RES ?
JR NC,$DL19
LD E,0E0H ; nein, DE = Pointer auf "BIT"
CP 40H ; BIT ?
JR NC,$DL19
AND 38H ; loesche Bits 0..2 und 6..7
RRCA ; Division durch 2
ADD A,CBMTAB & 0FFH ; zur Basis der CB-Mnemonics addieren
LD E,A
LD D,CBMTAB > 8 ; DE = Pointer auf CB-Mnemonic
$DL19: CALL TRBY ; Mnemonic ausgeben
POP DE ; akt. Disassemblieradr. wieder -> DE
LD A,B ; Byte wieder -> A
BIT 5,C ; IX/IY-Flag ?
JR Z,$DL20
DEC DE ; eins zurueck bei IX/IY-Adressierung
$DL20: DEC DE ; Pointer wieder auf CB-Preafix
CP 40H ; CB-Befehl < 40H ?
JR C,$DL21
AND 38H ; nein, Bits 0..2 und 6..7 loeschen
RRCA ; Division durch 8 -> 1. Operanden
RRCA
RRCA
CALL PRO1 ; 1. Operanden ausgeben
LD A,B ; Byte wieder -> A
SET 7,C ; Komma-Flag setzen
$DL21: AND 7 ; Bits 3..7 loeschen -> 2. Operanden
SET 4,A ; Buchstaben-Flag setzen
CALL PRO1 ; 2. Operanden ausgeben
CALL PRNB ; Befehlsbyte vorne ausgeben
JP INAD ; fertig, Adresse merken und Workspace ausgeben
; ohne Preafix CB/ED
OHNE: PUSH DE ; Disassemblieradr. retten
BIT 4,C ; ED-Flag ?
JP NZ,ED
CP 40H ; nein, < 40H ?
JR C,$DL25
CP 80H ; nein, > 80H ?
JR NC,$DL23
LD E,50H ; nein, DE = Pointer auf "LD"
CP 76H ; HALT ?
JR NZ,$DL22
LD E,5CH ; nein, DE = Pointer auf "HALT"
$DL22: JR $DL26 ; Mnemonic ausgeben
$DL23: CP 0C0H ; > C0H ?
JR NC,$DL24
AND 38H ; ja, Bits 0..2 und 6..7 loeschen
RRCA ; Division durch 2 -> Operator
LD E,A ; Operator -> E
JR $DL26 ; Mnemonic ausgeben
$DL24: SUB 80H ; wenn > C0H, -80 -> Tabellenoperator
$DL25: LD E,A ; Operator -> E
LD D,CODTAB > 8 ; High-Byte Operatortabelle -> D
LD A,(DE) ; LSB Mnemonic-Adresse -> A
LD E,A ; und nach E
$DL26: LD D,MNETAB > 8 ; MSB Mnemonic-Adresse -> D
CALL TRBY ; Mnemonic ausgeben
POP DE ; akt. Disassemblieradr. wieder -> DE
LD A,B ; Befehlsbyte wieder -> A
PUSH DE ; Disassemblieradr. retten
CP 40H ; Byte < 40 ?
JR C,$DL30
CP 80H ; nein, > 80 ?
JR NC,$DL28
CP 76H ; nein, HALT ?
JR NZ,$DL27
LD A,0FFH ; ja, leeren Operanden -> A
JR $DL31 ; Operanden ausgeben
$DL27: AND 38H ; loesche Bits 0..2 und 6..7
RRCA ; Division durch 8 -> 1. Operanden
RRCA
RRCA
SET 4,A ; Buchstabenflag setzen
JR $DL31 ; Operanden ausgeben
$DL28: CP 0C0H ; > C0 ?
JR NC,$DL29
CP 90H ; > 90 ?
JR C,$DL51
AND 0F8H ; ja, Register-Bits loeschen
CP 98H ; "SBC" ?
JR Z,$DL51
LD A,B ; Byte wieder -> A
AND 7 ; nur Register Bits uebrig lassen
SET 4,A ; Buchstaben-Flag setzen
JR $DL52
$DL51: LD A,17H ; ja, 17 = Register A ausgeben
JR $DL31 ; Operanden ausgeben
$DL29: SUB 80H ; wenn > C0, -80 -> Operandentabelle
$DL30: LD E,A ; LSB Operandentabelle -> E
LD D,OPETAB > 8 ; MSB Operandentabelle -> D
LD A,(DE) ; 1. Operanden -> A
$DL31: POP DE ; akt. Disassemblieradr. wieder -> DE
CALL PRO1 ; 1. Operanden ausgeben
LD A,B ; Befehlsbyte wieder -> A
PUSH DE ; akt. Disassemblieradr. retten
CP 40H ; < 40 ?
JR C,$DL34
CP 0C0H ; nein, < C0 ?
JR NC,$DL33
CP 76H ; ja, HALT ?
JR NZ,$DL32
LD A,0FFH ; ja, wieder leeren Operanden -> A
JR $DL35 ; Operanden ausgeben
$DL32: AND 7 ; loesche Bits 3..7, -> 2. Operanden
SET 4,A ; Buchstabenflag setzen
JR $DL35 ; Operanden ausgeben
$DL33: SUB 80H ; wenn > C0 : 80 abziehen
$DL34: ADD A,80H ; LSB Operandentabelle -> A
LD E,A ; und -> E
LD D,OPETAB > 8 ; MSB Operandentabelle -> D
LD A,(DE) ; 2. Operanden -> A
$DL35: POP DE ; akt. Disassemblieradr. wieder -> DE
SET 7,C ; Komma-Flag setzen
CALL PRO1 ; 2. Operanden ausgeben
JP INAD ; fertig, Adresse merken und Workspace ausgeben
; nach Preafix ED
ED: SUB 40H ; 40 vom 2. Byte subtrahieren
JP C,ERRO ; Fehler wenn carry
CP 60H ; 2. Byte < A0 ?
JR NC,$DL36
CP 40H ; ja, >= 60 ?
JP NC,ERRO ; ja, Fehler
JR $DL37 ; nein, weiter
$DL36: SUB 20H ; aus 60..7F wird 00..20
$DL37: ADD A,80H ; LSB Operatortabelle -> A
LD E,A ; und -> E
LD D,CODTAB > 8 ; MSB Operatortabelle -> D
LD A,(DE) ; LSB Mnemonic-Adresse -> A
CP 0FFH ; leer ?
JP Z,ERRO ; ja, Fehler
LD E,A ; nein, -> E
LD D,MNETAB > 8 ; MSB Mnemonic-Adresse -> D
CALL TRBY ; Mnemonic ausgeben
POP DE ; Disassemblieradr. wieder -> DE
LD A,B ; Befehlsbyte wieder -> A
CP 80H ; < 80 ?
JP NC,INAD ; nein, Workspace ausgeben und fertig
PUSH DE ; Disassemblieradr. retten
SUB 40H ; LSB 1. Operanden in A
LD E,A ; und -> E
LD D,OP2TAB > 8 ; MSB 2. Operanden -> D
LD A,(DE) ; 1. Operanden -> A
POP DE ; akt. Disassemblieradr. wieder -> DE
CALL PRO1 ; 1. Operanden ausgeben
LD A,B ; Befehlsbyte wieder -> A
CP 80H ; < 80 ?
JP NC,INAD ; ja, Workspace ausgeben und fertig
PUSH DE ; akt. Disassemblieradr. retten
LD E,A ; LSB Operandentabelle -> E
LD D,OP2TAB > 8 ; MSB Operandentabelle -> D
LD A,(DE) ; 2. Operanden -> A
SET 7,C ; Buchstabenflag setzen
$DL52: POP DE ; akt. Disassemblieradr. retten
CALL PRO1 ; 2. Operanden ausgeben
JP INAD ; fertig, Adresse merken und Workspace ausgeben
; Operand 1 ausgeben
PRO1: CP 0FFH ; leere Operand ?
RET Z ; ja, fertig
CP 17H ; nein, Register "A" ausgeben ?
JR NZ,$DL01
LD A,18H ; ja, umkodieren
$DL01: CP 16H ; Register "(HL)" ausgeben ?
JR NZ,$DL02
LD A,0B4H ; ja, umkodieren
$DL02: BIT 7,C ; 2. Operand ?
JR Z,$DL03
LD (HL),',' ; ja, "," ausgeben
INC HL ; naechste Printposition -> HL
$DL03: BIT 7,A ; "(...)" ?
JR Z,$DL04
LD (HL),'(' ; ja, "(" ausgeben
INC HL ; naechste Printposition -> HL
$DL04: BIT 4,A ; Buchstabe ?
JR NZ,PRBU ; ja, Buchstaben ausgeben
BIT 6,A ; nein, Bitnummer/RST-Adresse ?
JR NZ,DIST ; ja, Distanz ausgeben
BIT 5,A ; nein, Bitnummer ?
JR NZ,PRO2 ; ja, RST ausgeben
AND 7 ; nein, Bits 3..7 loeschen
CALL PRCH ; Hexbyte ausgeben
RET
; RST ausgeben
PRO2: PUSH AF ; A retten
AND 6 ; loesche Bits 0 und 4..7
RRCA ; Division durch 2
CALL PRCH ; oberes Nibble ausgeben
POP AF ; A wieder herstellen
BIT 0,A ; RST x8 ?
LD A,'0' ; nein, "0" -> A
JR Z,$DL05
LD A,'8' ; ja, "8" -> A
$DL05: LD (HL),A ; "0" oder "8" ausgeben
INC HL ; naechste Printposition -> HL
RET
; Distanz ausgeben
DIST: BIT 0,A ; relative Distanz ?
JR Z,PR_N ; nein, N ausgeben
CALL PRNB ; Byte vorne ausgeben
PUSH DE ; akt. Disassemblieradr. retten
LD A,(DE) ; Distanzbyte -> A
INC DE ; Disassemblieradr. erhoehen
RLCA ; Bit 7 Distanzbyte -> carry
RRCA
JR NC,$DL06 ; Vorwaertsprung
SET 0,C ; Flag fuer Rueckwaertssprung setzen
$DL06: ADD A,E ; Distanz zu PC addieren
LD E,A
BIT 0,C ; Flag testen
JR NC,$DL07 ; kein Ueberlauf
JR NZ,$DL08 ; Rueckwaertssprung
INC D ; MSB PC erhoehen
JR $DL08 ; Zieladresse ausgeben
$DL07: JR Z,$DL08 ; bei Vorwaertssprung Zieladresse ausgeben
DEC D ; sonst MSB PC erniedrigen
$DL08: CALL PRBY ; Zieladresse in DE ausgeben
POP DE ; akt. Disassemblieradresse wieder -> DE
RET
; N ausgeben
PR_N: PUSH AF ; A retten
BIT 1,A ; N ?
JR Z,PRNN ; nein, NN ausgeben
CALL PRVH ; ja, Byte vorne und hinten ausgeben
JR $DL12 ; ")" bearbeiten
; NN ausgeben
PRNN: CALL PRNB ; Byte vorne ausgeben
CALL PRVH ; Byte vorne und hinten ausgeben
DEC DE ; DE -> LSB von NN
CALL PRBH ; Byte hinten ausgeben
INC DE ; akt. Disassemblieradr. wieder -> DE
JR $DL12 ; ")" bearbeiten
; Buchstaben ausgeben
PRBU: PUSH AF ; A retten
PUSH BC ; Flags in C retten
PUSH DE ; akt. Disassemblieradr. retten
LD B,1 ; Anzahl = 1
LD DE,REGTAB ; DE zeigt auf die Register-Namen
BIT 5,A ; 2 Buchstaben ?
JR Z,$DL09
INC B ; ja, Anzahl erhoehen
$DL09: BIT 6,A ; Sprungbedingung ?
JR Z,$DL10
LD DE,SPRTAB ; ja, DE zeigt auf Condition-Namen
$DL10: RES 7,A ; Klammer-Bit loeschen
CP 34H ; "(HL)" ?
JR NZ,$DL11
BIT 5,C ; ja, Indexregister ?
JR Z,$DL11
LD A,0AH ; ja, A -> IX-Register
BIT 6,C ; IY-Register ?
JR Z,$DL11
LD A,0CH ; ja, A -> IY-Register
$DL11: AND 0FH ; loesche oberes Nibble
ADD A,E ; und addiere zur Basis in DE
LD E,A
$DL50: LD A,(DE) ; Zeichen -> A
LD (HL),A ; Zeichen ausgeben
INC DE ; Tabellen-Adresse erhoehen
INC HL ; naechste Printposition
DJNZ $DL50 ; naechstes Zeichen
POP DE ; Register wieder herstellen
POP BC
POP AF
PUSH AF ; A retten
CP 0B4H ; "(HL)" ?
JR NZ,$DL12
BIT 5,C ; nein, Indexregister ?
JR Z,$DL12
LD A,(DE) ; ja, Befehlsbyte nach DD/FD -> A
CP 0E9H ; "JP (IX/IY)" ?
JR Z,$DL12
LD (HL),'+' ; nein, "+" ausgeben
INC HL ; naechste Printposition
CALL PRVH ; Offset ausgeben
$DL12: POP AF ; A wieder herstellen
BIT 7,A ; "()" ?
RET Z ; nein, fertig
LD (HL),')' ; ja, ")" ausgeben
INC HL ; naechste Printposition
RET
; Error
ERRO: LD DE,CBMTAB+24 ; Pointer auf "????" -> DE
CALL TRBY ; als Mnemonic ausgeben
POP DE ; akt. Disassemblieradr. vom Stack holen
; Disassemblier-Adresse erhoehen und merken
INAD: INC DE
LD (DADR),DE
; Workspace ausgeben
PRWO: PUSH AF ; Register retten
PUSH BC
PUSH DE
PUSH HL
LD HL,WRKS ; Adresse Workspace -> HL
CALL PRTSTR ; Workspace aufs Terminal ausgeben
LD HL,NL ; Adresse Newline-String -> HL
CALL PRTSTR ; Newline ausgeben
POP HL ; Register wieder herstellen
POP DE
POP BC
POP AF
RET
; Workspace loeschen
CLWO: LD HL,WRKS ; Workspace mit Space fuellen
LD DE,WRKS+1 ; und mit Null terminieren
LD (HL),32
LD BC,32
LDIR
XOR A
LD (DE),A
RET
; 4 Bytes transferieren
TRBY: PUSH BC ; BC retten
LD BC,4 ; 4 Bytes
EX DE,HL ; DE=Printposition, HL=Mnemonic
LDIR ; Bytes transferieren
EX DE,HL ; HL ist wieder Printposition
POP BC ; BC wieder herstellen
INC HL ; Leerzeichen
RET
; Byte vorne und hinten ausgeben
PRVH: CALL PRNB ; Byte vorne ausgeben
; Byte hinten ausgeben
PRBH: PUSH AF ; A retten
LD A,(DE) ; Byte -> A
CALL PRAK ; A ausgeben
POP AF ; A wieder herstellen
RET
; Byte vorne ausgeben
PRNB: PUSH AF ; A retten
INC DE ; DE auf naechstes Byte setzen
PUSH HL ; akt. Printposition retten
LD HL,(PRTMP) ; vordere Printposition -> HL
LD A,(DE) ; Byte -> A
CALL PRAK ; A ausgeben
INC HL ; Leerzeichen
LD (PRTMP),HL ; vordere Printposition retten
POP HL ; akt. Printposition wieder -> HL
POP AF ; A wieder herstellen
RET
; DE ausgeben
PRBY: LD A,D ; MSB -> A
CALL PRAK ; A ausgeben
LD A,E ; LSB -> A
; A ausgeben
PRAK: PUSH AF ; A retten
RRCA ; oberes Nibble ins untere schieben
RRCA
RRCA
RRCA
CALL PRCH ; oberes Nibble ausgeben
POP AF ; A wieder herstellen
CALL PRCH ; unteres Nibble ausgeben
RET
; unteres Nibble in ASCII-Hex umwandeln und in Workspace schreiben
PRCH: AND 0FH
ADD A,90H
DAA
ADC A,40H
DAA
LD (HL),A ; ASCII-Ziffer in Workspace schreiben
INC HL ; Printposition erhoehen
RET
; Die hier folgenden Tabellen muessen am Anfang einer Page
; beginnen, und die Reihenfolge der Tabellen darf auf keinen
; Fall geaendert werden, weil das LSB der Tabellenadressen
; durch arithmetische Operationen mit den Op-Codes berechnet
; wird !!!
DEFS 256 - ($ & 0FFH)
MNETAB: ; Tabelle mit den Z80-Mnemonics
DEFM 'ADD ADC '
DEFM 'SUB SBC '
DEFM 'AND XOR '
DEFM 'OR CP '
DEFM 'JR NOP '
DEFM 'DJNZEX '
DEFM 'RLCARLA '
DEFM 'DAA SCF '
DEFM 'RRCARRA '
DEFM 'CPL CCF '
DEFM 'LD INC '
DEFM 'DEC HALT'
DEFM 'RET POP '
DEFM 'JP OUT '
DEFM 'EX DI '
DEFM 'CALLPUSH'
DEFM 'RST EXX '
DEFM 'IN EX '
DEFM 'EI LDI '
DEFM 'LDIRINI '
DEFM 'INIROUTI'
DEFM 'OTIRNEG '
DEFM 'RETNRRD '
DEFM 'LDD LDDR'
DEFM 'CPD CPDR'
DEFM 'IND INDR'
DEFM 'OTDROUTD'
DEFM 'RETIRLD '
DEFM 'BIT RES '
DEFM 'SET ????'
DEFM 'CPI CPIR'
DEFM 'IM ----'
CODTAB: ; LSB-Adressen der Mnemonics in MNETAB fuer
; Befehle 00..3F ohne Preafix ED/CB
DEFB 024H,050H,050H,054H,054H,058H,050H,030H ; NOP LD LD INC INC DEC LD RLCA
DEFB 070H,000H,050H,058H,054H,058H,050H,040H ; EX ADD LD DEC INC DEC LD RRCA
DEFB 028H,050H,050H,054H,054H,058H,050H,034H ; DJNZ LD LD INC INC DEC LD RLA
DEFB 020H,000H,050H,058H,054H,058H,050H,044H ; JR ADD LD DEC INC DEC LD RRA
DEFB 020H,050H,050H,054H,054H,058H,050H,038H ; JR LD LD INC INC DEC LD DAA
DEFB 020H,000H,050H,058H,054H,058H,050H,048H ; JR ADD LD DEC INC DEC LD CPL
DEFB 020H,050H,050H,054H,054H,058H,050H,03CH ; JR LD LD INC INC DEC LD SCF
DEFB 020H,000H,050H,058H,054H,058H,050H,04CH ; JR ADD LD DEC INC DEC LD CCF
; LSB-Adressen der Mnemonics in MNETAB fuer
; Befehle C0..FF ohne Preafix ED/CB
DEFB 060H,064H,068H,068H,078H,07CH,000H,080H ; RET POP JP JP CALL PUSH ADD RET
DEFB 060H,060H,068H,0F1H,078H,078H,004H,080H ; RET RET JP (CB) CALL CALL ADC RST
DEFB 060H,064H,068H,06CH,078H,07CH,008H,080H ; RET POP JP OUT CALL PUSH SUB RST
DEFB 060H,084H,068H,088H,078H,0F0H,00CH,080H ; RET EXX JP IN CALL (DD) SBC RST
DEFB 060H,064H,068H,070H,078H,07CH,010H,080H ; RET POP JP EX CALL PUSH AND RST
DEFB 060H,068H,068H,02CH,078H,0F2H,014H,080H ; RET JP JP EX CALL (ED) XOR RST
DEFB 060H,064H,068H,074H,078H,07CH,018H,080H ; RET POP JP DI CALL PUSH OR RST
DEFB 060H,050H,068H,090H,078H,0F8H,01CH,080H ; RET LD JP EI CALL (FD) CP RST
; LSB-Adressen der Mnemonics in MNETAB fuer
; Befehle 40..7F mit Preafix ED
DEFB 088H,06CH,00CH,050H,0ACH,0B0H,0F8H,050H ; IN OUT SBC LD NEG RETN IM LD
DEFB 088H,06CH,004H,050H,0FFH,0D8H,0FFH,050H ; IN OUT ADC LD RETI LD
DEFB 088H,06CH,00CH,050H,0FFH,0FFH,0F8H,050H ; IN OUT SBC LD IM LD
DEFB 088H,06CH,004H,050H,0FFH,0FFH,0F8H,050H ; IN OUT ADC LD IM LD
DEFB 088H,06CH,00CH,0FFH,0FFH,0FFH,0FFH,0B4H ; IN OUT SBC RRD
DEFB 088H,06CH,004H,0FFH,0FFH,0FFH,0FFH,0DCH ; IN OUT ADC RLD
DEFB 0FFH,0FFH,00CH,050H,0FFH,0FFH,0FFH,0FFH ; SBC LD
DEFB 088H,06CH,004H,050H,0FFH,0FFH,0FFH,0FFH ; IN OUT ADC LD
; LSB-Adressen der Mnemonics in MNETAB fuer
; Befehle A0..BF mit Praefix ED
DEFB 094H,0F0H,09CH,0A4H,0FFH,0FFH,0FFH,0FFH ; LDI CPI INI OUTI
DEFB 0B8H,0C0H,0C8H,0D4H,0FFH,0FFH,0FFH,0FFH ; LDD CPD IND OUTD
DEFB 098H,0F4H,0A0H,0A8H,0FFH,0FFH,0FFH,0FFH ; LDIR CPIR INIR OTIR
DEFB 0BCH,0C4H,0CCH,0D0H,0FFH,0FFH,0FFH,0FFH ; LDDR CPDR INDR OTDR
SPRTAB: ; Tabelle der Sprungbedingungen
DEFM 'NZNCPOPEPM'
DEFB 0FFH,0FFH,0FFH,0FFH,0FFH,0FFH
REGTAB: ; Tabelle der Register
DEFM 'BCDEHLSPAFIXIYIR'
OPETAB: ; Tabelle der Operanden:
; Bit 7: Zahl/Buchstabe
; Bit 6: einfach/doppelt
; Bit 5: Register/Sprungbedingung
; Bit 4: ohne/mit Klammer
; Bit 0..3: Offset in der Tabelle der Registernamen
; Befehle 00..3F ohne Preafix ED/CB
; 1. Operand
DEFB 0FFH,030H,0B0H,030H,010H,010H,010H,0FFH ; - BC (BC) BC B B B -
DEFB 038H,034H,017H,030H,011H,011H,011H,0FFH ; AF HL A BC C C C -
DEFB 041H,032H,0B2H,032H,012H,012H,012H,0FFH ; DIS DE (DE) DE D D D -
DEFB 041H,034H,017H,032H,013H,013H,013H,0FFH ; DIS HL A DE E E E -
DEFB 070H,034H,0C4H,034H,014H,014H,014H,0FFH ; NZ HL (NN) HL H H H -
DEFB 051H,034H,034H,034H,015H,015H,015H,0FFH ; Z HL HL HL L L L -
DEFB 072H,036H,0C4H,036H,016H,016H,016H,0FFH ; NC SP (NN) SP (HL) (HL) (HL) -
DEFB 011H,034H,017H,036H,017H,017H,017H,0FFH ; C HL A SP A A A -
; Befehle C0..FF ohne Preafix ED/CB
; 1. Operand
DEFB 070H,030H,070H,044H,070H,030H,017H,020H ; NZ BC NZ NN NZ BC A 00
DEFB 051H,0FFH,051H,0F1H,051H,044H,017H,021H ; Z - Z *CB Z NN A 08
DEFB 072H,032H,072H,0C2H,072H,032H,042H,022H ; NC DE NC (N) NC DE N 10
DEFB 053H,0FFH,053H,017H,053H,0F2H,017H,023H ; C - C A C *DD A 18
DEFB 074H,034H,074H,0B6H,074H,034H,042H,024H ; PO HL PO (SP) PO HL N 20
DEFB 076H,016H,076H,032H,076H,0F4H,042H,025H ; PE (HL) PE DE PE *ED N 28
DEFB 058H,038H,058H,0FFH,058H,038H,042H,026H ; P AF P - P AF N 30
DEFB 059H,036H,059H,0FFH,059H,0F8H,042H,027H ; M SP M - M *FD N 38
; Befehle 00..3F ohne Preafix ED/CB
; 2. Operand
DEFB 0FFH,044H,017H,0FFH,0FFH,0FFH,042H,0FFH ; - NN A - - - N -
DEFB 038H,030H,0B0H,0FFH,0FFH,0FFH,042H,0FFH ; AF BC (BC) - - - N -
DEFB 0FFH,044H,017H,0FFH,0FFH,0FFH,042H,0FFH ; - NN A - - - N -
DEFB 0FFH,032H,0B2H,0FFH,0FFH,0FFH,042H,0FFH ; - DE (DE) - - - N -
DEFB 041H,044H,034H,0FFH,0FFH,0FFH,042H,0FFH ; DIS NN HL - - - N -
DEFB 041H,034H,0C4H,0FFH,0FFH,0FFH,042H,0FFH ; DIS HL (NN) - - - N -
DEFB 041H,044H,017H,0FFH,0FFH,0FFH,042H,0FFH ; DIS NN A - - - N -
DEFB 041H,036H,0C4H,0FFH,0FFH,0FFH,042H,0FFH ; DIS SP (NN) - - - N -
; Befehle C0..FF ohne Praefix ED/CB
; 2. Operand
DEFB 0FFH,0FFH,044H,0FFH,044H,0FFH,042H,0FFH ; - - NN - NN - N -
DEFB 0FFH,0FFH,044H,0FFH,044H,0FFH,042H,0FFH ; - - NN *CB NN - N -
DEFB 0FFH,0FFH,044H,017H,044H,0FFH,0FFH,0FFH ; - - NN A NN - - -
DEFB 0FFH,0FFH,044H,0C2H,044H,0FFH,042H,0FFH ; - - NN (N) NN *DD N -
DEFB 0FFH,0FFH,044H,034H,044H,0FFH,0FFH,0FFH ; - - NN HL NN - - -
DEFB 0FFH,0FFH,044H,034H,044H,0FFH,0FFH,0FFH ; - - NN HL NN *ED - -
DEFB 0FFH,0FFH,044H,0FFH,044H,0FFH,0FFH,0FFH ; - - NN - NN - - -
DEFB 0FFH,034H,044H,0FFH,044H,0FFH,0FFH,0FFH ; - HL NN - NN *FD - -
OP2TAB: ; Befehle 40..7F mit Praefix ED
; 1. Operand
DEFB 010H,091H,034H,0C4H,0FFH,0FFH,000H,01EH ; B (C) HL (NN) - - 0 I
DEFB 011H,091H,034H,030H,0FFH,0FFH,0FFH,01FH ; C (C) HL BC - - - R
DEFB 012H,091H,034H,0C4H,0FFH,0FFH,001H,017H ; D (C) HL (NN) - - 1 A
DEFB 013H,091H,034H,032H,0FFH,0FFH,002H,017H ; E (C) HL DE - - 2 A
DEFB 014H,091H,034H,0C4H,0FFH,0FFH,076H,0FFH ; H (C) HL - - - - -
DEFB 015H,091H,034H,0FFH,0FFH,0FFH,0FFH,0FFH ; L (C) HL - - - - -
DEFB 0FFH,0FFH,034H,0C4H,0FFH,0FFH,0FFH,0FFH ; - - HL (NN) - - - -
DEFB 017H,091H,034H,036H,0FFH,0FFH,0FFH,0FFH ; A (C) HL SP - - - -
; Befehle 40..7F mit Preafix ED
; 2. Operand
DEFB 091H,010H,030H,030H,0FFH,0FFH,0FFH,017H ; (C) B BC BC - - - A
DEFB 091H,011H,030H,0C4H,0FFH,0FFH,0FFH,017H ; (C) C BC (NN) - - - A
DEFB 091H,012H,032H,032H,0FFH,0FFH,0FFH,01EH ; (C) D DE DE - - - I
DEFB 091H,013H,032H,0C4H,0FFH,0FFH,0FFH,01FH ; (C) E DE (NN) - - - R
DEFB 091H,014H,034H,034H,0FFH,0FFH,0FFH,0FFH ; (C) H HL - - - - -
DEFB 091H,015H,034H,0FFH,0FFH,0FFH,0FFH,0FFH ; (C) L HL - - - - -
DEFB 0FFH,0FFH,036H,036H,0FFH,0FFH,0FFH,0FFH ; - - SP SP - - - -
DEFB 091H,017H,036H,0C4H,0FFH,0FFH,0FFH,0FFH ; (C) A SP (NN) - - - -
CBMTAB: ; Tabelle der Mnemonics mit Praefix CB
DEFM 'RLC RRC '
DEFM 'RL RR '
DEFM 'SLA SRA '
DEFM '????SRL '
NL: ; Null-terminiertes Newline fuers Terminal
DEFB 10,13,0
WRKS: DEFS 34 ; Workspace zur Aufbereitung einer Ausgabezeile
PRTMP: DEFS 2 ; temoraerer Speicher fuer Printposition
DADR: DEFS 2 ; Disassemblier-Adresse
| 33.704225 | 87 | 0.637136 |
756333765d4d093f853e04e7b067d21d98ba0c5f | 595 | asm | Assembly | oeis/134/A134003.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | oeis/134/A134003.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | oeis/134/A134003.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | ; A134003: Positive integers n for which n^2+(n+5)^2 is prime.
; Submitted by Jamie Morken(w3)
; 1,2,3,4,6,7,8,9,12,14,17,18,19,21,22,26,27,28,29,32,34,39,41,43,44,48,51,52,53,54,56,58,59,66,72,74,77,78,79,82,83,87,91,93,94,96,97,103,104,106,107,109,113,116,117,119,121,122,123,126,134,136,137,144,151,157
mov $1,9
mov $2,332202
mov $5,16
lpb $2
mov $3,$6
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,4
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,18
sub $5,5
add $5,$1
mov $6,$5
lpe
mov $0,$1
sub $0,17
div $0,4
add $0,1
| 22.884615 | 210 | 0.623529 |
9023d8de915199e4e858f60cc859faba20b9a8cc | 4,435 | asm | Assembly | third_party/boringssl/win-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.asm | zipated/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | third_party/boringssl/win-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.asm | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | third_party/boringssl/win-x86_64/crypto/fipsmodule/p256_beeu-x86_64-asm.asm | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | default rel
%define XMMWORD
%define YMMWORD
%define ZMMWORD
%ifdef BORINGSSL_PREFIX
%include "boringssl_prefix_symbols_nasm.inc"
%endif
section .text code align=64
global beeu_mod_inverse_vartime
ALIGN 32
beeu_mod_inverse_vartime:
mov QWORD[8+rsp],rdi ;WIN64 prologue
mov QWORD[16+rsp],rsi
mov rax,rsp
$L$SEH_begin_beeu_mod_inverse_vartime:
mov rdi,rcx
mov rsi,rdx
mov rdx,r8
mov rcx,r9
mov r8,QWORD[40+rsp]
mov r9,QWORD[48+rsp]
push rbp
mov rbp,rsp
push r12
push r13
push r14
push r15
push rbx
push rsi
sub rsp,80
mov QWORD[rsp],rdi
mov r8,1
xor r9,r9
xor r10,r10
xor r11,r11
xor rdi,rdi
xor r12,r12
xor r13,r13
xor r14,r14
xor r15,r15
xor rbp,rbp
vmovdqu xmm0,XMMWORD[rsi]
vmovdqu xmm1,XMMWORD[16+rsi]
vmovdqu XMMWORD[48+rsp],xmm0
vmovdqu XMMWORD[64+rsp],xmm1
vmovdqu xmm0,XMMWORD[rdx]
vmovdqu xmm1,XMMWORD[16+rdx]
vmovdqu XMMWORD[16+rsp],xmm0
vmovdqu XMMWORD[32+rsp],xmm1
$L$beeu_loop:
xor rbx,rbx
or rbx,QWORD[48+rsp]
or rbx,QWORD[56+rsp]
or rbx,QWORD[64+rsp]
or rbx,QWORD[72+rsp]
jz NEAR $L$beeu_loop_end
mov rcx,1
$L$beeu_shift_loop_XB:
mov rbx,rcx
and rbx,QWORD[48+rsp]
jnz NEAR $L$beeu_shift_loop_end_XB
mov rbx,1
and rbx,r8
jz NEAR $L$shift1_0
add r8,QWORD[rdx]
adc r9,QWORD[8+rdx]
adc r10,QWORD[16+rdx]
adc r11,QWORD[24+rdx]
adc rdi,0
$L$shift1_0:
shrd r8,r9,1
shrd r9,r10,1
shrd r10,r11,1
shrd r11,rdi,1
shr rdi,1
shl rcx,1
cmp rcx,0x8000000
jne NEAR $L$beeu_shift_loop_XB
$L$beeu_shift_loop_end_XB:
bsf rcx,rcx
test rcx,rcx
jz NEAR $L$beeu_no_shift_XB
mov rax,QWORD[((8+48))+rsp]
mov rbx,QWORD[((16+48))+rsp]
mov rsi,QWORD[((24+48))+rsp]
shrd QWORD[((0+48))+rsp],rax,cl
shrd QWORD[((8+48))+rsp],rbx,cl
shrd QWORD[((16+48))+rsp],rsi,cl
shr rsi,cl
mov QWORD[((24+48))+rsp],rsi
$L$beeu_no_shift_XB:
mov rcx,1
$L$beeu_shift_loop_YA:
mov rbx,rcx
and rbx,QWORD[16+rsp]
jnz NEAR $L$beeu_shift_loop_end_YA
mov rbx,1
and rbx,r12
jz NEAR $L$shift1_1
add r12,QWORD[rdx]
adc r13,QWORD[8+rdx]
adc r14,QWORD[16+rdx]
adc r15,QWORD[24+rdx]
adc rbp,0
$L$shift1_1:
shrd r12,r13,1
shrd r13,r14,1
shrd r14,r15,1
shrd r15,rbp,1
shr rbp,1
shl rcx,1
cmp rcx,0x8000000
jne NEAR $L$beeu_shift_loop_YA
$L$beeu_shift_loop_end_YA:
bsf rcx,rcx
test rcx,rcx
jz NEAR $L$beeu_no_shift_YA
mov rax,QWORD[((8+16))+rsp]
mov rbx,QWORD[((16+16))+rsp]
mov rsi,QWORD[((24+16))+rsp]
shrd QWORD[((0+16))+rsp],rax,cl
shrd QWORD[((8+16))+rsp],rbx,cl
shrd QWORD[((16+16))+rsp],rsi,cl
shr rsi,cl
mov QWORD[((24+16))+rsp],rsi
$L$beeu_no_shift_YA:
mov rax,QWORD[48+rsp]
mov rbx,QWORD[56+rsp]
mov rsi,QWORD[64+rsp]
mov rcx,QWORD[72+rsp]
sub rax,QWORD[16+rsp]
sbb rbx,QWORD[24+rsp]
sbb rsi,QWORD[32+rsp]
sbb rcx,QWORD[40+rsp]
jnc NEAR $L$beeu_B_bigger_than_A
mov rax,QWORD[16+rsp]
mov rbx,QWORD[24+rsp]
mov rsi,QWORD[32+rsp]
mov rcx,QWORD[40+rsp]
sub rax,QWORD[48+rsp]
sbb rbx,QWORD[56+rsp]
sbb rsi,QWORD[64+rsp]
sbb rcx,QWORD[72+rsp]
mov QWORD[16+rsp],rax
mov QWORD[24+rsp],rbx
mov QWORD[32+rsp],rsi
mov QWORD[40+rsp],rcx
add r12,r8
adc r13,r9
adc r14,r10
adc r15,r11
adc rbp,rdi
jmp NEAR $L$beeu_loop
$L$beeu_B_bigger_than_A:
mov QWORD[48+rsp],rax
mov QWORD[56+rsp],rbx
mov QWORD[64+rsp],rsi
mov QWORD[72+rsp],rcx
add r8,r12
adc r9,r13
adc r10,r14
adc r11,r15
adc rdi,rbp
jmp NEAR $L$beeu_loop
$L$beeu_loop_end:
mov rbx,QWORD[16+rsp]
sub rbx,1
or rbx,QWORD[24+rsp]
or rbx,QWORD[32+rsp]
or rbx,QWORD[40+rsp]
jnz NEAR $L$beeu_err
mov r8,QWORD[rdx]
mov r9,QWORD[8+rdx]
mov r10,QWORD[16+rdx]
mov r11,QWORD[24+rdx]
xor rdi,rdi
$L$beeu_reduction_loop:
mov QWORD[16+rsp],r12
mov QWORD[24+rsp],r13
mov QWORD[32+rsp],r14
mov QWORD[40+rsp],r15
mov QWORD[48+rsp],rbp
sub r12,r8
sbb r13,r9
sbb r14,r10
sbb r15,r11
sbb rbp,0
cmovc r12,QWORD[16+rsp]
cmovc r13,QWORD[24+rsp]
cmovc r14,QWORD[32+rsp]
cmovc r15,QWORD[40+rsp]
jnc NEAR $L$beeu_reduction_loop
sub r8,r12
sbb r9,r13
sbb r10,r14
sbb r11,r15
$L$beeu_save:
mov rdi,QWORD[rsp]
mov QWORD[rdi],r8
mov QWORD[8+rdi],r9
mov QWORD[16+rdi],r10
mov QWORD[24+rdi],r11
mov rax,1
jmp NEAR $L$beeu_finish
$L$beeu_err:
xor rax,rax
$L$beeu_finish:
add rsp,80
pop rsi
pop rbx
pop r15
pop r14
pop r13
pop r12
pop rbp
mov rdi,QWORD[8+rsp] ;WIN64 epilogue
mov rsi,QWORD[16+rsp]
DB 0F3h,0C3h ;repret
$L$SEH_end_beeu_mod_inverse_vartime:
| 13.082596 | 44 | 0.694927 |
8e672bc1be2453563f25917a0befb84d0609363a | 186 | asm | Assembly | Build/HelloWorld/hello.asm | polankivijay/sample | 27fa0ff101ff416e81dbcfc734d66d76a0195676 | [
"Apache-2.0"
] | 47 | 2018-06-19T17:35:27.000Z | 2022-02-24T23:08:31.000Z | Build/HelloWorld/hello.asm | polankivijay/sample | 27fa0ff101ff416e81dbcfc734d66d76a0195676 | [
"Apache-2.0"
] | 76 | 2018-09-30T14:47:16.000Z | 2022-03-15T14:44:47.000Z | Build/HelloWorld/hello.asm | polankivijay/sample | 27fa0ff101ff416e81dbcfc734d66d76a0195676 | [
"Apache-2.0"
] | 114 | 2018-09-28T14:04:25.000Z | 2022-03-29T10:42:54.000Z | HELLO CSECT
USING *,15
STM 14,12,12(13)
LR 12,15
USING HELLO,12
WTO 'HI'
XR 15,15
RETURN (14,12)
END
| 18.6 | 27 | 0.376344 |
5de8d6d4946ee28971e63d2924923ec0a09aad2f | 6,194 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1745.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1745.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0_notsx.log_21829_1745.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 %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0xb215, %r11
nop
nop
nop
nop
nop
and $19044, %rdx
movw $0x6162, (%r11)
nop
nop
nop
nop
sub $30205, %r8
lea addresses_D_ht+0xa2ad, %rsi
lea addresses_WT_ht+0x1dd1d, %rdi
nop
nop
nop
sub %r9, %r9
mov $2, %rcx
rep movsl
nop
nop
xor $2417, %r9
lea addresses_D_ht+0x18715, %r9
add %rdi, %rdi
mov (%r9), %cx
nop
nop
nop
nop
nop
lfence
lea addresses_WT_ht+0xa789, %rsi
lea addresses_D_ht+0xcccd, %rdi
nop
nop
nop
nop
inc %r8
mov $88, %rcx
rep movsl
nop
nop
nop
nop
nop
and $23234, %rdi
lea addresses_UC_ht+0x13db5, %rsi
nop
nop
xor %rdi, %rdi
vmovups (%rsi), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $1, %xmm7, %rcx
and $31384, %rsi
lea addresses_normal_ht+0x43d4, %rsi
lea addresses_D_ht+0xffad, %rdi
nop
nop
nop
nop
add %rdx, %rdx
mov $40, %rcx
rep movsl
nop
nop
nop
nop
nop
dec %rsi
lea addresses_A_ht+0x19615, %r12
inc %rcx
mov $0x6162636465666768, %r8
movq %r8, %xmm1
movups %xmm1, (%r12)
nop
nop
cmp %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r8
push %rax
push %rbx
push %rdx
push %rsi
// Load
lea addresses_normal+0x68f5, %rdx
nop
nop
nop
cmp %r12, %r12
movb (%rdx), %bl
and $46338, %rdx
// Store
lea addresses_RW+0x10155, %r8
nop
add $61450, %r14
movl $0x51525354, (%r8)
nop
nop
inc %rdx
// Faulty Load
lea addresses_A+0xde15, %rdx
nop
nop
nop
nop
add %rax, %rax
movb (%rdx), %bl
lea oracles, %r8
and $0xff, %rbx
shlq $12, %rbx
mov (%r8,%rbx,1), %rbx
pop %rsi
pop %rdx
pop %rbx
pop %rax
pop %r8
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}}
[Faulty Load]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 1, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 7}}
{'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 3, 'same': False}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 11}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 36.869048 | 2,999 | 0.657572 |
a7b9dd65265bbea76bde50a24532721f03a2f960 | 748 | asm | Assembly | libsrc/_DEVELOPMENT/arch/zx/bifrost_h/c/sdcc/BIFROSTH_fillTileAttrH_callee.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/arch/zx/bifrost_h/c/sdcc/BIFROSTH_fillTileAttrH_callee.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/arch/zx/bifrost_h/c/sdcc/BIFROSTH_fillTileAttrH_callee.asm | teknoplop/z88dk | bb03fbfd6b2ab0f397a1358559089f9cd3706485 | [
"ClArtistic"
] | 1 | 2019-12-03T23:57:48.000Z | 2019-12-03T23:57:48.000Z | ; ----------------------------------------------------------------
; Z88DK INTERFACE LIBRARY FOR THE BIFROST* ENGINE - RELEASE 1.2/L
;
; See "bifrost_h.h" for further details
; ----------------------------------------------------------------
; void void BIFROSTH_fillTileAttrH(unsigned int lin,unsigned int col,unsigned int attr)
; callee
SECTION code_clib
SECTION code_bifrost_h
PUBLIC _BIFROSTH_fillTileAttrH_callee
EXTERN asm_BIFROSTH_fillTileAttrH
_BIFROSTH_fillTileAttrH_callee:
pop hl ; RET address
pop bc ; C=lin
pop de ; E=col
ld d,c ; D=lin
pop bc ; C=attrib
push hl
jp asm_BIFROSTH_fillTileAttrH ; execute 'fill_tile_attr'
| 27.703704 | 87 | 0.537433 |
8a527a9f8b6f2cc266ce513381f669bc84c57b68 | 584 | asm | Assembly | programs/oeis/057/A057960.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/057/A057960.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/057/A057960.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A057960: Number of base 5 n-digit numbers with adjacent digits differing by one or less.
; 1,2,5,13,35,95,259,707,1931,5275,14411,39371,107563,293867,802859,2193451,5992619,16372139,44729515,122203307,333865643,912137899,2492007083,6808289963,18600594091,50817768107,138836724395,379308985003,1036291418795,2831200807595,7734984452779,21132370520747,57734709947051,157734160935595,430937741765291,1177343805401771,3216563094334123,8787813799471787
mov $1,1
mov $3,4
lpb $0,1
sub $0,1
mov $2,$1
mul $1,2
trn $1,3
sub $3,3
mul $3,2
add $1,$3
add $2,4
mov $3,$2
lpe
| 34.352941 | 358 | 0.775685 |
975490fb6ed6399cf9498db067c48b183964df5a | 54,817 | asm | Assembly | getp.asm | haniyehnasseri/xv6ProcessScheduling | cb908f7fa9cf0874db1c310d8d2220d923fda15b | [
"MIT-0"
] | null | null | null | getp.asm | haniyehnasseri/xv6ProcessScheduling | cb908f7fa9cf0874db1c310d8d2220d923fda15b | [
"MIT-0"
] | null | null | null | getp.asm | haniyehnasseri/xv6ProcessScheduling | cb908f7fa9cf0874db1c310d8d2220d923fda15b | [
"MIT-0"
] | null | null | null |
_getp: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "x86.h"
#define child_NUM 4
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: 83 ec 48 sub $0x48,%esp
14: 8b 59 04 mov 0x4(%ecx),%ebx
int childrenn[child_NUM];
int havechild = 0;
int children[child_NUM][child_NUM];
int i,j;
int mainparent = getpid();
17: e8 96 04 00 00 call 4b2 <getpid>
int isfirstchild = 0;
if(strcmp(argv[1],"1") == 0)
1c: 83 ec 08 sub $0x8,%esp
int childrenn[child_NUM];
int havechild = 0;
int children[child_NUM][child_NUM];
int i,j;
int mainparent = getpid();
1f: 89 c6 mov %eax,%esi
int isfirstchild = 0;
if(strcmp(argv[1],"1") == 0)
21: 68 f0 08 00 00 push $0x8f0
26: ff 73 04 pushl 0x4(%ebx)
29: e8 f2 01 00 00 call 220 <strcmp>
2e: 83 c4 10 add $0x10,%esp
31: 85 c0 test %eax,%eax
33: 75 4c jne 81 <main+0x81>
35: 8d 5d a8 lea -0x58(%ebp),%ebx
38: 8d 7d b4 lea -0x4c(%ebp),%edi
{
childrenn[0] = fork();
3b: e8 ea 03 00 00 call 42a <fork>
40: 89 45 a8 mov %eax,-0x58(%ebp)
for(i = 1; i < child_NUM;i++){
if(childrenn[i-1] == 0){
43: 8b 0b mov (%ebx),%ecx
45: 85 c9 test %ecx,%ecx
47: 0f 84 72 01 00 00 je 1bf <main+0x1bf>
havechild = 0;
exit();
}
else{
havechild = 1;
childrenn[i]=fork();
4d: e8 d8 03 00 00 call 42a <fork>
52: 83 c3 04 add $0x4,%ebx
55: 89 03 mov %eax,(%ebx)
int mainparent = getpid();
int isfirstchild = 0;
if(strcmp(argv[1],"1") == 0)
{
childrenn[0] = fork();
for(i = 1; i < child_NUM;i++){
57: 39 fb cmp %edi,%ebx
59: 75 e8 jne 43 <main+0x43>
}
if(havechild == 1)
{
if(getpid() == mainparent){
5b: e8 52 04 00 00 call 4b2 <getpid>
60: 39 c6 cmp %eax,%esi
62: 0f 84 18 01 00 00 je 180 <main+0x180>
printf(1,"getchildren syscall : %d\n",getchildren(mainparent));
}
}
for(i = 0; i < child_NUM; i++)
wait();
68: e8 cd 03 00 00 call 43a <wait>
6d: e8 c8 03 00 00 call 43a <wait>
72: e8 c3 03 00 00 call 43a <wait>
77: e8 be 03 00 00 call 43a <wait>
exit();
7c: e8 b1 03 00 00 call 432 <exit>
}
//////////////////////////////////////////bonus////////////////////////////////////////////
if(strcmp(argv[1],"2") == 0)
81: 57 push %edi
82: 57 push %edi
83: 68 42 09 00 00 push $0x942
88: ff 73 04 pushl 0x4(%ebx)
8b: e8 90 01 00 00 call 220 <strcmp>
90: 83 c4 10 add $0x10,%esp
93: 85 c0 test %eax,%eax
95: 75 50 jne e7 <main+0xe7>
97: 8d 45 a8 lea -0x58(%ebp),%eax
9a: 8d 55 e8 lea -0x18(%ebp),%edx
{
for(i = 0;i < child_NUM;i++)
for(j=0;j < child_NUM;j++)
children[i][j] = -1;
9d: c7 00 ff ff ff ff movl $0xffffffff,(%eax)
a3: c7 40 04 ff ff ff ff movl $0xffffffff,0x4(%eax)
aa: 83 c0 10 add $0x10,%eax
ad: c7 40 f8 ff ff ff ff movl $0xffffffff,-0x8(%eax)
//////////////////////////////////////////bonus////////////////////////////////////////////
if(strcmp(argv[1],"2") == 0)
{
for(i = 0;i < child_NUM;i++)
b4: 39 c2 cmp %eax,%edx
b6: 75 e5 jne 9d <main+0x9d>
for(j=0;j < child_NUM;j++)
children[i][j] = -1;
printf(1,"mainparent pid : %d\n",mainparent);
b8: 51 push %ecx
b9: 56 push %esi
ba: 68 44 09 00 00 push $0x944
bf: 6a 01 push $0x1
c1: e8 0a 05 00 00 call 5d0 <printf>
children[0][0] = fork();
c6: e8 5f 03 00 00 call 42a <fork>
if (children[0][0] == 0){
cb: 83 c4 10 add $0x10,%esp
ce: 85 c0 test %eax,%eax
d0: 74 23 je f5 <main+0xf5>
if ((children[0][1] == 0) || (children[0][2] == 0)){
d2: 83 7d ac 00 cmpl $0x0,-0x54(%ebp)
d6: 74 0a je e2 <main+0xe2>
d8: 83 7d b0 00 cmpl $0x0,-0x50(%ebp)
dc: 0f 85 8f 00 00 00 jne 171 <main+0x171>
for(i = 0; i < 2; i++)
wait();
exit();
e2: e8 4b 03 00 00 call 432 <exit>
}
}
e7: 8d 65 f0 lea -0x10(%ebp),%esp
ea: 31 c0 xor %eax,%eax
ec: 59 pop %ecx
ed: 5b pop %ebx
ee: 5e pop %esi
ef: 5f pop %edi
f0: 5d pop %ebp
f1: 8d 61 fc lea -0x4(%ecx),%esp
f4: c3 ret
children[0][0] = fork();
if (children[0][0] == 0){
isfirstchild = 1;
children[0][1] = fork();
f5: e8 30 03 00 00 call 42a <fork>
if (children[0][1] != 0)
fa: 85 c0 test %eax,%eax
children[0][0] = fork();
if (children[0][0] == 0){
isfirstchild = 1;
children[0][1] = fork();
fc: 89 c3 mov %eax,%ebx
if (children[0][1] != 0)
fe: 74 e2 je e2 <main+0xe2>
children[0][2] = fork();
100: e8 25 03 00 00 call 42a <fork>
if ((children[0][1] == 0) || (children[0][2] == 0)){
105: 85 c0 test %eax,%eax
if (children[0][0] == 0){
isfirstchild = 1;
children[0][1] = fork();
if (children[0][1] != 0)
children[0][2] = fork();
107: 89 c7 mov %eax,%edi
109: 89 45 b0 mov %eax,-0x50(%ebp)
if ((children[0][1] == 0) || (children[0][2] == 0)){
10c: 74 d4 je e2 <main+0xe2>
exit();
}
if(isfirstchild){
printf(1,"Father pid : %d\n",get_parent_id());
10e: e8 a7 03 00 00 call 4ba <get_parent_id>
113: 52 push %edx
114: 50 push %eax
115: 68 f2 08 00 00 push $0x8f2
11a: 6a 01 push $0x1
11c: e8 af 04 00 00 call 5d0 <printf>
printf(1,"First degree child : %d\n",getpid());
121: e8 8c 03 00 00 call 4b2 <getpid>
126: 83 c4 0c add $0xc,%esp
129: 50 push %eax
12a: 68 59 09 00 00 push $0x959
12f: 6a 01 push $0x1
131: e8 9a 04 00 00 call 5d0 <printf>
printf(1,"Second degree child 1 : %d\n",children[0][1]);
136: 83 c4 0c add $0xc,%esp
139: 53 push %ebx
13a: 68 72 09 00 00 push $0x972
13f: 6a 01 push $0x1
141: e8 8a 04 00 00 call 5d0 <printf>
printf(1,"Second degree child 2 : %d\n",children[0][2]);
146: 83 c4 0c add $0xc,%esp
149: 57 push %edi
14a: 68 8e 09 00 00 push $0x98e
14f: 6a 01 push $0x1
151: e8 7a 04 00 00 call 5d0 <printf>
printf(1,"getchildren syscall : %d\n",getchildren(mainparent));
156: 89 34 24 mov %esi,(%esp)
159: e8 64 03 00 00 call 4c2 <getchildren>
15e: 83 c4 0c add $0xc,%esp
161: 50 push %eax
162: 68 28 09 00 00 push $0x928
167: 6a 01 push $0x1
169: e8 62 04 00 00 call 5d0 <printf>
16e: 83 c4 10 add $0x10,%esp
}
for(i = 0; i < 2; i++)
wait();
171: e8 c4 02 00 00 call 43a <wait>
176: e8 bf 02 00 00 call 43a <wait>
17b: e9 62 ff ff ff jmp e2 <main+0xe2>
180: 31 db xor %ebx,%ebx
if(havechild == 1)
{
if(getpid() == mainparent){
for(i = 0; i < child_NUM;i++){
printf(1,"children array : %d\n",childrenn[i]);
182: 50 push %eax
183: ff 74 9d a8 pushl -0x58(%ebp,%ebx,4)
if(havechild == 1)
{
if(getpid() == mainparent){
for(i = 0; i < child_NUM;i++){
187: 83 c3 01 add $0x1,%ebx
printf(1,"children array : %d\n",childrenn[i]);
18a: 68 13 09 00 00 push $0x913
18f: 6a 01 push $0x1
191: e8 3a 04 00 00 call 5d0 <printf>
if(havechild == 1)
{
if(getpid() == mainparent){
for(i = 0; i < child_NUM;i++){
196: 83 c4 10 add $0x10,%esp
199: 83 fb 04 cmp $0x4,%ebx
19c: 75 e4 jne 182 <main+0x182>
printf(1,"children array : %d\n",childrenn[i]);
}
printf(1,"getchildren syscall : %d\n",getchildren(mainparent));
19e: 83 ec 0c sub $0xc,%esp
1a1: 56 push %esi
1a2: e8 1b 03 00 00 call 4c2 <getchildren>
1a7: 83 c4 0c add $0xc,%esp
1aa: 50 push %eax
1ab: 68 28 09 00 00 push $0x928
1b0: 6a 01 push $0x1
1b2: e8 19 04 00 00 call 5d0 <printf>
1b7: 83 c4 10 add $0x10,%esp
1ba: e9 a9 fe ff ff jmp 68 <main+0x68>
if(strcmp(argv[1],"1") == 0)
{
childrenn[0] = fork();
for(i = 1; i < child_NUM;i++){
if(childrenn[i-1] == 0){
printf(1,"Father pid : %d\n",get_parent_id());
1bf: e8 f6 02 00 00 call 4ba <get_parent_id>
1c4: 52 push %edx
1c5: 50 push %eax
1c6: 68 f2 08 00 00 push $0x8f2
1cb: 6a 01 push $0x1
1cd: e8 fe 03 00 00 call 5d0 <printf>
printf(1,"Child pid : %d\n",getpid());
1d2: e8 db 02 00 00 call 4b2 <getpid>
1d7: 83 c4 0c add $0xc,%esp
1da: 50 push %eax
1db: 68 03 09 00 00 push $0x903
1e0: 6a 01 push $0x1
1e2: e8 e9 03 00 00 call 5d0 <printf>
havechild = 0;
exit();
1e7: e8 46 02 00 00 call 432 <exit>
1ec: 66 90 xchg %ax,%ax
1ee: 66 90 xchg %ax,%ax
000001f0 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
1f0: 55 push %ebp
1f1: 89 e5 mov %esp,%ebp
1f3: 53 push %ebx
1f4: 8b 45 08 mov 0x8(%ebp),%eax
1f7: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
1fa: 89 c2 mov %eax,%edx
1fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
200: 83 c1 01 add $0x1,%ecx
203: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
207: 83 c2 01 add $0x1,%edx
20a: 84 db test %bl,%bl
20c: 88 5a ff mov %bl,-0x1(%edx)
20f: 75 ef jne 200 <strcpy+0x10>
;
return os;
}
211: 5b pop %ebx
212: 5d pop %ebp
213: c3 ret
214: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
21a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000220 <strcmp>:
int
strcmp(const char *p, const char *q)
{
220: 55 push %ebp
221: 89 e5 mov %esp,%ebp
223: 56 push %esi
224: 53 push %ebx
225: 8b 55 08 mov 0x8(%ebp),%edx
228: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
22b: 0f b6 02 movzbl (%edx),%eax
22e: 0f b6 19 movzbl (%ecx),%ebx
231: 84 c0 test %al,%al
233: 75 1e jne 253 <strcmp+0x33>
235: eb 29 jmp 260 <strcmp+0x40>
237: 89 f6 mov %esi,%esi
239: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
240: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
243: 0f b6 02 movzbl (%edx),%eax
p++, q++;
246: 8d 71 01 lea 0x1(%ecx),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
249: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
24d: 84 c0 test %al,%al
24f: 74 0f je 260 <strcmp+0x40>
251: 89 f1 mov %esi,%ecx
253: 38 d8 cmp %bl,%al
255: 74 e9 je 240 <strcmp+0x20>
p++, q++;
return (uchar)*p - (uchar)*q;
257: 29 d8 sub %ebx,%eax
}
259: 5b pop %ebx
25a: 5e pop %esi
25b: 5d pop %ebp
25c: c3 ret
25d: 8d 76 00 lea 0x0(%esi),%esi
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
260: 31 c0 xor %eax,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
262: 29 d8 sub %ebx,%eax
}
264: 5b pop %ebx
265: 5e pop %esi
266: 5d pop %ebp
267: c3 ret
268: 90 nop
269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000270 <strlen>:
uint
strlen(const char *s)
{
270: 55 push %ebp
271: 89 e5 mov %esp,%ebp
273: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
276: 80 39 00 cmpb $0x0,(%ecx)
279: 74 12 je 28d <strlen+0x1d>
27b: 31 d2 xor %edx,%edx
27d: 8d 76 00 lea 0x0(%esi),%esi
280: 83 c2 01 add $0x1,%edx
283: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
287: 89 d0 mov %edx,%eax
289: 75 f5 jne 280 <strlen+0x10>
;
return n;
}
28b: 5d pop %ebp
28c: c3 ret
uint
strlen(const char *s)
{
int n;
for(n = 0; s[n]; n++)
28d: 31 c0 xor %eax,%eax
;
return n;
}
28f: 5d pop %ebp
290: c3 ret
291: eb 0d jmp 2a0 <memset>
293: 90 nop
294: 90 nop
295: 90 nop
296: 90 nop
297: 90 nop
298: 90 nop
299: 90 nop
29a: 90 nop
29b: 90 nop
29c: 90 nop
29d: 90 nop
29e: 90 nop
29f: 90 nop
000002a0 <memset>:
void*
memset(void *dst, int c, uint n)
{
2a0: 55 push %ebp
2a1: 89 e5 mov %esp,%ebp
2a3: 57 push %edi
2a4: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
2a7: 8b 4d 10 mov 0x10(%ebp),%ecx
2aa: 8b 45 0c mov 0xc(%ebp),%eax
2ad: 89 d7 mov %edx,%edi
2af: fc cld
2b0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
2b2: 89 d0 mov %edx,%eax
2b4: 5f pop %edi
2b5: 5d pop %ebp
2b6: c3 ret
2b7: 89 f6 mov %esi,%esi
2b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000002c0 <strchr>:
char*
strchr(const char *s, char c)
{
2c0: 55 push %ebp
2c1: 89 e5 mov %esp,%ebp
2c3: 53 push %ebx
2c4: 8b 45 08 mov 0x8(%ebp),%eax
2c7: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
2ca: 0f b6 10 movzbl (%eax),%edx
2cd: 84 d2 test %dl,%dl
2cf: 74 1d je 2ee <strchr+0x2e>
if(*s == c)
2d1: 38 d3 cmp %dl,%bl
2d3: 89 d9 mov %ebx,%ecx
2d5: 75 0d jne 2e4 <strchr+0x24>
2d7: eb 17 jmp 2f0 <strchr+0x30>
2d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2e0: 38 ca cmp %cl,%dl
2e2: 74 0c je 2f0 <strchr+0x30>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
2e4: 83 c0 01 add $0x1,%eax
2e7: 0f b6 10 movzbl (%eax),%edx
2ea: 84 d2 test %dl,%dl
2ec: 75 f2 jne 2e0 <strchr+0x20>
if(*s == c)
return (char*)s;
return 0;
2ee: 31 c0 xor %eax,%eax
}
2f0: 5b pop %ebx
2f1: 5d pop %ebp
2f2: c3 ret
2f3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
2f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000300 <gets>:
char*
gets(char *buf, int max)
{
300: 55 push %ebp
301: 89 e5 mov %esp,%ebp
303: 57 push %edi
304: 56 push %esi
305: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
306: 31 f6 xor %esi,%esi
cc = read(0, &c, 1);
308: 8d 7d e7 lea -0x19(%ebp),%edi
return 0;
}
char*
gets(char *buf, int max)
{
30b: 83 ec 1c sub $0x1c,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
30e: eb 29 jmp 339 <gets+0x39>
cc = read(0, &c, 1);
310: 83 ec 04 sub $0x4,%esp
313: 6a 01 push $0x1
315: 57 push %edi
316: 6a 00 push $0x0
318: e8 2d 01 00 00 call 44a <read>
if(cc < 1)
31d: 83 c4 10 add $0x10,%esp
320: 85 c0 test %eax,%eax
322: 7e 1d jle 341 <gets+0x41>
break;
buf[i++] = c;
324: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
328: 8b 55 08 mov 0x8(%ebp),%edx
32b: 89 de mov %ebx,%esi
if(c == '\n' || c == '\r')
32d: 3c 0a cmp $0xa,%al
for(i=0; i+1 < max; ){
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
32f: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
333: 74 1b je 350 <gets+0x50>
335: 3c 0d cmp $0xd,%al
337: 74 17 je 350 <gets+0x50>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
339: 8d 5e 01 lea 0x1(%esi),%ebx
33c: 3b 5d 0c cmp 0xc(%ebp),%ebx
33f: 7c cf jl 310 <gets+0x10>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
341: 8b 45 08 mov 0x8(%ebp),%eax
344: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
348: 8d 65 f4 lea -0xc(%ebp),%esp
34b: 5b pop %ebx
34c: 5e pop %esi
34d: 5f pop %edi
34e: 5d pop %ebp
34f: c3 ret
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
350: 8b 45 08 mov 0x8(%ebp),%eax
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
353: 89 de mov %ebx,%esi
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
355: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
359: 8d 65 f4 lea -0xc(%ebp),%esp
35c: 5b pop %ebx
35d: 5e pop %esi
35e: 5f pop %edi
35f: 5d pop %ebp
360: c3 ret
361: eb 0d jmp 370 <stat>
363: 90 nop
364: 90 nop
365: 90 nop
366: 90 nop
367: 90 nop
368: 90 nop
369: 90 nop
36a: 90 nop
36b: 90 nop
36c: 90 nop
36d: 90 nop
36e: 90 nop
36f: 90 nop
00000370 <stat>:
int
stat(const char *n, struct stat *st)
{
370: 55 push %ebp
371: 89 e5 mov %esp,%ebp
373: 56 push %esi
374: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
375: 83 ec 08 sub $0x8,%esp
378: 6a 00 push $0x0
37a: ff 75 08 pushl 0x8(%ebp)
37d: e8 f0 00 00 00 call 472 <open>
if(fd < 0)
382: 83 c4 10 add $0x10,%esp
385: 85 c0 test %eax,%eax
387: 78 27 js 3b0 <stat+0x40>
return -1;
r = fstat(fd, st);
389: 83 ec 08 sub $0x8,%esp
38c: ff 75 0c pushl 0xc(%ebp)
38f: 89 c3 mov %eax,%ebx
391: 50 push %eax
392: e8 f3 00 00 00 call 48a <fstat>
397: 89 c6 mov %eax,%esi
close(fd);
399: 89 1c 24 mov %ebx,(%esp)
39c: e8 b9 00 00 00 call 45a <close>
return r;
3a1: 83 c4 10 add $0x10,%esp
3a4: 89 f0 mov %esi,%eax
}
3a6: 8d 65 f8 lea -0x8(%ebp),%esp
3a9: 5b pop %ebx
3aa: 5e pop %esi
3ab: 5d pop %ebp
3ac: c3 ret
3ad: 8d 76 00 lea 0x0(%esi),%esi
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
3b0: b8 ff ff ff ff mov $0xffffffff,%eax
3b5: eb ef jmp 3a6 <stat+0x36>
3b7: 89 f6 mov %esi,%esi
3b9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000003c0 <atoi>:
return r;
}
int
atoi(const char *s)
{
3c0: 55 push %ebp
3c1: 89 e5 mov %esp,%ebp
3c3: 53 push %ebx
3c4: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
3c7: 0f be 11 movsbl (%ecx),%edx
3ca: 8d 42 d0 lea -0x30(%edx),%eax
3cd: 3c 09 cmp $0x9,%al
3cf: b8 00 00 00 00 mov $0x0,%eax
3d4: 77 1f ja 3f5 <atoi+0x35>
3d6: 8d 76 00 lea 0x0(%esi),%esi
3d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
3e0: 8d 04 80 lea (%eax,%eax,4),%eax
3e3: 83 c1 01 add $0x1,%ecx
3e6: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
3ea: 0f be 11 movsbl (%ecx),%edx
3ed: 8d 5a d0 lea -0x30(%edx),%ebx
3f0: 80 fb 09 cmp $0x9,%bl
3f3: 76 eb jbe 3e0 <atoi+0x20>
n = n*10 + *s++ - '0';
return n;
}
3f5: 5b pop %ebx
3f6: 5d pop %ebp
3f7: c3 ret
3f8: 90 nop
3f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000400 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
400: 55 push %ebp
401: 89 e5 mov %esp,%ebp
403: 56 push %esi
404: 53 push %ebx
405: 8b 5d 10 mov 0x10(%ebp),%ebx
408: 8b 45 08 mov 0x8(%ebp),%eax
40b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
40e: 85 db test %ebx,%ebx
410: 7e 14 jle 426 <memmove+0x26>
412: 31 d2 xor %edx,%edx
414: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
418: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
41c: 88 0c 10 mov %cl,(%eax,%edx,1)
41f: 83 c2 01 add $0x1,%edx
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
422: 39 da cmp %ebx,%edx
424: 75 f2 jne 418 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
426: 5b pop %ebx
427: 5e pop %esi
428: 5d pop %ebp
429: c3 ret
0000042a <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
42a: b8 01 00 00 00 mov $0x1,%eax
42f: cd 40 int $0x40
431: c3 ret
00000432 <exit>:
SYSCALL(exit)
432: b8 02 00 00 00 mov $0x2,%eax
437: cd 40 int $0x40
439: c3 ret
0000043a <wait>:
SYSCALL(wait)
43a: b8 03 00 00 00 mov $0x3,%eax
43f: cd 40 int $0x40
441: c3 ret
00000442 <pipe>:
SYSCALL(pipe)
442: b8 04 00 00 00 mov $0x4,%eax
447: cd 40 int $0x40
449: c3 ret
0000044a <read>:
SYSCALL(read)
44a: b8 05 00 00 00 mov $0x5,%eax
44f: cd 40 int $0x40
451: c3 ret
00000452 <write>:
SYSCALL(write)
452: b8 10 00 00 00 mov $0x10,%eax
457: cd 40 int $0x40
459: c3 ret
0000045a <close>:
SYSCALL(close)
45a: b8 15 00 00 00 mov $0x15,%eax
45f: cd 40 int $0x40
461: c3 ret
00000462 <kill>:
SYSCALL(kill)
462: b8 06 00 00 00 mov $0x6,%eax
467: cd 40 int $0x40
469: c3 ret
0000046a <exec>:
SYSCALL(exec)
46a: b8 07 00 00 00 mov $0x7,%eax
46f: cd 40 int $0x40
471: c3 ret
00000472 <open>:
SYSCALL(open)
472: b8 0f 00 00 00 mov $0xf,%eax
477: cd 40 int $0x40
479: c3 ret
0000047a <mknod>:
SYSCALL(mknod)
47a: b8 11 00 00 00 mov $0x11,%eax
47f: cd 40 int $0x40
481: c3 ret
00000482 <unlink>:
SYSCALL(unlink)
482: b8 12 00 00 00 mov $0x12,%eax
487: cd 40 int $0x40
489: c3 ret
0000048a <fstat>:
SYSCALL(fstat)
48a: b8 08 00 00 00 mov $0x8,%eax
48f: cd 40 int $0x40
491: c3 ret
00000492 <link>:
SYSCALL(link)
492: b8 13 00 00 00 mov $0x13,%eax
497: cd 40 int $0x40
499: c3 ret
0000049a <mkdir>:
SYSCALL(mkdir)
49a: b8 14 00 00 00 mov $0x14,%eax
49f: cd 40 int $0x40
4a1: c3 ret
000004a2 <chdir>:
SYSCALL(chdir)
4a2: b8 09 00 00 00 mov $0x9,%eax
4a7: cd 40 int $0x40
4a9: c3 ret
000004aa <dup>:
SYSCALL(dup)
4aa: b8 0a 00 00 00 mov $0xa,%eax
4af: cd 40 int $0x40
4b1: c3 ret
000004b2 <getpid>:
SYSCALL(getpid)
4b2: b8 0b 00 00 00 mov $0xb,%eax
4b7: cd 40 int $0x40
4b9: c3 ret
000004ba <get_parent_id>:
SYSCALL(get_parent_id)
4ba: b8 16 00 00 00 mov $0x16,%eax
4bf: cd 40 int $0x40
4c1: c3 ret
000004c2 <getchildren>:
SYSCALL(getchildren)
4c2: b8 17 00 00 00 mov $0x17,%eax
4c7: cd 40 int $0x40
4c9: c3 ret
000004ca <sbrk>:
SYSCALL(sbrk)
4ca: b8 0c 00 00 00 mov $0xc,%eax
4cf: cd 40 int $0x40
4d1: c3 ret
000004d2 <sleep>:
SYSCALL(sleep)
4d2: b8 0d 00 00 00 mov $0xd,%eax
4d7: cd 40 int $0x40
4d9: c3 ret
000004da <uptime>:
SYSCALL(uptime)
4da: b8 0e 00 00 00 mov $0xe,%eax
4df: cd 40 int $0x40
4e1: c3 ret
000004e2 <set>:
SYSCALL(set)
4e2: b8 18 00 00 00 mov $0x18,%eax
4e7: cd 40 int $0x40
4e9: c3 ret
000004ea <count>:
SYSCALL(count)
4ea: b8 19 00 00 00 mov $0x19,%eax
4ef: cd 40 int $0x40
4f1: c3 ret
000004f2 <sleepp>:
SYSCALL(sleepp)
4f2: b8 1a 00 00 00 mov $0x1a,%eax
4f7: cd 40 int $0x40
4f9: c3 ret
000004fa <cmos>:
SYSCALL(cmos)
4fa: b8 1b 00 00 00 mov $0x1b,%eax
4ff: cd 40 int $0x40
501: c3 ret
00000502 <chqueue>:
SYSCALL(chqueue)
502: b8 1c 00 00 00 mov $0x1c,%eax
507: cd 40 int $0x40
509: c3 ret
0000050a <setLottery>:
SYSCALL(setLottery)
50a: b8 1d 00 00 00 mov $0x1d,%eax
50f: cd 40 int $0x40
511: c3 ret
00000512 <chprSRPF>:
SYSCALL(chprSRPF)
512: b8 1e 00 00 00 mov $0x1e,%eax
517: cd 40 int $0x40
519: c3 ret
0000051a <printinfo>:
SYSCALL(printinfo)
51a: b8 1f 00 00 00 mov $0x1f,%eax
51f: cd 40 int $0x40
521: c3 ret
522: 66 90 xchg %ax,%ax
524: 66 90 xchg %ax,%ax
526: 66 90 xchg %ax,%ax
528: 66 90 xchg %ax,%ax
52a: 66 90 xchg %ax,%ax
52c: 66 90 xchg %ax,%ax
52e: 66 90 xchg %ax,%ax
00000530 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
530: 55 push %ebp
531: 89 e5 mov %esp,%ebp
533: 57 push %edi
534: 56 push %esi
535: 53 push %ebx
536: 89 c6 mov %eax,%esi
538: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
53b: 8b 5d 08 mov 0x8(%ebp),%ebx
53e: 85 db test %ebx,%ebx
540: 74 7e je 5c0 <printint+0x90>
542: 89 d0 mov %edx,%eax
544: c1 e8 1f shr $0x1f,%eax
547: 84 c0 test %al,%al
549: 74 75 je 5c0 <printint+0x90>
neg = 1;
x = -xx;
54b: 89 d0 mov %edx,%eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
54d: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
x = -xx;
554: f7 d8 neg %eax
556: 89 75 c0 mov %esi,-0x40(%ebp)
} else {
x = xx;
}
i = 0;
559: 31 ff xor %edi,%edi
55b: 8d 5d d7 lea -0x29(%ebp),%ebx
55e: 89 ce mov %ecx,%esi
560: eb 08 jmp 56a <printint+0x3a>
562: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
do{
buf[i++] = digits[x % base];
568: 89 cf mov %ecx,%edi
56a: 31 d2 xor %edx,%edx
56c: 8d 4f 01 lea 0x1(%edi),%ecx
56f: f7 f6 div %esi
571: 0f b6 92 b4 09 00 00 movzbl 0x9b4(%edx),%edx
}while((x /= base) != 0);
578: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
57a: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
57d: 75 e9 jne 568 <printint+0x38>
if(neg)
57f: 8b 45 c4 mov -0x3c(%ebp),%eax
582: 8b 75 c0 mov -0x40(%ebp),%esi
585: 85 c0 test %eax,%eax
587: 74 08 je 591 <printint+0x61>
buf[i++] = '-';
589: c6 44 0d d8 2d movb $0x2d,-0x28(%ebp,%ecx,1)
58e: 8d 4f 02 lea 0x2(%edi),%ecx
591: 8d 7c 0d d7 lea -0x29(%ebp,%ecx,1),%edi
595: 8d 76 00 lea 0x0(%esi),%esi
598: 0f b6 07 movzbl (%edi),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
59b: 83 ec 04 sub $0x4,%esp
59e: 83 ef 01 sub $0x1,%edi
5a1: 6a 01 push $0x1
5a3: 53 push %ebx
5a4: 56 push %esi
5a5: 88 45 d7 mov %al,-0x29(%ebp)
5a8: e8 a5 fe ff ff call 452 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
5ad: 83 c4 10 add $0x10,%esp
5b0: 39 df cmp %ebx,%edi
5b2: 75 e4 jne 598 <printint+0x68>
putc(fd, buf[i]);
}
5b4: 8d 65 f4 lea -0xc(%ebp),%esp
5b7: 5b pop %ebx
5b8: 5e pop %esi
5b9: 5f pop %edi
5ba: 5d pop %ebp
5bb: c3 ret
5bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
} else {
x = xx;
5c0: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
5c2: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
5c9: eb 8b jmp 556 <printint+0x26>
5cb: 90 nop
5cc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000005d0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
5d0: 55 push %ebp
5d1: 89 e5 mov %esp,%ebp
5d3: 57 push %edi
5d4: 56 push %esi
5d5: 53 push %ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
5d6: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
5d9: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
5dc: 8b 75 0c mov 0xc(%ebp),%esi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
5df: 8b 7d 08 mov 0x8(%ebp),%edi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
5e2: 89 45 d0 mov %eax,-0x30(%ebp)
5e5: 0f b6 1e movzbl (%esi),%ebx
5e8: 83 c6 01 add $0x1,%esi
5eb: 84 db test %bl,%bl
5ed: 0f 84 b0 00 00 00 je 6a3 <printf+0xd3>
5f3: 31 d2 xor %edx,%edx
5f5: eb 39 jmp 630 <printf+0x60>
5f7: 89 f6 mov %esi,%esi
5f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
600: 83 f8 25 cmp $0x25,%eax
603: 89 55 d4 mov %edx,-0x2c(%ebp)
state = '%';
606: ba 25 00 00 00 mov $0x25,%edx
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
60b: 74 18 je 625 <printf+0x55>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
60d: 8d 45 e2 lea -0x1e(%ebp),%eax
610: 83 ec 04 sub $0x4,%esp
613: 88 5d e2 mov %bl,-0x1e(%ebp)
616: 6a 01 push $0x1
618: 50 push %eax
619: 57 push %edi
61a: e8 33 fe ff ff call 452 <write>
61f: 8b 55 d4 mov -0x2c(%ebp),%edx
622: 83 c4 10 add $0x10,%esp
625: 83 c6 01 add $0x1,%esi
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
628: 0f b6 5e ff movzbl -0x1(%esi),%ebx
62c: 84 db test %bl,%bl
62e: 74 73 je 6a3 <printf+0xd3>
c = fmt[i] & 0xff;
if(state == 0){
630: 85 d2 test %edx,%edx
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
632: 0f be cb movsbl %bl,%ecx
635: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
638: 74 c6 je 600 <printf+0x30>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
63a: 83 fa 25 cmp $0x25,%edx
63d: 75 e6 jne 625 <printf+0x55>
if(c == 'd'){
63f: 83 f8 64 cmp $0x64,%eax
642: 0f 84 f8 00 00 00 je 740 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
648: 81 e1 f7 00 00 00 and $0xf7,%ecx
64e: 83 f9 70 cmp $0x70,%ecx
651: 74 5d je 6b0 <printf+0xe0>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
653: 83 f8 73 cmp $0x73,%eax
656: 0f 84 84 00 00 00 je 6e0 <printf+0x110>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
65c: 83 f8 63 cmp $0x63,%eax
65f: 0f 84 ea 00 00 00 je 74f <printf+0x17f>
putc(fd, *ap);
ap++;
} else if(c == '%'){
665: 83 f8 25 cmp $0x25,%eax
668: 0f 84 c2 00 00 00 je 730 <printf+0x160>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
66e: 8d 45 e7 lea -0x19(%ebp),%eax
671: 83 ec 04 sub $0x4,%esp
674: c6 45 e7 25 movb $0x25,-0x19(%ebp)
678: 6a 01 push $0x1
67a: 50 push %eax
67b: 57 push %edi
67c: e8 d1 fd ff ff call 452 <write>
681: 83 c4 0c add $0xc,%esp
684: 8d 45 e6 lea -0x1a(%ebp),%eax
687: 88 5d e6 mov %bl,-0x1a(%ebp)
68a: 6a 01 push $0x1
68c: 50 push %eax
68d: 57 push %edi
68e: 83 c6 01 add $0x1,%esi
691: e8 bc fd ff ff call 452 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
696: 0f b6 5e ff movzbl -0x1(%esi),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
69a: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
69d: 31 d2 xor %edx,%edx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
69f: 84 db test %bl,%bl
6a1: 75 8d jne 630 <printf+0x60>
putc(fd, c);
}
state = 0;
}
}
}
6a3: 8d 65 f4 lea -0xc(%ebp),%esp
6a6: 5b pop %ebx
6a7: 5e pop %esi
6a8: 5f pop %edi
6a9: 5d pop %ebp
6aa: c3 ret
6ab: 90 nop
6ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
6b0: 83 ec 0c sub $0xc,%esp
6b3: b9 10 00 00 00 mov $0x10,%ecx
6b8: 6a 00 push $0x0
6ba: 8b 5d d0 mov -0x30(%ebp),%ebx
6bd: 89 f8 mov %edi,%eax
6bf: 8b 13 mov (%ebx),%edx
6c1: e8 6a fe ff ff call 530 <printint>
ap++;
6c6: 89 d8 mov %ebx,%eax
6c8: 83 c4 10 add $0x10,%esp
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
6cb: 31 d2 xor %edx,%edx
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
6cd: 83 c0 04 add $0x4,%eax
6d0: 89 45 d0 mov %eax,-0x30(%ebp)
6d3: e9 4d ff ff ff jmp 625 <printf+0x55>
6d8: 90 nop
6d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
6e0: 8b 45 d0 mov -0x30(%ebp),%eax
6e3: 8b 18 mov (%eax),%ebx
ap++;
6e5: 83 c0 04 add $0x4,%eax
6e8: 89 45 d0 mov %eax,-0x30(%ebp)
if(s == 0)
s = "(null)";
6eb: b8 aa 09 00 00 mov $0x9aa,%eax
6f0: 85 db test %ebx,%ebx
6f2: 0f 44 d8 cmove %eax,%ebx
while(*s != 0){
6f5: 0f b6 03 movzbl (%ebx),%eax
6f8: 84 c0 test %al,%al
6fa: 74 23 je 71f <printf+0x14f>
6fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
700: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
703: 8d 45 e3 lea -0x1d(%ebp),%eax
706: 83 ec 04 sub $0x4,%esp
709: 6a 01 push $0x1
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
70b: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
70e: 50 push %eax
70f: 57 push %edi
710: e8 3d fd ff ff call 452 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
715: 0f b6 03 movzbl (%ebx),%eax
718: 83 c4 10 add $0x10,%esp
71b: 84 c0 test %al,%al
71d: 75 e1 jne 700 <printf+0x130>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
71f: 31 d2 xor %edx,%edx
721: e9 ff fe ff ff jmp 625 <printf+0x55>
726: 8d 76 00 lea 0x0(%esi),%esi
729: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
730: 83 ec 04 sub $0x4,%esp
733: 88 5d e5 mov %bl,-0x1b(%ebp)
736: 8d 45 e5 lea -0x1b(%ebp),%eax
739: 6a 01 push $0x1
73b: e9 4c ff ff ff jmp 68c <printf+0xbc>
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
740: 83 ec 0c sub $0xc,%esp
743: b9 0a 00 00 00 mov $0xa,%ecx
748: 6a 01 push $0x1
74a: e9 6b ff ff ff jmp 6ba <printf+0xea>
74f: 8b 5d d0 mov -0x30(%ebp),%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
752: 83 ec 04 sub $0x4,%esp
755: 8b 03 mov (%ebx),%eax
757: 6a 01 push $0x1
759: 88 45 e4 mov %al,-0x1c(%ebp)
75c: 8d 45 e4 lea -0x1c(%ebp),%eax
75f: 50 push %eax
760: 57 push %edi
761: e8 ec fc ff ff call 452 <write>
766: e9 5b ff ff ff jmp 6c6 <printf+0xf6>
76b: 66 90 xchg %ax,%ax
76d: 66 90 xchg %ax,%ax
76f: 90 nop
00000770 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
770: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
771: a1 70 0c 00 00 mov 0xc70,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
776: 89 e5 mov %esp,%ebp
778: 57 push %edi
779: 56 push %esi
77a: 53 push %ebx
77b: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
77e: 8b 10 mov (%eax),%edx
void
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
780: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
783: 39 c8 cmp %ecx,%eax
785: 73 19 jae 7a0 <free+0x30>
787: 89 f6 mov %esi,%esi
789: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
790: 39 d1 cmp %edx,%ecx
792: 72 1c jb 7b0 <free+0x40>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
794: 39 d0 cmp %edx,%eax
796: 73 18 jae 7b0 <free+0x40>
static Header base;
static Header *freep;
void
free(void *ap)
{
798: 89 d0 mov %edx,%eax
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
79a: 39 c8 cmp %ecx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
79c: 8b 10 mov (%eax),%edx
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
79e: 72 f0 jb 790 <free+0x20>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7a0: 39 d0 cmp %edx,%eax
7a2: 72 f4 jb 798 <free+0x28>
7a4: 39 d1 cmp %edx,%ecx
7a6: 73 f0 jae 798 <free+0x28>
7a8: 90 nop
7a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
break;
if(bp + bp->s.size == p->s.ptr){
7b0: 8b 73 fc mov -0x4(%ebx),%esi
7b3: 8d 3c f1 lea (%ecx,%esi,8),%edi
7b6: 39 d7 cmp %edx,%edi
7b8: 74 19 je 7d3 <free+0x63>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
7ba: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
7bd: 8b 50 04 mov 0x4(%eax),%edx
7c0: 8d 34 d0 lea (%eax,%edx,8),%esi
7c3: 39 f1 cmp %esi,%ecx
7c5: 74 23 je 7ea <free+0x7a>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
7c7: 89 08 mov %ecx,(%eax)
freep = p;
7c9: a3 70 0c 00 00 mov %eax,0xc70
}
7ce: 5b pop %ebx
7cf: 5e pop %esi
7d0: 5f pop %edi
7d1: 5d pop %ebp
7d2: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
7d3: 03 72 04 add 0x4(%edx),%esi
7d6: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
7d9: 8b 10 mov (%eax),%edx
7db: 8b 12 mov (%edx),%edx
7dd: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
7e0: 8b 50 04 mov 0x4(%eax),%edx
7e3: 8d 34 d0 lea (%eax,%edx,8),%esi
7e6: 39 f1 cmp %esi,%ecx
7e8: 75 dd jne 7c7 <free+0x57>
p->s.size += bp->s.size;
7ea: 03 53 fc add -0x4(%ebx),%edx
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
freep = p;
7ed: a3 70 0c 00 00 mov %eax,0xc70
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
p->s.size += bp->s.size;
7f2: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
7f5: 8b 53 f8 mov -0x8(%ebx),%edx
7f8: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
}
7fa: 5b pop %ebx
7fb: 5e pop %esi
7fc: 5f pop %edi
7fd: 5d pop %ebp
7fe: c3 ret
7ff: 90 nop
00000800 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
800: 55 push %ebp
801: 89 e5 mov %esp,%ebp
803: 57 push %edi
804: 56 push %esi
805: 53 push %ebx
806: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
809: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
80c: 8b 15 70 0c 00 00 mov 0xc70,%edx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
812: 8d 78 07 lea 0x7(%eax),%edi
815: c1 ef 03 shr $0x3,%edi
818: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
81b: 85 d2 test %edx,%edx
81d: 0f 84 a3 00 00 00 je 8c6 <malloc+0xc6>
823: 8b 02 mov (%edx),%eax
825: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
828: 39 cf cmp %ecx,%edi
82a: 76 74 jbe 8a0 <malloc+0xa0>
82c: 81 ff 00 10 00 00 cmp $0x1000,%edi
832: be 00 10 00 00 mov $0x1000,%esi
837: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
83e: 0f 43 f7 cmovae %edi,%esi
841: ba 00 80 00 00 mov $0x8000,%edx
846: 81 ff ff 0f 00 00 cmp $0xfff,%edi
84c: 0f 46 da cmovbe %edx,%ebx
84f: eb 10 jmp 861 <malloc+0x61>
851: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
858: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
85a: 8b 48 04 mov 0x4(%eax),%ecx
85d: 39 cf cmp %ecx,%edi
85f: 76 3f jbe 8a0 <malloc+0xa0>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
861: 39 05 70 0c 00 00 cmp %eax,0xc70
867: 89 c2 mov %eax,%edx
869: 75 ed jne 858 <malloc+0x58>
char *p;
Header *hp;
if(nu < 4096)
nu = 4096;
p = sbrk(nu * sizeof(Header));
86b: 83 ec 0c sub $0xc,%esp
86e: 53 push %ebx
86f: e8 56 fc ff ff call 4ca <sbrk>
if(p == (char*)-1)
874: 83 c4 10 add $0x10,%esp
877: 83 f8 ff cmp $0xffffffff,%eax
87a: 74 1c je 898 <malloc+0x98>
return 0;
hp = (Header*)p;
hp->s.size = nu;
87c: 89 70 04 mov %esi,0x4(%eax)
free((void*)(hp + 1));
87f: 83 ec 0c sub $0xc,%esp
882: 83 c0 08 add $0x8,%eax
885: 50 push %eax
886: e8 e5 fe ff ff call 770 <free>
return freep;
88b: 8b 15 70 0c 00 00 mov 0xc70,%edx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
891: 83 c4 10 add $0x10,%esp
894: 85 d2 test %edx,%edx
896: 75 c0 jne 858 <malloc+0x58>
return 0;
898: 31 c0 xor %eax,%eax
89a: eb 1c jmp 8b8 <malloc+0xb8>
89c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
8a0: 39 cf cmp %ecx,%edi
8a2: 74 1c je 8c0 <malloc+0xc0>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
8a4: 29 f9 sub %edi,%ecx
8a6: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
8a9: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
8ac: 89 78 04 mov %edi,0x4(%eax)
}
freep = prevp;
8af: 89 15 70 0c 00 00 mov %edx,0xc70
return (void*)(p + 1);
8b5: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
8b8: 8d 65 f4 lea -0xc(%ebp),%esp
8bb: 5b pop %ebx
8bc: 5e pop %esi
8bd: 5f pop %edi
8be: 5d pop %ebp
8bf: c3 ret
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
8c0: 8b 08 mov (%eax),%ecx
8c2: 89 0a mov %ecx,(%edx)
8c4: eb e9 jmp 8af <malloc+0xaf>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
8c6: c7 05 70 0c 00 00 74 movl $0xc74,0xc70
8cd: 0c 00 00
8d0: c7 05 74 0c 00 00 74 movl $0xc74,0xc74
8d7: 0c 00 00
base.s.size = 0;
8da: b8 74 0c 00 00 mov $0xc74,%eax
8df: c7 05 78 0c 00 00 00 movl $0x0,0xc78
8e6: 00 00 00
8e9: e9 3e ff ff ff jmp 82c <malloc+0x2c>
| 30.218853 | 91 | 0.418812 |
258bc8df8942d080db158f57b28531f6a6336063 | 325 | asm | Assembly | oeis/021/A021491.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/021/A021491.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/021/A021491.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A021491: Decimal expansion of 1/487.
; Submitted by Jon Maiga
; 0,0,2,0,5,3,3,8,8,0,9,0,3,4,9,0,7,5,9,7,5,3,5,9,3,4,2,9,1,5,8,1,1,0,8,8,2,9,5,6,8,7,8,8,5,0,1,0,2,6,6,9,4,0,4,5,1,7,4,5,3,7,9,8,7,6,7,9,6,7,1,4,5,7,9,0,5,5,4,4,1,4,7,8,4,3,9,4,2,5,0,5,1,3,3,4,7,0,2
add $0,1
mov $2,10
pow $2,$0
div $2,487
mov $0,$2
mod $0,10
| 29.545455 | 199 | 0.556923 |
670c55743ed91d03beeb43b0a838241c180246c6 | 4,269 | asm | Assembly | Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_856.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_856.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_856.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %rax
push %rbx
push %rdx
lea addresses_WT_ht+0x1cc89, %r13
nop
nop
sub %rbx, %rbx
mov (%r13), %rdx
nop
nop
mfence
pop %rdx
pop %rbx
pop %rax
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r8
push %r9
push %rax
push %rbp
push %rdx
// Store
lea addresses_WC+0xe849, %rbp
nop
nop
nop
nop
cmp $9398, %r9
mov $0x5152535455565758, %r8
movq %r8, (%rbp)
nop
nop
nop
nop
cmp $8836, %r10
// Faulty Load
lea addresses_US+0x142c9, %r11
nop
nop
nop
nop
cmp %rax, %rax
mov (%r11), %r8
lea oracles, %rdx
and $0xff, %r8
shlq $12, %r8
mov (%rdx,%r8,1), %r8
pop %rdx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_WC', 'same': False, 'AVXalign': False, 'congruent': 4}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'size': 8, 'NT': True, 'type': 'addresses_WT_ht', 'same': True, 'AVXalign': False, 'congruent': 5}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 54.037975 | 2,999 | 0.660342 |
d3fb997eb46ae6b6e7b48244722c0a112ad646c4 | 783 | asm | Assembly | 8086/9sort/movdatablock.asm | iamvk1437k/mpmc | 3640b29f29b3ffa78747b13b2ca8ac77c49695eb | [
"MIT"
] | 1 | 2022-01-01T11:27:43.000Z | 2022-01-01T11:27:43.000Z | 8086/9sort/movdatablock.asm | iamvk1437k/mpmc | 3640b29f29b3ffa78747b13b2ca8ac77c49695eb | [
"MIT"
] | null | null | null | 8086/9sort/movdatablock.asm | iamvk1437k/mpmc | 3640b29f29b3ffa78747b13b2ca8ac77c49695eb | [
"MIT"
] | null | null | null | ASSUME CS:CODE,DS:DATA
DATA SEGMENT
X DB 01H,02H,03H,04H,05H ; initializes data segments memory locations
DATA ENDS
CODE SEGMENT
START:MOV AX,DATA ; initialize ds to start of the memory
MOV DS,AX ; set aside for storing of data
MOV CX,05H ; load counter
LEA SI,X+04 ; SI pointer pointed to top of the memory block
LEA DI,X+04+05 ; 05 is displacement of non overlapping DI pointed to top of dest block
UP: MOV BL,[SI] ; move the SI content to BL register
MOV [DI],BL ; move the BL register to content of DI
DEC SI ; update si and di
DEC DI
DEC CX ; decrement the counter till it becomes zero
JNZ UP
MOV AH,4CH
INT 21H
CODE ENDS
END START | 39.15 | 99 | 0.616858 |
a0d393681255e901f74fa365bc94dc30de026361 | 533 | asm | Assembly | programs/oeis/315/A315563.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/315/A315563.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/315/A315563.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A315563: Coordination sequence Gal.5.320.2 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.
; 1,6,11,18,23,28,36,40,45,54,57,62,72,74,79,90,91,96,108,108,113,126,125,130,144,142,147,162,159,164,180,176,181,198,193,198,216,210,215,234,227,232,252,244,249,270,261,266,288,278
mov $5,$0
lpb $0
add $1,$0
mov $3,$0
mov $0,$1
div $1,3
sub $0,$1
sub $1,1
mov $2,$3
sub $2,1
lpe
mov $1,$2
add $1,1
mov $4,$5
mul $4,5
add $1,$4
mov $0,$1
| 25.380952 | 181 | 0.660413 |
3f3137a68de9a7a6eacb18dd69f41e74ec93254b | 238 | asm | Assembly | programs/oeis/016/A016812.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/016/A016812.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/016/A016812.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A016812: (4n)^12.
; 0,16777216,68719476736,8916100448256,281474976710656,4096000000000000,36520347436056576,232218265089212416,1152921504606846976,4738381338321616896,16777216000000000000,52654090776777588736
pow $0,12
mul $0,16777216
| 39.666667 | 190 | 0.865546 |
ff2c19b4ba8be6ccae44d2b3e2ffe42f3df3b87b | 314 | asm | Assembly | libsrc/_DEVELOPMENT/font/font_4x8/_zx7_font_4x8_64_nbot.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/font/font_4x8/_zx7_font_4x8_64_nbot.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/font/font_4x8/_zx7_font_4x8_64_nbot.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ;
; Font extracted from 64-4.tap
;
; Tap file downloaded from: http://mdfs.net/Software/Spectrum/Coding/Printout/
SECTION rodata_font
SECTION rodata_font_4x8
PUBLIC _zx7_font_4x8_64_nbot
PUBLIC _zx7_font_4x8_64_nbot_end
_zx7_font_4x8_64_nbot:
BINARY "font_4x8_64_nbot.bin.zx7"
_zx7_font_4x8_64_nbot_end:
| 18.470588 | 78 | 0.818471 |
a2fe7649eaa73e13d6c37ad9a55ec889885f0511 | 14,779 | asm | Assembly | MSDOS/Virus.MSDOS.Unknown.browse.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | 3 | 2021-05-15T15:57:13.000Z | 2022-03-16T09:11:05.000Z | MSDOS/Virus.MSDOS.Unknown.browse.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | null | null | null | MSDOS/Virus.MSDOS.Unknown.browse.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | 3 | 2021-05-15T15:57:15.000Z | 2022-01-08T20:51:04.000Z | ; BROWSE.ASM -- Full Screen File Pager
; ====================================
CSEG Segment
Assume CS:CSEG, DS:CSEG, ES:CSEG, SS:CSEG
Org 0080h
Parameter Label Byte
Org 0100h
Entry: Jmp Begin
; All Data
; --------
db 'ATTR='
Attribute db 0 ; Current screen attribute
db 'SHIFT='
ShiftHoriz db 8 ; Horizontal shift screen default
DosVersionFail db 'Requires DOS 2.0 or above$'
NoSpaceFail db 'Not enough memory$'
FileFail db 'File Not Found$'
ScreenFail db 'Unsupported video mode$'
Delimiters db 9,' ,;=/' ; Delimiters in parameter
FileHandle dw ? ; Use for saving file handle
WSMode db 0FFh ; AND value for non-WordStar mode
LineLength db ? ; Length of line (from BIOS)
NumberLines db 25,0 ; Number of lines (check EGA BIOS)
ScreenSize dw ? ; Size of screen in bytes
CheckRetrace db 1 ; Flag zero if EGA or MONO used
Addr6845 dw ? ; Could use for retrace check
ScreenAddr Label DWord ; Address of screen
ScreenOff dw 0 ; Higher for non-page 0
ScreenSeg dw 0B800h ; Set to B000h for Mono Mode 7
ScreenStart dw ? ; Points within buffer
EndOfFile dw ? ; Points within buffer
FileOffset dw -1, -1 ; Address within file of buffer data
HorizOffset dw 0 ; Horizontal offset for display
RightMargin dw 0 ; Right margin for offset display
Dispatch dw Home, Up, PgUp, Dummy, Left
dw Dummy, Right, Dummy, End, Down, PgDn
; Check DOS Version for 2.0 or above
; ----------------------------------
Begin: Cld ; All string directions forward
Mov AH,30h
Int 21h ; Get DOS Version Number
Cmp AL,2 ; Check for 2.0 or later
Jae DOSVerOK
Mov DX,Offset DOSVersionFail
ErrorExit: Mov AH,9 ; Write error message
Int 21h
Int 20h
; Parse Command Line to get File Name and WordStar flag
; -----------------------------------------------------
DOSVerOK: Mov SI,1 + Offset Parameter ; Points to parameter
NameSearch: Lodsb ; Get byte
Cmp AL,13 ; Check if carriage return
Jz NoFileFound ; If so, no file name
Mov DI,Offset Delimiters ; String of delimiters
Mov CX,5 ; Number of delimiters (no /)
Repne Scasb ; See if a match
Je NameSearch ; If a delimiter, keep looking
Mov DX,SI ; Otherwise found file name
Dec DX ; Points to beginning of it
EndSearch: Lodsb ; Get next byte
Cmp AL,13 ; See if carriage return
Je GotFileEnd ; If so, we're all done
Mov DI,Offset Delimiters ; String of delimiters
Mov CX,6 ; Number (including /)
Repne Scasb ; See if a match
Jne EndSearch ; If not, still in file name
Mov Byte Ptr [SI - 1],0 ; If so, mark end of file name
Jcxz GotFlag ; If slash, check for W
Jmp EndSearch ; Or continue flag search
GotFlag: Lodsb ; Get byte after / flag
Or AL,20h ; Uncapitalize
Cmp AL,'w' ; See if w for WordStar mode
Jnz GotFileEnd ; If not, just ignore it
Mov [WSMode],7Fh ; AND value for WordStar
; Open the File
; -------------
GotFileEnd: Mov Byte Ptr [SI - 1],0 ; Mark end of file name
; DX still points to name
Mov AX,3D00h ; Open file for reading
Int 21h ; by calling DOS
Jnc GotTheFile ; If no error, continue
NoFileFound: Mov DX,Offset FileFail ; Otherwise print a message
Jmp ErrorExit
GotTheFile: Mov [FileHandle],AX ; Save the file handle
; Get Screen Mode Information from BIOS Data Area
; -----------------------------------------------
Push ES ; Save register
Sub AX,AX
Mov ES,AX ; Set ES to 0 (BIOS Data)
Mov AL,ES:[0449h] ; Current Video Mode
Cmp AL,3 ; Check if Color Alpha
Jbe DisplayOK ; Continue if so
Cmp AL,7 ; Check if monochrome display
Je Monochrome ; If so, branch
Mov DX,Offset ScreenFail ; We can't handle graphics
Jmp ErrorExit ; So print an error message
Monochrome: Mov [ScreenSeg],0B000h ; Use Monochrome Segment
Mov [CheckRetrace],0 ; Don't have to check retrace
DisplayOK: Mov AL,ES:[044Ah] ; Number of Columns
Mov [LineLength],AL ; Save it
Mov AX,ES:[044Eh] ; Offset into screen buffer
Mov [ScreenOff],AX ; Save it
Mov AX,ES:[0463h] ; Address of 6845 Regsiter
Mov [Addr6845],AX ; Save it
Push ES
Sub DL,DL ; Set Rows to zero first
Sub BH,BH
Mov AX,1130h ; EGA BIOS: Get Information
Int 10h
Pop ES
Or DL,DL ; Check if DL is still zero
Jz NoEGA ; If so, skip rest of stuff
Inc DL
Mov [NumberLines],DL ; Save Number of Lines
Test Byte Ptr ES:[0487h],4 ; Check if must check retrace
Jnz NoEGA
Mov [CheckRetrace],0 ; EGA says we don't have to
NoEGA: Mov BH,ES:[0462h] ; Get Current Page (use later)
Pop ES
Mov AL,[LineLength] ; Length of each line
Mul [NumberLines] ; Total chars on screen
Add AX,AX ; Double for attributes
Mov [ScreenSize],AX ; And Save it
; See if enough memory is left
; ----------------------------
Add AX,Offset ScreenHold ; Add ScreenSize to code end
Add AX,256 ; Add a little stack room
Cmp AX,SP ; Check against stack pointer
Jbe GotEnufMemory ; Continue if OK
Mov DX,Offset NoSpaceFail ; Otherwise end program
Jmp ErrorExit ; with error messae
; Get Current Screen Attribute
; ----------------------------
GotEnufMemory: Cmp [Attribute],0 ; Check if attribute pre-set
Jnz GotAttribute ; If so, move on
Mov DL,' ' ; Write out a byte
Mov AH,2 ; using DOS
Int 21h
Mov AL,8 ; Now backspace
Mov AH,14 ; using BIOS call
Int 10h
Mov AH,8 ; Read character & attribute
Int 10h ; using BIOS call (BH = pg)
Mov [Attribute],AH ; And save attribute
; Save Current Screen
; -------------------
GotAttribute: Mov DX,Offset Terminate ; Set Ctrl-Break exit
Mov AX,2523h ; to terminate that way
Int 21h
Mov DI,Offset ScreenHold ; Destination of screen
Mov CX,[ScreenSize] ; Size of screen
Push DS ; Save Source Segment
Lds SI,[ScreenAddr] ; Get screen address
Rep Movsb ; Move in the bytes
Pop DS ; Restore Source Segment
; Get Keyboard Key and Decide on Action
; -------------------------------------
Call Home ; Read file in
Mov [ScreenStart],SI ; Set buffer address
KeyLoop: Call UpDateScreen ; Write file to screen
GetKey: Mov AH,8 ; Get key
Int 21h ; by calling DOS
Cmp AL,27 ; Check if ESC
Je Terminate ; If so, terminate
Cmp AL,0 ; Check if extended
Jnz GetKey ; If not, try again
Mov AH,8 ; Get extended code
Int 21h ; by calling DOS
Sub AL,71 ; Subtract Home key value
Jb GetKey ; If below that, not valid
Cmp AL,(81 - 71) ; Check if above PgDn
Ja GetKey ; If so, ignore it
Sub AH,AH ; Zero out top byte
Add AX,AX ; Double for word access
Mov BX,AX ; Offset in dispatch table
Mov SI,[ScreenStart] ; Set current buffer pointer
Call [Dispatch + BX] ; Do the call
Mov [ScreenStart],SI ; Set new buffer pointer
Jmp KeyLoop ; And update the screen
; Terminate -- Restore screen and close file
; ------------------------------------------
Terminate: Mov SI,Offset ScreenHold ; Address of Saved Screen
Les DI,[ScreenAddr] ; Address of Display
Mov CX,[ScreenSize] ; Number of characters
Rep Movsb ; Move them back
Mov BX,[FileHandle] ; Get File Handle
Mov AH,3Eh ; Close File
Int 21h
Int 20h ; Terminate
; Cursor Key Routines -- Home Key
; -------------------------------
Home: Sub BX,BX ; For zeroing out values
Mov AX,[FileOffset] ; Check if read in file
Or AX,[FileOffset + 2]
Mov [FileOffset],BX ; Zero out file address
Mov [FileOffset + 2],BX
Mov [HorizOffset],BX ; Zero out horizontal offset
Mov SI,Offset Buffer ; Reset buffer pointer
Jz Dummy ; Skip file read if in already
Mov DX,Offset Buffer ; Area to read file in
Mov CX,32768 ; Number of bytes to read
Call FileRead ; Read in file
Dummy: Ret
; Up and PgUp Keys
; ----------------
Up: Call GetPrevChar ; Get previous char in buffer
Jc UpDone ; If none available, finish
UpLoop: Call GetPrevChar ; Get previous char again
Jc UpDone ; if none, we're done
Cmp AL,10 ; Check if line feed
Jnz UpLoop ; If not, try again
Call GetNextChar ; Get char after line feed
UpDone: Ret
PgUp: Mov CX,Word Ptr [NumberLines] ; Number of lines
PgUpLoop: Call Up ; Do UP that many times
Loop PgUpLoop
Ret
; Left and Right Keys
; -------------------
Left: Mov [HorizOffset],0 ; Reset Horizontal Offset
Ret
Right: Mov AL,[ShiftHoriz] ; Get places to shift
Sub AH,AH
Add [HorizOffset],AX ; Move that many right
Ret
; End, Down, and PgDn Keys
; ------------------------
End: Mov BX,SI ; Save buffer pointer
Call PgDn ; Go page down
Cmp BX,SI ; Check if we did so
Jnz End ; If so, do it again
Ret
Down: Call GetNextChar ; Get next character
Jc NoMoreDown ; If no more, we're done
DownLoop: Call GetNextChar ; Get one again
Jc UpLoop ; If no more, find prev LF
Cmp AL,10 ; See if line feed
Jnz DownLoop ; If not, continue
NoMoreDown: Ret
PgDn: Mov CX,Word Ptr [NumberLines] ; Number of lines
PgDnLoop: Call Down ; Do DOWN that many times
Loop PgDnLoop
Ret
; Update Screen
; -------------
UpdateScreen: Push ES
Mov SI,[ScreenStart] ; Address of data in buffer
Les DI,[ScreenAddr] ; Address of display
Mov CX,ScreenSize ; Number of bytes in screen
Shr CX,1 ; Half for number of chars
Mov AL,' ' ; Will blank screen
Mov AH,[Attribute] ; With screen attribute
Rep Stosw ; Blank it
Mov AL,[LineLength] ; Length of display line
Sub AH,AH
Add AX,[HorizOffset] ; Add Horizontal Offset
Mov [RightMargin],AX ; That's right display margin
Sub DL,DL ; Line Number
LineLoop: Sub BX,BX ; Column Number
Mov AL,[LineLength] ; Use Line Length
Mul DL ; and Line Number
Add AX,AX ; to recalculate
Mov DI,AX ; display destination
Add DI,[ScreenOff] ; Add beginning address
CharLoop: Call GetNextChar ; Get next character
Jc EndOfScreen ; If no more, we're done
And AL,[WSMode] ; Will be 7Fh for WordStar
Cmp AL,13 ; Check for carriage return
Je CharLoop ; Do nothing if so
Cmp AL,10 ; Check for line feed
Je LineFeed ; Do routine if so
Cmp AL,9 ; Check for tab
Je Tab ; Do routine if so
Mov CX,1 ; Just 1 char to display
PrintChar: Cmp BX,[HorizOffset] ; See if we can print it
Jb NoPrint
Cmp BX,[RightMargin] ; See if within margin
Jae NoPrint
Mov AH,[Attribute] ; Attribute for display
Cmp [CheckRetrace],0 ; See if must stop snow
Jz WriteIt ; If not, skip retrace wait
Push BX
Push DX
Mov BX,AX ; Save character and attribute
Mov DX,[Addr6845] ; Set up I/O address
Add DX,6
RetraceWait1: In AL,DX ; Check until
Shr AL,1 ; vertical retrace
Jc RetraceWait1 ; ends
Cli ; Clear interrupts
RetraceWait2: In AL,DX ; Check until
Shr AL,1 ; vertical retrace
Jnc RetraceWait2 ; begins
Mov AX,BX ; Get back character & attr
Stosw ; Write to display
Sti ; Enable interrupts again
Pop DX
Pop BX
Jmp Short NoPrint ; Skip around "no snow" write
WriteIt: Stosw ; Write without retrace wait
NoPrint: Inc BX ; Bump up line counter
Loop PrintChar ; Do it CX times
Jmp CharLoop ; Then go back to top
Tab: Mov AX,BX ; Current column number
And AX,07h ; Take lower three bits
Mov CX,8
Sub CX,AX ; Subtract from 8
Mov AL,' ' ; Will print CX blanks
Jmp PrintChar
LineFeed: Inc DL ; Next line
Cmp DL,[NumberLines] ; See if down at bottom
Jb LineLoop ; If not, continue
EndOfScreen: Pop ES ; All done -- leave
Ret
; Get Next Character from buffer
; ------------------------------
; (Input is SI pointing to buffer, Returns AL, CY if no more)
GetNextChar: Cmp SI,[EndOfFile] ; See if at end of file
Jae NoMoreNext ; If so, no more chars
Cmp SI,Offset BufferEnd ; See if at end of buffer
Jb CanGetNext ; If not, just get character
Push CX ; Otherwise save registers
Push DX
Push DI
Push ES
Push DS ; Set ES to DS
Pop ES ; (could be different)
Mov SI,Offset BufferMid ; Move 2nd buffer half
Mov DI,Offset Buffer ; to 1st buffer half
Mov CX,16384
Sub [ScreenStart],CX ; New buffer pointer
Rep Movsb ; Move them
Mov SI,DI ; SI also buffer pointer
Add [FileOffset],32768 ; Adjust file addr to read
Adc [FileOffset + 2],0
Mov DX,Offset BufferMid ; Place to read file
Mov CX,16384 ; Number of bytes
Call FileRead ; Read the file
Sub [FileOffset],16384 ; Now adjust so reflects
Sbb [FileOffset + 2],0 ; 1st half of buffer
Pop ES ; Get back registers
Pop DI
Pop DX
Pop CX
Jmp GetNextChar ; And try again to get char
CanGetNext: Lodsb ; Get the character
NoMoreNext: Cmc ; So CY set if no more
Ret
; Get Previous Character from buffer
; ----------------------------------
GetPrevChar: Cmp SI,Offset Buffer ; See if at top of buffer
Ja CanGetPrev ; If not, just get character
Mov AX,[FileOffset] ; See if at top of file
Or AX,[FileOffset + 2]
Jz AtTopAlready ; If so, can't get anymore
Push CX ; Save some registers
Push DX
Mov SI,Offset Buffer ; Move 1st half of buffer
Mov DI,Offset BufferMid ; to 2nd half of buffer
Mov CX,16384
Add [ScreenStart],CX ; New buffer pointer
Rep Movsb ; Do the move
Sub [FileOffset],16384 ; Adjust file addr for read
Sbb [FileOffset + 2],0
Mov DX,Offset Buffer ; Area to read file into
Mov CX,16384 ; Number of bytes
Call FileRead ; Read the file
Pop DX ; Get back registers
Pop CX
Jmp Short CanGetPrev ; Now get character
AtTopAlready: Stc ; CY flag set for no more
Ret
CanGetPrev: Dec SI ; Move pointer back
Mov AL,[SI] ; Get the character
Clc ; CY flag reset for success
Ret
; Read CX bytes from the file into DX buffer
; ------------------------------------------
FileRead: Push AX ; Save some registers
Push BX
Push CX
Push DX
Mov [EndOfFile],-1 ; Initialize this
Mov DX,[FileOffset] ; Get file address to read
Mov CX,[FileOffset + 2]
Mov BX,[FileHandle] ; Get file Handle
Sub AL,AL ; Do LSEEK from beginning
Mov AH,42h ; LSEEK call
Int 21h
Pop DX ; Get back destination
Pop CX ; Get back count
Mov AH,3Fh ; Read file function call
Int 21h
Jnc NoReadError ; If no error, continue
Sub AX,AX ; Otherwise read zero bytes
NoReadError: Cmp AX,CX ; See if 32K has been read
Je GotItAll ; If so, we're home free
Add AX,DX ; Otherwise add to buffer addr
Mov [EndOfFile],AX ; And save as end of file
GotItAll: Pop BX
Pop AX
Ret
; File Buffer and Screen Hold Areas
; ---------------------------------
Buffer Label Byte ; Area for file reads
BufferMid equ Buffer + 16384 ; Halfway through it
BufferEnd equ BufferMid + 16384 ; At end of it
ScreenHold equ BufferEnd ; Area for holding screen
CSEG EndS ; End of segment
End Entry ; Denotes entry point
| 32.552863 | 94 | 0.654442 |
33d113c8913ead01f49f15029954aeb46374fce1 | 12,057 | asm | Assembly | firmware/coreboot/3rdparty/blobs/cpu/amd/geode_lx/gplvsa_ii/sysmgr/sw_int.asm | fabiojna02/OpenCellular | 45b6a202d6b2e2485c89955b9a6da920c4d56ddb | [
"CC-BY-4.0",
"BSD-3-Clause"
] | 1 | 2019-11-04T07:11:25.000Z | 2019-11-04T07:11:25.000Z | firmware/coreboot/3rdparty/blobs/cpu/amd/geode_lx/gplvsa_ii/sysmgr/sw_int.asm | fabiojna02/OpenCellular | 45b6a202d6b2e2485c89955b9a6da920c4d56ddb | [
"CC-BY-4.0",
"BSD-3-Clause"
] | 13 | 2018-10-12T21:29:09.000Z | 2018-10-25T20:06:51.000Z | firmware/coreboot/3rdparty/blobs/cpu/amd/geode_lx/gplvsa_ii/sysmgr/sw_int.asm | fabiojna02/OpenCellular | 45b6a202d6b2e2485c89955b9a6da920c4d56ddb | [
"CC-BY-4.0",
"BSD-3-Clause"
] | null | null | null | ;
; Copyright (c) 2006-2008 Advanced Micro Devices,Inc. ("AMD").
;
; This library is free software; you can redistribute it and/or modify
; it under the terms of the GNU Lesser General Public License as
; published by the Free Software Foundation; either version 2.1 of the
; License, or (at your option) any later version.
;
; This code is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
; Lesser General Public License for more details.
;
; You should have received a copy of the GNU Lesser General
; Public License along with this library; if not, write to the
; Free Software Foundation, Inc., 59 Temple Place, Suite 330,
; Boston, MA 02111-1307 USA
;
;********************************************************************************
;* Implementation of BIOS callbacks
;********************************************************************************
include SYSMGR.INC
include VSA2.INC
include SMIMAC.MAC
include GX2.INC
include ISA.INC
.model tiny,c
.586p
.ALPHA
DGROUP GROUP _CODE, _TEXT
_CODE SEGMENT PUBLIC use16 'CODE'
ASSUME DS:_CODE
public VSM_Buffer
SMINT_SEGMENT equ 0E000h ; Segment to store SMINT instruction & ISR stack
ALLOW_SMM_SEGMENTS equ 0 ; 1 = ES segment allowed to point to SMM memory
externdef pascal Report_VSM_Error: proc
externdef pascal Schedule_VSM: proc
externdef Sys_Exit: proc
externdef pascal Hex_8: proc
externdef pascal Hex_16: proc
externdef pascal Hex_32: proc
externdef BracketFlag: byte
externdef SchedulerStack: word
externdef INT_Vectors: dword
externdef Current_VSM: dword
externdef StartSaveArea: dword
externdef EndSaveArea: dword
externdef SysMgr_VSM: dword
externdef Header_Addr: dword
externdef SMM_Header: SmiHeader
;************************************************************************
; Implements the SYS_STATE macro
;
; Input:
; CX = Flag: 0 = Save 1 = Restore
; EDI = Offset to VSM's register buffer
; DS = System Manager's data segment
;************************************************************************
Sys_State proc
cld
mov eax, [Current_VSM] ; Create flat ptr to calling VSM
add edi, eax
push eax ; Re-schedule the calling VSM
call Schedule_VSM
lea esi, [StartSaveArea]
add esi, [SysMgr_VSM]
jcxz CopyState ; Save or Restore ?
xchg esi, edi ; Restore
; Copy the non-SMM state
CopyState:
mov ecx, OFFSET EndSaveArea
sub cx, OFFSET StartSaveArea
shr cx, 1
rep movsw [edi], fs:[esi]
jmp Sys_Exit
Sys_State endp
;************************************************************************
; Implements the SYS_SW_INTERRUPT macro
;
; Input:
; EBX = 4 * INT number
; ECX = Offset to VSM's register buffer
;************************************************************************
Sys_SW_INT proc
cld
mov esi, [Current_VSM]
push esi ; Re-schedule the calling VSM
call Schedule_VSM
cmp bx, 4*MAX_INT ; Validate INT vector
ja Unsupported_INT
mov edx, [INT_Vectors+bx]
or edx, edx
jz Illegal_INT
mov [Saved_INT], ebx ; Save current vector &
mov edi, edx ; patch with the original vector
xchg fs:[ebx], edi
mov [Saved_Vector], edi
xor edi, edi ; Don't allow calling VSM to execute
push edi
call Schedule_VSM
ASSUME di:PTR VSM_Header ; Mark the requesting VSM blocked
mov gs:[di].SysStuff.RunFlag, RUN_FLAG_BLOCKED
; Handle PIC masks
in al, PIC1_MASK ; Save PIC masks & set user-defined masks
mov ah, al
in al, PIC2_MASK
mov [Saved_PIC], ax
ASSUME di:PTR INT_REGS
mov di, cx
mov ax, word ptr gs:[di].PIC0_Mask
not ax ; PIC masks are 0=enable
cmp ah, 0FFh ; Any PIC1 IRQs enabled ?
je short SetPIC
and al, NOT 04h ; Yes, enable IRQ2
SetPIC:
or al, 01h ; Always disable IRQ0
out PIC1_MASK, al
mov al, ah
out PIC2_MASK, al
cmp ax, 0FFFFh ; Are any IRQs enabled ?
je short RealMode
or gs:[di].Flags, EFLAGS_IF ; Yes, enable interrupts
;
; Initialize real-mode state
;
RealMode:
mov ax, gs:[di].Reg_ES ; Set up ES descriptor
push OFFSET BIOS_ES
call Set_Descriptor
mov ax, gs:[di].Reg_DS ; Set up DS descriptor
push OFFSET BIOS_DS
call Set_Descriptor
add esi, ecx ; Create flat ptr to calling VSM's registers
mov [VSM_Buffer], esi
ASSUME di:PTR SmiHeader
lea edi, [BIOS_Header] ; Set up CS descriptor & Next_EIP
mov word ptr [di].SS_Flags, DATA_ATTR
mov [di].SMI_Flags, SMI_FLAGS_CS_WRITABLE + SMI_FLAGS_CS_READABLE
mov word ptr [di].Next_EIP, dx ; IP
shr edx, 16 ; Convert segment to linear address
mov [di]._CS.selector, dx ; CS selector
shl edx, 4
mov [di]._CS.base, edx ; CS descriptor
mov [di]._CS.limit, 0FFFFh
mov [di]._CS.attr, CODE_ATTR ; CS attribute
mov eax, CR0 ; Preserve the CD & NW bits
and eax, 60000000h
or eax, VSM_CR0
mov [di].r_CR0, eax
if ALLOW_SMM_SEGMENTS
mov ecx, MSR_RCONF_SMM ; Make SMM memory writeable by interrupt code
rdmsr
mov [OldRCONF], al
and al, NOT REGION_WP
wrmsr
endif
ASSUME DI: NOTHING
mov ecx, 1000002Ch ; Save P2D_SC value & make UMBs R/W
rdmsr
mov [ShadowMSR], dx
or dx, 0FFFFh
wrmsr
mov ebx, SMINT_SEGMENT ; Patch SS descriptor
mov word ptr [BIOS_SS+8], bx
shl ebx, 4
mov dword ptr [BIOS_SS+2], ebx
mov byte ptr [BIOS_SS+5], DATA_ATTR
add ebx, 0FFF0h
mov [ShadowAddr], ebx
mov word ptr [BIOS_ESP], bx
; Build a stack frame:
; SMINT_SEGMENT:FFF0 SMINT_SEGMENT:FFF6 - return addresss
; SMINT_SEGMENT:FFF4 Flags
; SMINT_SEGMENT:FFF6 SMINT instruction
mov eax, SMINT_SEGMENT SHL 16 ; Segment
lea ax, [bx+6] ; Offset (SP+6)
xchg eax, dword ptr fs:[ebx]
mov [ShadowMemory], eax
mov eax, 380F0000h ; FLAGS & SMINT
xchg eax, fs:[ebx+4]
mov [ShadowMemory+4], eax
mov eax, [Header_Addr] ; Copy top-level header address
mov [Hdr_Address], eax
call VSM_Registers ; Get registers for ISR
call Swap_States ; S wap top-level state with BIOS state
Exit: jmp Sys_Exit
Unsupported_INT:
Illegal_INT:
mov ax, ERR_BAD_INTERRUPT
push ax ; Push error code
shr ebx, 2
push ebx ; Info1 = Interrupt #
push dword ptr 0 ; Info2 = 0x00000000
call Report_VSM_Error
jmp Exit
Sys_SW_INT endp
;********************************************************************************
; Returns here from INT callback
;********************************************************************************
INT_Return proc
mov ebx, [Saved_INT] ; Restore the INT vector
mov edx, [Saved_Vector]
mov fs:[ebx], edx
if ALLOW_SMM_SEGMENTS
mov ecx, MSR_RCONF_SMM ; Restore SMM region properties
rdmsr
mov al, [OldRCONF]
wrmsr
endif
mov esi, [Current_VSM] ; Mark the requesting VSM ready to run
mov fs:(VSM_Header PTR [esi]).SysStuff.RunFlag, RUN_FLAG_READY
call Swap_States ; Restore the original non-SMM state
call VSM_Registers ; Return register values & flags
xor eax, eax
mov [VSM_Buffer], eax
sub [SchedulerStack], 4 ; Pop the scheduler sentinel
mov ebx, [ShadowAddr] ; Restore shadow memory
mov eax, [ShadowMemory]
mov fs:[ebx], eax
mov eax, [ShadowMemory+4]
mov fs:[ebx+4], eax
mov ecx, 1000002Ch ; Restore R/W attributes of UMBs
rdmsr
mov dx, [ShadowMSR]
wrmsr
mov ax, [Saved_PIC] ; Restore PIC masks
out PIC2_MASK, al
mov al, ah
out PIC1_MASK, al
ret
INT_Return endp
;************************************************************************
; Swaps the top-level state with the BIOS callback state.
; Info to be saved:
; - SMM header & pointer
; - Descriptors
; - GP registers
; - IDT ptr
; - PCI config address
;************************************************************************
Swap_States proc
lea si, [StartSaveArea] ; Swap thread states
lea di, [Saved_State]
mov cx, OFFSET EndSaveArea ; Compute # dwords of state
sub cx, si
shr cx, 2
StateLoop:
lodsd ; Exchange a dword
xchg [di], eax
mov dword ptr [si-4], eax
add di, 4
loop StateLoop
lea si, [SMM_Header] ; Now do the top-level SMM header
lea di, [BIOS_Header]
mov cl, sizeof(SmiHeader)/4
Hdr_Loop:
lodsd
xchg [di], eax
mov [si-4], eax
add di, 4
loop Hdr_Loop
ret
Swap_States endp
;************************************************************************
; Swaps the VSM's registers with the local state
;************************************************************************
VSM_Registers proc
mov esi, [VSM_Buffer] ; Caller's register buffer
mov ax, word ptr [BIOS_Header].EFLAGS
xchg fs:(INT_REGS PTR [esi]).Flags, ax
mov word ptr [BIOS_Header].EFLAGS, ax
lea bx, [Reg_Table]
mov cx, (End_Reg_Table-Reg_Table)/2
Reg_Loop:
mov di, [bx] ; Get offset of register
mov eax, [di] ; Swap with register structure
xchg eax, fs:[esi]
mov [di], eax
add bx, 2 ; Increment ptrs
add esi, 4
loop Reg_Loop
ret
; This table translates between a INT_REGS structure and the PUSHA/POPA ordering
Reg_Table:
dw OFFSET BIOS_EAX
dw OFFSET BIOS_EBX
dw OFFSET BIOS_ECX
dw OFFSET BIOS_EDX
dw OFFSET BIOS_EBP
dw OFFSET BIOS_ESI
dw OFFSET BIOS_EDI
End_Reg_Table:
VSM_Registers endp
;************************************************************************
; Sets a descriptor to a real-mode descriptor
; Input:
; AX = selector
; If selector = 0x0000, a 4 GB descriptor (big-real) is used
; If selector = 0xFFFF, the calling VSM's base/limit is used
; DI = ptr to descriptor
;************************************************************************
Set_Descriptor proc pascal uses di \
DescrPtr: PTR Descriptor
ASSUME di: PTR Descriptor
mov di, [DescrPtr]
mov ebx, 0FFFFh ; 64K limit
or ax, ax ; Selector = 0000h?
jnz short SetSelector
mov ebx, 008FFFFFh ; Yes, then use 4 GB limit (big-real mode)
SetSelector:
movzx eax, ax
mov [di].selector, ax
shl eax, 4
if ALLOW_SMM_SEGMENTS
; If ES == 0xFFFF, use VSM's base
cmp ax, bx
jne short Set_Limit
mov eax, [Current_VSM] ; No, use VSM's base & limit
mov bx, ax
shr bx, 4
mov [di].selector, bx
mov ebx, (VSM_Header PTR fs:[eax]).DS_Limit
endif
Set_Limit:
; EAX = base
; EBX = limit
mov [di].limit_15_0, bx ; Store 24-bit limit
shr ebx, 16
mov [di].limit_19_16, bl
mov [di].base_15_0, ax ; Store 32-bit base
shr eax, 16
mov [di].base_23_16, al
mov [di].base_31_24, ah
ret
ASSUME di: NOTHING
Set_Descriptor endp
align 4
Saved_State:
;******************************************************************************
; The following must match the structure at StartSaveArea in SYSMGR.ASM
BIOS_PCI dd 80000000h
BIOS_EDI dd 0
BIOS_ESI dd 0
BIOS_EBP dd 0
dd 0 ; ESP (not used)
BIOS_EBX dd 0
BIOS_EDX dd 0
BIOS_ECX dd 0
BIOS_EAX dd 0
BIOS_ESP dd 0
BIOS_SS Descriptor {0FFFFh, 0, 0, DATA_ATTR, 0, 0, 0}
BIOS_DS Descriptor {0FFFFh, 0, 0, DATA_ATTR, 0, 0, 0}
BIOS_ES Descriptor {0FFFFh, 0, 0, DATA_ATTR, 0, 0, 0}
BIOS_FS Descriptor {0FFFFh, 0, 0, DATA_ATTR, 0, 0, 0}
BIOS_GS Descriptor {0FFFFh, 0, 0, DATA_ATTR, 0, 0, 0}
Hdr_Address dd 0
IDT_Selector dd 00920000h
IDT_Base dd 00000000h
IDT_Limit dd 0000FFFFh
dw 0 ; Pad
;******************************************************************************
SMM_CONTROL equ EXTL_SMI_EN + INTL_SMI_EN + SMM_INST_EN + NEST_SMI_EN
BIOS_Header SmiHeader {,SMM_CONTROL,,,,,,,,,VSM_CR0, VSM_EFLAGS, VSM_DR7}
ShadowMemory dd 0, 0
ShadowAddr dd 0
ShadowMSR dw 0
VSM_Buffer dd 0
Saved_PIC dw 0
Saved_INT dd 0
Saved_Vector dd 0
OldRCONF db 0
_CODE ENDS
END
| 23.970179 | 82 | 0.604711 |
bdda61ae4b5d9478b17a8745dc68803580287b55 | 74,687 | asm | Assembly | ggsound_ca65/ggsound.asm | cacciatc/ggsound | c91c403264db32b0380a34c5f8813e1cf828dcda | [
"Unlicense"
] | 1 | 2019-03-24T20:17:19.000Z | 2019-03-24T20:17:19.000Z | ggsound_ca65/ggsound.asm | Bananattack/ggsound | c91c403264db32b0380a34c5f8813e1cf828dcda | [
"Unlicense"
] | 4 | 2020-04-29T19:16:59.000Z | 2020-09-16T22:03:33.000Z | ggsound_ca65/ggsound.asm | cacciatc/ggsound | c91c403264db32b0380a34c5f8813e1cf828dcda | [
"Unlicense"
] | 1 | 2020-04-29T19:01:13.000Z | 2020-04-29T19:01:13.000Z | .linecont +
.include "ggsound.inc"
.segment "ZEROPAGE"
sound_region: .res 1
sound_disable_update: .res 1
sound_local_byte_0: .res 1
sound_local_byte_1: .res 1
sound_local_byte_2: .res 1
sound_local_word_0: .res 2
sound_local_word_1: .res 2
sound_local_word_2: .res 2
sound_param_byte_0: .res 1
sound_param_byte_1: .res 1
sound_param_byte_2: .res 1
sound_param_word_0: .res 2
sound_param_word_1: .res 2
sound_param_word_2: .res 2
sound_param_word_3: .res 2
base_address_instruments: .res 2
base_address_note_table_lo: .res 2
base_address_note_table_hi: .res 2
.ifdef FEATURE_DPCM
base_address_dpcm_sample_table: .res 2
base_address_dpcm_note_to_sample_index: .res 2
base_address_dpcm_note_to_sample_length: .res 2
base_address_dpcm_note_to_loop_pitch_index: .res 2
.endif
apu_data_ready: .res 1
apu_square_1_old: .res 1
apu_square_2_old: .res 1
.ifdef FEATURE_DPCM
apu_dpcm_state: .res 1
.endif
song_list_address: .res 2
sfx_list_address: .res 2
song_address: .res 2
apu_register_sets: .res MAX_MUSIC_STREAMS*4
.segment "BSS"
stream_flags: .res MAX_STREAMS
stream_note: .res MAX_STREAMS
stream_note_length_lo: .res MAX_STREAMS
stream_note_length_hi: .res MAX_STREAMS
stream_note_length_counter_lo: .res MAX_STREAMS
stream_note_length_counter_hi: .res MAX_STREAMS
stream_instrument_index: .res MAX_STREAMS
stream_volume_offset: .res MAX_STREAMS
.ifdef FEATURE_ARPEGGIOS
stream_arpeggio_offset: .res MAX_STREAMS
.endif
stream_pitch_offset: .res MAX_STREAMS
stream_duty_offset: .res MAX_STREAMS
stream_channel: .res MAX_STREAMS
stream_channel_register_1: .res MAX_STREAMS
stream_channel_register_2: .res MAX_STREAMS
stream_channel_register_3: .res MAX_STREAMS
stream_channel_register_4: .res MAX_STREAMS
stream_read_address_lo: .res MAX_STREAMS
stream_read_address_hi: .res MAX_STREAMS
stream_return_address_lo: .res MAX_STREAMS
stream_return_address_hi: .res MAX_STREAMS
stream_tempo_counter_lo: .res MAX_STREAMS
stream_tempo_counter_hi: .res MAX_STREAMS
stream_tempo_lo: .res MAX_STREAMS
stream_tempo_hi: .res MAX_STREAMS
.segment "CODE"
;Expects sound_param_byte_0 to contain desired region (SOUND_REGION_NTSC, SOUND_REGION_PAL, SOUND_REGION_DENDY)
;Expects sound_param_word_0 to contain song list address.
;Expects sound_param_word_1 to contain sfx list address.
;Expects sound_param_word_2 to contain instrument list address.
;If FEATURE_DPCM is defined, then
;Expects sound_param_word_3 to contain dpcm sample address.
.proc sound_initialize
lda #1
sta sound_disable_update
lda sound_param_byte_0
sta sound_region
;Get songs address.
lda sound_param_word_0
sta song_list_address
lda sound_param_word_0+1
sta song_list_address+1
;Get sfx address.
lda sound_param_word_1
sta sfx_list_address
lda sound_param_word_1+1
sta sfx_list_address+1
;Get instruments address.
lda sound_param_word_2
sta base_address_instruments
lda sound_param_word_2+1
sta base_address_instruments+1
.ifdef FEATURE_DPCM
;Get dpcm samples list.
ldy #0
lda (sound_param_word_3),y
sta base_address_dpcm_sample_table
iny
lda (sound_param_word_3),y
sta base_address_dpcm_sample_table+1
;Get dpcm note to sample index table.
iny
lda (sound_param_word_3),y
sta base_address_dpcm_note_to_sample_index
iny
lda (sound_param_word_3),y
sta base_address_dpcm_note_to_sample_index+1
;Get dpcm note to sample length table.
iny
lda (sound_param_word_3),y
sta base_address_dpcm_note_to_sample_length
iny
lda (sound_param_word_3),y
sta base_address_dpcm_note_to_sample_length+1
;Get dpcm note to loop and pitch index table.
iny
lda (sound_param_word_3),y
sta base_address_dpcm_note_to_loop_pitch_index
iny
lda (sound_param_word_3),y
sta base_address_dpcm_note_to_loop_pitch_index+1
.endif
;Load PAL note table for PAL, NTSC for any other region.
.scope
lda sound_region
cmp #SOUND_REGION_PAL
beq pal
nstc:
lda #<ntsc_note_table_lo
sta base_address_note_table_lo
lda #>ntsc_note_table_lo
sta base_address_note_table_lo+1
lda #<ntsc_note_table_hi
sta base_address_note_table_hi
lda #>ntsc_note_table_hi
sta base_address_note_table_hi+1
jmp done
pal:
lda #<pal_note_table_lo
sta base_address_note_table_lo
lda #>pal_note_table_lo
sta base_address_note_table_lo+1
lda #<pal_note_table_hi
sta base_address_note_table_hi
lda #>pal_note_table_hi
sta base_address_note_table_hi+1
done:
.endscope
;Enable square 1, square 2, triangle and noise.
lda #%00001111
sta $4015
.ifdef FEATURE_VRC6
;Initialize the VRC6 frequency control register to default
;frequency multiplier and disable halt flag.
lda #%00000000
sta vrc6_reg_freq_ctrl
.endif
;Ensure no apu data is uploaded yet.
lda #0
sta apu_data_ready
.ifdef FEATURE_DPCM
lda #DPCM_STATE_NOP
sta apu_dpcm_state
.endif
jsr sound_initialize_apu_buffer
;Make sure all streams are killed.
jsr sound_stop
dec sound_disable_update
rts
.endproc
;Kill all active streams and halt sound.
.proc sound_stop
;Save x.
txa
pha
inc sound_disable_update
;Kill all streams.
ldx #(MAX_STREAMS-1)
loop:
lda #0
sta stream_flags,x
dex
bpl loop
jsr sound_initialize_apu_buffer
dec sound_disable_update
;Restore x.
pla
tax
rts
.endproc
;Updates all playing streams, if actve. Streams 0 through MAX_MUSIC_STREAMS-1
;are assumed to be music streams. The last two streams, are assumed to be sound
;effect streams. When these are playing, their channel control registers are
;copied overtop what the corresponding music streams had written, so the sound
;effect streams essentially take over while they are playing. When the sound
;effect streams are finished, they signify their corresponding music stream
;(via the TRM callback) to silence themselves until the next note to avoid
;ugly volume envelope transitions. DPCM is handled within this framework by
;a state machine that handles sound effect priority.
.proc sound_update
;Save regs.
txa
pha
;Signal apu data not ready.
lda #0
sta apu_data_ready
;First copy all music streams.
ldx #0
song_stream_register_copy_loop:
;Load whether this stream is active.
lda stream_flags,x
and #STREAM_ACTIVE_TEST
beq song_stream_not_active
;Update the stream.
jsr stream_update
;Load channel number.
lda stream_channel,x
;Multiply by four to get location within apu_register_sets.
asl
asl
tay
;Copy the registers over.
lda stream_channel_register_1,x
sta apu_register_sets,y
lda stream_channel_register_2,x
sta apu_register_sets+1,y
lda stream_channel_register_3,x
sta apu_register_sets+2,y
lda stream_channel_register_4,x
sta apu_register_sets+3,y
song_stream_not_active:
inx
cpx #MAX_MUSIC_STREAMS
bne song_stream_register_copy_loop
do_not_update_music:
ldx #soundeffect_one
sfx_stream_register_copy_loop:
;Load whether this stream is active.
lda stream_flags,x
and #STREAM_ACTIVE_TEST
beq sfx_stream_not_active
;Update the stream.
jsr stream_update
;Load channel number
lda stream_channel,x
;Multiply by four to get location within apu_register_sets.
asl
asl
tay
;Copy the registers over.
lda stream_channel_register_1,x
sta apu_register_sets,y
lda stream_channel_register_2,x
sta apu_register_sets+1,y
lda stream_channel_register_3,x
sta apu_register_sets+2,y
lda stream_channel_register_4,x
sta apu_register_sets+3,y
sfx_stream_not_active:
inx
cpx #MAX_STREAMS
bne sfx_stream_register_copy_loop
;Signial apu data ready.
lda #1
sta apu_data_ready
;Restore regs.
pla
tax
rts
.endproc
;Note table borrowed from periods.s provided by FamiTracker's NSF driver.
ntsc_note_table_lo:
.byte <$0D5B, <$0C9C, <$0BE6, <$0B3B, <$0A9A, <$0A01, <$0972, <$08EA, <$086A, <$07F1, <$077F, <$0713
.byte <$06AD, <$064D, <$05F3, <$059D, <$054C, <$0500, <$04B8, <$0474, <$0434, <$03F8, <$03BF, <$0389
.byte <$0356, <$0326, <$02F9, <$02CE, <$02A6, <$0280, <$025C, <$023A, <$021A, <$01FB, <$01DF, <$01C4
.byte <$01AB, <$0193, <$017C, <$0167, <$0152, <$013F, <$012D, <$011C, <$010C, <$00FD, <$00EF, <$00E1
.byte <$00D5, <$00C9, <$00BD, <$00B3, <$00A9, <$009F, <$0096, <$008E, <$0086, <$007E, <$0077, <$0070
.byte <$006A, <$0064, <$005E, <$0059, <$0054, <$004F, <$004B, <$0046, <$0042, <$003F, <$003B, <$0038
.byte <$0034, <$0031, <$002F, <$002C, <$0029, <$0027, <$0025, <$0023, <$0021, <$001F, <$001D, <$001B
.byte <$001A, <$0018, <$0017, <$0015, <$0014, <$0013, <$0012, <$0011, <$0010, <$000F, <$000E, <$000D
ntsc_note_table_hi:
.byte >$0D5B, >$0C9C, >$0BE6, >$0B3B, >$0A9A, >$0A01, >$0972, >$08EA, >$086A, >$07F1, >$077F, >$0713
.byte >$06AD, >$064D, >$05F3, >$059D, >$054C, >$0500, >$04B8, >$0474, >$0434, >$03F8, >$03BF, >$0389
.byte >$0356, >$0326, >$02F9, >$02CE, >$02A6, >$0280, >$025C, >$023A, >$021A, >$01FB, >$01DF, >$01C4
.byte >$01AB, >$0193, >$017C, >$0167, >$0152, >$013F, >$012D, >$011C, >$010C, >$00FD, >$00EF, >$00E1
.byte >$00D5, >$00C9, >$00BD, >$00B3, >$00A9, >$009F, >$0096, >$008E, >$0086, >$007E, >$0077, >$0070
.byte >$006A, >$0064, >$005E, >$0059, >$0054, >$004F, >$004B, >$0046, >$0042, >$003F, >$003B, >$0038
.byte >$0034, >$0031, >$002F, >$002C, >$0029, >$0027, >$0025, >$0023, >$0021, >$001F, >$001D, >$001B
.byte >$001A, >$0018, >$0017, >$0015, >$0014, >$0013, >$0012, >$0011, >$0010, >$000F, >$000E, >$000D
pal_note_table_lo:
.byte <$0C68, <$0BB6, <$0B0E, <$0A6F, <$09D9, <$094B, <$08C6, <$0848, <$07D1, <$0760, <$06F6, <$0692
.byte <$0634, <$05DB, <$0586, <$0537, <$04EC, <$04A5, <$0462, <$0423, <$03E8, <$03B0, <$037B, <$0349
.byte <$0319, <$02ED, <$02C3, <$029B, <$0275, <$0252, <$0231, <$0211, <$01F3, <$01D7, <$01BD, <$01A4
.byte <$018C, <$0176, <$0161, <$014D, <$013A, <$0129, <$0118, <$0108, <$00F9, <$00EB, <$00DE, <$00D1
.byte <$00C6, <$00BA, <$00B0, <$00A6, <$009D, <$0094, <$008B, <$0084, <$007C, <$0075, <$006E, <$0068
.byte <$0062, <$005D, <$0057, <$0052, <$004E, <$0049, <$0045, <$0041, <$003E, <$003A, <$0037, <$0034
.byte <$0031, <$002E, <$002B, <$0029, <$0026, <$0024, <$0022, <$0020, <$001E, <$001D, <$001B, <$0019
.byte <$0018, <$0016, <$0015, <$0014, <$0013, <$0012, <$0011, <$0010, <$000F, <$000E, <$000D, <$000C
pal_note_table_hi:
.byte >$0C68, >$0BB6, >$0B0E, >$0A6F, >$09D9, >$094B, >$08C6, >$0848, >$07D1, >$0760, >$06F6, >$0692
.byte >$0634, >$05DB, >$0586, >$0537, >$04EC, >$04A5, >$0462, >$0423, >$03E8, >$03B0, >$037B, >$0349
.byte >$0319, >$02ED, >$02C3, >$029B, >$0275, >$0252, >$0231, >$0211, >$01F3, >$01D7, >$01BD, >$01A4
.byte >$018C, >$0176, >$0161, >$014D, >$013A, >$0129, >$0118, >$0108, >$00F9, >$00EB, >$00DE, >$00D1
.byte >$00C6, >$00BA, >$00B0, >$00A6, >$009D, >$0094, >$008B, >$0084, >$007C, >$0075, >$006E, >$0068
.byte >$0062, >$005D, >$0057, >$0052, >$004E, >$0049, >$0045, >$0041, >$003E, >$003A, >$0037, >$0034
.byte >$0031, >$002E, >$002B, >$0029, >$0026, >$0024, >$0022, >$0020, >$001E, >$001D, >$001B, >$0019
.byte >$0018, >$0016, >$0015, >$0014, >$0013, >$0012, >$0011, >$0010, >$000F, >$000E, >$000D, >$000C
.ifdef FEATURE_VRC6
vrc6_saw_note_table_lo:
.byte <$0F44, <$0E69, <$0D9A, <$0CD6, <$0C1E, <$0B70, <$0ACB, <$0A30, <$099E, <$0913, <$0891, <$0816
.byte <$07A2, <$0734, <$06CC, <$066B, <$060E, <$05B7, <$0565, <$0518, <$04CE, <$0489, <$0448, <$040A
.byte <$03D0, <$0399, <$0366, <$0335, <$0307, <$02DB, <$02B2, <$028B, <$0267, <$0244, <$0223, <$0205
.byte <$01E8, <$01CC, <$01B2, <$019A, <$0183, <$016D, <$0159, <$0145, <$0133, <$0122, <$0111, <$0102
.byte <$00F3, <$00E6, <$00D9, <$00CC, <$00C1, <$00B6, <$00AC, <$00A2, <$0099, <$0090, <$0088, <$0080
.byte <$0079, <$0072, <$006C, <$0066, <$0060, <$005B, <$0055, <$0051, <$004C, <$0048, <$0044, <$0040
.byte <$003C, <$0039, <$0035, <$0032, <$002F, <$002D, <$002A, <$0028, <$0025, <$0023, <$0021, <$001F
.byte <$001E, <$001C, <$001A, <$0019, <$0017, <$0016, <$0015, <$0013, <$0012, <$0011, <$0010, <$000F
vrc6_saw_note_table_hi:
.byte >$0F44, >$0E69, >$0D9A, >$0CD6, >$0C1E, >$0B70, >$0ACB, >$0A30, >$099E, >$0913, >$0891, >$0816
.byte >$07A2, >$0734, >$06CC, >$066B, >$060E, >$05B7, >$0565, >$0518, >$04CE, >$0489, >$0448, >$040A
.byte >$03D0, >$0399, >$0366, >$0335, >$0307, >$02DB, >$02B2, >$028B, >$0267, >$0244, >$0223, >$0205
.byte >$01E8, >$01CC, >$01B2, >$019A, >$0183, >$016D, >$0159, >$0145, >$0133, >$0122, >$0111, >$0102
.byte >$00F3, >$00E6, >$00D9, >$00CC, >$00C1, >$00B6, >$00AC, >$00A2, >$0099, >$0090, >$0088, >$0080
.byte >$0079, >$0072, >$006C, >$0066, >$0060, >$005B, >$0055, >$0051, >$004C, >$0048, >$0044, >$0040
.byte >$003C, >$0039, >$0035, >$0032, >$002F, >$002D, >$002A, >$0028, >$0025, >$0023, >$0021, >$001F
.byte >$001E, >$001C, >$001A, >$0019, >$0017, >$0016, >$0015, >$0013, >$0012, >$0011, >$0010, >$000F
.endif
;Maps NTSC to NTSC tempo, maps PAL and Dendy to
;faster PAL tempo in song and sfx headers.
sound_region_to_tempo_offset:
.byte 0, 2, 2
channel_callback_table_lo:
.byte <square_1_play_note
.byte <square_2_play_note
.byte <triangle_play_note
.byte <noise_play_note
.ifdef FEATURE_DPCM
.byte <dpcm_play_note
.endif
.ifdef FEATURE_VRC6
.byte <vrc6_square_1_play_note
.byte <vrc6_square_2_play_note
.byte <vrc6_saw_play_note
.endif
channel_callback_table_hi:
.byte >square_1_play_note
.byte >square_2_play_note
.byte >triangle_play_note
.byte >noise_play_note
.ifdef FEATURE_DPCM
.byte >dpcm_play_note
.endif
.ifdef FEATURE_VRC6
.byte >vrc6_square_1_play_note
.byte >vrc6_square_2_play_note
.byte >vrc6_saw_play_note
.endif
stream_callback_table_lo:
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_s
.byte <stream_set_length_lo
.byte <stream_set_length_hi
.byte <stream_set_instrument
.byte <stream_goto
.byte <stream_call
.byte <stream_return
.byte <stream_terminate
stream_callback_table_hi:
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_s
.byte >stream_set_length_lo
.byte >stream_set_length_hi
.byte >stream_set_instrument
.byte >stream_goto
.byte >stream_call
.byte >stream_return
.byte >stream_terminate
.ifdef FEATURE_ARPEGGIOS
arpeggio_callback_table_lo:
.byte <(arpeggio_absolute-1)
.byte <(arpeggio_fixed-1)
.byte <(arpeggio_relative-1)
arpeggio_callback_table_hi:
.byte >(arpeggio_absolute-1)
.byte >(arpeggio_fixed-1)
.byte >(arpeggio_relative-1)
.endif
;****************************************************************
;These callbacks are all note playback and only execute once per
;frame.
;****************************************************************
.proc square_1_play_note
;Load instrument index.
ldy stream_instrument_index,x
;Load instrument address.
lda (base_address_instruments),y
sta sound_local_word_0
iny
lda (base_address_instruments),y
sta sound_local_word_0+1
;Set negate flag for sweep unit.
lda #$08
sta stream_channel_register_2,x
.ifdef FEATURE_ARPEGGIOS
;Get arpeggio type.
ldy #instrument_header_arpeggio_type
lda (sound_local_word_0),y
tay
;Get the address.
lda #>(return_from_arpeggio_callback-1)
pha
lda #<(return_from_arpeggio_callback-1)
pha
lda arpeggio_callback_table_hi,y
pha
lda arpeggio_callback_table_lo,y
pha
rts
return_from_arpeggio_callback:
.else
ldy stream_note,x
.endif
;Skip loading note pitch if already loaded, to allow envelopes
;to modify the pitch.
lda stream_flags,x
and #STREAM_PITCH_LOADED_TEST
bne pitch_already_loaded
lda stream_flags,x
ora #STREAM_PITCH_LOADED_SET
sta stream_flags,x
;Load low byte of note.
lda (base_address_note_table_lo),y
;Store in low 8 bits of pitch.
sta stream_channel_register_3,x
;Load high byte of note.
lda (base_address_note_table_hi),y
sta stream_channel_register_4,x
pitch_already_loaded:
.scope
lda stream_flags,x
and #STREAM_SILENCE_TEST
bne silence_until_note
note_not_silenced:
;Load volume offset.
ldy stream_volume_offset,x
;Load volume value for this frame, branch if opcode.
lda (sound_local_word_0),y
cmp #ENV_STOP
beq volume_stop
cmp #ENV_LOOP
bne skip_volume_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_volume_offset,x
tay
skip_volume_loop:
;Initialize channel control register with envelope decay and
;length counter disabled but preserving current duty cycle.
lda stream_channel_register_1,x
and #%11000000
ora #%00110000
;Load current volume value.
ora (sound_local_word_0),y
sta stream_channel_register_1,x
inc stream_volume_offset,x
volume_stop:
jmp done
silence_until_note:
lda stream_channel_register_1,x
and #%11000000
ora #%00110000
sta stream_channel_register_1,x
done:
.endscope
;Load pitch offset.
ldy stream_pitch_offset,x
;Load pitch value.
lda (sound_local_word_0),y
cmp #ENV_STOP
beq pitch_stop
cmp #ENV_LOOP
bne skip_pitch_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_pitch_offset,x
tay
skip_pitch_loop:
;Test sign.
lda (sound_local_word_0),y
bmi pitch_delta_negative
pitch_delta_positive:
clc
lda stream_channel_register_3,x
adc (sound_local_word_0),y
sta stream_channel_register_3,x
lda stream_channel_register_4,x
adc #0
sta stream_channel_register_4,x
jmp pitch_delta_test_done
pitch_delta_negative:
clc
lda stream_channel_register_3,x
adc (sound_local_word_0),y
sta stream_channel_register_3,x
lda stream_channel_register_4,x
adc #$ff
sta stream_channel_register_4,x
pitch_delta_test_done:
;Move pitch offset along.
inc stream_pitch_offset,x
pitch_stop:
duty_code:
ldy stream_duty_offset,x
;Load duty value for this frame, but hard code flags and duty for now.
lda (sound_local_word_0),y
cmp #DUTY_ENV_STOP
beq duty_stop
cmp #DUTY_ENV_LOOP
bne skip_duty_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_duty_offset,x
tay
skip_duty_loop:
;Or the duty value into the register.
lda stream_channel_register_1,x
and #%00111111
ora (sound_local_word_0),y
sta stream_channel_register_1,x
;Move duty offset along.
inc stream_duty_offset,x
duty_stop:
rts
.endproc
square_2_play_note = square_1_play_note
.proc triangle_play_note
;Load instrument index.
ldy stream_instrument_index,x
;Load instrument address.
lda (base_address_instruments),y
sta sound_local_word_0
iny
lda (base_address_instruments),y
sta sound_local_word_0+1
.ifdef FEATURE_ARPEGGIOS
;Get arpeggio type.
ldy #instrument_header_arpeggio_type
lda (sound_local_word_0),y
tay
;Get the address.
lda #>(return_from_arpeggio_callback-1)
pha
lda #<(return_from_arpeggio_callback-1)
pha
lda arpeggio_callback_table_hi,y
pha
lda arpeggio_callback_table_lo,y
pha
rts
return_from_arpeggio_callback:
.else
ldy stream_note,x
.endif
;Skip loading note pitch if already loaded, to allow envelopes
;to modify the pitch.
lda stream_flags,x
and #STREAM_PITCH_LOADED_TEST
bne pitch_already_loaded
lda stream_flags,x
ora #STREAM_PITCH_LOADED_SET
sta stream_flags,x
;Load low byte of note.
lda (base_address_note_table_lo),y
;Store in low 8 bits of pitch.
sta stream_channel_register_3,x
;Load high byte of note.
lda (base_address_note_table_hi),y
sta stream_channel_register_4,x
pitch_already_loaded:
;Load volume offset.
ldy stream_volume_offset,x
;Load volume value for this frame, but hard code flags and duty for now.
lda (sound_local_word_0),y
cmp #ENV_STOP
beq volume_stop
cmp #ENV_LOOP
bne skip_volume_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_volume_offset,x
tay
skip_volume_loop:
lda #%10000000
ora (sound_local_word_0),y
sta stream_channel_register_1,x
inc stream_volume_offset,x
volume_stop:
;Load pitch offset.
ldy stream_pitch_offset,x
;Load pitch value.
lda (sound_local_word_0),y
cmp #ENV_STOP
beq pitch_stop
cmp #ENV_LOOP
bne skip_pitch_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_pitch_offset,x
tay
skip_pitch_loop:
;Test sign.
lda (sound_local_word_0),y
bmi pitch_delta_negative
pitch_delta_positive:
clc
lda stream_channel_register_3,x
adc (sound_local_word_0),y
sta stream_channel_register_3,x
lda stream_channel_register_4,x
adc #0
sta stream_channel_register_4,x
jmp pitch_delta_test_done
pitch_delta_negative:
clc
lda stream_channel_register_3,x
adc (sound_local_word_0),y
sta stream_channel_register_3,x
lda stream_channel_register_4,x
adc #$ff
sta stream_channel_register_4,x
pitch_delta_test_done:
;Move pitch offset along.
inc stream_pitch_offset,x
pitch_stop:
rts
.endproc
.proc noise_play_note
;Load instrument index.
ldy stream_instrument_index,x
;Load instrument address.
lda (base_address_instruments),y
sta sound_local_word_0
iny
lda (base_address_instruments),y
sta sound_local_word_0+1
.ifdef FEATURE_ARPEGGIOS
;Get arpeggio type.
ldy #instrument_header_arpeggio_type
lda (sound_local_word_0),y
tay
;Get the address.
lda #>(return_from_arpeggio_callback-1)
pha
lda #<(return_from_arpeggio_callback-1)
pha
lda arpeggio_callback_table_hi,y
pha
lda arpeggio_callback_table_lo,y
pha
rts
return_from_arpeggio_callback:
.else
ldy stream_note,x
.endif
tya
and #%01111111
sta sound_local_byte_0
;Skip loading note pitch if already loaded, to allow envelopes
;to modify the pitch.
lda stream_flags,x
and #STREAM_PITCH_LOADED_TEST
bne pitch_already_loaded
lda stream_flags,x
ora #STREAM_PITCH_LOADED_SET
sta stream_flags,x
lda stream_channel_register_3,x
and #%10000000
ora sound_local_byte_0
sta stream_channel_register_3,x
pitch_already_loaded:
;Load volume offset.
ldy stream_volume_offset,x
;Load volume value for this frame, hard code disable flags.
lda (sound_local_word_0),y
cmp #ENV_STOP
beq volume_stop
cmp #ENV_LOOP
bne skip_volume_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_volume_offset,x
tay
skip_volume_loop:
lda #%00110000
ora (sound_local_word_0),y
sta stream_channel_register_1,x
;Move volume offset along.
inc stream_volume_offset,x
volume_stop:
;Load pitch offset.
ldy stream_pitch_offset,x
;Load pitch value.
lda (sound_local_word_0),y
cmp #ENV_STOP
beq pitch_stop
cmp #ENV_LOOP
bne skip_pitch_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_pitch_offset,x
tay
skip_pitch_loop:
;Save off current duty bit.
lda stream_channel_register_3,x
and #%10000000
sta sound_local_byte_0
;Advance pitch regardless of duty bit.
clc
lda stream_channel_register_3,x
adc (sound_local_word_0),y
and #%00001111
;Get duty bit back in.
ora sound_local_byte_0
sta stream_channel_register_3,x
;Move pitch offset along.
inc stream_pitch_offset,x
pitch_stop:
duty_code:
;Load duty offset.
ldy stream_duty_offset,x
;Load duty value for this frame, but hard code flags and duty for now.
lda (sound_local_word_0),y
cmp #DUTY_ENV_STOP
beq duty_stop
cmp #DUTY_ENV_LOOP
bne skip_duty_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_duty_offset,x
tay
skip_duty_loop:
;We only care about bit 6 for noise, and we want it in bit 7 position.
lda (sound_local_word_0),y
asl
sta sound_local_byte_0
lda stream_channel_register_3,x
and #%01111111
ora sound_local_byte_0
sta stream_channel_register_3,x
;Move duty offset along.
inc stream_duty_offset,x
duty_stop:
rts
.endproc
.ifdef FEATURE_DPCM
.proc dpcm_play_note
;Determine if silence until note is set.
lda stream_flags,x
and #STREAM_SILENCE_TEST
bne note_already_played
;Load note index.
ldy stream_note,x
;Get sample index.
lda (base_address_dpcm_note_to_sample_index),y
bmi no_sample
;This sample index looks up into base_address_dpcm_sample_table.
tay
lda (base_address_dpcm_sample_table),y
sta stream_channel_register_3,x
;Get loop and pitch from dpcm_note_to_loop_pitch_index table.
ldy stream_note,x
lda (base_address_dpcm_note_to_loop_pitch_index),y
sta stream_channel_register_1,x
;Get sample length.
lda (base_address_dpcm_note_to_sample_length),y
sta stream_channel_register_4,x
;Upload the dpcm data if sfx commands are not overriding.
lda apu_dpcm_state
cmp #DPCM_STATE_WAIT
beq skip
cmp #DPCM_STATE_UPLOAD_THEN_WAIT
beq skip
lda #DPCM_STATE_UPLOAD
sta apu_dpcm_state
skip:
lda stream_flags,x
ora #STREAM_SILENCE_SET
sta stream_flags,x
no_sample:
note_already_played:
rts
.endproc
.endif
; TODO: add play_note subroutines for 2 pulses (use same technique as square channels) and 1 sawtooth
.ifdef FEATURE_VRC6
.proc vrc6_square_1_play_note
;Load instrument index.
ldy stream_instrument_index,x
;Load instrument address.
lda (base_address_instruments),y
sta sound_local_word_0
iny
lda (base_address_instruments),y
sta sound_local_word_0+1
.ifdef FEATURE_ARPEGGIOS
;Get arpeggio type.
ldy #instrument_header_arpeggio_type
lda (sound_local_word_0),y
tay
;Get the address.
lda #>(return_from_arpeggio_callback-1)
pha
lda #<(return_from_arpeggio_callback-1)
pha
lda arpeggio_callback_table_hi,y
pha
lda arpeggio_callback_table_lo,y
pha
rts
return_from_arpeggio_callback:
.else
ldy stream_note,x
.endif
;Skip loading note pitch if already loaded, to allow envelopes
;to modify the pitch.
lda stream_flags,x
and #STREAM_PITCH_LOADED_TEST
bne pitch_already_loaded
lda stream_flags,x
ora #STREAM_PITCH_LOADED_SET
sta stream_flags,x
;Load low byte of note.
lda (base_address_note_table_lo),y
;Store in low 8 bits of pitch.
sta stream_channel_register_3,x
;Load high byte of note.
lda (base_address_note_table_hi),y
ora #$80
sta stream_channel_register_4,x
pitch_already_loaded:
.scope
lda stream_flags,x
and #STREAM_SILENCE_TEST
bne silence_until_note
note_not_silenced:
;Load volume offset.
ldy stream_volume_offset,x
;Load volume value for this frame, branch if opcode.
lda (sound_local_word_0),y
cmp #ENV_STOP
beq volume_stop
cmp #ENV_LOOP
bne skip_volume_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_volume_offset,x
tay
skip_volume_loop:
;Initialize channel control register with envelope decay and
;length counter disabled but preserving current duty cycle.
lda stream_channel_register_1,x
and #%01110000
;Load current volume value.
ora (sound_local_word_0),y
sta stream_channel_register_1,x
inc stream_volume_offset,x
volume_stop:
jmp done
silence_until_note:
lda stream_channel_register_1,x
and #%01110000
sta stream_channel_register_1,x
done:
.endscope
;Load pitch offset.
ldy stream_pitch_offset,x
;Load pitch value.
lda (sound_local_word_0),y
cmp #ENV_STOP
beq pitch_stop
cmp #ENV_LOOP
bne skip_pitch_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_pitch_offset,x
tay
skip_pitch_loop:
;Test sign.
lda (sound_local_word_0),y
bmi pitch_delta_negative
pitch_delta_positive:
clc
lda stream_channel_register_3,x
adc (sound_local_word_0),y
sta stream_channel_register_3,x
lda stream_channel_register_4,x
and #$0f
adc #0
ora #$80
sta stream_channel_register_4,x
jmp pitch_delta_test_done
pitch_delta_negative:
clc
lda stream_channel_register_3,x
adc (sound_local_word_0),y
sta stream_channel_register_3,x
lda stream_channel_register_4,x
and #$0f
adc #$ff
ora #$80
sta stream_channel_register_4,x
pitch_delta_test_done:
;Move pitch offset along.
inc stream_pitch_offset,x
pitch_stop:
duty_code:
ldy stream_duty_offset,x
;Load duty value for this frame, but hard code flags and duty for now.
lda (sound_local_word_0),y
cmp #DUTY_ENV_STOP
beq duty_stop
cmp #DUTY_ENV_LOOP
bne skip_duty_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_duty_offset,x
tay
skip_duty_loop:
;Or the duty value into the register.
lda stream_channel_register_1,x
and #%00001111
ora (sound_local_word_0),y
sta stream_channel_register_1,x
;Move duty offset along.
inc stream_duty_offset,x
duty_stop:
rts
.endproc
vrc6_square_2_play_note = vrc6_square_1_play_note
.proc vrc6_saw_play_note
;Load instrument index.
ldy stream_instrument_index,x
;Load instrument address.
lda (base_address_instruments),y
sta sound_local_word_0
iny
lda (base_address_instruments),y
sta sound_local_word_0+1
.ifdef FEATURE_ARPEGGIOS
;Get arpeggio type.
ldy #instrument_header_arpeggio_type
lda (sound_local_word_0),y
tay
;Get the address.
lda #>(return_from_arpeggio_callback-1)
pha
lda #<(return_from_arpeggio_callback-1)
pha
lda arpeggio_callback_table_hi,y
pha
lda arpeggio_callback_table_lo,y
pha
rts
return_from_arpeggio_callback:
.else
ldy stream_note,x
.endif
;Skip loading note pitch if already loaded, to allow envelopes
;to modify the pitch.
lda stream_flags,x
and #STREAM_PITCH_LOADED_TEST
bne pitch_already_loaded
lda stream_flags,x
ora #STREAM_PITCH_LOADED_SET
sta stream_flags,x
;Load low byte of note.
lda vrc6_saw_note_table_lo,y
;Store in low 8 bits of pitch.
sta stream_channel_register_3,x
;Load high byte of note.
lda vrc6_saw_note_table_hi,y
ora #$80
sta stream_channel_register_4,x
pitch_already_loaded:
.scope
lda stream_flags,x
and #STREAM_SILENCE_TEST
bne silence_until_note
note_not_silenced:
;Load volume offset.
ldy stream_volume_offset,x
;Load volume value for this frame, branch if opcode.
lda (sound_local_word_0),y
cmp #ENV_STOP
beq volume_stop
cmp #ENV_LOOP
bne skip_volume_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_volume_offset,x
tay
skip_volume_loop:
;Initialize channel control register with envelope decay and
;length counter disabled but preserving current duty cycle.
lda stream_channel_register_1,x
and #%11000000
sta sound_local_byte_0
;Load current volume value.
lda (sound_local_word_0),y
asl
ora sound_local_byte_0
sta stream_channel_register_1,x
inc stream_volume_offset,x
volume_stop:
jmp done
silence_until_note:
lda stream_channel_register_1,x
and #%11000000
sta stream_channel_register_1,x
done:
.endscope
;Load pitch offset.
ldy stream_pitch_offset,x
;Load pitch value.
lda (sound_local_word_0),y
cmp #ENV_STOP
beq pitch_stop
cmp #ENV_LOOP
bne skip_pitch_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_pitch_offset,x
tay
skip_pitch_loop:
;Test sign.
lda (sound_local_word_0),y
bmi pitch_delta_negative
pitch_delta_positive:
clc
lda stream_channel_register_3,x
adc (sound_local_word_0),y
sta stream_channel_register_3,x
lda stream_channel_register_4,x
and #$0f
adc #0
ora #$80
sta stream_channel_register_4,x
jmp pitch_delta_test_done
pitch_delta_negative:
clc
lda stream_channel_register_3,x
adc (sound_local_word_0),y
sta stream_channel_register_3,x
lda stream_channel_register_4,x
and #$0f
adc #$ff
ora #$80
sta stream_channel_register_4,x
pitch_delta_test_done:
;Move pitch offset along.
inc stream_pitch_offset,x
pitch_stop:
duty_code:
ldy stream_duty_offset,x
;Load duty value for this frame, but hard code flags and duty for now.
lda (sound_local_word_0),y
cmp #DUTY_ENV_STOP
beq duty_stop
cmp #DUTY_ENV_LOOP
bne skip_duty_loop
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_duty_offset,x
tay
skip_duty_loop:
;Or the duty value into the register.
lda (sound_local_word_0),y
lsr
and #%00100000
sta sound_local_byte_0
lda stream_channel_register_1,x
and #%00011111
ora sound_local_byte_0
sta stream_channel_register_1,x
;Move duty offset along.
inc stream_duty_offset,x
duty_stop:
rts
.endproc
.endif
.ifdef FEATURE_ARPEGGIOS
.proc arpeggio_absolute
ldy stream_arpeggio_offset,x
lda (sound_local_word_0),y
cmp #ENV_STOP
beq arpeggio_stop
cmp #ENV_LOOP
beq arpeggio_loop
arpeggio_play:
;We're changing notes.
lda stream_flags,x
and #STREAM_PITCH_LOADED_CLEAR
sta stream_flags,x
;Load the current arpeggio value and add it to current note.
clc
lda (sound_local_word_0),y
adc stream_note,x
tay
;Advance arpeggio offset.
inc stream_arpeggio_offset,x
jmp done
arpeggio_stop:
;Just load the current note.
ldy stream_note,x
jmp done
arpeggio_loop:
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_arpeggio_offset,x
tay
;We're changing notes.
lda stream_flags,x
and #STREAM_PITCH_LOADED_CLEAR
sta stream_flags,x
;Load the current arpeggio value and add it to current note.
clc
lda (sound_local_word_0),y
adc stream_note,x
tay
;Advance arpeggio offset.
inc stream_arpeggio_offset,x
done:
rts
.endproc
.proc arpeggio_fixed
ldy stream_arpeggio_offset,x
lda (sound_local_word_0),y
cmp #ENV_STOP
beq arpeggio_stop
cmp #ENV_LOOP
beq arpeggio_loop
arpeggio_play:
;We're changing notes.
lda stream_flags,x
and #STREAM_PITCH_LOADED_CLEAR
sta stream_flags,x
;Load the current arpeggio value and use it as the current note.
lda (sound_local_word_0),y
;sta stream_note,x
tay
;Advance arpeggio offset.
inc stream_arpeggio_offset,x
jmp done
arpeggio_stop:
;When a fixed arpeggio is done, we're changing notes to the
;currently playing note. (This is FamiTracker's behavior)
;However, we only do this if we're stopping at any point other
;than one, which indicates an arpeggio did in fact execute.
lda stream_arpeggio_offset,x
cmp #1
beq skip_clear_pitch_loaded
lda stream_flags,x
and #STREAM_PITCH_LOADED_CLEAR
sta stream_flags,x
skip_clear_pitch_loaded:
;Just load the current note.
ldy stream_note,x
jmp done
arpeggio_loop:
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_arpeggio_offset,x
tay
;We're changing notes.
lda stream_flags,x
and #STREAM_PITCH_LOADED_CLEAR
sta stream_flags,x
;Load the current arpeggio value and use it as the current note.
lda (sound_local_word_0),y
tay
;Advance arpeggio offset.
inc stream_arpeggio_offset,x
done:
rts
.endproc
.proc arpeggio_relative
ldy stream_arpeggio_offset,x
lda (sound_local_word_0),y
cmp #ENV_STOP
beq arpeggio_stop
cmp #ENV_LOOP
beq arpeggio_loop
arpeggio_play:
;We're changing notes.
lda stream_flags,x
and #STREAM_PITCH_LOADED_CLEAR
sta stream_flags,x
;Load the current arpeggio value and add it to current note.
clc
lda (sound_local_word_0),y
adc stream_note,x
cmp #HIGHEST_NOTE
bmi skip
lda #HIGHEST_NOTE
skip:
sta stream_note,x
tay
;Advance arpeggio offset.
inc stream_arpeggio_offset,x
jmp done
arpeggio_stop:
;Just load the current note.
ldy stream_note,x
jmp done
arpeggio_loop:
;We hit a loop opcode, advance envelope index and load loop point.
iny
lda (sound_local_word_0),y
sta stream_arpeggio_offset,x
tay
;We're changing notes.
lda stream_flags,x
and #STREAM_PITCH_LOADED_CLEAR
sta stream_flags,x
;Load the current arpeggio value and add it to current note.
clc
lda (sound_local_word_0),y
adc stream_note,x
tay
;Advance arpeggio offset.
inc stream_arpeggio_offset,x
done:
rts
.endproc
.endif
;****************************************************************
;These callbacks are all stream control and execute in sequence
;until exhausted.
;****************************************************************
.proc stream_set_instrument
advance_stream_read_address
;Load byte at read address.
lda stream_read_address_lo,x
sta sound_local_word_0
lda stream_read_address_hi,x
sta sound_local_word_0+1
ldy #0
lda (sound_local_word_0),y
asl
sta stream_instrument_index,x
tay
lda (base_address_instruments),y
sta sound_local_word_0
iny
lda (base_address_instruments),y
sta sound_local_word_0+1
ldy #0
lda (sound_local_word_0),y
sta stream_volume_offset,x
iny
lda (sound_local_word_0),y
sta stream_pitch_offset,x
iny
lda (sound_local_word_0),y
sta stream_duty_offset,x
.ifdef FEATURE_ARPEGGIOS
iny
lda (sound_local_word_0),y
sta stream_arpeggio_offset,x
.endif
rts
.endproc
;Set a standard note length. This callback works for a set
;of opcodes which can set the note length for values 1 through 16.
;This helps reduce ROM space required by songs.
.proc stream_set_length_s
;determine note length from opcode
sec
lda stream_note,x
sbc #OPCODES_BASE
clc
adc #1
sta stream_note_length_lo,x
sta stream_note_length_counter_lo,x
lda #0
sta stream_note_length_hi,x
sta stream_note_length_counter_hi,x
rts
.endproc
.proc stream_set_length_lo
advance_stream_read_address
;Load byte at read address.
lda stream_read_address_lo,x
sta sound_local_word_0
lda stream_read_address_hi,x
sta sound_local_word_0+1
ldy #0
lda (sound_local_word_0),y
sta stream_note_length_lo,x
sta stream_note_length_counter_lo,x
lda #0
sta stream_note_length_hi,x
sta stream_note_length_counter_hi,x
rts
.endproc
.proc stream_set_length_hi
advance_stream_read_address
;Load byte at read address.
lda stream_read_address_lo,x
sta sound_local_word_0
lda stream_read_address_hi,x
sta sound_local_word_0+1
ldy #0
lda (sound_local_word_0),y
sta stream_note_length_hi,x
sta stream_note_length_counter_hi,x
rts
.endproc
;This opcode loops to the beginning of the stream. It expects the two
;following bytes to contain the address to loop to.
.proc stream_goto
advance_stream_read_address
;Load byte at read address.
lda stream_read_address_lo,x
sta sound_local_word_0
lda stream_read_address_hi,x
sta sound_local_word_0+1
ldy #0
lda (sound_local_word_0),y
sta stream_read_address_lo,x
ldy #1
lda (sound_local_word_0),y
sta stream_read_address_hi,x
sec
lda stream_read_address_lo,x
sbc #1
sta stream_read_address_lo,x
lda stream_read_address_hi,x
sbc #0
sta stream_read_address_hi,x
rts
.endproc
;This opcode stores the current stream read address in
;return_stream_read_address (lo and hi) and then reads the
;following two bytes and stores them in the current stream read address.
;It is assumed that a RET opcode will be encountered in the stream which
;is being called, which will restore the return stream read address.
;This is how the engine can allow repeated chunks of a song.
.proc stream_call
advance_stream_read_address
lda stream_read_address_lo,x
sta sound_local_word_0
lda stream_read_address_hi,x
sta sound_local_word_0+1
;Retrieve lo byte of destination address from first CAL parameter.
ldy #0
lda (sound_local_word_0),y
sta sound_local_word_1
iny
;Retrieve hi byte of destination address from second CAL parameter.
lda (sound_local_word_0),y
sta sound_local_word_1+1
advance_stream_read_address
;Now store current stream read address in stream's return address.
lda stream_read_address_lo,x
sta stream_return_address_lo,x
lda stream_read_address_hi,x
sta stream_return_address_hi,x
;Finally, transfer address we are calling to current read address.
sec
lda sound_local_word_1
sbc #<1
sta stream_read_address_lo,x
lda sound_local_word_1+1
sbc #>1
sta stream_read_address_hi,x
rts
.endproc
;This opcode restores the stream_return_address to the stream_read_address
;and continues where it left off.
.proc stream_return
lda stream_return_address_lo,x
sta stream_read_address_lo,x
lda stream_return_address_hi,x
sta stream_read_address_hi,x
rts
.endproc
;This opcode returns from the parent caller by popping two bytes off
;the stack and then doing rts.
.proc stream_terminate
;Set the current stream to inactive.
lda #0
sta stream_flags,x
cpx #soundeffect_one
bmi not_sound_effect
;Load channel this sfx writes to.
ldy stream_channel,x
;Use this as index into streams to tell corresponding music channel
;to silence until the next note.
lda stream_flags,y
ora #STREAM_SILENCE_SET
sta stream_flags,y
not_sound_effect:
;Pop current address off the stack.
pla
pla
;Return from parent caller.
rts
.endproc
;Expects sound_param_byte_0 to contain index of a song in song_list.
;Assumed to be four addresses to initialize streams on, for square1, square2, triangle and noise.
;Any addresses found to be zero will not initialize that channel.
.proc play_song
;Save index regs.
tya
pha
txa
pha
inc sound_disable_update
;Select header tempo offset based on region.
ldx sound_region
lda sound_region_to_tempo_offset,x
sta sound_local_byte_0
;Get song address from song list.
lda sound_param_byte_0
asl
tay
lda (song_list_address),y
sta song_address
iny
lda (song_list_address),y
sta song_address+1
;Load square 1 stream.
ldx #0
jsr stream_stop
ldy #track_header_square1_stream_address
lda (song_address),y
sta sound_param_word_0
iny
lda (song_address),y
beq no_square_1
sta sound_param_word_0+1
lda #0
sta sound_param_byte_0
lda #0
sta sound_param_byte_1
jsr stream_initialize
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_0
tay
lda (song_address),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (song_address),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
no_square_1:
;Load square 2 stream.
ldx #1
jsr stream_stop
ldy #track_header_square2_stream_address
lda (song_address),y
sta sound_param_word_0
iny
lda (song_address),y
beq no_square_2
sta sound_param_word_0+1
lda #1
sta sound_param_byte_0
lda #1
sta sound_param_byte_1
jsr stream_initialize
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_0
tay
lda (song_address),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (song_address),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
no_square_2:
;Load triangle stream.
ldx #2
jsr stream_stop
ldy #track_header_triangle_stream_address
lda (song_address),y
sta sound_param_word_0
iny
lda (song_address),y
beq no_triangle
sta sound_param_word_0+1
lda #2
sta sound_param_byte_0
lda #2
sta sound_param_byte_1
jsr stream_initialize
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_0
tay
lda (song_address),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (song_address),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
no_triangle:
;Load noise stream.
ldx #3
jsr stream_stop
ldy #track_header_noise_stream_address
lda (song_address),y
sta sound_param_word_0
iny
lda (song_address),y
beq no_noise
sta sound_param_word_0+1
lda #3
sta sound_param_byte_0
lda #3
sta sound_param_byte_1
jsr stream_initialize
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_0
tay
lda (song_address),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (song_address),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
no_noise:
.ifdef FEATURE_DPCM
;Load dpcm stream.
ldx #4
jsr stream_stop
ldy #track_header_dpcm_stream_address
lda (song_address),y
sta sound_param_word_0
iny
lda (song_address),y
beq no_dpcm
sta sound_param_word_0+1
lda #4
sta sound_param_byte_0
lda #4
sta sound_param_byte_1
jsr stream_initialize
lda #DPCM_STATE_NOP
sta apu_dpcm_state
;Reset load counter to safeguard against accumulating too far
;in one direction. (can cause distortion). Suggestion by thefox
;on nesdev. I've never actually heard this distortion occur.
lda #0
sta $4011
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_0
tay
lda (song_address),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (song_address),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
no_dpcm:
.endif
.ifdef FEATURE_VRC6
;Load VRC6 square 1 stream.
ldx #START_STREAM_VRC6
jsr stream_stop
ldy #track_header_vrc6_square1_stream_address
lda (song_address),y
sta sound_param_word_0
iny
lda (song_address),y
beq no_vrc6_square_1
sta sound_param_word_0+1
lda #START_STREAM_VRC6
sta sound_param_byte_0
lda #START_STREAM_VRC6
sta sound_param_byte_1
jsr stream_initialize
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_0
tay
lda (song_address),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (song_address),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
no_vrc6_square_1:
;Load VRC6 square 2 stream.
ldx #START_STREAM_VRC6+1
jsr stream_stop
ldy #track_header_vrc6_square2_stream_address
lda (song_address),y
sta sound_param_word_0
iny
lda (song_address),y
beq no_vrc6_square_2
sta sound_param_word_0+1
lda #START_STREAM_VRC6+1
sta sound_param_byte_0
lda #START_STREAM_VRC6+1
sta sound_param_byte_1
jsr stream_initialize
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_0
tay
lda (song_address),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (song_address),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
no_vrc6_square_2:
;Load VRC6 saw stream.
ldx #START_STREAM_VRC6+2
jsr stream_stop
ldy #track_header_vrc6_saw_stream_address
lda (song_address),y
sta sound_param_word_0
iny
lda (song_address),y
beq no_vrc6_saw
sta sound_param_word_0+1
lda #START_STREAM_VRC6+2
sta sound_param_byte_0
lda #START_STREAM_VRC6+2
sta sound_param_byte_1
jsr stream_initialize
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_0
tay
lda (song_address),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (song_address),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
no_vrc6_saw:
.endif
dec sound_disable_update
;Restore index regs.
pla
tax
pla
tay
rts
.endproc
;Expects sound_param_byte_0 to contain the index of the sound effect to play.
;Expects sound_param_byte_1 to contain the sound effect priority. This can
;be one of two values: soundeffect_one, and soundeffect_two from ggsound.inc.
;Assumes the parameters are correct; no range checking is performed.
.proc play_sfx
;Save index regs.
tya
pha
txa
pha
inc sound_disable_update
;Select header tempo offset based on region.
ldx sound_region
lda sound_region_to_tempo_offset,x
sta sound_local_byte_1
;Get sfx address from sfx list.
lda sound_param_byte_0
asl
tay
lda (sfx_list_address),y
sta sound_local_word_0
iny
lda (sfx_list_address),y
sta sound_local_word_0+1
lda sound_param_byte_1
sta sound_local_byte_0
;Load square 1 stream.
ldy #track_header_square1_stream_address
lda (sound_local_word_0),y
sta sound_param_word_0
iny
lda (sound_local_word_0),y
beq no_square_1
sta sound_param_word_0+1
lda #0
sta sound_param_byte_0
lda sound_local_byte_0
sta sound_param_byte_1
jsr stream_initialize
ldx sound_local_byte_0
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_1
tay
lda (sound_local_word_0),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (sound_local_word_0),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
inc sound_local_byte_0
no_square_1:
lda sound_local_byte_0
cmp #(soundeffect_two + 1)
bne skip0
jmp no_more_sfx_streams_available
skip0:
;Load square 2 stream.
ldy #track_header_square2_stream_address
lda (sound_local_word_0),y
sta sound_param_word_0
iny
lda (sound_local_word_0),y
beq no_square_2
sta sound_param_word_0+1
lda #1
sta sound_param_byte_0
lda sound_local_byte_0
sta sound_param_byte_1
jsr stream_initialize
ldx sound_local_byte_0
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_1
tay
lda (sound_local_word_0),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (sound_local_word_0),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
inc sound_local_byte_0
no_square_2:
lda sound_local_byte_0
cmp #(soundeffect_two + 1)
bne skip1
jmp no_more_sfx_streams_available
skip1:
;Load triangle stream.
ldy #track_header_triangle_stream_address
lda (sound_local_word_0),y
sta sound_param_word_0
iny
lda (sound_local_word_0),y
beq no_triangle
sta sound_param_word_0+1
lda #2
sta sound_param_byte_0
lda sound_local_byte_0
sta sound_param_byte_1
jsr stream_initialize
ldx sound_local_byte_0
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_1
tay
lda (sound_local_word_0),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (sound_local_word_0),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
inc sound_local_byte_0
no_triangle:
lda sound_local_byte_0
cmp #(soundeffect_two + 1)
bne skip2
jmp no_more_sfx_streams_available
skip2:
;Load noise stream.
ldy #track_header_noise_stream_address
lda (sound_local_word_0),y
sta sound_param_word_0
iny
lda (sound_local_word_0),y
beq no_noise
sta sound_param_word_0+1
lda #3
sta sound_param_byte_0
lda sound_local_byte_0
sta sound_param_byte_1
jsr stream_initialize
ldx sound_local_byte_0
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_1
tay
lda (sound_local_word_0),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (sound_local_word_0),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
inc sound_local_byte_0
no_noise:
.ifdef FEATURE_DPCM
;Load dpcm stream.
ldy #track_header_dpcm_stream_address
lda (sound_local_word_0),y
sta sound_param_word_0
iny
lda (sound_local_word_0),y
beq no_dpcm
sta sound_param_word_0+1
lda #4
sta sound_param_byte_0
lda sound_local_byte_0
sta sound_param_byte_1
jsr stream_initialize
ldx sound_local_byte_0
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_1
tay
lda (sound_local_word_0),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (sound_local_word_0),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
lda #DPCM_STATE_UPLOAD_THEN_WAIT
sta apu_dpcm_state
no_dpcm:
.endif
.ifdef FEATURE_VRC6
;Load VRC6 square 1 stream.
ldy #track_header_vrc6_square1_stream_address
lda (sound_local_word_0),y
sta sound_param_word_0
iny
lda (sound_local_word_0),y
beq no_vrc6_square_1
sta sound_param_word_0+1
lda #START_STREAM_VRC6
sta sound_param_byte_0
lda sound_local_byte_0
sta sound_param_byte_1
jsr stream_initialize
ldx sound_local_byte_0
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_1
tay
lda (sound_local_word_0),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (sound_local_word_0),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
inc sound_local_byte_0
no_vrc6_square_1:
;Load VRC6 square 1 stream.
ldy #track_header_vrc6_square2_stream_address
lda (sound_local_word_0),y
sta sound_param_word_0
iny
lda (sound_local_word_0),y
beq no_vrc6_square_2
sta sound_param_word_0+1
lda #START_STREAM_VRC6+1
sta sound_param_byte_0
lda #START_STREAM_VRC6+1
sta sound_param_byte_1
jsr stream_initialize
ldx sound_local_byte_0
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_1
tay
lda (sound_local_word_0),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (sound_local_word_0),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
inc sound_local_byte_0
no_vrc6_square_2:
;Load VRC6 saw stream.
ldy #track_header_vrc6_saw_stream_address
lda (sound_local_word_0),y
sta sound_param_word_0
iny
lda (sound_local_word_0),y
beq no_vrc6_saw
sta sound_param_word_0+1
lda #START_STREAM_VRC6+2
sta sound_param_byte_0
lda #START_STREAM_VRC6+2
sta sound_param_byte_1
jsr stream_initialize
ldx sound_local_byte_0
clc
lda #track_header_ntsc_tempo_lo
adc sound_local_byte_1
tay
lda (sound_local_word_0),y
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
iny
lda (sound_local_word_0),y
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
inc sound_local_byte_0
no_vrc6_saw:
.endif
no_more_sfx_streams_available:
dec sound_disable_update
;Restore index regs.
pla
tax
pla
tay
rts
.endproc
;Pauses all music streams by clearing volume bits from all channel registers
;and setting the pause flag so these streams are not updated.
.proc pause_song
ldx #(MAX_MUSIC_STREAMS-1)
next_stream:
lda stream_flags,x
ora #STREAM_PAUSE_SET
sta stream_flags,x
lda stream_channel_register_1,x
and #%11110000
sta stream_channel_register_1,x
dex
bpl next_stream
rts
.endproc
;Resumes all music streams.
.proc resume_song
ldx #(MAX_MUSIC_STREAMS-1)
next_stream:
lda stream_flags,x
and #STREAM_PAUSE_CLEAR
sta stream_flags,x
dex
bpl next_stream
rts
.endproc
;Expects sound_param_byte_0 to contain the channel on which to play the stream.
;Expects sound_param_byte_1 to contain the offset of the stream instance to initialize.
;Expects sound_param_word_0 to contain the starting read address of the stream to
;initialize.
.proc stream_initialize
channel = sound_param_byte_0
stream = sound_param_byte_1
starting_read_address = sound_param_word_0
;Save x.
txa
pha
ldx stream
inc sound_disable_update
lda starting_read_address
ora starting_read_address+1
beq null_starting_read_address
;Set stream to be inactive while initializing.
lda #0
sta stream_flags,x
;Set a default note length (20 frames).
lda #20
sta stream_note_length_lo,x
;Set initial note length counter.
sta stream_note_length_counter_lo,x
lda #0
sta stream_note_length_hi,x
sta stream_note_length_counter_hi,x
;Set initial instrument index.
lda #0
sta stream_instrument_index,x
sta stream_volume_offset,x
sta stream_pitch_offset,x
sta stream_duty_offset,x
.ifdef FEATURE_ARPEGGIOS
sta stream_arpeggio_offset,x
.endif
;Set channel.
lda channel
sta stream_channel,x
;Set initial read address.
lda starting_read_address
sta stream_read_address_lo,x
lda starting_read_address+1
sta stream_read_address_hi,x
;Set default tempo.
lda #<DEFAULT_TEMPO
sta stream_tempo_lo,x
sta stream_tempo_counter_lo,x
lda #>DEFAULT_TEMPO
sta stream_tempo_hi,x
sta stream_tempo_counter_hi,x
;Set stream to be active.
lda stream_flags,x
ora #STREAM_ACTIVE_SET
sta stream_flags,x
null_starting_read_address:
dec sound_disable_update
;Restore x.
pla
tax
rts
.endproc
;Stops a stream from playing.
;Assumes x contains the index of the stream to kill.
.proc stream_stop
inc sound_disable_update
lda #0
sta stream_flags,x
dec sound_disable_update
rts
.endproc
;Updates a single stream.
;Expects x to be pointing to a stream instance as an offset from streams.
.proc stream_update
callback_address = sound_local_word_0
read_address = sound_local_word_1
lda stream_flags,x
and #STREAM_PAUSE_TEST
beq skip0
rts
skip0:
;Load current read address of stream.
lda stream_read_address_lo,x
sta read_address
lda stream_read_address_hi,x
sta read_address+1
;Load next byte from stream data.
lda stream_flags,x
and #STREAM_PITCH_LOADED_TEST
bne skip1
ldy #0
lda (read_address),y
sta stream_note,x
skip1:
;Is this byte a note or a stream opcode?
cmp #OPCODES_BASE
bcc process_note
process_opcode:
;Look up the opcode in the stream callbacks table.
sec
sbc #OPCODES_BASE
tay
;Get the address.
lda stream_callback_table_lo,y
sta callback_address
lda stream_callback_table_hi,y
sta callback_address+1
;Call the callback!
jsr indirect_jsr_callback_address
;Advance the stream's read address.
advance_stream_read_address
;Immediately process the next opcode or note. The idea here is that
;all stream control opcodes will execute during the current frame as "setup"
;for the next note. All notes will execute once per frame and will always
;return from this routine. This leaves the problem, how would the stream
;control opcode "terminate" work? It works by pulling the current return
;address off the stack and then performing an rts, effectively returning
;from its caller, this routine.
jmp stream_update
process_note:
;Determine which channel callback to use.
lda stream_channel,x
tay
lda channel_callback_table_lo,y
sta callback_address
lda channel_callback_table_hi,y
sta callback_address+1
;Call the channel callback!
jsr indirect_jsr_callback_address
sec
lda stream_tempo_counter_lo,x
sbc #<256
sta stream_tempo_counter_lo,x
lda stream_tempo_counter_hi,x
sbc #>256
sta stream_tempo_counter_hi,x
bcs do_not_advance_note_length_counter
;Reset tempo counter when we cross 0 by adding original tempo back on.
;This way we have a wrap-around value that does not get lost when we count
;down to the next note.
clc
lda stream_tempo_counter_lo,x
adc stream_tempo_lo,x
sta stream_tempo_counter_lo,x
lda stream_tempo_counter_hi,x
adc stream_tempo_hi,x
sta stream_tempo_counter_hi,x
;Decrement the note length counter.. On zero, advance the stream's read address.
sec
lda stream_note_length_counter_lo,x
sbc #<1
sta stream_note_length_counter_lo,x
lda stream_note_length_counter_hi,x
sbc #>1
sta stream_note_length_counter_hi,x
lda stream_note_length_counter_lo,x
ora stream_note_length_counter_hi,x
bne note_length_counter_not_zero
;Reset the note length counter.
lda stream_note_length_lo,x
sta stream_note_length_counter_lo,x
lda stream_note_length_hi,x
sta stream_note_length_counter_hi,x
ldy stream_instrument_index,x
lda (base_address_instruments),y
sta sound_local_word_0
iny
lda (base_address_instruments),y
sta sound_local_word_0+1
ldy #0
lda (sound_local_word_0),y
sta stream_volume_offset,x
iny
lda (sound_local_word_0),y
sta stream_pitch_offset,x
iny
lda (sound_local_word_0),y
sta stream_duty_offset,x
.ifdef FEATURE_ARPEGGIOS
iny
lda (sound_local_word_0),y
sta stream_arpeggio_offset,x
.endif
;Reset silence until note and pitch loaded flags.
lda stream_flags,x
and #STREAM_SILENCE_CLEAR
and #STREAM_PITCH_LOADED_CLEAR
sta stream_flags,x
;Advance the stream's read address.
advance_stream_read_address
do_not_advance_note_length_counter:
note_length_counter_not_zero:
rts
.proc indirect_jsr_callback_address
jmp (callback_address)
rts
.endproc
.endproc
.proc sound_initialize_apu_buffer
;****************************************************************
;Initialize Square 1
;****************************************************************
;Set Saw Envelope Disable and Length Counter Disable to 1 for square 1.
lda #%00110000
sta apu_register_sets
;Set Negate flag on the sweep unit.
lda #$08
sta apu_register_sets+1
;Set period to C9, which is a C#...just in case nobody writes to it.
lda #$C9
sta apu_register_sets+2
;Make sure the old value starts out different from the first default value.
sta apu_square_1_old
lda #$00
sta apu_register_sets+3
;****************************************************************
;Initialize Square 2
;****************************************************************
;Set Saw Envelope Disable and Length Counter Disable to 1 for square 2.
lda #%00110000
sta apu_register_sets+4
;Set Negate flag on the sweep unit.
lda #$08
sta apu_register_sets+5
;Set period to C9, which is a C#...just in case nobody writes to it.
lda #$C9
sta apu_register_sets+6
;Make sure the old value starts out different from the first default value.
sta apu_square_2_old
lda #$00
sta apu_register_sets+7
;****************************************************************
;Initialize Triangle
;****************************************************************
lda #%10000000
sta apu_register_sets+8
lda #$C9
sta apu_register_sets+10
lda #$00
sta apu_register_sets+11
;****************************************************************
;Initialize Noise
;****************************************************************
lda #%00110000
sta apu_register_sets+12
lda #%00000000
sta apu_register_sets+13
lda #%00000000
sta apu_register_sets+14
lda #%00000000
sta apu_register_sets+15
.ifdef FEATURE_DPCM
;****************************************************************
;Initialize DPCM
;****************************************************************
lda #0
sta apu_register_sets+16
lda #0
sta apu_register_sets+17
lda #0
sta apu_register_sets+18
lda #0
sta apu_register_sets+19
.endif
.ifdef FEATURE_VRC6
;****************************************************************
;Initialize VRC6 Square 1
;****************************************************************
lda #0
sta apu_register_sets+(START_STREAM_VRC6*4)
lda #0
sta apu_register_sets+((START_STREAM_VRC6*4)+1)
lda #$C9
sta apu_register_sets+((START_STREAM_VRC6*4)+2)
lda #$00
sta apu_register_sets+((START_STREAM_VRC6*4)+3)
;****************************************************************
;Initialize VRC6 Square 2
;****************************************************************
lda #0
sta apu_register_sets+((START_STREAM_VRC6*4)+4)
lda #0
sta apu_register_sets+((START_STREAM_VRC6*4)+5)
lda #$C9
sta apu_register_sets+((START_STREAM_VRC6*4)+6)
lda #0
sta apu_register_sets+((START_STREAM_VRC6*4)+7)
;****************************************************************
;Initialize VRC6 Saw
;****************************************************************
lda #0
sta apu_register_sets+((START_STREAM_VRC6*4)+8)
lda #0
sta apu_register_sets+((START_STREAM_VRC6*4)+9)
lda #$C9
sta apu_register_sets+((START_STREAM_VRC6*4)+10)
lda #0
sta apu_register_sets+((START_STREAM_VRC6*4)+11)
.endif
rts
.endproc
.proc sound_upload
lda apu_data_ready
beq apu_data_not_ready
jsr sound_upload_apu_register_sets
apu_data_not_ready:
rts
.endproc
.proc sound_upload_apu_register_sets
square1:
lda apu_register_sets+0
sta $4000
lda apu_register_sets+1
sta $4001
lda apu_register_sets+2
sta $4002
lda apu_register_sets+3
;Compare to last write.
cmp apu_square_1_old
;Don't write this frame if they were equal.
beq square2
sta $4003
;Save the value we just wrote to $4003.
sta apu_square_1_old
square2:
lda apu_register_sets+4
sta $4004
lda apu_register_sets+5
sta $4005
lda apu_register_sets+6
sta $4006
lda apu_register_sets+7
cmp apu_square_2_old
beq triangle
sta $4007
;Save the value we just wrote to $4007.
sta apu_square_2_old
triangle:
lda apu_register_sets+8
sta $4008
lda apu_register_sets+10
sta $400A
lda apu_register_sets+11
sta $400B
noise:
lda apu_register_sets+12
sta $400C
lda apu_register_sets+14
;Our notes go from 0 to 15 (low to high)
;but noise channel's low to high is 15 to 0.
eor #$0f
sta $400E
lda apu_register_sets+15
sta $400F
.ifdef FEATURE_VRC6
vrc6_square1:
lda apu_register_sets+((START_STREAM_VRC6*4)+0)
sta vrc6_reg_square1+VRC6_CONTROL
lda apu_register_sets+((START_STREAM_VRC6*4)+2)
sta vrc6_reg_square1+VRC6_FREQ_LO
lda apu_register_sets+((START_STREAM_VRC6*4)+3)
sta vrc6_reg_square1+VRC6_FREQ_HI
vrc6_square2:
lda apu_register_sets+((START_STREAM_VRC6*4)+4)
sta vrc6_reg_square2+VRC6_CONTROL
lda apu_register_sets+((START_STREAM_VRC6*4)+6)
sta vrc6_reg_square2+VRC6_FREQ_LO
lda apu_register_sets+((START_STREAM_VRC6*4)+7)
sta vrc6_reg_square2+VRC6_FREQ_HI
vrc6_saw:
lda apu_register_sets+((START_STREAM_VRC6*4)+8)
sta vrc6_reg_saw+VRC6_CONTROL
lda apu_register_sets+((START_STREAM_VRC6*4)+10)
sta vrc6_reg_saw+VRC6_FREQ_LO
lda apu_register_sets+((START_STREAM_VRC6*4)+11)
sta vrc6_reg_saw+VRC6_FREQ_HI
.endif
;Clear out all volume values from this frame in case a sound effect is killed suddenly.
lda #%00110000
sta apu_register_sets
sta apu_register_sets+4
sta apu_register_sets+12
lda #%10000000
sta apu_register_sets+8
.ifdef FEATURE_VRC6
lda #0
sta apu_register_sets+((START_STREAM_VRC6*4)+0)
sta apu_register_sets+((START_STREAM_VRC6*4)+4)
sta apu_register_sets+((START_STREAM_VRC6*4)+8)
.endif
.ifdef FEATURE_DPCM
;Now execute DPCM command/state machine. This state machine has logic for allowing
;a DPCM sound effect to override the currenty playing music DPCM sample until finished.
dpcm:
ldx apu_dpcm_state
lda dpcm_state_callback_hi,x
pha
lda dpcm_state_callback_lo,x
pha
rts
dpcm_upload:
jsr dpcm_upload_registers
lda #DPCM_STATE_NOP
sta apu_dpcm_state
rts
dpcm_upload_then_wait:
jsr dpcm_upload_registers
lda #DPCM_STATE_WAIT
sta apu_dpcm_state
rts
dpcm_wait:
lda $4015
and #%00010000
bne skip
lda #DPCM_STATE_NOP
sta apu_dpcm_state
skip:
rts
dpcm_nop:
rts
dpcm_state_callback_lo:
.byte <(dpcm_nop-1)
.byte <(dpcm_upload-1)
.byte <(dpcm_upload_then_wait-1)
.byte <(dpcm_wait-1)
dpcm_state_callback_hi:
.byte >(dpcm_nop-1)
.byte >(dpcm_upload-1)
.byte >(dpcm_upload_then_wait-1)
.byte >(dpcm_wait-1)
dpcm_upload_registers:
lda apu_register_sets+16
sta $4010
lda apu_register_sets+18
sta $4012
lda apu_register_sets+19
sta $4013
;Restart DPCM channel in case a new note was played before sample finished.
lda #%00001111
sta $4015
lda #%00011111
sta $4015
rts
.else
rts
.endif
.endproc
| 24.439463 | 112 | 0.666167 |
da15dc927715f98fd86f389ecbc286fc3ecf24e2 | 1,022 | asm | Assembly | src/util/sprite/tab.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | src/util/sprite/tab.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | src/util/sprite/tab.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | ;Sprite source code generated with EASYSOURCE 1991 Albin Hessler Software
;**************************************************************************
; -> asm_spr_ <- 1992 Jun 13 12:45:26
section sprite
xdef mes_tab
mes_tab
sp1
dc.w $0100,$0000 ;form, time/adaption
dc.w $000E,$0007 ;x size, y size
dc.w $0000,$0000 ;x origin, y origin
dc.l cp1-* ;pointer to colour pattern
dc.l pm1-* ;pointer to pattern mask
dc.l 0 ;pointer to next definition
cp1
dc.w $F300,$3800
dc.w $2400,$A400
dc.w $2400,$A400
dc.w $2700,$B800
dc.w $2400,$A400
dc.w $2400,$A400
dc.w $2400,$B800
pm1
dc.w $0000,$0000
dc.w $0000,$0000
dc.w $0000,$0000
dc.w $0000,$0000
dc.w $0000,$0000
dc.w $0000,$0000
dc.w $0000,$0000
;
end
| 30.058824 | 75 | 0.427593 |
1ff02fcc44edd82115d02ded5240311f033d4541 | 12,492 | asm | Assembly | P6/data_P6_2/ALUTest21.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | 1 | 2022-01-23T09:24:47.000Z | 2022-01-23T09:24:47.000Z | P6/data_P6_2/ALUTest21.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | null | null | null | P6/data_P6_2/ALUTest21.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | null | null | null | slt $0,$0,$3
and $0,$0,$3
sllv $5,$3,$3
srlv $3,$4,$3
subu $3,$3,$3
addu $1,$4,$3
lw $1,8($0)
sll $3,$4,2
sltu $1,$4,$3
addu $1,$1,$3
sltiu $4,$4,-16897
sltiu $1,$1,-12440
addiu $3,$6,10179
sll $1,$1,8
lbu $5,2($0)
subu $3,$0,$3
addu $5,$5,$3
sltu $5,$6,$3
andi $3,$0,15743
nor $1,$4,$3
srlv $6,$6,$3
slti $3,$3,-20966
sh $0,6($0)
sltu $3,$3,$3
slt $3,$3,$3
sw $5,12($0)
srav $3,$3,$3
andi $1,$1,39345
slt $3,$1,$3
slt $4,$3,$3
sltiu $3,$3,254
xor $4,$6,$3
srav $4,$0,$3
lb $3,5($0)
lw $3,12($0)
addu $4,$4,$3
subu $1,$3,$3
addiu $4,$3,26384
srlv $4,$4,$3
lh $0,14($0)
sltiu $4,$4,-3149
addiu $0,$3,2044
sltiu $6,$3,1582
addiu $3,$1,-31861
lh $3,16($0)
srlv $2,$2,$3
and $4,$4,$3
slt $3,$3,$3
or $4,$5,$3
sw $4,4($0)
srav $4,$6,$3
lh $4,4($0)
srl $5,$1,1
sb $4,1($0)
sw $5,12($0)
sra $3,$0,3
and $3,$4,$3
lw $1,4($0)
addiu $0,$4,17029
and $4,$4,$3
andi $0,$3,2762
andi $5,$5,15519
sllv $0,$3,$3
srav $3,$5,$3
xor $6,$4,$3
lhu $3,0($0)
lh $1,14($0)
subu $3,$0,$3
lhu $1,8($0)
nor $5,$5,$3
sw $5,0($0)
sw $1,8($0)
sb $4,2($0)
sb $6,15($0)
srlv $4,$4,$3
sra $5,$4,8
srl $3,$4,19
srav $4,$1,$3
ori $3,$4,48157
srav $3,$3,$3
or $1,$2,$3
lb $3,8($0)
addu $6,$2,$3
srl $0,$0,18
lb $3,11($0)
sh $3,4($0)
srav $4,$5,$3
srav $3,$6,$3
srav $1,$4,$3
andi $5,$1,55801
addu $4,$1,$3
sra $3,$3,23
addiu $4,$5,-2792
addu $1,$1,$3
sw $3,12($0)
lbu $4,10($0)
srl $4,$1,24
addiu $3,$4,-11598
sltu $6,$6,$3
addu $3,$4,$3
xori $1,$3,60574
and $5,$6,$3
sll $1,$0,30
xori $1,$1,14130
lh $6,6($0)
ori $1,$3,38295
andi $3,$4,14807
or $5,$5,$3
andi $0,$4,6434
andi $1,$3,43885
lhu $4,16($0)
slti $0,$4,18348
sllv $5,$3,$3
sra $6,$1,22
sw $4,4($0)
sw $3,0($0)
nor $1,$1,$3
lw $3,12($0)
slt $3,$3,$3
slt $4,$4,$3
addiu $4,$4,3102
ori $4,$5,18510
and $3,$3,$3
xor $3,$3,$3
srav $6,$4,$3
and $3,$4,$3
srl $3,$1,8
subu $0,$3,$3
sw $5,4($0)
subu $4,$4,$3
addu $3,$5,$3
sb $3,4($0)
subu $1,$1,$3
xori $1,$2,37274
sltiu $3,$4,23720
lhu $1,14($0)
subu $6,$6,$3
ori $4,$1,61484
sw $3,8($0)
addu $3,$3,$3
sh $1,0($0)
nor $5,$2,$3
subu $6,$6,$3
nor $4,$4,$3
sll $5,$5,26
nor $1,$5,$3
nor $4,$5,$3
addiu $1,$4,-25058
sw $0,0($0)
sltu $3,$3,$3
sra $3,$3,15
sb $4,9($0)
subu $3,$3,$3
sh $0,0($0)
addiu $1,$3,3102
sltu $3,$1,$3
srav $4,$5,$3
xori $3,$1,9083
xori $6,$6,56449
slti $0,$3,10557
addu $3,$0,$3
andi $5,$3,15830
and $5,$4,$3
lbu $5,5($0)
sll $3,$3,27
subu $5,$0,$3
addiu $4,$4,-24668
lb $3,14($0)
lh $1,0($0)
addiu $3,$1,947
sra $4,$4,4
addu $4,$5,$3
xor $3,$1,$3
and $1,$5,$3
addiu $3,$3,-29901
subu $3,$3,$3
sw $0,16($0)
addu $1,$3,$3
sra $1,$4,31
srl $3,$3,11
srav $4,$5,$3
subu $4,$3,$3
sllv $5,$3,$3
lbu $3,2($0)
andi $0,$5,12345
subu $3,$3,$3
sw $1,8($0)
sll $3,$4,16
lbu $2,14($0)
addu $1,$3,$3
slti $3,$6,5412
ori $5,$4,24156
nor $5,$1,$3
sb $3,8($0)
subu $5,$1,$3
lw $1,0($0)
xor $5,$4,$3
sw $3,16($0)
lh $1,8($0)
lb $1,0($0)
xor $3,$1,$3
addiu $1,$4,5345
sb $5,2($0)
nor $1,$3,$3
sh $3,4($0)
slt $4,$6,$3
ori $5,$5,44653
sb $3,5($0)
subu $6,$3,$3
and $4,$4,$3
srl $5,$4,10
sllv $5,$5,$3
subu $1,$5,$3
srav $5,$5,$3
or $4,$4,$3
lbu $6,11($0)
lhu $4,0($0)
xori $0,$3,24761
lbu $1,13($0)
lbu $3,1($0)
nor $3,$5,$3
lb $1,5($0)
addiu $3,$3,-1410
srlv $1,$5,$3
sltu $4,$3,$3
sb $1,11($0)
subu $6,$3,$3
srlv $1,$1,$3
ori $1,$5,48756
sllv $6,$6,$3
subu $4,$3,$3
xori $5,$5,64636
xor $5,$3,$3
sb $5,6($0)
sb $1,8($0)
sra $0,$3,0
sll $4,$3,21
or $1,$0,$3
xori $4,$4,9047
srlv $6,$3,$3
sltu $3,$3,$3
sltiu $5,$5,-32304
sb $3,4($0)
sw $4,4($0)
srlv $5,$1,$3
andi $3,$3,38986
addiu $1,$3,16114
sw $3,0($0)
nor $6,$4,$3
nor $0,$0,$3
ori $3,$1,55743
and $1,$4,$3
ori $4,$4,24749
lbu $0,8($0)
ori $5,$5,39622
addiu $4,$5,27039
sltiu $6,$4,13974
lbu $5,12($0)
lh $3,12($0)
nor $4,$4,$3
ori $3,$4,23405
lhu $3,16($0)
srlv $4,$5,$3
xor $3,$5,$3
and $5,$5,$3
and $3,$5,$3
ori $4,$5,52960
sb $1,16($0)
sllv $6,$2,$3
addiu $3,$3,-10327
srl $3,$1,8
xori $4,$6,63811
sll $4,$6,31
and $3,$4,$3
sll $6,$1,22
srav $3,$0,$3
sra $4,$4,31
srl $6,$3,0
slti $3,$4,-26603
subu $3,$3,$3
srav $4,$4,$3
sb $5,4($0)
sllv $6,$3,$3
subu $4,$3,$3
addu $5,$3,$3
sltu $6,$4,$3
slt $0,$1,$3
sw $3,16($0)
lbu $3,12($0)
sllv $1,$3,$3
subu $5,$4,$3
lh $3,14($0)
addiu $0,$3,29162
sll $0,$4,12
slti $4,$4,-25034
sllv $3,$3,$3
sh $4,8($0)
lhu $0,16($0)
ori $3,$5,34611
xor $3,$5,$3
lw $4,8($0)
addu $4,$1,$3
lw $1,4($0)
lb $1,0($0)
sltiu $3,$3,-18426
addu $1,$4,$3
sb $4,7($0)
addu $1,$3,$3
lbu $4,4($0)
addu $4,$3,$3
srav $5,$4,$3
subu $1,$4,$3
sb $1,0($0)
sw $1,0($0)
addu $5,$3,$3
xori $4,$4,905
srlv $4,$4,$3
addiu $4,$4,-22289
subu $5,$5,$3
subu $3,$4,$3
sra $1,$5,1
nor $5,$3,$3
lhu $1,16($0)
addu $1,$1,$3
subu $4,$6,$3
addiu $5,$5,-16523
or $6,$1,$3
sltiu $6,$5,-28740
andi $3,$5,19380
srl $4,$6,15
xor $5,$1,$3
subu $4,$4,$3
sw $5,12($0)
lw $5,12($0)
addiu $3,$6,-19468
xor $3,$3,$3
sltiu $0,$2,5761
sra $1,$5,15
sra $4,$0,13
sw $3,0($0)
xori $3,$4,12024
srav $5,$5,$3
and $1,$1,$3
ori $4,$1,20659
lbu $5,4($0)
xori $4,$3,11429
srlv $3,$6,$3
addiu $3,$3,17234
sll $4,$3,0
addiu $5,$4,-26268
andi $3,$6,62059
subu $6,$6,$3
lw $5,8($0)
subu $3,$0,$3
lw $4,4($0)
sra $5,$4,17
lw $4,12($0)
xor $3,$4,$3
sra $6,$6,12
andi $1,$4,1202
xor $4,$3,$3
lh $4,2($0)
nor $1,$4,$3
addiu $4,$4,-26713
srl $4,$5,19
sra $1,$5,9
sltu $6,$6,$3
sltiu $1,$1,20916
srlv $4,$4,$3
subu $4,$6,$3
srl $5,$3,9
srl $6,$1,19
srlv $5,$3,$3
sb $1,4($0)
addu $6,$6,$3
subu $3,$3,$3
srlv $4,$3,$3
andi $3,$1,42667
sra $3,$6,10
ori $1,$3,54839
addiu $3,$4,24937
lh $4,0($0)
slt $3,$2,$3
sltu $4,$3,$3
srlv $1,$5,$3
subu $5,$3,$3
andi $4,$4,40887
lhu $4,6($0)
lbu $3,14($0)
sh $3,0($0)
lbu $3,4($0)
srav $1,$0,$3
slt $5,$1,$3
srl $3,$3,19
or $3,$4,$3
lh $4,4($0)
sltu $6,$3,$3
addiu $4,$5,-19147
lh $1,12($0)
srl $3,$3,31
or $5,$1,$3
lbu $5,12($0)
sra $5,$4,15
srl $0,$1,10
sw $3,12($0)
sh $4,8($0)
srav $3,$3,$3
or $5,$4,$3
lbu $6,8($0)
addiu $3,$4,-22889
xor $3,$3,$3
srav $6,$4,$3
addiu $1,$0,27165
sltu $5,$0,$3
addiu $3,$6,2679
lw $1,0($0)
or $1,$1,$3
subu $1,$1,$3
sw $6,8($0)
ori $0,$0,59200
sllv $3,$4,$3
lb $3,7($0)
lbu $3,5($0)
lh $5,16($0)
sb $6,0($0)
lw $5,4($0)
lbu $6,2($0)
lh $3,6($0)
addu $3,$3,$3
srl $3,$3,0
lbu $6,10($0)
lw $4,12($0)
srl $4,$5,9
nor $4,$5,$3
addu $5,$0,$3
and $4,$4,$3
subu $3,$2,$3
srlv $3,$6,$3
sltiu $3,$4,-1190
lh $4,2($0)
andi $1,$6,45286
sllv $5,$1,$3
sllv $1,$4,$3
andi $4,$3,9121
or $5,$5,$3
slt $4,$4,$3
srlv $3,$3,$3
lhu $1,4($0)
xori $0,$3,47912
ori $4,$2,8382
addu $1,$4,$3
andi $6,$4,19799
lhu $1,2($0)
xori $3,$3,21877
sw $5,0($0)
subu $4,$4,$3
sb $4,9($0)
sltiu $1,$3,-23318
andi $4,$6,61054
xori $3,$4,59051
sra $5,$5,6
subu $4,$3,$3
xor $3,$4,$3
ori $1,$1,52829
slti $1,$0,16506
xori $3,$3,1306
xori $3,$4,59801
andi $3,$3,5320
lbu $4,12($0)
xor $4,$1,$3
xor $3,$3,$3
xor $3,$0,$3
lh $5,14($0)
subu $1,$3,$3
or $0,$6,$3
sltu $4,$3,$3
xori $4,$4,45308
and $3,$1,$3
addu $5,$2,$3
lh $1,8($0)
lbu $3,14($0)
sll $6,$6,30
and $0,$0,$3
lw $1,8($0)
sltiu $4,$6,24866
srl $4,$3,13
subu $0,$0,$3
addiu $3,$5,29066
lb $4,11($0)
sw $3,8($0)
nor $6,$1,$3
slti $6,$3,-17604
slt $4,$1,$3
srav $3,$3,$3
xor $0,$0,$3
xori $6,$4,54078
lw $0,16($0)
lh $1,4($0)
addiu $1,$3,17922
sra $5,$5,19
lh $1,2($0)
sb $3,3($0)
or $3,$1,$3
ori $3,$3,54144
lhu $4,4($0)
sltiu $5,$1,-2642
lh $3,16($0)
and $3,$2,$3
lhu $5,14($0)
ori $3,$4,16218
sllv $4,$4,$3
addu $4,$6,$3
or $5,$3,$3
xor $1,$1,$3
addu $3,$6,$3
srlv $4,$5,$3
andi $0,$3,42362
sb $4,9($0)
ori $1,$1,20831
sh $1,12($0)
sra $4,$3,22
addu $5,$4,$3
nor $1,$1,$3
lhu $4,16($0)
or $4,$4,$3
lh $4,8($0)
or $5,$5,$3
ori $4,$1,33722
sh $1,16($0)
srlv $1,$3,$3
or $6,$6,$3
andi $0,$4,48998
lbu $4,6($0)
or $4,$5,$3
lbu $5,1($0)
xor $4,$6,$3
addu $4,$3,$3
xor $4,$0,$3
or $3,$4,$3
sra $5,$3,5
addu $6,$6,$3
xori $4,$3,6349
xor $5,$3,$3
lh $4,4($0)
addiu $3,$1,32167
nor $6,$3,$3
or $4,$6,$3
or $4,$3,$3
addu $1,$3,$3
srlv $3,$4,$3
sll $3,$3,20
lb $1,6($0)
subu $5,$6,$3
srl $5,$4,8
slti $6,$3,-24855
xor $4,$5,$3
xori $4,$5,43197
addiu $4,$4,16164
srav $3,$1,$3
lhu $0,12($0)
addiu $0,$4,12265
srl $4,$4,5
slt $1,$4,$3
slti $1,$4,-17268
addiu $4,$1,-24877
or $1,$4,$3
addu $3,$3,$3
addiu $0,$6,-19784
addiu $3,$1,-4693
sw $6,4($0)
srlv $3,$3,$3
lh $3,6($0)
addiu $5,$3,12535
addiu $1,$1,-10366
nor $5,$5,$3
srl $3,$1,1
sltu $6,$6,$3
or $6,$3,$3
lw $6,12($0)
nor $4,$4,$3
and $0,$1,$3
nor $4,$4,$3
lb $3,13($0)
lbu $3,0($0)
sltiu $4,$4,-1230
ori $3,$0,7030
addu $4,$4,$3
lbu $4,0($0)
slt $1,$1,$3
srlv $3,$3,$3
sltiu $3,$5,21953
and $5,$4,$3
xori $3,$4,17477
and $4,$4,$3
and $5,$5,$3
sw $6,4($0)
lhu $3,8($0)
nor $4,$5,$3
lw $1,0($0)
sh $4,0($0)
addu $1,$3,$3
ori $3,$1,17056
xori $5,$3,30202
xor $3,$3,$3
ori $3,$4,4659
sll $1,$5,29
sra $5,$5,0
addu $3,$6,$3
addu $1,$2,$3
sw $4,4($0)
srav $4,$5,$3
and $3,$3,$3
lbu $4,11($0)
slti $3,$1,3060
subu $3,$1,$3
addu $6,$4,$3
addu $3,$3,$3
ori $3,$3,22650
and $3,$3,$3
srl $1,$0,26
subu $5,$5,$3
addu $3,$5,$3
subu $5,$0,$3
and $4,$3,$3
lhu $1,10($0)
xor $3,$4,$3
andi $3,$3,39602
sllv $3,$5,$3
sll $3,$5,23
srav $3,$3,$3
addiu $6,$4,23817
subu $3,$3,$3
srlv $4,$4,$3
srav $3,$5,$3
and $0,$4,$3
addu $5,$5,$3
addu $4,$5,$3
sh $3,2($0)
sw $3,12($0)
sllv $1,$5,$3
addu $3,$3,$3
sra $3,$3,10
sllv $2,$2,$3
srav $4,$4,$3
slti $3,$3,25091
or $3,$2,$3
lh $6,8($0)
sltiu $6,$6,28868
sb $1,1($0)
lh $3,12($0)
srav $1,$1,$3
xor $6,$1,$3
sllv $3,$5,$3
sra $3,$3,11
sltu $0,$3,$3
addu $1,$1,$3
lb $0,4($0)
xor $4,$5,$3
addiu $4,$4,10827
or $3,$0,$3
slti $1,$1,-28476
or $6,$2,$3
subu $3,$3,$3
ori $3,$1,15088
sltu $3,$4,$3
slti $4,$6,-28083
subu $5,$1,$3
lb $3,14($0)
andi $4,$3,44309
slt $6,$1,$3
nor $4,$5,$3
nor $0,$0,$3
subu $4,$4,$3
srlv $5,$1,$3
sb $4,11($0)
sltiu $5,$1,5785
slt $3,$3,$3
addu $1,$1,$3
lhu $3,12($0)
xor $1,$4,$3
subu $4,$4,$3
nor $1,$5,$3
subu $3,$3,$3
addiu $1,$6,-18510
or $4,$4,$3
ori $6,$4,36908
ori $5,$5,25138
subu $0,$1,$3
xor $3,$3,$3
xori $6,$4,55482
sltu $4,$4,$3
and $1,$1,$3
sra $1,$1,10
addiu $2,$2,19080
or $3,$3,$3
sw $0,16($0)
lw $3,8($0)
or $4,$4,$3
lbu $3,3($0)
sltu $4,$1,$3
nor $0,$2,$3
or $3,$4,$3
subu $3,$4,$3
sw $0,8($0)
sw $5,0($0)
sltu $3,$2,$3
srav $6,$0,$3
andi $5,$3,11336
sh $3,10($0)
xori $5,$0,31651
srav $3,$1,$3
sll $4,$4,12
sw $3,0($0)
or $3,$3,$3
and $3,$5,$3
sh $4,10($0)
addiu $3,$3,7936
lbu $4,1($0)
sb $5,16($0)
addiu $4,$0,2359
addu $3,$6,$3
ori $4,$4,64189
sb $2,1($0)
sra $3,$4,8
xori $3,$3,30297
addu $5,$3,$3
sll $6,$6,19
sltiu $3,$3,-8477
srav $4,$4,$3
srav $3,$3,$3
nor $4,$4,$3
addiu $3,$5,14968
or $0,$0,$3
andi $6,$6,46066
sh $3,10($0)
sb $4,10($0)
addiu $3,$3,15076
sb $1,12($0)
slti $4,$4,-12820
nor $1,$3,$3
lh $3,2($0)
lbu $4,2($0)
srav $1,$3,$3
xori $3,$2,62522
addiu $3,$4,-27879
sw $3,12($0)
sltu $0,$4,$3
nor $4,$4,$3
nor $3,$3,$3
xori $3,$5,36147
ori $1,$4,27010
xori $4,$3,57991
xori $5,$3,34922
addu $6,$0,$3
lw $1,0($0)
lbu $6,6($0)
sb $5,13($0)
sra $3,$3,8
sllv $3,$3,$3
sll $3,$4,5
lhu $5,2($0)
sw $3,12($0)
sltiu $6,$5,20084
sra $6,$3,23
nor $1,$3,$3
slti $3,$3,10873
sllv $4,$3,$3
sh $4,4($0)
and $1,$1,$3
subu $3,$3,$3
sra $1,$3,9
and $1,$3,$3
lw $4,12($0)
sltu $5,$5,$3
addu $6,$6,$3
sh $4,8($0)
sll $3,$1,17
xori $4,$2,28388
and $4,$1,$3
nor $3,$1,$3
addiu $4,$1,1195
nor $5,$3,$3
xori $3,$3,37355
lh $4,8($0)
sb $4,9($0)
andi $0,$4,15901
nor $3,$1,$3
slti $5,$3,-10011
sh $5,4($0)
lbu $4,8($0)
lh $3,16($0)
sh $3,4($0)
subu $4,$0,$3
and $3,$3,$3
sltiu $4,$3,-9805
and $5,$5,$3
sb $3,4($0)
xor $1,$4,$3
lbu $4,8($0)
xori $4,$4,60282
srl $4,$3,18
srl $4,$5,11
or $5,$5,$3
sw $5,12($0)
xor $1,$4,$3
sltiu $4,$4,746
lw $4,12($0)
sllv $1,$1,$3
subu $3,$3,$3
sllv $3,$3,$3
and $3,$5,$3
sb $0,10($0)
xor $5,$4,$3
sltiu $4,$4,21974
sw $5,0($0)
nor $3,$1,$3
addu $3,$4,$3
sll $4,$4,16
sltu $1,$0,$3
lh $3,14($0)
sltiu $4,$6,-21886
lhu $3,8($0)
sllv $3,$4,$3
subu $4,$4,$3
sltiu $1,$4,-18907
subu $4,$0,$3
addu $3,$3,$3
xori $6,$5,5963
xor $0,$3,$3
sllv $1,$5,$3
nor $3,$1,$3
sltu $3,$4,$3
sll $3,$3,6
sh $3,8($0)
sltiu $4,$5,20691
srl $4,$6,29
addiu $0,$1,-20381
srl $4,$1,29
sh $3,8($0)
addiu $3,$1,-21571
srlv $1,$4,$3
ori $3,$3,49951
sllv $3,$3,$3
nor $1,$3,$3
sltiu $6,$3,-27961
nor $1,$4,$3
addu $3,$4,$3
sllv $1,$3,$3
slti $5,$5,30300
or $5,$5,$3
xori $4,$3,58777
sw $4,4($0)
xor $3,$3,$3
xori $4,$3,51337
sb $4,14($0)
or $0,$3,$3
srav $5,$5,$3
or $4,$0,$3
srl $1,$1,16
addiu $5,$5,-24668
srlv $3,$3,$3
slt $3,$4,$3
xori $0,$3,275
nor $1,$3,$3
slti $4,$4,5643
addiu $5,$5,-25950
or $0,$3,$3
sllv $1,$3,$3
sb $0,3($0)
sltiu $1,$1,-31725
addu $4,$5,$3
sra $3,$5,28
addu $1,$4,$3
sw $1,0($0)
sb $0,12($0)
sw $4,0($0)
nor $5,$5,$3
addu $4,$3,$3
addu $3,$3,$3
addu $3,$4,$3
sltiu $4,$4,11533
sltiu $4,$1,-32656
sb $4,11($0)
lhu $5,16($0)
subu $5,$5,$3
srlv $5,$3,$3
srl $4,$1,4
srlv $4,$4,$3
| 14.051744 | 18 | 0.520813 |
dba7dd9693ae7b078f04cde809d4095418018eb1 | 5,096 | asm | Assembly | Working Disassembly/General/Sprites/Knuckles/Cutscene/Map - Cutscene Knuckles.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | 5 | 2021-07-09T08:17:56.000Z | 2022-02-27T19:57:47.000Z | Working Disassembly/General/Sprites/Knuckles/Cutscene/Map - Cutscene Knuckles.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | null | null | null | Working Disassembly/General/Sprites/Knuckles/Cutscene/Map - Cutscene Knuckles.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | null | null | null | Map_364016: dc.w Frame_364060-Map_364016
dc.w Frame_364062-Map_364016
dc.w Frame_36407C-Map_364016
dc.w Frame_364096-Map_364016
dc.w Frame_3640B0-Map_364016
dc.w Frame_3640B8-Map_364016
dc.w Frame_3640C0-Map_364016
dc.w Frame_3640C8-Map_364016
dc.w Frame_3640D0-Map_364016
dc.w Frame_3640D8-Map_364016
dc.w Frame_3640F2-Map_364016
dc.w Frame_36410C-Map_364016
dc.w Frame_364120-Map_364016
dc.w Frame_364134-Map_364016
dc.w Frame_364142-Map_364016
dc.w Frame_36415C-Map_364016
dc.w Frame_364176-Map_364016
dc.w Frame_36418A-Map_364016
dc.w Frame_3641A4-Map_364016
dc.w Frame_3641B2-Map_364016
dc.w Frame_3641C0-Map_364016
dc.w Frame_3641CE-Map_364016
dc.w Frame_3641DC-Map_364016
dc.w Frame_3641EA-Map_364016
dc.w Frame_364204-Map_364016
dc.w Frame_364218-Map_364016
dc.w Frame_364232-Map_364016
dc.w Frame_36424C-Map_364016
dc.w Frame_36425A-Map_364016
dc.w Frame_36426E-Map_364016
dc.w Frame_364282-Map_364016
dc.w Frame_364296-Map_364016
dc.w Frame_3642AA-Map_364016
dc.w Frame_3642B8-Map_364016
dc.w Frame_3642C6-Map_364016
dc.w Frame_3642E0-Map_364016
dc.w Frame_3642F4-Map_364016
Frame_364060: dc.w 0
Frame_364062: dc.w 4
dc.b $EC, $F, 0, 0,$FF,$F5
dc.b $EC, 1, 0,$10, 0,$15
dc.b $FC, 1, 0,$12,$FF,$ED
dc.b $C, 4, 0,$14,$FF,$F5
Frame_36407C: dc.w 4
dc.b $F4, 5, 0, 0, 0,$11
dc.b $F4, $F, 0, 4,$FF,$F1
dc.b $E4, 9, 0,$14,$FF,$F9
dc.b 4, 0, 0,$1A,$FF,$E9
Frame_364096: dc.w 4
dc.b $E4, 4, 0, 0, 0, 3
dc.b $EC, $F, 0, 2,$FF,$FB
dc.b $F4, 6, 0,$12,$FF,$EB
dc.b $C, 4, 0,$18,$FF,$FB
Frame_3640B0: dc.w 1
dc.b $F0, $F, 0, 0,$FF,$F0
Frame_3640B8: dc.w 1
dc.b $F0, $F, 0, 0,$FF,$F0
Frame_3640C0: dc.w 1
dc.b $F0, $F, 0, 0,$FF,$F0
Frame_3640C8: dc.w 1
dc.b $F0, $F, 0, 0,$FF,$F0
Frame_3640D0: dc.w 1
dc.b $F0, $F, 0, 0,$FF,$F0
Frame_3640D8: dc.w 4
dc.b $EB, $D, 0, 0,$FF,$F2
dc.b $EB, 0, 0, 8, 0,$12
dc.b $FB, $A, 0, 9,$FF,$F2
dc.b 3, 5, 0,$12, 0, $A
Frame_3640F2: dc.w 4
dc.b $EC, 8, 0, 0,$FF,$F3
dc.b $F4, $E, 0, 3,$FF,$F3
dc.b $FC, 2, 0, $F,$FF,$EB
dc.b $C, 4, 0,$12, 0, 3
Frame_36410C: dc.w 3
dc.b $EC, 4, 0, 0,$FF,$F9
dc.b $F4, $F, 0, 2,$FF,$F1
dc.b $FC, 2, 0,$12,$FF,$E9
Frame_364120: dc.w 3
dc.b $EC, 9, 0, 0,$FF,$F4
dc.b $FC, $D, 0, 6,$FF,$EC
dc.b $C, 4, 0, $E,$FF,$F4
Frame_364134: dc.w 2
dc.b $EC, 9, 0, 0,$FF,$F5
dc.b $FC, $E, 0, 6,$FF,$ED
Frame_364142: dc.w 4
dc.b $EC, 8, 0, 0,$FF,$F4
dc.b $F4, $E, 0, 3,$FF,$F4
dc.b $FC, 2, 0, $F,$FF,$EC
dc.b $C, 0, 0,$12, 0, 4
Frame_36415C: dc.w 4
dc.b $EA, 4, 0, 0,$FF,$FA
dc.b $F2, 8, 0, 2,$FF,$F2
dc.b $FA, $E, 0, 5,$FF,$F2
dc.b 2, 1, 0,$11,$FF,$EA
Frame_364176: dc.w 3
dc.b $EC, 4, 0, 0,$FF,$F7
dc.b $F4, $E, 0, 2,$FF,$EF
dc.b $C, 8, 0, $E,$FF,$EF
Frame_36418A: dc.w 4
dc.b $EC, 9, 0, 0,$FF,$F3
dc.b $FC, $D, 0, 6,$FF,$F3
dc.b $FC, 0, 0, $E,$FF,$EB
dc.b $C, 8, 0, $F,$FF,$F3
Frame_3641A4: dc.w 2
dc.b $EC, 8, 0, 0,$FF,$F5
dc.b $F4, $F, 0, 3,$FF,$ED
Frame_3641B2: dc.w 2
dc.b $ED, 8, 0, 0,$FF,$F5
dc.b $F5, $F, 0, 3,$FF,$ED
Frame_3641C0: dc.w 2
dc.b $EC, 8, 0, 0,$FF,$F5
dc.b $F4, $F, 0, 3,$FF,$ED
Frame_3641CE: dc.w 2
dc.b $ED, 8, 0, 0,$FF,$F5
dc.b $F5, $F, 0, 3,$FF,$ED
Frame_3641DC: dc.w 2
dc.b $EC, 9, 0, 0,$FF,$F9
dc.b $FC, $E, 0, 6,$FF,$F1
Frame_3641EA: dc.w 4
dc.b $EC, 8, 0, 0,$FF,$F9
dc.b $F4, $D, 0, 3,$FF,$F1
dc.b 4, 8, 0, $B,$FF,$F9
dc.b $C, $C, 0, $E,$FF,$F1
Frame_364204: dc.w 3
dc.b $EC, 8, 0, 0,$FF,$EF
dc.b $F4, $D, 0, 3,$FF,$EF
dc.b 4, 9, 0, $B,$FF,$EF
Frame_364218: dc.w 4
dc.b $EC, $D, 0, 0,$FF,$F2
dc.b $F4, 0, 0, 8,$FF,$EA
dc.b $FC, $D, 0, 9,$FF,$EA
dc.b $C, 8, 0,$11,$FF,$EA
Frame_364232: dc.w 4
dc.b $EC, 8, 0, 0,$FF,$EF
dc.b $F4, $C, 0, 3,$FF,$E7
dc.b $FC, 9, 0, 7,$FF,$EF
dc.b $C, $C, 0, $D,$FF,$E7
Frame_36424C: dc.w 2
dc.b $EC, 9, 0, 0,$FF,$EA
dc.b $FC, $E, 0, 6,$FF,$E2
Frame_36425A: dc.w 3
dc.b $EC, $A, 0, 0,$FF,$F7
dc.b 4, 4, 0, 9,$FF,$F7
dc.b $C, $C, 0, $B,$FF,$EF
Frame_36426E: dc.w 3
dc.b $EC, $A, 0, 0,$FF,$F7
dc.b 4, 4, 0, 9,$FF,$F7
dc.b $C, $C, 0, $B,$FF,$EF
Frame_364282: dc.w 3
dc.b $EC, $A, 0, 0,$FF,$F7
dc.b 4, 4, 0, 9,$FF,$F7
dc.b $C, $C, 0, $B,$FF,$EF
Frame_364296: dc.w 3
dc.b $EC, $A, 0, 0,$FF,$F7
dc.b 4, 4, 0, 9,$FF,$F7
dc.b $C, $C, 0, $B,$FF,$EF
Frame_3642AA: dc.w 2
dc.b $EC, 9, 8, 0,$FF,$F3
dc.b $FC, $E, 8, 6,$FF,$F3
Frame_3642B8: dc.w 2
dc.b $EC, 9, 0, 0,$FF,$F3
dc.b $FC, $E, 0, 6,$FF,$F3
Frame_3642C6: dc.w 4
dc.b $EC, 8, 0, 0,$FF,$F3
dc.b $F4, $D, 0, 3,$FF,$F3
dc.b 4, 8, 0, $B,$FF,$F3
dc.b $C, $C, 0, $E,$FF,$F3
Frame_3642E0: dc.w 3
dc.b $EC, 8, 0, 0,$FF,$F5
dc.b $F4, $D, 0, 3,$FF,$F5
dc.b 4, 9, 0, $B,$FF,$F5
Frame_3642F4: dc.w 4
dc.b $EC, $E, 0, 0,$FF,$F3
dc.b $F4, 1, 0, $C, 0,$13
dc.b 4, 8, 0, $E,$FF,$F3
dc.b $C, $C, 0,$11,$FF,$F3
| 28.79096 | 40 | 0.534733 |
35ef683275e809bbed841c82aaa86f24a49da081 | 8,543 | asm | Assembly | src/c64/video.asm | puzzud/retroleague | e11932ffaaf7ee07571e9971cf12bbf7f1457d89 | [
"MIT"
] | 4 | 2017-11-06T20:37:16.000Z | 2021-02-05T15:55:20.000Z | src/c64/video.asm | puzzud/retroleague | e11932ffaaf7ee07571e9971cf12bbf7f1457d89 | [
"MIT"
] | 11 | 2016-09-06T17:42:23.000Z | 2016-09-26T18:50:24.000Z | src/c64/video.asm | puzzud/retroleague | e11932ffaaf7ee07571e9971cf12bbf7f1457d89 | [
"MIT"
] | 2 | 2020-03-28T21:41:22.000Z | 2020-05-08T09:18:25.000Z | ; c64 video.asm
.export _PrintColor
.export _InitializeVideo
.export _ClearScreen
.export _PrintText
.export _DrawImage
.autoimport on
.importzp sp, sreg, regsave, regbank
.importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
.macpack longbranch
.import _CHARSET
.import _SPRITES
.include "c64.asm"
.segment "BSS"
_PrintColor:
.res 1
ImageWidth:
.res 1
ImageHeight:
.res 1
.segment "ZEROPAGE"
.segment "CODE"
;------------------------------------------------------------------
_InitializeVideo:
lda #COLOR_BLACK
sta _PrintColor
jsr _ClearScreen
jsr InitializeCharacterGraphics
jsr InitializeSprites
rts
;------------------------------------------------------------------
InitializeCharacterGraphics:
;VIC bank
lda CIA2_PRA
;and #%11111101 ; bank 2 base vic mem = $8000
and #%11111100 ; bank 3 base vic mem = $c000
sta CIA2_PRA
;block interrupts
;since we turn ROMs off this would result in crashes if we didn't
sei
;set charset
;lda #%00111110 ; screen mem = $8000 + $0c00 = $8c00
; ; char mem = $8000 + $3800 = $b800
lda #%00111100 ; screen mem = $c000 + $0c00 = $cc00
; char mem = $c000 + $3000 = $f000
; screen mem = (base VIC memory address) + (1024 * high nibble)
; char mem = (base VIC memory address) + (1024 * low nibble)
sta VIC_VIDEO_ADR
;save old configuration
lda LORAM
pha
;only RAM
;to copy under the IO rom
lda #%00110000
sta LORAM
;take source address from CHARSET
lda #<_CHARSET
sta ptr1
lda #>_CHARSET
sta ptr1+1
;now copy
jsr CopyCharacterSet
;restore ROMs
pla
sta LORAM
cli
;enable multi color charset
lda VIC_CTRL2
ora #%00010000
sta VIC_CTRL2
rts
;------------------------------------------------------------------
InitializeSprites:
; Init sprite registers.
; No visible sprites.
lda #$0
sta VIC_SPR_ENA
; All sprites normal scale.
sta VIC_SPR_EXP_X
sta VIC_SPR_EXP_Y
; Take source address from SPRITES.
lda #<_SPRITES
sta ptr1
lda #>_SPRITES
sta ptr1+1
sei
; Save old configuration.
lda LORAM
pha
; Only RAM to copy under the IO ROM.
lda #%00110000
sta LORAM
jsr CopySprites
; Restore ROMs.
pla
sta LORAM
cli
rts
;------------------------------------------------------------------
CopyCharacterSet:
; Set target address ($f000).
lda #<CHARACTER_GRAPHICS_TARGET
sta ptr2
lda #>CHARACTER_GRAPHICS_TARGET
sta ptr2+1
ldx #$00
ldy #$00
lda #0
sta tmp1
@nextLine:
lda (ptr1),Y
sta (ptr2),Y
inx
iny
cpx #$08
bne @nextLine
cpy #$00
bne @pageBoundaryNotReached
; The next 256 bytes have been reached, increase high byte.
inc ptr1+1
inc ptr2+1
@pageBoundaryNotReached:
; Only copy 254 chars to keep IRQ vectors intact.
inc tmp1
lda tmp1
cmp #254
beq @copyCharsetDone
ldx #$00
jmp @nextLine
@copyCharsetDone:
rts
;------------------------------------------------------------------
CopySprites:
ldy #$00
ldx #$00
lda #<SPRITE_GRAPHICS_TARGET
sta ptr2
lda #>SPRITE_GRAPHICS_TARGET
sta ptr2+1
; 4 sprites per loop.
@spriteLoop:
lda (ptr1),y
sta (ptr2),y
iny
bne @spriteLoop
inx
inc ptr1+1
inc ptr2+1
cpx #NUMBER_OF_SPRITES_DIV_4
bne @spriteLoop
rts
; _PrintText
; Prints text string to an X,Y coordinate on the screen.
;
; inputs:
; - text: (sp[2],sp[1]), Pointer to text string.
; - x: sp[0], X position to write string.
; - y: a, Y position to write string.
_PrintText:
tax ; y
lda ScreenLineOffsetTableHi,x
sta ptr2+1
lda ScreenLineOffsetTableLo,x
sta ptr2
; A = ptr2
clc
ldy #0 ; x
adc (sp),y
sta ptr2
bcc @setTextPointer
lda #0
adc ptr2+1
sta ptr2+1
@setTextPointer:
clc ; (ptr+1,ptr)=&text
lda #0
ldy #1
adc (sp),y
sta ptr1
lda #0
iny
adc (sp),y
sta ptr1+1
ldy #$ff
@printTextLoop:
iny
lda (ptr1),y ; (ptr2+1,ptr2)=a=text[++y]
sta (ptr2),y
bne @printTextLoop
; Switch ptr2 to point to color RAM.
clc
lda ptr2
adc #<(SCREEN_COLOR-SCREEN_CHAR)
sta ptr2
lda ptr2+1
adc #>(SCREEN_COLOR-SCREEN_CHAR)
sta ptr2+1
lda _PrintColor
@printTextColorLoop:
dey
sta (ptr2),y
bne @printTextColorLoop
jmp incsp3
; _DrawImage
; Prints text string to an X,Y coordinate on the screen.
;
; inputs:
; - image: (sp[2],sp[1]), Pointer to an image map.
; - x: sp[0], X position to draw image (uppler left corner).
; - y: a, Y position to draw image (uppler left corner)
_DrawImage:
sta tmp2
clc ; (ptr+1,ptr)=&image
lda #0
ldy #1
adc (sp),y
sta ptr1
lda #0
iny
adc (sp),y
sta ptr1+1
; Retrieve image dimensions.
ldy #0
lda (ptr1),y
sta ImageWidth
iny
lda (ptr1),y
sta ImageHeight
; Move ptr1 beyond header.
clc
lda ptr1
adc #2
sta ptr1
lda #0
adc ptr1+1
sta ptr1+1
; Set up base target VRAM address.
ldx tmp2 ; y
lda ScreenLineOffsetTableHi,x
sta ptr2+1
lda ScreenLineOffsetTableLo,x
sta ptr2
; Add x offset to screen start address.
clc
ldy #0 ; x
adc (sp),y
sta ptr2
lda #0
adc ptr2+1
sta ptr2+1
; Calculate color RAM.
clc
lda ptr2
adc #<(SCREEN_COLOR-SCREEN_CHAR)
sta ptr3
lda ptr2+1
adc #>(SCREEN_COLOR-SCREEN_CHAR)
sta ptr3+1
ldx #0
@drawImageYLoop:
ldy #$ff
@drawImageXLoop:
iny
cpy ImageWidth
beq @drawImageXLoopEnd
lda (ptr1),y
sta (ptr2),y
lda _PrintColor
sta (ptr3),y
jmp @drawImageXLoop
@drawImageXLoopEnd:
inx
cpx ImageHeight
bcs @endDrawImage
; Move ptr1 to start of next line.
clc
lda ptr1
adc ImageWidth
sta ptr1
lda #0
adc ptr1+1
sta ptr1+1
; Move ptr2 and ptr3 to next line.
clc
lda ptr2
adc #SCREEN_CHAR_WIDTH
sta ptr2
lda #0
adc ptr2+1
sta ptr2+1
clc
lda ptr3
adc #SCREEN_CHAR_WIDTH
sta ptr3
lda #0
adc ptr3+1
sta ptr3+1
jmp @drawImageYLoop
@endDrawImage:
jmp incsp3
;------------------------------------------------------------------
FillScreen:
pha
; Fill character memory.
; Algorithm assumes even pages,
; thus -1 to high byte and zeroing of low byte of address.
lda #>(SCREEN_CHAR+SCREEN_CHAR_SIZE-1)
sta ptr1+1
tax ; Set up X to be part of loop as a secondary decrementer.
ldy #0 ; Also, setting Y's starting value in loop.
sty ptr1
pla
@fillScreenCharacterLoop:
dey
sta (ptr1),y
bne @fillScreenCharacterLoop
dex
cpx #>SCREEN_CHAR-1
beq @endFillScreenCharacter
stx ptr1+1
bne @fillScreenCharacterLoop
@endFillScreenCharacter:
; Fill color memory.
lda #>(SCREEN_COLOR+SCREEN_CHAR_SIZE-1)
sta ptr1+1
tax
lda #0
sta ptr1
tay
lda _PrintColor
@fillScreenColorLoop:
dey
sta (ptr1),y
bne @fillScreenColorLoop
dex
cpx #>SCREEN_COLOR-1
beq @endFillScreenColor
stx ptr1+1
bne @fillScreenColorLoop
@endFillScreenColor:
rts
;------------------------------------------------------------------
_ClearScreen:
lda #' '
jsr FillScreen
rts
;------------------------------------------------------------------
.macro sloTable loOrHi, n
.local lineNumber
.if .paramcount > 1
lineNumber = n
.else
lineNumber = 0
.endif
.local address
address = (SCREEN_CHAR + (SCREEN_CHAR_WIDTH * lineNumber))
.if loOrHi = 0
.byte <(address)
.endif
.if loOrHi = 1
.byte >(address)
.endif
.if lineNumber < SCREEN_CHAR_HEIGHT
sloTable loOrHi, (lineNumber+1) ; NOTE: Wrapping parameter in parentheses is critical (bug?).
.endif
.endmacro
;------------------------------------------------------------------
.macro scloTable loOrHi, n
.local lineNumber
.if .paramcount > 1
lineNumber = n
.else
lineNumber = 0
.endif
.local address
address = (SCREEN_COLOR + (SCREEN_CHAR_WIDTH * lineNumber))
.if loOrHi = 0
.byte <(address)
.endif
.if loOrHi = 1
.byte >(address)
.endif
.if lineNumber < SCREEN_CHAR_HEIGHT
scloTable loOrHi, (lineNumber+1) ; NOTE: Wrapping parameter in parentheses is critical (bug?).
.endif
.endmacro
;------------------------------------------------------------------
; Preprocessed table of video RAM addresses for each start of a line.
ScreenLineOffsetTableLo:
sloTable 0
ScreenLineOffsetTableHi:
sloTable 1
;------------------------------------------------------------------
; Preprocessed table of video color RAM addresses for each start of a line.
ScreenColorLineOffsetTableLo:
scloTable 0
ScreenColorLineOffsetTableHi:
scloTable 1
| 17.12024 | 98 | 0.607164 |
f786acb905c5921edf927e12967928782383f974 | 613 | asm | Assembly | programs/oeis/313/A313927.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/313/A313927.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/313/A313927.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A313927: Coordination sequence Gal.5.135.2 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.
; 1,5,10,16,22,28,34,40,45,50,55,60,66,72,78,84,90,95,100,105,110,116,122,128,134,140,145,150,155,160,166,172,178,184,190,195,200,205,210,216,222,228,234,240,245,250,255,260,266,272
mov $2,$0
add $2,5
mov $4,1
mov $5,$0
mov $0,$2
mov $1,4
mov $3,$2
add $3,2
add $4,$2
sub $4,5
sub $1,$4
lpb $0,1
sub $0,1
add $1,1
trn $3,5
add $3,1
trn $1,$3
add $1,1
trn $3,5
add $1,$3
lpe
lpb $5,1
add $1,4
sub $5,1
lpe
sub $1,5
| 20.433333 | 181 | 0.646003 |
163615ed758fccb539db2be18921b99a38e44c84 | 564 | asm | Assembly | oeis/165/A165829.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/165/A165829.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/165/A165829.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A165829: Totally multiplicative sequence with a(p) = 8.
; Submitted by Jon Maiga
; 1,8,8,64,8,64,8,512,64,64,8,512,8,64,64,4096,8,512,8,512,64,64,8,4096,64,64,512,512,8,512,8,32768,64,64,64,4096,8,64,64,4096,8,512,8,512,512,64,8,32768,64,512,64,512,8,4096,64,4096,64,64,8,4096,8,64,512,262144,64,512,8,512,64,512,8,32768,8,64,512,512,64,512,8,32768,4096,64,8,4096,64,64,64,4096,8,4096,64,512,64,64,64,262144,8,512,512,4096
seq $0,1222 ; Number of prime divisors of n counted with multiplicity (also called bigomega(n) or Omega(n)).
mov $2,8
pow $2,$0
mov $0,$2
| 62.666667 | 341 | 0.707447 |
b662c03cbd8c96a0a078630a9a82f7a065671d8c | 7,731 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca_notsx.log_21829_227.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca_notsx.log_21829_227.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca_notsx.log_21829_227.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 %r14
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xfc10, %r12
nop
nop
nop
nop
sub $53296, %rbp
mov $0x6162636465666768, %rcx
movq %rcx, %xmm6
vmovups %ymm6, (%r12)
nop
nop
and %r12, %r12
lea addresses_normal_ht+0x1ebf0, %rsi
lea addresses_WC_ht+0x1acf0, %rdi
nop
nop
nop
sub $32987, %r13
mov $21, %rcx
rep movsl
sub %r12, %r12
lea addresses_D_ht+0x122d0, %r13
nop
nop
nop
inc %rsi
mov (%r13), %cx
nop
nop
nop
add %r12, %r12
lea addresses_normal_ht+0x14ad0, %rsi
nop
and %rcx, %rcx
mov (%rsi), %edi
nop
nop
nop
nop
nop
and $26199, %rsi
lea addresses_WT_ht+0x1b698, %r12
nop
nop
nop
nop
nop
and $16826, %r14
mov (%r12), %cx
nop
nop
cmp $55956, %r13
lea addresses_A_ht+0x1ba4e, %rdi
nop
nop
nop
nop
xor %r14, %r14
movb $0x61, (%rdi)
nop
nop
cmp $39127, %rcx
lea addresses_D_ht+0x498a, %r13
nop
nop
nop
nop
add %r14, %r14
movb $0x61, (%r13)
add %r14, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r8
push %rax
push %rcx
push %rdi
push %rsi
// Store
lea addresses_RW+0x13bd0, %rsi
nop
nop
nop
xor %r12, %r12
movw $0x5152, (%rsi)
nop
add %rdi, %rdi
// Store
lea addresses_RW+0x7fd0, %rsi
nop
nop
nop
nop
xor %rcx, %rcx
mov $0x5152535455565758, %r13
movq %r13, %xmm5
vmovups %ymm5, (%rsi)
nop
nop
nop
nop
xor %rsi, %rsi
// Store
lea addresses_US+0xded0, %r8
nop
nop
nop
nop
cmp $53390, %rax
mov $0x5152535455565758, %rdi
movq %rdi, %xmm2
movaps %xmm2, (%r8)
nop
nop
nop
nop
sub $37129, %rdi
// Store
lea addresses_WC+0x1c370, %rdi
nop
nop
sub %r8, %r8
mov $0x5152535455565758, %r12
movq %r12, %xmm7
vmovups %ymm7, (%rdi)
nop
nop
nop
nop
nop
cmp %rdi, %rdi
// Store
lea addresses_normal+0xcdd0, %r8
sub $7701, %rax
movl $0x51525354, (%r8)
nop
nop
sub $16962, %r8
// Store
mov $0x905900000000dd0, %r8
nop
nop
xor %rdi, %rdi
mov $0x5152535455565758, %rsi
movq %rsi, %xmm0
vmovups %ymm0, (%r8)
nop
nop
xor $35203, %rcx
// Store
lea addresses_RW+0xdad0, %r13
nop
nop
xor %rdi, %rdi
mov $0x5152535455565758, %r8
movq %r8, %xmm3
vmovntdq %ymm3, (%r13)
nop
nop
nop
nop
dec %r12
// Store
lea addresses_RW+0xdad0, %r8
nop
xor $45073, %rdi
mov $0x5152535455565758, %rcx
movq %rcx, (%r8)
nop
cmp $61876, %rdi
// Faulty Load
lea addresses_RW+0xdad0, %rsi
clflush (%rsi)
nop
nop
nop
sub %r12, %r12
mov (%rsi), %ecx
lea oracles, %rdi
and $0xff, %rcx
shlq $12, %rcx
mov (%rdi,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 6, 'same': False, 'type': 'addresses_RW'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 4, 'same': False, 'type': 'addresses_US'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 4, 'same': False, 'type': 'addresses_WC'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 8, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': True, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 1, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'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
*/
| 31.555102 | 2,999 | 0.652568 |
f81af78193e49236a007ea3a1fa1018a26a397e8 | 124,786 | asm | Assembly | Appl/FileMgrs/CommonDesktop/CMain/cmainFileOps.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Appl/FileMgrs/CommonDesktop/CMain/cmainFileOps.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Appl/FileMgrs/CommonDesktop/CMain/cmainFileOps.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: Desktop/Main
FILE: mainFileOps.asm
ROUTINES:
INT RenameWithOverwrite - rename file, overwriting existing one
INT UpdateFilenameList - update filename list in dialog box
INT ShowFileOpStatus - report file operation and filename
INT ShowFileOpResult - report file operation results
INT GetCheckOneFilename - parse filename list for single filename
INT GetDestinationName - handle wildcards in dest. filename
INT WildcardRename - rename with wildcards
INT WildcardDelete - delete with wildcards
INT WildcardMove - move with wildcards
INT WildcardCopy - copy with wildcards
INT CheckForWildcards - check path/filename for wildcard chars
INT BuildWildcardBuffer - build list of filenames from wildcard
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 7/89 Initial version
DESCRIPTION:
This file contains support routines for file operations.
$Id: cmainFileOps.asm,v 1.3 98/06/03 13:37:21 joon Exp $
------------------------------------------------------------------------------@
FileOperation segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopFileOpSkip
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Skip to next file in file list for this file operation,
dismisses file op box if no more files
CALLED BY: MSG_FILE_OP_SKIP
PASS: cx - file op box chunk
dx - file op file list chunk
RETURN: carry set if dismissed
carry clear otherwise
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/23/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopFileOpSkip method DesktopClass, MSG_FILE_OP_SKIP_FILE
push cx ; save file op box chunk
mov bx, handle FileOperationUI
mov si, dx
mov ax, MSG_SHOW_NEXT_FILE ; skip to next file
call ObjMessageCall
pop si ; si = file op box
jnc done ; => file being shown, so leave up
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
mov cx, IC_DISMISS
call ObjMessageForce
stc
done:
ret
DesktopFileOpSkip endm
;
; file operation status strings
;
;moved for LOCALIZATION - brianc 11/30/90
;renameStatusString byte 'Renaming ',0
;createDirStatusString byte 'Creating folder ',0
;duplicateStatusString byte 'Duplicating ',0
;changeAttrStatusString byte 'Changing attributes of ',0
if 0
renameResultString byte ' files renamed.',0
renameOneResultString byte ' file renamed.',0
createDirResultString byte ' folders created.',0
createDirOneResultString byte ' folder created.',0
duplicateResultString byte ' files duplicated.',0
duplicateOneResultString byte ' file duplicated.',0
changeAttrResultString byte ' files with attributes changed.',0
changeAttrOneResultString byte ' file with attributes changed.',0
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopEndRename
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: rename file(s) specified by dialog box
CALLED BY: MSG_META_END_RENAME
PASS:
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 8/22/89 Initial version
brianc 10/11/89 added wildcard support
brianc 1/18/90 hacked for 8.3 and 32 name support
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopEndRename method DesktopClass, MSG_FM_END_RENAME
call ShowHourglass
call InitForWindowUpdate
;
; disable name entry field and reply bar
;
mov bx, handle FileOperationUI
mov si, offset FileOperationUI:RenameToEntry
mov ax, MSG_GEN_SET_NOT_ENABLED
mov cx, offset FileOperationUI:RenameControl
call FileOpDisableControls
;
; change to directory specified in rename box, we don't care what
; directory we are in when we quit, so no need to save current
; directory
;
mov si, offset FileOperationUI:RenameFromEntry
call GetSrcFromFileListAndSetCurDir
jnc notDone
unlockDone:
tst ax
LONG jz done
call MemUnlock
jmp done ; if no more, done
notDone:
;
; get destination filename
;
push bx, dx
mov si, offset FileOperationUI:RenameToEntry
call CallGetText ; get dest. filename(s)
pop bx, ax
jcxz unlockDone ; if no dest. name, done
; check if the destination file name has visible characters
push bx, ax
mov bx, dx
call MemLock
push ds
mov ds, ax
clr dx ; ds:dx = beg. of name buffer
call CheckForBlankName
pushf
call MemUnlock
popf
mov dx, bx
pop ds
pop bx, ax
jnc visibleDestFile
mov ax, ERROR_BLANK_NAME
call DesktopOKError
jmp done
visibleDestFile:
push bx ; save FQT
mov bx, dx
mov dx, ax ; ds:dx <- FOIE
push bx
call MemLock ; lock dest. filename buffer
mov es, ax ; es:di = dest fname
clr di
;
; update rename status in rename box
;
mov si, offset FileOperationUI:RenameStatus ; status field
mov bp, offset RenameStatusString ; status text
CheckHack <offset FOIE_name eq 0>
call ShowFileOpStatus
;
; rename file
; es:di = entered destination name
; ds:dx = FOIE
;
CheckHack <offset FOIE_name eq 0>
call RenameWithOverwrite ; rename ds:dx to es:di
mov cx, 1 ; one file renamed
jnc noError
mov cx, 0 ; no files renamed
call DesktopOKError ; report error
jnc noError
cmp ax, DESK_DB_DETACH ; detaching, no update
je noUpdate
cmp ax, YESNO_CANCEL ; user-cancel operation, update
je finishUp ; previous files
cmp ax, YESNO_NO ; no rename, just update name
je updateNames ; list
stc ; don't update names
jmp finishUp
noError:
;
; update folder windows
;
pushf
mov ax, RENAME_UPDATE_STRATEGY
call MarkWindowForUpdate ; pass ds:dx = source name
; preserves cx
popf
jc finishUp ; if error, don't update names
updateNames:
;
; update name entries in rename dialog box
; (if no more files, box will be dismissed)
;
mov ax, MSG_RENAME_NEXT
mov si, offset FileOperationUI:RenameToEntry
call UpdateSrcAndDestNames ; move to next file when done
finishUp:
;
; show rename results
;
mov si, offset FileOperationUI:RenameStatus ; result field
call ShowFileOpResult ; show file count of renamed
;
; finish up
;
call UpdateMarkedWindows ; update affected window(s)
noUpdate:
mov ss:[recurErrorFlag], 0 ; clear error handling flag
pop bx ; throw away dest. fname buffer
call MemFree
pop bx ; bx <- FQT block
call MemUnlock
done:
mov ax, SP_TOP ; just go to top-level path
call FileSetStandardPath
;
; disable name entry field and reply bar
;
mov bx, handle FileOperationUI
mov si, offset FileOperationUI:RenameToEntry
mov ax, MSG_GEN_SET_ENABLED
mov cx, offset FileOperationUI:RenameControl
call FileOpDisableControls
;
; finish up
;
call HideHourglass
ret
DesktopEndRename endp
;
; pass:
; bx - UI object handle
; si - name entry field
; ax - method
; cx - reply bar
FileOpDisableControls proc near
push ax ; save method
push cx ; save reply bar
mov dl, VUM_NOW
call ObjMessageCall ; do name entry
pop si ; retrieve reply bar
pop ax ; retrieve method
mov dl, VUM_NOW
call ObjMessageCall ; do reply bar
ret
FileOpDisableControls endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopRenameNext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: move to next file in Rename dialog box
CALLED BY: MSG_RENAME_NEXT
PASS:
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 03/17/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopRenameNext method DesktopClass, MSG_RENAME_NEXT
;
; tell file list to show next file
;
mov cx, offset RenameBox
mov dx, offset RenameFromEntry
mov ax, MSG_FILE_OP_SKIP_FILE
mov bx, handle 0 ; send to ourselves
call ObjMessageCall
jc exit ; no more files
;
; then update destination name field characteristics for this file
; and fill source name as default destination name
;
call RenameStuff
exit:
ret
DesktopRenameNext endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopEndCreateDir
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: create directory/directories specified by dialog box
CALLED BY: MSG_META_END_CREATE_DIR
PASS:
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 8/23/89 Initial version
brianc 10/12/89 added wildcard checking
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopEndCreateDir method DesktopClass, MSG_FM_END_CREATE_DIR
call ShowHourglass
call InitForWindowUpdate
;
; temporarily change to directory specified in create dir box
;
mov bx, offset FileOperationUI:CreateDirBox
mov si, offset FileOperationUI:CreateDirCurDir
call ChangeToFileOpSrcDir
LONG jc exit ; if error reported, done
if (_ZMGR and not _PMGR)
MAX_NUM_ZMGR_WORLD_DIRS = 22 ; 21 + 1 for the Desk Accessories folder
; which doesn't show up in Express Menu
;
; for ZMGR, limit number of directories allowed in WORLD
;
push ax ; allocate two bytes on stack
segmov ds, ss
mov si, sp
mov cx, size word
call FileGetCurrentPath ; bx = disk handle
pop ax ; ax = two bytes of path
cmp bx, SP_APPLICATION ; WORLD?
jne allowDir ; nope
if DBCS_PCGEOS
ERROR -1
PrintMessage <fix DesktopEndCreateDir>
endif
cmp ax, '\\' or (0 shl 8) ; with null path?
je checkNumDirs
cmp al, 0 ; or null path?
jne allowDir
checkNumDirs:
sub sp, size FileEnumParams
mov bp, sp
mov ss:[bp].FEP_searchFlags, mask FESF_DIRS
mov ss:[bp].FEP_returnAttrs.segment, 0
mov ss:[bp].FEP_returnAttrs.offset, FESRT_COUNT_ONLY
mov ss:[bp].FEP_returnSize, 0
mov ss:[bp].FEP_matchAttrs.segment, 0
mov ss:[bp].FEP_bufSize, 0
mov ss:[bp].FEP_skipCount, 0
call FileEnum ; dx = count
jc allowDir ; detect error later
cmp dx, MAX_NUM_ZMGR_WORLD_DIRS
jb allowDir
mov ax, ERROR_TOO_MANY_WORLD_DIRS
call DesktopOKError
mov cx, 1 ; pretend dirs were created
jmp DECD_noFiles ; clean up
allowDir:
endif
;
; get source filename(s) buffer
;
mov si, offset FileOperationUI:CreateDirNameEntry
call CallGetText ; get filename(s)
tst cx
mov cx, 0 ; count of directories created
; (preserve flags)
LONG jz DECD_noFiles ; if no files, done
mov bx, dx
push bx
call MemLock ; lock filename buffer
mov ds, ax ; ds = filename buffer segment
clr dx ; ds:dx = beg. of fname buffer
;
; create directory
; ds:dx = directory name
;
call PrepDSDXForError ; do this while...?
mov si, offset FileOperationUI:CreateDirStatus ; status field
mov bp, offset CreateDirStatusString ; status text
clc ; DOS name, need conversion
call ShowFileOpStatus ; use common status reporting
call CheckForBlankName
jc dirError
if ENSURE_LOCAL_SP_SUBDIRS
;
; make sure that SP subdirs exist locally - brianc 6/7/93
;
call EnsureLocalStandardPathSubdirs
endif
call FileCreateDirWithError ; ds:dx = filename
jnc DECD_noError
dirError:
call DesktopOKError
; returns C=1 for error
jmp short DECD_noCreate
DECD_noError:
mov ax, CREATE_DIR_UPDATE_STRATEGY
mov si, dx ; pass ds:si = new dir. name
call MarkWindowForUpdate
inc cx ; bump created dir count
clc ; indicate no error
DECD_noCreate:
mov si, offset FileOperationUI:CreateDirStatus ; result field
push cx
call ShowFileOpResult ; show number of dirs created
call UpdateMarkedWindows ; redraw affected window(s)
pop cx
pop bx ; throw away filename buffer
call MemFree
DECD_noFiles:
mov ax, SP_TOP ; just go to top-level path
call FileSetStandardPath
;
; if no errors, bring down box
;
tst cx ; any dirs created?
jz exit ; no
mov bx, handle FileOperationUI ; yes, bring down box
mov si, offset CreateDirBox
mov cx, IC_DISMISS
mov ax, MSG_GEN_GUP_INTERACTION_COMMAND
call ObjMessageCall
exit:
call HideHourglass
ret
DesktopEndCreateDir endp
PrepDSDXForError proc near
uses es, di, si, cx
.enter
NOFXIP< segmov es, dgroup, di >
FXIP< mov di, bx >
FXIP< GetResourceSegmentNS dgroup, es, TRASH_BX >
FXIP< mov bx, di >
mov di, offset fileOperationInfoEntryBuffer
CheckHack <offset FOIE_name eq 0>
mov si, dx
mov cx, size FOIE_name
rep movsb
.leave
ret
PrepDSDXForError endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckForBlankName
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Checks to see if a string contains any non-blank characters
before its null-terminator.
CALLED BY: DesktopEndCreateDir
PASS: ds:dx - string
RETURN: carry set if string is blank (or null string)
ax - ERROR_BLANK_NAME
clear if name has visible characters
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 3/23/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckForBlankName proc near
uses si
.enter
mov si, dx ; ds:si is string
blankCheck:
LocalGetChar ax, dssi ;ax <- character
LocalIsNull ax ;NULL?
jz noVisCharFound ;branch if reached NULL
SBCS < clr ah >
call LocalIsSpace ;space?
jnz blankCheck ;branch if still spaces
clc
jmp exit
noVisCharFound:
mov ax, ERROR_BLANK_NAME
stc
exit:
.leave
ret
CheckForBlankName endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopEndDuplicate
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: duplicate file(s) specified by dialog box
CALLED BY: MSG_FM_END_DUPLICATE
PASS:
RETURN: nothing
DESTROYED: ax,cx,dx,bp
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 2/16/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopEndDuplicate method dynamic DesktopClass, MSG_FM_END_DUPLICATE
call ShowHourglass
call InitForWindowUpdate
mov ss:[enteredFileOpRecursion], 0 ; in case of early error
mov ax, FOPT_COPY
call SetFileOpProgressBox
;
; disable name entry field and reply bar
;
mov bx, handle FileOperationUI
mov si, offset FileOperationUI:DuplicateToEntry
mov ax, MSG_GEN_SET_NOT_ENABLED
mov cx, offset FileOperationUI:DuplicateControl
call FileOpDisableControls
;
; get source path and source name
; returns:
; ds = FQT block
; ds:dx - source name info
;
mov ax, offset FileOperationUI:DuplicateFromEntry
mov bx, offset FileOperationUI:DuplicateBox
mov si, offset FileOperationUI:DuplicateCurDir
call CopyMoveSourceSetUp
LONG jc done ; no more files
push bx, dx ; save FQT & FOIE offset
mov bx, ds:[FQTH_diskHandle]
mov dx, offset FQTH_pathname
call FileSetCurrentPath
LONG jc errorNoUpdateDestFreed
;
; get destination name
;
mov si, offset FileOperationUI:DuplicateToEntry
call CallGetText ; get dest. filename
; jcxz noDestNameGiven
tst cx
LONG jz noDestNameGiven
; check if the destination has visible character
push bx, ax
mov bx, dx
call MemLock
push ds
mov ds, ax
clr dx ; ds:dx = beg. of name buffer
call CheckForBlankName
pushf
call MemUnlock
popf
mov dx, bx
pop ds
pop bx, ax
jnc visibleDestFile
mov ax, ERROR_BLANK_NAME
call DesktopOKError
jmp noDestNameGiven
visibleDestFile:
mov bx, dx
pop dx ; ds:dx <- FOIE
push bx ; save dest filename block
push dx ; and FOIE again
call MemLock ; lock dest. filename buffer
;
; Report status using src name
;
push ax
mov si, offset FileOperationUI:DuplicateStatus ; status field
mov bp, offset DuplicateStatusString ; status text
call ShowFileOpStatus ; use common status reporting
segmov es, ds ; es <- FQT
pop ds
clr dx ; ds:dx <- dest name
call FileGetAttributes
pop si ; es:si <- source FOIE
jnc destExists
cmp ax, ERROR_FILE_NOT_FOUND ; only acceptable error
stc ; in case other error
jne errorNoUpdate
;
; valid destination name that doesn't already exist
; es = FQT
; ds:dx = destination name
;
segxchg ds, es
mov di, dx ; es:di <- dest name
call FileBatchChangeNotifications
call SuspendFolders
call DeskFileCopy
call UnsuspendFolders
call FileFlushChangeNotifications
jmp short afterFileDup ; go to finish duplicate
;
; dest filename exists, report error
;
destExists:
mov ax, ERROR_FILE_EXISTS ; cannot dup. to existing name
stc ; indicate error
errorNoUpdate:
; es is FQT
; sp -> dest name handle
; FQT handle
call DesktopOKError ; report error
mov cx, 0 ; no files duplicated
cmp ax, DESK_DB_DETACH ; detaching?
jne finishUp ; no, so show results
jmp noUpdate
errorNoUpdateDestFreed:
call DesktopOKError
noDestNameGiven:
pop dx ; ds:dx <- FOIE
mov cx, 0
jmp noUpdateNoDest
;
; duplication done, handle errors, etc.
;
afterFileDup:
mov cx, 1 ; assume one file duplicated
jnc update ; if no error, update
mov cx, 0 ; no files duplicated
call DesktopOKError ; report error
jnc update ; if ignored error, update
cmp ax, DESK_DB_DETACH ; detaching, no update
je noUpdate
;
; handle errors
; YESNO_NO - user wants to skip copy/move of current item
; YESNO_CANCEL - user wants to cancel complete copy/move operation
; ERROR_ACCESS_DENIED - file-busy/access-denied error for this
; item
; ERROR_SHARING_VIOLATION - ditto
; ERROR_DIR_NOT_EMPTY - can only happen when moving directory
; to another disk, in which case
; enteredFileOpRecursion will send us
; to "update"
; other - other file system error
;
cmp ss:[enteredFileOpRecursion], 1 ; did we do recursive file op?
stc ; C set to not update name list
je update ; yes, update this file as
; we could have made
; non-top-level changes
; before getting error
;
; error on top-level duplicate
;
cmp ax, YESNO_CANCEL ; user-cancel operation, update
je finishUp ; previous files
cmp ax, YESNO_NO ; no dup, update name list
je updateNames ; and update prev. files
cmp ax, ERROR_ACCESS_DENIED ; top-level no dup, update
je updateNames ; name list & prev. files
cmp ax, ERROR_SHARING_VIOLATION ; ditto
je updateNames
stc ; else, other error - update
; this file, but don't
; update name list
update:
;
; update affected folder windows
;
pushf
mov ax, COPY_UPDATE_STRATEGY
call MarkWindowForUpdate ; preserves cx
popf
jc finishUp ; error - don't update names
updateNames:
;
; update name entries in duplicate dialog box
; (if no more files, box will be dismissed)
;
mov ax, MSG_DUPLICATE_NEXT
mov si, offset FileOperationUI:DuplicateToEntry
call UpdateSrcAndDestNames ; move to next file when done
finishUp:
;
; show duplicate results
;
mov si, offset FileOperationUI:DuplicateStatus ; result field
if 0
mov bp, offset duplicateResultString ; result text
mov dx, offset duplicateOneResultString ; result text
endif
call ShowFileOpResult ; show file count of duplicated
;
; finish up
;
call UpdateMarkedWindows ; update affected window(s)
if GPC_FULL_WASTEBASKET
call UpdateWastebasket
endif
noUpdate:
pop bx ; throw away dest. fname buffer
call MemFree
noUpdateNoDest:
pop bx ; unlock FQT
call MemUnlock
mov ss:[recurErrorFlag], 0 ; clear error handling flag
done:
mov ax, SP_TOP ; just go to top-level path
call FileSetStandardPath
call ClearFileOpProgressBox
;
; re-enable name entry field and reply bar
;
mov bx, handle FileOperationUI
mov si, offset FileOperationUI:DuplicateToEntry
mov ax, MSG_GEN_SET_ENABLED
mov cx, offset FileOperationUI:DuplicateControl
call FileOpDisableControls
;
; finish up
;
call HideHourglass
ret
DesktopEndDuplicate endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopDuplicateNext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: move to next file in Duplicate dialog box
CALLED BY: MSG_DUPLICATE_NEXT
PASS: es = segment of DesktopClass
RETURN: nothing
DESTROYED: ax,cx,dx,bp
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 03/17/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopDuplicateNext method dynamic DesktopClass, MSG_DUPLICATE_NEXT
;
; tell file list to show next file
;
mov cx, offset DuplicateBox
mov dx, offset DuplicateFromEntry
mov ax, MSG_FILE_OP_SKIP_FILE
mov bx, handle 0 ; send to ourselves
call ObjMessageCall
jc exit ; no more files
;
; then update destination name field characteristics for this file
; and fill source name as default destination name
;
call DuplicateStuff
exit:
ret
DesktopDuplicateNext endm
ifndef GEOLAUNCHER ; no Change Attr in GeoLauncher
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopEndChangeAttr
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: change attributes for file specified in dialog box
CALLED BY: MSG_FM_END_CHANGE_ATTR
PASS: es = segment of DesktopClass
RETURN: nothing
DESTROYED: ax,cx,dx,bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 03/16/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopEndChangeAttr method dynamic DesktopClass, MSG_FM_END_CHANGE_ATTR
call InitForWindowUpdate
;
; change to directory specified in change attr box, we don't care what
; directory we are in when we quit, so no need to save current
; directory
;
mov si, offset FileOperationUI:ChangeAttrNameList
call GetSrcFromFileListAndSetCurDir
jnc doIt
tst ax
jz exit
call MemUnlock
jmp exit
doIt:
push bx
mov si, offset FileOperationUI:ChangeAttrStatus ; status field
mov bp, offset ChangeAttrStatusString ; status text
call ShowFileOpStatus
;
; change attributes of file
; ss:[fileOperationInfoEntryBuffer] = source
;
call SetNewFileAttributes ; cx = new attributes
mov cx, 1 ; one file with attrs changed
jnc noError ; yes
mov cx, 0 ; no files with attrs changed
call DesktopOKError ; report error
jnc updateNames
cmp ax, DESK_DB_DETACH ; detaching, no update
je done
cmp ax, YESNO_CANCEL ; user-cancel operation, update
je finishUp ; previous files
cmp ax, YESNO_NO ; no change, just update name
je updateNames ; list
stc ; error - don't update name
noError:
pushf
push cx ; save deleted file count
mov ax, CHANGE_ATTR_UPDATE_STRATEGY
call MarkWindowForUpdate ; pass ds:dx = source name
pop cx ; retrieve delete count
popf
jc finishUp ; error - don't update name
updateNames:
;
; update name entries in change attrs dialog box
; (if no more files, box will be dismissed)
;
mov ax, MSG_CHANGE_ATTR_NEXT
call UpdateNameListManually ; move to next file when done
;
; show change attrs results
;
finishUp:
mov si, offset FileOperationUI:ChangeAttrStatus ; result field
if 0
mov bp, offset changeAttrResultString ; result text
mov dx, offset changeAttrOneResultString ; result text
endif
call ShowFileOpResult ; show file count of renamed
;
; finish up
;
call UpdateMarkedWindows ; update affected window(s)
done:
pop bx ; bx <- FQT
call MemUnlock
mov ax, SP_TOP ; just go to top-level path
call FileSetStandardPath
exit:
ret
DesktopEndChangeAttr endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetNewFileAttributes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: set new flags and attributes for file
CALLED BY: INTERNAL
DesktopEndChangeAttr
PASS: ds:dx - filename
RETURN: carry - set on error
ax = error code
- clear otherwise
DESTROYED: bx, si, ax, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 3/16/89 broken out from old Change Attr handling
dlitwin 9/21/93 Changed the name to Set... from Get... and
added flags and attrs setting.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetNewFileAttributes proc near
uses dx, cx
changeAttrs local 2 dup (FileExtAttrDesc)
fileAttrs local FileAttrs
flagsAttrs local GeosFileHeaderFlags
.enter
;
; Get the original FileAttrs so we can preserve the FileAttrs
; that we don't want to change.
;
call FileGetAttributes ; cx = FileAttrs
LONG jc exit
andnf cl, not (mask FA_RDONLY or mask FA_ARCHIVE or \
mask FA_HIDDEN or mask FA_SYSTEM)
mov ss:[fileAttrs], cl
;
; Get the File Attributes
;
if GPC_GET_INFO_DB
mov bx, handle GetInfoAttrToList
mov si, offset GetInfoAttrToList
else
mov bx, handle ChangeAttrToList
mov si, offset ChangeAttrToList
endif
mov ax, MSG_GEN_BOOLEAN_GROUP_GET_SELECTED_BOOLEANS
push dx, bp
call ObjMessageCall ; ax = FileAttrs
pop dx, bp
;
; Fill the File Attributes FEAD
;
ornf ss:[fileAttrs], al ; FileAttrs
lea ax, ss:[fileAttrs] ; ss:ax is FileAttrs
mov ss:[changeAttrs].FEAD_attr, FEA_FILE_ATTR
segmov ss:[changeAttrs].FEAD_value.segment, ss
mov ss:[changeAttrs].FEAD_value.offset, ax
mov ss:[changeAttrs].FEAD_size, size FileAttrs
;
; check to see if this is a Geos file or not. If not, don't attempt
; to set the GeosFileHeaderFlags.
;
mov ax, FEA_FILE_TYPE
push ax ; allocate word on stack
segmov es, ss
mov di, sp ; es:di point to stack buffer
mov cx, size GeosFileType
call FileGetPathExtAttributes
pop cx
jnc geosFile ; if it has an FEA_FILE_TYPE
; it is a geos file
cmp ax, ERROR_ATTR_NOT_FOUND
jne exit ; some weird error happened...
mov cx, 1 ; default to one attribute
jmp notGeosFile
geosFile:
;
; Get the Flags
;
if GPC_GET_INFO_DB
mov bx, handle GetInfoAttrToList
mov si, offset GetInfoAttrToList
else
mov bx, handle ChangeFlagsToList
mov si, offset ChangeFlagsToList
endif
mov ax, MSG_GEN_BOOLEAN_GROUP_GET_SELECTED_BOOLEANS
push dx, bp
call ObjMessageCall ; ax - GeosFileHeaderFlags
pop dx, bp
if GPC_GET_INFO_DB
andnf ax, 0xff00 ; high bits only
endif
;
; Fill the Flags FEAD
;
mov ss:[flagsAttrs], ax ; Flags
lea ax, ss:[flagsAttrs] ; ss:ax is Flags
lea di, ss:[changeAttrs]
add di, size FileExtAttrDesc ; use second FEAD
mov ss:[di].FEAD_attr, FEA_FLAGS
segmov ss:[di].FEAD_value.segment, ss
mov ss:[di].FEAD_value.offset, ax
mov ss:[di].FEAD_size, size GeosFileHeaderFlags
mov cx, 2 ; two attributes to set
notGeosFile:
segmov es, ss
lea di, ss:[changeAttrs]
mov ax, FEA_MULTIPLE
call FileSetPathExtAttributes
;
; The above will set the ARCHIVE bit if it is a GEOS file (i.e.
; when the GEOS file header is written). If the user wants to
; turn off the archive bit, make another call. This correctly
; deals with READ_ONLY - brianc 10/11/94
; es:di = changeAttrs (FileAttrs)
; cx = 1 if not GEOS file
;
jc exit ; whoops, error from above
cmp cx, 1
je exit ; not GEOS file, carry clear
test ss:[fileAttrs], mask FA_ARCHIVE
jnz exit ; leave set, carry clear
mov cx, 1 ; set only FileAttrs
mov ax, FEA_MULTIPLE
call FileSetPathExtAttributes
exit:
.leave
ret
SetNewFileAttributes endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetOldFileAttributes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the UI for the existing set of attributes for the
file
CALLED BY: ChangeAttrShowAttrs
PASS: cx - old FileAttrs
RETURN: nothing
DESTROYED: ax,cx,di,si,bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 2/ 9/93 added header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetOldFileAttributes proc near
uses bx, dx
.enter
; make sure we only use the
; attributes we have
andnf cx, mask FA_RDONLY or mask FA_ARCHIVE or \
mask FA_HIDDEN or mask FA_SYSTEM
mov bx, handle ChangeAttrToList
mov si, offset ChangeAttrToList
mov ax, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE
mov dx, 0 ; no indeterminates
call ObjMessageCall
.leave
ret
SetOldFileAttributes endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetOldFileHeaderFlags
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the original file header flags
CALLED BY: ChangeAttrShowAttrs
PASS: ds:dx - filename
RETURN: nothing
DESTROYED: ax,dx,si,di,bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 2/ 9/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetOldFileHeaderFlags proc near
uses bx,cx
.enter
;
; See what type of file this is
;
push ax ; garbage push
mov di, sp
segmov es, ss
mov ax, FEA_FILE_TYPE
mov cx, size GeosFileType
call FileGetPathExtAttributes
pop ax ; GeosFileType
;
; If it's a document, then set the Template group enabled
;
push dx
mov bx, handle ChangeFlagsToList
mov si, offset ChangeFlagsToList
CheckHack < MSG_GEN_SET_NOT_ENABLED eq MSG_GEN_SET_ENABLED+1>
cmp ax, GFT_VM
mov ax, MSG_GEN_SET_ENABLED
je gotMessage
inc ax
gotMessage:
mov dl, VUM_NOW
call ObjMessageNone
pop dx
;
; Now, display the old setting.
;
call ShellGetFileHeaderFlags ; ax - flags
mov_tr cx, ax
clr dx ; no indeterminates
mov ax, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE
call ObjMessageNone
.leave
ret
SetOldFileHeaderFlags endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopChangeAttrNext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: move to next file in Change Attributes dialog box
CALLED BY: MSG_CHANGE_ATTR_NEXT
PASS:
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 03/17/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopChangeAttrNext method DesktopClass, MSG_CHANGE_ATTR_NEXT
; tell file list to show next file
mov cx, offset ChangeAttrBox
mov dx, offset ChangeAttrNameList
mov ax, MSG_FILE_OP_SKIP_FILE
mov bx, handle 0 ; send to ourselves
call ObjMessageCall
jc exit ; no more files
;
; then show attributes for this file
;
call ChangeAttrShowAttrs
exit:
ret
DesktopChangeAttrNext endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DisableChangeAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Disables the Change button in "Change Attributes"
and shows the hourglass.
CALLED BY: ChangeAttrShowAttrs
PASS: nothing
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
PC 8/29/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DisableChangeAttrs proc near
uses ax,bx,cx,dx,si,bp
.enter
call ForceShowHourglass
mov ax, MSG_GEN_SET_NOT_ENABLED
mov bx, handle ChangeAttrCtrlChange
mov si, offset ChangeAttrCtrlChange
mov dl, VUM_NOW
call ObjMessageCall
.leave
ret
DisableChangeAttrs endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EnableChangeAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Enables the Change button in "Change Attributes"
and hides the hourglass.
CALLED BY: ChangeAttrShowAttrs
PASS: nothing
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
PC 8/29/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
EnableChangeAttrs proc near
uses ax,bx,cx,dx,si,bp
.enter
call ForceHideHourglass
mov ax, MSG_GEN_SET_ENABLED
mov bx, handle ChangeAttrCtrlChange
mov si, offset ChangeAttrCtrlChange
mov dl, VUM_NOW
call ObjMessageCall
.leave
ret
EnableChangeAttrs endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ChangeAttrShowAttrs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Show the attributes for this file
CALLED BY: DesktopChangeAttrNext, FolderStartChangeAttr,
TreeStartChangeAttr
PASS: nothing
RETURN: nothing
DESTROYED: ax,bx,cx,dx,si,di,bp,ds,es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 2/ 9/93 added header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ChangeAttrShowAttrs proc far
; Show hourglass and disable the Change Button.
call DisableChangeAttrs
; update state of "Next" button
;
mov ax, offset ChangeAttrCtrlNext
mov si, offset ChangeAttrNameList
call DisableIfLastFile
;
; change to directory specified in change attr box, we don't care what
; directory we are in when we quit, so no need to save current
; directory
;
mov si, offset FileOperationUI:ChangeAttrNameList
call GetSrcFromFileListAndSetCurDir
jnc doIt
tst ax
jz exit
jmp done
doIt:
;
; get attributes of file
;
CheckHack <offset FOIE_name eq 0>
call FileGetAttributes ; get attrs with name
; cx = file attributes
jnc noError
call DesktopOKError ; report error
clr cx ; no attributes
noError:
;
; Fetch the file header flags
;
call SetOldFileHeaderFlags
;
; set buttons to show current attributes
;
call SetOldFileAttributes
done:
call MemUnlock
exit:
mov ax, SP_TOP ; just go to top-level path
call FileSetStandardPath
; Remove hourglass and enable the Change button again.
call EnableChangeAttrs
ret
ChangeAttrShowAttrs endp
COMMENT @-------------------------------------------------------------------
DesktopEndChangeToken
----------------------------------------------------------------------------
DESCRIPTION:
CALLED BY: GLOBAL
PASS: nothing
RETURN: nothing
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
martin 10/28/92 Initial version
----------------------------------------------------------------------------@
DesktopEndChangeToken method dynamic DesktopClass,
MSG_FM_END_CHANGE_TOKEN
.enter
mov ax, MSG_GEN_SET_NOT_ENABLED
mov bx, handle ChangeIconCtrlChange
mov si, offset ChangeIconCtrlChange
mov dl, VUM_NOW
call ObjMessageCall
call ShowHourglass
call InitForWindowUpdate
;
; change to directory specified in change Icon box, we don't care what
; directory we are in when we quit, so no need to save current
; directory
;
mov si, offset FileOperationUI:ChangeIconNameList
call GetSrcFromFileListAndSetCurDir
jnc doIt
tst ax
jz exit
call MemUnlock
jmp exit
doIt:
push bx
;
; get new Icon for file from the Change Icon dialog
;
push dx
mov bx, handle ChangeIconList
mov si, offset ChangeIconList
mov ax, MSG_ICON_LIST_GET_SELECTED
call ObjMessageCall
mov di, dx ; ax:cx:di = GeodeToken
pop dx ; ds:dx = filename
;
; change token of file
; ss:[fileOperationInfoEntryBuffer] = source
;
mov si, offset FileOperationUI:ChangeIconStatus
mov bp, offset ChangeIconStatusString
call ShowFileOpStatus
call ShellSetToken
mov cx, 1 ; one token changed
jnc noError ; yes
clr cx ; no tokens changed
call DesktopOKError ; report error
jnc noError
cmp ax, DESK_DB_DETACH ; detaching, no update
je done
cmp ax, YESNO_CANCEL ; user-cancel update
je finishUp ; previous files
cmp ax, YESNO_NO ; no change, update name
je updateNames ; list
stc ; error -
; don't update name
;change Icon error can still cause file system changes, so update - 4/19/90
noError:
;
; update folder windows (handled by file-change notification now)
;
; pushf
; push cx ; cx=deleted file count
; mov ax, mask FWUF_RESCAN_SOURCE or \
; mask FWUF_DS_IS_FQT_BLOCK
; call MarkWindowForUpdate ; ds:dx = source name
; pop cx
; popf
jc finishUp ; error -
; don't update name
updateNames:
;
; update name entries in change Icons dialog box
; (if no more files, box will be dismissed)
;
mov ax, MSG_CHANGE_TOKEN_NEXT
call UpdateNameListManually ; next file when done
;
; show change Icons results
;
finishUp:
mov si, offset FileOperationUI:ChangeIconStatus
call ShowFileOpResult ; show file count
;
; finish up
;
call UpdateMarkedWindows ; update
; affected window(s)
done:
pop bx ; bx <- FQT
call MemUnlock
mov ax, SP_TOP ; just go to
; top-level path
call FileSetStandardPath
exit:
call HideHourglass
mov ax, MSG_GEN_SET_ENABLED
mov bx, handle ChangeIconCtrlChange
mov si, offset ChangeIconCtrlChange
mov dl, VUM_NOW
call ObjMessageForce
.leave
ret
DesktopEndChangeToken endm
COMMENT @-------------------------------------------------------------------
DesktopChangeTokenNext
----------------------------------------------------------------------------
DESCRIPTION:
CALLED BY: GLOBAL
PASS: nothing
RETURN: nothing
DESTROYED: nothing
REVISION HISTORY:
Name Date Description
---- ---- -----------
martin 10/27/92 Initial version
----------------------------------------------------------------------------@
DesktopChangeTokenNext method dynamic DesktopClass,
MSG_CHANGE_TOKEN_NEXT
.enter
;
; tell file list to show next file
;
mov cx, offset ChangeIconBox
mov dx, offset ChangeIconNameList
mov ax, MSG_FILE_OP_SKIP_FILE
mov bx, handle 0 ; send to ourselves
call ObjMessageCall
jc exit ; no more files
;
; then show attributes for this file
;
call ChangeIconShowIcon
exit:
.leave
ret
DesktopChangeTokenNext endm
COMMENT @-------------------------------------------------------------------
ChangeIconShowIcon
----------------------------------------------------------------------------
DESCRIPTION: Disable 'Next' button if no more files, set the
current Icon, and (in NewDeskBA) have the IconList only
show the appropriate icons based on the
NewDeskObjectType.
CALLED BY: INTERNAL - FolderStartChangeToken
PASS: nothing
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
martin 10/27/92 Initial version
---------------------------------------------------------------------------@
ChangeIconShowIcon proc near
uses bx, dx, bp, si
.enter
;
; update state of "Next" button
;
mov ax, offset ChangeIconCtrlNext
mov si, offset ChangeIconNameList
call DisableIfLastFile
;
; change to directory specified in change attr box, we don't care what
; directory we are in when we quit, so no need to save current
; directory
;
mov si, offset FileOperationUI:ChangeIconNameList
call GetSrcFromFileListAndSetCurDir ; bx = mem handle
jnc doIt
tst ax
jz exit
jmp done
doIt:
BA < call SetIconListForFile >
call SetCurrentIconForFile
done:
call MemUnlock
exit:
mov ax, SP_TOP ; just go to top-level path
call FileSetStandardPath
.leave
ret
ChangeIconShowIcon endp
COMMENT @-------------------------------------------------------------------
SetCurrentIconForFile
----------------------------------------------------------------------------
DESCRIPTION: Sets the ChangeIconCurrentIcon object to display the
icon of the given file.
CALLED BY: INTERNAL - ChangeIconShowIcon
PASS: ds:dx = filename
RETURN: ax, cx, dx, si, bp
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
martin 10/30/92 Initial version
---------------------------------------------------------------------------@
SetCurrentIconForFile proc near
uses bx
.enter
;
; get token of file
;
CheckHack <offset FOIE_name eq 0>
call ShellGetToken ; get token
mov dx, di
mov bp, ax ; bp:cx:dx = token
jnc noError
call DesktopOKError ; report error
clr bp, cx, dx ; no token
noError:
;
; set buttons to show current icon
;
mov bx, handle ChangeIconCurrentIcon
mov si, offset ChangeIconCurrentIcon
mov ax, MSG_ICON_DISPLAY_SET_ICON
call ObjMessageCall
.leave
ret
SetCurrentIconForFile endp
if _NEWDESKBA
COMMENT @-------------------------------------------------------------------
SetIconListForFile
----------------------------------------------------------------------------
DESCRIPTION: Sets the ChangeIconList object in the change icon
dialog to use the proper list depending on the
NewDeskObjectType of the given file.
CALLED BY: INTERNAL - ChangeIconShowIcon
PASS: ds:dx = filename
RETURN: nothing
DESTROYED: ax, cx, si
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
martin 10/30/92 Initial version
---------------------------------------------------------------------------@
SetIconListForFile proc near
uses bx, dx
.enter
call ShellGetObjectType
jnc noError
call DesktopOKError ; report error
jmp gotTable
noError:
;
; Get proper list depending on type, quick solution for now...
; change to lookup table later.
;
clr cx, dx ; assume all tokens
cmp ax, WOT_TEACHER_COURSE
jne next1
mov dx, handle ClassIconLookupTable
mov cx, offset ClassIconLookupTable
jmp gotTable
next1:
cmp ax, WOT_GEOS_COURSEWARE
jne next2
mov dx, handle CoursewareIconLookupTable
mov cx, offset CoursewareIconLookupTable
jmp gotTable
next2:
cmp ax, WOT_DOS_COURSEWARE
jne gotTable
mov dx, handle CoursewareIconLookupTable
mov cx, offset CoursewareIconLookupTable
gotTable:
;
; set IconList to show proper list
;
mov bx, handle ChangeIconList
mov si, offset ChangeIconList
mov ax, MSG_ICON_LIST_SET_TOKEN_LIST
call ObjMessageCall
.leave
ret
SetIconListForFile endp
endif ; if _NEWDESKBA
endif ; ifndef GEOLAUNCHER
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopGetInfoNext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: move to next file in get info list
CALLED BY: MSG_GET_INFO_NEXT, MSG_GET_INFO_OK
PASS:
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/17/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopGetInfoNext method DesktopClass, MSG_GET_INFO_NEXT, \
MSG_GET_INFO_OK
;
; first, save current notes, if MSG_GET_INFO_OK
;
cmp ax, MSG_GET_INFO_OK
jne noSave
call GetInfoSaveNotes
noSave:
;
; tell file list to show next file
;
mov cx, offset GetInfoBox
mov dx, offset GetInfoFileList
mov ax, MSG_FILE_OP_SKIP_FILE
mov bx, handle 0 ; send to ourselves
call ObjMessageCall
jc exit ; no more files
;
; then show info for this file
;
call ShowCurrentGetInfoFile
exit:
ret
DesktopGetInfoNext endm
DesktopHackGetInfoOK method DesktopClass, MSG_HACK_GET_INFO_OK
mov bx, handle GetInfoCtrlOK
mov si, offset GetInfoCtrlOK
mov ax, MSG_GEN_SET_NOT_ENABLED
mov dl, VUM_NOW
call ObjMessageCall
ret
DesktopHackGetInfoOK endm
if GPC_GET_INFO_DB
DesktopGetInfoEnableOK method DesktopClass, MSG_GET_INFO_ENABLE_OK
mov bx, handle GetInfoCtrlOK
mov si, offset GetInfoCtrlOK
mov ax, MSG_GEN_SET_ENABLED
mov dl, VUM_NOW
call ObjMessageCall
ret
DesktopGetInfoEnableOK endm
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ShowCurrentGetInfoFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: show current file in get info box
CALLED BY: INTERNAL
DesktopGetInfoNext
FolderGetInfo
PASS: nothing
RETURN: carry clear if a file was shown
carry set if no more files
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/22/90 Extracted from original FolderGetInfo
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
getInfoReturnAttrs FileExtAttrDesc \
<FEA_MODIFICATION, GIS_modified, size GIS_modified>,
<FEA_FILE_ATTR, GIS_fileAttrs, size GIS_fileAttrs>,
<FEA_CREATION, GIS_created, size GIS_created>,
<FEA_FILE_TYPE, GIS_fileType, size GIS_fileType>,
<FEA_SIZE, GIS_size, size GIS_size>,
<FEA_USER_NOTES, GIS_userNotes, size GIS_userNotes>,
<FEA_RELEASE, GIS_release, size GIS_release>,
<FEA_CREATOR, GIS_creator, size GIS_creator>,
<FEA_FLAGS, GIS_flags, size GIS_flags>,
<FEA_DOS_NAME, GIS_dosName, size GIS_dosName>,
<FEA_OWNER, GIS_owner, size GIS_owner>
GetInfoStruct struct
GIS_modified FileDateAndTime
GIS_fileAttrs FileAttrs
GIS_created FileDateAndTime
GIS_fileType GeosFileType
GIS_size sdword
GIS_userNotes FileUserNotes
GIS_release ReleaseNumber
GIS_creator GeodeToken
GIS_flags GeosFileHeaderFlags
if _DOS_LONG_NAME_SUPPORT
; GEOS supports DOS long names of length up to FILE_LONGNAME_LENGTH
; *DOS chars*, both in SBCS and DBCS.
GIS_dosName char FILE_LONGNAME_LENGTH + 1 dup(?)
else
GIS_dosName char DOS_DOT_FILE_NAME_LENGTH_ZT dup(?)
endif
GIS_owner FileOwnerName
GIS_attrs FileExtAttrDesc length getInfoReturnAttrs dup(<>)
if DBCS_PCGEOS
if _DOS_LONG_NAME_SUPPORT
GIS_dosName2 wchar FILE_LONGNAME_LENGTH + 1 dup(?)
else
GIS_dosName2 wchar DOS_DOT_FILE_NAME_LENGTH_ZT dup(?)
endif
endif
GetInfoStruct ends
ShowCurrentGetInfoFile proc far
call ShowHourglass
;
; update state of "Next" button
;
mov ax, offset GetInfoCtrlNext
mov si, offset GetInfoFileList
call DisableIfLastFile
;
; change to directory specified in rename box, we don't care what
; directory we are in when we quit, so no need to save current
; directory
;
mov si, offset FileOperationUI:GetInfoFileList
call GetSrcFromFileListAndSetCurDir
push bx
jc errorReport
jmp doIt
errorFreeAttrsReport:
pop bx
call MemFree
errorReport:
call DesktopOKError ; report error
pop bx ; bx <- FQT block
tst ax
LONG jz done
call MemUnlock
jmp done ; if no more files, done
doIt:
;
; ds:dx = FileOperationInfoEntry
; handle of block containing same pushed on the stack
;
; get DOS file info:
; - allocate a block to hold the extended attributes and the
; descriptors by which we get them
; - copy the descriptors into the block wholesale
; - fix up the FEAD_value.segment fields of the duplicated
; descriptors to point to the block
; - call FileGetPathExtAttributes
;
mov ax, size GetInfoStruct
mov cx, ALLOC_DYNAMIC_LOCK
call MemAlloc
LONG jnc noError
mov ax, ERROR_INSUFFICIENT_MEMORY ; else, report mem error
jmp errorReport
noError:
push bx
mov es, ax
push ds
segmov ds, cs
mov si, offset getInfoReturnAttrs
mov di, offset GIS_attrs
mov cx, size getInfoReturnAttrs
rep movsb
mov di, offset GIS_attrs
mov cx, length GIS_attrs
mov si, di
setAttrSegmentsLoop:
mov es:[di].FEAD_value.segment, es
add di, size FileExtAttrDesc
loop setAttrSegmentsLoop
pop ds
mov di, si
mov cx, length GIS_attrs
mov ax, FEA_MULTIPLE
CheckHack <offset FOIE_name eq 0>
call FileGetPathExtAttributes
jnc haveAttrs
cmp ax, ERROR_ATTR_NOT_FOUND ; not geos file?
je haveAttrs
cmp ax, ERROR_ATTR_NOT_SUPPORTED
stc
jne errorFreeAttrsReport ; no -- report other error
haveAttrs:
;
; set up name field
;
NOFXIP< mov dx, segment fileOperationInfoEntryBuffer ; dx:bp= name >
FXIP< push ds >
FXIP< GetResourceSegmentNS dgroup, ds >
FXIP< mov dx, ds >
FXIP< pop ds >
mov bp, offset fileOperationInfoEntryBuffer.FOIE_name
mov ax, offset GetInfoName
call SetGetInfoText
segmov ds, es
;
; Set up DOSName field.
;
mov si, offset GIS_dosName
SBCS < mov cx, size GIS_dosName-1 >
DBCS < mov cx, size GIS_dosName >
mov ax, '?'
if DBCS_PCGEOS
;
; XXX: should use disk handle for file
;
clr dx ;dx <- disk handle (0 = primary)
clr bx ;bx <- DosCodePage (0 = current)
mov di, offset GIS_dosName2 ;es:di <- ptr to dest buffer
endif
call LocalDosToGeos
mov dx, ds
SBCS < mov bp, offset GIS_dosName >
DBCS < mov bp, offset GIS_dosName2 >
mov ax, offset GetInfoDOSName
call SetGetInfoText
if GPC_DEBUG_MODE
;
; disable or enable attributes and DOS name fields based on debug mode
;
mov ax, MSG_GEN_SET_USABLE
cmp ss:[debugMode], TRUE
je haveDebug
mov ax, MSG_GEN_SET_NOT_USABLE
haveDebug:
mov bx, handle GetInfoDOSName
mov si, offset GetInfoDOSName
push ax
mov dl, VUM_NOW
call ObjMessageCall
pop ax
mov bx, handle GetInfoAttrGroup
mov si, offset GetInfoAttrGroup
mov dl, VUM_NOW
call ObjMessageCall
endif
;
; set up attributes field
;
if GPC_GET_INFO_DB
; (stores GFHF_ flags and FA_ flags in UI
; for easy retrieval when changing file attributes)
mov cx, ds:[GIS_flags] ; GFHF_ flags uses high 8 bits
mov cl, ds:[GIS_fileAttrs] ; so we can use low 8 bits for FA_
clr dx ; no indeterminates
mov ax, MSG_GEN_BOOLEAN_GROUP_SET_GROUP_STATE
mov bx, handle GetInfoAttrToList
mov si, offset GetInfoAttrToList
call ObjMessageCall
;
; disable if not GEOS VM file
;
mov ax, MSG_GEN_SET_NOT_ENABLED
cmp ds:[GIS_fileType], GFT_VM
jne notVM
mov ax, MSG_GEN_SET_ENABLED
notVM:
mov dl, VUM_NOW
mov bx, handle GetInfoAttrTemplate
mov si, offset GetInfoAttrTemplate
call ObjMessageCall
else ; GPC_GET_INFO_DB
call PointToGetInfoBuffer
mov ah, ds:[GIS_fileAttrs]
clr bx
attrLoop:
test ah, cs:[attrBitTable][bx]
jz 10$
DBCS < push ax >
DBCS < clr ah >
mov al, cs:[attrCharTable][bx]
LocalPutChar esdi, ax
mov al, ' '
LocalPutChar esdi, ax
DBCS < pop ax >
10$:
inc bx
cmp bx, length attrBitTable
jne attrLoop
clr bx
CheckHack <(mask GeosFileHeaderFlags and 0xff) eq 0>
mov ah, ds:[GIS_flags].high
flagLoop:
test ah, cs:[flagBitTable][bx]
jz 11$
DBCS < push ax >
DBCS < clr ah >
mov al, cs:[flagCharTable][bx]
LocalPutChar esdi, ax
mov al, ' ' ; preserve ah, (don't use stosw)
LocalPutChar esdi, ax
DBCS < pop ax >
11$:
inc bx
cmp bx, length flagBitTable
jne flagLoop
SBCS < clr al ; null-term. attrs >
DBCS < clr ax ; null-term. attrs >
LocalPutChar esdi, ax
mov ax, offset GetInfoAttrs
call SetGetInfoText
endif ; GPC_GET_INFO_DB
;
; Put up owner, if known, else "-"
;
if GPC_GET_INFO_DB ne TRUE
call PointAndInitGetInfoBuffer ; dx:bp <- infoBuffer thingy
tst ds:[GIS_owner][0] ; owner known?
jz setInfoOwner ; no
mov dx, ds
mov bp, offset GIS_owner
setInfoOwner:
mov ax, offset GetInfoOwner
call SetGetInfoText
endif ; !GPC_GET_INFO_DB
;
; set up last modification field
;
call PointAndInitGetInfoBuffer ; es:di=dx:bp=time
; string buffer
mov ax, ds:[GIS_modified].FDAT_time
mov bx, ds:[GIS_modified].FDAT_date
tst bx
jz setModified
call UtilFormatDateAndTime
setModified:
mov ax, offset GetInfoDate
call SetGetInfoText
;
; set up creation field
;
call PointAndInitGetInfoBuffer ; es:di=dx:bp=time
; string buffer
mov ax, ds:[GIS_created].FDAT_time
mov bx, ds:[GIS_created].FDAT_date
tst bx
jz setCreationDate
call UtilFormatDateAndTime
setCreationDate:
mov ax, offset GetInfoCreated
call SetGetInfoText
;
; See if this file's a link, and if so, get its target
;
if GPC_GET_INFO_DB ne TRUE
if not _NEWDESKBA
call GetInfoCheckLink
endif
endif ; !GPC_GET_INFO_DB
;
; Account for GeosFileHeader - brianc 7/12/93
;
test ds:[GIS_fileAttrs], mask FA_SUBDIR or mask FA_LINK
jnz haveFileSize ; leave subdir alone
cmp ds:[GIS_fileType], GFT_NOT_GEOS_FILE
je haveFileSize ; leave non-GEOS alone
adddw ds:[GIS_size], 256
haveFileSize:
; subdirectory?
test ds:[GIS_fileAttrs], mask FA_SUBDIR
jz printSize ; no -- use size as returned
;
; this is a directory -- let's get the total size of all files within
; it
;
call PointToGetInfoBuffer ; es:di = dx:bp = size buffer
; ds:dx - 8.3 dir name
push ds
NOFXIP< segmov ds, <segment fileOperationInfoEntryBuffer>, dx >
FXIP< mov dx, bx >
FXIP< GetResourceSegmentNS dgroup, ds, TRASH_BX >
FXIP< mov bx, dx >
mov dx, offset fileOperationInfoEntryBuffer.FOIE_name
call FileDirGetSize ; dx:ax = size
pop ds ; ds = buffer segment
jc printSize ; pass on error code
mov ds:[GIS_size].low, ax
mov ds:[GIS_size].high, dx
printSize:
pushf ; save error status for later
push ax ; save err code (in case error)
;
; set up file size field
;
call PointAndInitGetInfoBuffer ; es:di = dx:bp = size buffer
mov dx, ds:[GIS_size].low
mov ax, ds:[GIS_size].high
call ASCIIizeDWordAXDX
mov dx, es ; dx:bp = filesize string
mov ax, offset GetInfoSize
call SetGetInfoText
if 0
; I'm tired of seeing this damn compilation message!
PrintMessage <need a FileInUse? function to do this now>
;
; show file busy state
; ds = file header buffer segment
; (file header is all ZEROs for non-GEOS file or
; error-reading-GEOS file)
;
mov cx, offset NotBusyMoniker ; assume file not busy
;;; mov ax, mask VTS_EDITABLE ; set editable bit
tst si ; file busy?
jz gotBusyState ; no, show it
mov cx, offset BusyMoniker ; indicate file busy
;;; mov ax, mask VTS_EDITABLE shl 8 ; clear editable bit
gotBusyState:
;;; push ax ; save editable flag for later
mov ax, MSG_GEN_USE_VIS_MONIKER
mov dl, VUM_NOW
mov bx, handle FileOperationUI
mov si, offset GetInfoBusy
call ObjMessageCall
endif
;
; set up geos file type
;
call PointAndInitGetInfoBuffer
;
; show "DOS File" if not a GEOS file - brianc 2/2/93
;
if GPC_GET_INFO_DB ne TRUE
mov cx, ds:[GIS_fileType] ; cx = geos file type
test ds:[GIS_fileAttrs], mask FA_SUBDIR
push ds
mov bx, handle DeskStringsRare
pushf ; save FA_SUBDIR result
call MemLock
popf
mov ds, ax ; ds = string segment
mov si, offset GetInfoGeosFileTypeDirectoryString
jnz gotString ; FA_SUBDIR is set
cmp cx, GFT_DIRECTORY
je gotString
mov si, offset GetInfoGeosFileTypeNonGeos
cmp cx, GFT_NOT_GEOS_FILE
je gotString
mov si, offset GetInfoGeosFileTypeExecString
cmp cx, GFT_EXECUTABLE
je gotString
mov si, offset GetInfoGeosFileTypeVMString
cmp cx, GFT_VM
je gotString
mov si, offset GetInfoGeosFileTypeDataString
cmp cx, GFT_DATA
je gotString
mov si, offset GetInfoGeosFileTypeOldVMString
EC < cmp cx, GFT_OLD_VM >
EC < ERROR_NZ GET_INFO_UNKNOWN_FILE_TYPE >
gotString:
mov si, ds:[si] ; deref. string
call CopyNullTermString
call MemUnlock ; unlock string block
pop ds
mov ax, offset GetInfoGeosType
call SetGetInfoText
endif ; !GPC_GET_INFO_DB
if 0
;
; set up token field
;
mov si, offset GFH_core.GFHC_token ; ds:si = token field
call GetInfoTokenCommon ; build token string
mov ax, offset GetInfoToken
call SetGetInfoText
endif
;
; set up release field
;
mov si, offset GIS_release ; ds:si = release field
call GetInfoRelProtCommon ; build release string
mov ax, offset GetInfoRelease
call SetGetInfoText
;
; set up creator field
;
mov si, offset GIS_creator ; ds:si = creator field
call GetInfoTokenCommon ; build creator string
mov ax, offset GetInfoCreator
call SetGetInfoText
;
; set up user notes field
;
mov ax, MSG_GEN_SET_NOT_ENABLED ; assume a link
mov bx, (mask VTS_EDITABLE or mask VTS_SELECTABLE) shl 8 ; clr
test ds:[GIS_fileAttrs], mask FA_LINK
jnz haveEnableMessage ; yep, it's a link
test ds:[GIS_fileAttrs], mask FA_SUBDIR
jnz setUserNotesEnabled
mov ax, MSG_GEN_SET_NOT_ENABLED ; assume not GEOS file
mov bx, (mask VTS_EDITABLE or mask VTS_SELECTABLE) shl 8 ; clr
cmp ds:[GIS_fileType], GFT_NOT_GEOS_FILE
je haveEnableMessage
cmp ds:[GIS_fileType], GFT_OLD_VM
je haveEnableMessage
setUserNotesEnabled:
mov ax, MSG_GEN_SET_ENABLED
mov bx, mask VTS_EDITABLE or mask VTS_SELECTABLE ; set
haveEnableMessage:
push bx ; save VTS
mov bx, handle GetInfoUserNotesGroup
mov si, offset GetInfoUserNotesGroup
mov dl, VUM_NOW
call ObjMessageCall ; (in)activate user notes field
pop cx ; new VTS
mov ax, MSG_VIS_TEXT_MODIFY_EDITABLE_SELECTABLE
mov bx, handle GetInfoUserNotes
mov si, offset GetInfoUserNotes
call ObjMessageCall
mov dx, ds
mov bp, offset GIS_userNotes
mov ax, offset GetInfoUserNotes
call SetGetInfoText ; show user notes
;;; ;
;;; ; make notes editable or not depending on whether file is in use
;;; ;
;;; mov bx, handle GetInfoUserNotes
;;; mov si, offset GetInfoUserNotes
;;; pop cx ; bits to set/clear
;;; clr dx
;;; mov ax, MSG_VIS_TEXT_REPLACE_ALL_STATE
;;; call ObjMessageCall
;
; clean notes, OK disabled
;
; mov bx, handle GetInfoCtrlOK
; mov si, offset GetInfoCtrlOK
; mov ax, MSG_GEN_SET_NOT_ENABLED
; mov dl, VUM_NOW
; call ObjMessageCall
mov bx, handle 0
mov ax, MSG_HACK_GET_INFO_OK
call ObjMessageForce
;
; put up Get Info dialog box
;
mov bx, handle GetInfoBox
mov si, offset GetInfoBox
mov ax, MSG_GEN_INTERACTION_INITIATE
call ObjMessageNone
;
; clean up
;
pop ax ; get err code (in case error)
popf ; retrieve error flag
jnc noErr ; no error, continue
call DesktopOKError ; report earlier error
; (put on top of GetInfoBox)
noErr:
pop bx ; free attribute buffer
call MemFree
pop bx ; bx <- FQT block
call MemUnlock
clc ; had a file to show
done:
mov ss:[recurErrorFlag], 0 ; clear flag possibly set
; by FileDirGetSize
call HideHourglass ; (preserves flags)
ret
ShowCurrentGetInfoFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetInfoCheckLink
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See if the file's a link, and if so, get and display
its target. Otherwise, set the link text not usable.
CALLED BY: ShowCurrentGetInfoFile
PASS: ds:0 - GetInfoStruct
RETURN: nothing
DESTROYED: ax,bx,cx,dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
allocates 400 bytes on the stack!
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 9/ 3/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if GPC_GET_INFO_DB ne TRUE
if not _NEWDESKBA
GetInfoCheckLink proc near
uses di,si,ds,es
buffer local PathName
fullPath local PathName
.enter
test ds:[GIS_fileAttrs], mask FA_LINK
jz notUsable
mov ax, MSG_GEN_SET_USABLE
call callIt
NOFXIP< segmov ds, dgroup, dx >
FXIP< mov dx, bx >
FXIP< GetResourceSegmentNS dgroup, ds, TRASH_BX >
FXIP< mov bx, dx >
mov dx, offset fileOperationInfoEntryBuffer.FOIE_name
segmov es, ss
lea di, ss:[buffer]
mov cx, size buffer
call FileReadLink
jc notUsable ; set the object not usable
;
; Construct the full path, including disk name.
;
mov dl, TRUE
mov si, di
segmov ds, ss
lea di, ss:[fullPath]
mov cx, size fullPath
call FileConstructFullPath
jc notUsable
;
; Set the text, using the full path
;
push bp
lea bp, ss:[fullPath]
mov dx, ss
mov ax, offset GetInfoLink
call SetGetInfoText
pop bp
done:
.leave
ret
notUsable:
mov ax, MSG_GEN_SET_NOT_USABLE
call callIt
jmp done
;
; Set the link object usable or not, depending...
;
callIt:
mov bx, handle GetInfoLink
mov si, offset GetInfoLink
mov dl, VUM_NOW
call ObjMessageNone
retn
GetInfoCheckLink endp
endif
endif ; !GPC_GET_INFO_DB
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PointAndInitGetInfoBuffer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: point to the getInfo buffer, and initialize it to
contain a single dash, in the event that the
attributes we want aren't available
CALLED BY: ShowCurrentGetInfoFile
PASS: nothing
RETURN: es:di, dx:bp - pointing to getInfoStringBuffer (in
dgroup)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 9/ 3/92 added header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PointAndInitGetInfoBuffer proc near
.enter
call PointToGetInfoBuffer
mov {word} es:[di], '-'
DBCS < mov {wchar}es:[di][1*2], 0 >
.leave
ret
PointAndInitGetInfoBuffer endp
PointToGetInfoBuffer proc near
NOFXIP< mov dx, segment dgroup ; es:di = dx:bp = attrs >
NOFXIP< mov es, dx >
FXIP< GetResourceSegmentNS dgroup, es >
FXIP< mov dx, es ; dx = es = dgroup >
mov di, offset getInfoStringBuffer
mov bp, di
ret
PointToGetInfoBuffer endp
GetInfoRelProtCommon proc near
call PointAndInitGetInfoBuffer ; es:di = dx:bp = release buf
cmp ds:[GIS_fileType], GFT_NOT_GEOS_FILE
je done
lodsw ; get major #
call ASCIIizeWordAX ; show major #
LocalLoadChar ax, '.'
LocalPutChar esdi, ax
lodsw ; get minor #
call ASCIIizeWordAX ; show minor #
;
; no second part for ZMGR - brianc 6/24/93
;
if not _ZMGR
SBCS < mov ax, ' ' or (' ' shl 8) ; show four spaces >
DBCS < mov ax, ' ' >
stosw
stosw
DBCS < stosw >
DBCS < stosw >
lodsw ; get change #
call ASCIIizeWordAX ; show change #
LocalLoadChar ax, '-'
LocalPutChar esdi, ax
lodsw ; get engineering #
call ASCIIizeWordAX ; show engineering #
endif
done:
ret
GetInfoRelProtCommon endp
GetInfoTokenCommon proc near
call PointAndInitGetInfoBuffer ; es:di = dx:bp = token buffer
lodsb
dec si
tst al
jz done ; no token
call GetNameFromTokenDB
jnc done ; dx:bp = name from token DB
LocalLoadChar ax, '\"'
LocalPutChar esdi, ax
mov cx, 4
if DBCS_PCGEOS
charLoop:
lodsb
stosw
loop charLoop
else
rep movsb
endif
DBCS < mov ax, '\"' >
DBCS < stosw >
push bx, cx, dx
call LocalGetNumericFormat ; bx=thousands separator (DBCS)
SBCS < mov ah, bl ; sorry, SBCS (sic:) for now >
DBCS < mov ax, bx >
DBCS < stosw >
pop bx, cx, dx
SBCS < mov al, '\"' >
SBCS < stosw >
lodsw ; ax = manuf ID
call ASCIIizeWordAX
SBCS < clr al >
DBCS < clr ax >
LocalPutChar esdi, ax ; null-terminate
done:
ret
GetInfoTokenCommon endp
;
; Find the text moniker for a creator token in the DB. Much faster than
; questing after the application itself...
;
GetNameFromTokenDB proc near
uses ax, bx, dx, si, di, bp, ds
.enter
mov ax, {word} ds:[si].GT_chars+0
mov bx, {word} ds:[si].GT_chars+2
mov si, ds:[si].GT_manufID
mov dh, ss:[desktopDisplayType]
mov bp, VMSF_TEXT_MASK
clr cx ; alloc global block
push di ; save buffer offset
push bp ; pass VisMonikerSearchFlags
push cx ; pass unused buffer size
call TokenLoadMoniker ; di = block, cx = size
mov bx, di
pop di ; retrieve buffer offset
jc done ; nothing in token DB
call MemLock
mov ds, ax
test ds:[VM_type], mask VMT_GSTRING ; make sure not gstring
stc ; assume gstring
jnz freeAndDone ; if gstring, skip
mov si, offset VM_data + offset VMT_text ; ds:si = string
sub cx, size VisMoniker + size VMT_mnemonicOffset
; cx = string size
rep movsb ; copy over string
SBCS < clr al >
DBCS < clr ax >
LocalPutChar esdi, ax ; null-terminate
clc
freeAndDone:
pushf
call MemFree ; free gstring buffer
popf
done:
.leave
ret
GetNameFromTokenDB endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetGetInfoText
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the text for a text object in the GetInfo DB
CALLED BY: ShowCurrentGetInfoFile, GetInfoCheckLink
PASS: ax - chunk handle of text object
dx:bp - pointer to text
RETURN: nothing
DESTROYED: ax,bx,cx,dx,bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 9/ 3/92 added header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetGetInfoText proc near
uses si
.enter
mov bx, handle FileOperationUI
mov_tr si, ax
call CallSetText
.leave
ret
SetGetInfoText endp
if GPC_GET_INFO_DB ne TRUE
attrBitTable byte mask FA_LINK,
mask FA_SUBDIR,
mask FA_RDONLY,
mask FA_ARCHIVE,
mask FA_HIDDEN,
mask FA_SYSTEM
attrCharTable char 'L', 'D', 'R', 'A', 'H', 'S'
flagBitTable byte mask GFHF_TEMPLATE shr 8,
mask GFHF_SHARED_MULTIPLE shr 8,
mask GFHF_SHARED_SINGLE shr 8
flagCharTable char 'T', 'M', 'P'
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopUserNotesMadeDirty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: enabled OK button in Get Info box if user notes field
changed
CALLED BY: MSG_TEXT_MADE_DIRTY
PASS: cx:dx = text object
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/04/90 broken out for usability fixes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopUserNotesMadeDirty method DesktopClass, MSG_META_TEXT_USER_MODIFIED
cmp cx, handle GetInfoUserNotes
jne done
cmp dx, offset GetInfoUserNotes
jne done
mov bx, handle GetInfoCtrlOK
mov si, offset GetInfoCtrlOK
mov ax, MSG_GEN_SET_ENABLED
mov dl, VUM_NOW
call ObjMessageCallFixup
jmp exit
done:
cmp cx, handle RenameToEntry
jne done
cmp dx, offset RenameToEntry
jne done
mov bx, handle RenameCtrlRename
mov si, offset RenameCtrlRename
mov ax, MSG_GEN_SET_ENABLED
mov dl, VUM_NOW
call ObjMessageCallFixup
exit:
ret
DesktopUserNotesMadeDirty endm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetInfoSaveNotes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: save user notes, if changed
CALLED BY: INTERNAL
DesktopGetInfoOk
DesktopGetInfoNext
PASS: nothing
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 05/04/90 broken out for usability fixes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetInfoSaveNotes proc near
call ShowHourglass
;
; check if notes field is dirty
;
if GPC_GET_INFO_DB ne TRUE ; must save attributes, check later
mov bx, handle GetInfoUserNotes
mov si, offset GetInfoUserNotes
mov ax, MSG_VIS_TEXT_GET_USER_MODIFIED_STATE
call ObjMessageCall ; cx = 0 if clean
jcxz exitJMP ; exit if so
endif
;
; change to directory specified in rename box, we don't care what
; directory we are in when we quit, so no need to save current
; directory
;
mov si, offset FileOperationUI:GetInfoFileList
call GetSrcFromFileListAndSetCurDir
jnc 10$
tst ax
jz exit
call MemUnlock
exitJMP::
jmp exit ; if error reported, done
10$:
push bx ; save FQT block handle
if GPC_GET_INFO_DB
;
; save file attributes
; ds:dx = filename
;
call SetNewFileAttributes
jnc attrDone
call DesktopOKError
noNotesToFreeJMP:
jmp noNotesToFree
;
; check if user notes changed
;
attrDone:
mov bx, handle GetInfoUserNotes
mov si, offset GetInfoUserNotes
mov ax, MSG_VIS_TEXT_GET_USER_MODIFIED_STATE
call ObjMessageCall ; cx = 0 if clean
jcxz noNotesToFreeJMP ; exit if so
endif
push dx
;
; get notes entered
;
mov bx, handle GetInfoUserNotes
mov si, offset GetInfoUserNotes
mov ax, MSG_VIS_TEXT_GET_ALL_BLOCK
clr dx ; return global block
call ObjMessageCall
mov bx, cx ; bx = notes block handle
call MemLock ; lock notes
pop dx ; ds:dx <- FOIE
CheckHack <offset FOIE_name eq 0>
push bx ; save notes handle
mov es, ax
clr di ; es:di <- buffer
; Get the size of the user notes in CX (including the null).
; If it's larger than the max size (how could this possibly happen?)
; then truncate it at the max size
call LocalStringSize ;CX <- size of buffer
inc cx ; ...including null
DBCS < inc cx ; ...including null >
cmp cx, size FileUserNotes
jbe setNotes
mov cx, size FileUserNotes
SBCS < mov {char} es:[size FileUserNotes-1], C_NULL >
DBCS < mov {wchar} es:[size FileUserNotes-2], C_NULL >
setNotes:
mov ax, FEA_USER_NOTES ; ax <- attr to set
call FileSetPathExtAttributes
jnc noError
call DesktopOKError ; report error
noError:
;
; clean up
;
pop bx ; free notes buffer
; (0 if null notes)
tst bx
jz noNotesToFree
call MemFree
noNotesToFree:
pop bx ; bx <- FQT block
call MemUnlock
clc ; indicate success
mov ax, SP_TOP
call FileSetStandardPath ; be in top level path
exit:
call HideHourglass
ret
GetInfoSaveNotes endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopDriveToolInternal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: user clicked or double-clicked on drive icon
CALLED BY: MSG_DRIVETOOL_INTERNAL
PASS: cl = drive number
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/12/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopDriveToolInternal method DesktopClass, MSG_DRIVETOOL_INTERNAL
.enter
registerDisk::
;
; register disk
;
mov al, cl
call DiskRegisterDiskSilently
jnc diskRegistered
mov ax, ERROR_DRIVE_NOT_READY
call DesktopOKError
jmp exit
;
; open root directory Folder Window for this drive
;
diskRegistered: ; bx = new disk handle
;
; if openRootPath has changed, then the corresponding XIP code
; has to be changed too.
;
NOFXIP < mov dx, cs ; dx:bp = root >
NOFXIP < mov bp, offset openRootPath >
FXIP < mov bp, C_BACKSLASH >
FXIP < push bp >
FXIP < mov dx, ss >
FXIP < mov bp, sp ;dx:bp = backslash char >
push bx
ND < mov cx, WOT_DRIVE ; open a drive folder >
call CreateNewFolderWindow ; do it
pop cx ; cx <- disk handle, in case
; rescan needed
FXIP < pop bp >
jnc exit ; new Folder Window created
tst ax ; existing Folder Window
; brought to front?
jnz exit ; no, done
;
; existing Folder Window for root directory of selected drive was
; brought to front (not newly created), force rescan and redraw
;
;
; if openRootPath has changed, then the corresponding XIP code
; has to be changed too.
;
NOFXIP < mov dx, cs ; dx:bp = root >
NOFXIP < mov bp, offset openRootPath >
FXIP < mov bp, C_BACKSLASH >
FXIP < push bp >
FXIP < mov dx, ss >
FXIP < mov bp, sp ;dx:bp = backslash char >
mov di, mask MF_CALL or mask MF_FIXUP_DS
call FindFolderWindow ; get folder object
call ShellFreePathBuffer ; nuke returned path buffer
FXIP < pop bp >
jnc exit ; not found, just exit
mov si, FOLDER_OBJECT_OFFSET ; common offset
mov ax, MSG_WINDOWS_REFRESH_CURRENT
mov di, mask MF_CALL
call ObjMessage
exit:
.leave
ret
DesktopDriveToolInternal endm
ife FULL_EXECUTE_IN_PLACE
LocalDefNLString openRootPath <C_BACKSLASH,0>
endif
if _GMGR
if not _ZMGR
ifndef GEOLAUNCHER ; no Tree Window for GeoLauncher
if _TREE_MENU ; no Tree Window for NIKE
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopNewTreeDrive
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: user selects new drive for tree
CALLED BY: MSG_NEW_TREE_DRIVE
PASS: cx = identifier of DriveLetter object which got clicked
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 03/29/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopNewTreeDrive method DesktopClass, MSG_NEW_TREE_DRIVE
;
; get drive number
;
clr ch ; cx = drive #
mov bp, cx ; bp = drive
;
; set new Tree Drive, if disk is good
; else, leave current Tree Window alone and report error
;
call SetTreeDriveAndShowTreeWindow
ret
DesktopNewTreeDrive endm
;
; pass:
; bp = drive number
;
SetTreeDriveAndShowTreeWindow proc far
;
; try to register disk
;
mov ax, bp ; al = drive number
call DiskRegisterDiskSilently
jnc noError ; bx = disk handle
mov ax, ERROR_DRIVE_NOT_READY
call DesktopOKError ; report error
mov ax, MSG_UPDATE_TREE_DRIVE
mov bx, handle TreeObject ; restore current tree drive
mov si, offset TreeObject ; in Tree Menu Drive List
call ObjMessageCallFixup
jmp short done ; do nothing more
noError:
;
; set new drive for Tree Window
; bx = disk handle
;
mov cx, bx ; cx = disk handle
mov ax, MSG_TREE_STORE_NEW_DRIVE
mov bx, handle TreeObject
mov si, offset TreeObject
call ObjMessageFixup
;
; show Tree Window with new drive (brings-to-front or creates)
;
call IsTreeWindowUp ; if up already, just front it
jc up
call CreateTreeWindow ; else, create
jmp short done
up:
call BringUpTreeWindow
done:
ret
SetTreeDriveAndShowTreeWindow endp
;
; returns:
; carry set if Tree Window is up
; carry clear if NOT
;
IsTreeWindowUp proc far
mov bx, handle FileSystemDisplayGroup ; ^lbx:si = DC
mov si, offset FileSystemDisplayGroup
mov ax, MSG_GEN_COUNT_CHILDREN
call ObjMessageCallFixup ; dx = # of children
tst dx ; any?
jz done ; nope, (carry clear)
mov cx, handle TreeWindow ; ^lcx:dx = Tree Window
mov dx, offset TreeWindow
mov ax, MSG_GEN_FIND_CHILD ; try to find Tree Window
call ObjMessageCallFixup
cmc ; carry set if found
; carry clear if NOT
done:
ret
IsTreeWindowUp endp
CreateTreeWindow proc near
mov ax, TRUE
call TreeWindowCommon
ret
CreateTreeWindow endp
BringUpTreeWindow proc far
mov ax, FALSE
call TreeWindowCommon
ret
BringUpTreeWindow endp
;
; pass:
; ax = TRUE to create
; ax = FALSE to bring to front
;
TreeWindowCommon proc near
if CLOSE_IN_OVERLAP
;; ;
;; ; get current window, in case it needs to be closed
;; ;
;; push ax ; save flag
;; mov bx, handle FileSystemDisplayGroup
;; mov si, offset FileSystemDisplayGroup
;; mov cx, TL_GEN_DISPLAY
;; mov ax, MSG_GET_TARGET
;; call ObjMessageCallFixup
;; pop ax ; retreive flag
;; push cx, dx ; save current window
endif ; if CLOSE_IN_OVERLAP
cmp ax, FALSE ; create?
je bringUp ; nope, just bring to front
EC < cmp ax, TRUE >
EC < ERROR_NZ 0 >
;
; create Tree Window
; ^lbx:si = DisplayControl
;
mov cx, handle TreeWindow ; ^lcx:dx = Tree Window
mov dx, offset TreeWindow
mov ax, MSG_GEN_ADD_CHILD
mov bp, mask CCF_MARK_DIRTY or CCO_LAST
call ObjMessageCallFixup
;
; set horizontal and vertical increment amounts in
; Directory Tree pane
;
mov bx, handle TreeView
mov si, offset TreeView
mov cx, ss:[widest83FilenameWidth]
mov dx, ss:[desktopFontHeight]
push bp
sub sp, size PointDWord
mov bp, sp
mov ss:[bp].PD_x.low, cx
clr ss:[bp].PD_x.high
mov ss:[bp].PD_y.low, dx
clr ss:[bp].PD_y.high
mov dx, size PointDWord
mov ax, MSG_GEN_VIEW_SET_INCREMENT
mov di, mask MF_CALL or mask MF_STACK
call ObjMessage
add sp, size PointDWord
pop bp
bringUp:
;
; bring up Tree Window (existing or just created)
;
mov bx, handle TreeWindow
mov si, offset TreeWindow
mov dl, VUM_NOW
mov ax, MSG_GEN_SET_USABLE ; (also brings it up)
call ObjMessageCallFixup
mov ax, MSG_GEN_BRING_TO_TOP
call ObjMessageCallFixup
if CLOSE_IN_OVERLAP
;
; before closing, add Tree Window to LRU table
;
mov bx, handle TreeWindow ; bx:si = Tree Window
mov si, offset TreeWindow
call UpdateWindowLRUStatus
;
; close current window if in maximized mode and current window
; is closable
;
mov bx, handle FileSystemDisplayGroup
mov si, offset FileSystemDisplayGroup
mov ax, MSG_GEN_DISPLAY_GROUP_GET_FULL_SIZED
call ObjMessageCallFixup ; carry set if maximized
mov cx, FALSE ; assume not maximized
jnc 77$
mov cx, TRUE ; maximized
77$:
;; pop bx, si ; bx:si = current window
push cx ; save state
;; cmp bx, handle TreeWindow ; if current window is
;; jne 80$ ; Tree Window, don't
;; cmp si, offset TreeWindow ; close, we just brought
;; je notMax ; it up!
;;80$:
cmp cx, TRUE ; maximized?
jne notMax ; no, don't close
;; mov ax, MSG_DESKDISPLAY_GET_OPEN_STATE
;; call ObjMessageCallFixup ; cx = state
;; cmp cx, TRUE ; can we close?
;; jne notMax ; nope
;; mov ax, MSG_GEN_DISPLAY_CLOSE
;; call ObjMessageCallFixup ; else, close
;;also deals with LRU table - brianc 10/8/90
call CloseOldestWindowIfPossible
;;
notMax:
pop cx ; retreive max state
mov bx, handle TreeWindow
mov si, offset TreeWindow
mov ax, MSG_DESKDISPLAY_SET_OPEN_STATE
call ObjMessageCallFixup
endif ; if CLOSE_IN_OVERLAP
ret
TreeWindowCommon endp
endif ; ifdef TREE_MENU
endif ; ifndef GEOLAUNCHER
endif ; if (not _ZMGR)
endif ; if _GMGR
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopDriveToolQTInternal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: hack method handler to get desktop thread running
CALLED BY: MSG_DRIVETOOL_QT_INTERNAL
PASS: cx:dx = OD of DriveTool object which got QuickTransfer
bp = mem handle of block of filenames
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 12/18/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopDriveToolQTInternal method DesktopClass,
MSG_DRIVETOOL_QT_INTERNAL
.enter
push bp ; save block handle
mov bx, cx ; bx:si = object
mov si, dx
;
; get drive letter for move/copy to root directory
;
mov ax, MSG_DRIVE_TOOL_GET_DRIVE
call ObjMessageCall ; bp = drive number
; dx = disk handle
pop bx ; retrieve block handle
call DriveToolCopyMoveFiles
.leave
ret
DesktopDriveToolQTInternal endm
if _FCAB or _PEN_BASED
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopDeskToolQTInternal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: hack method handler to get desktop thread running
CALLED BY: MSG_DESKTOOL_QT_INTERNAL
PASS: cx:dx = OD of DeskTool object which got QuickTransfer
bp = mem handle of block of filenames
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 12/18/89 Initial version
dlitwin 6/1/92 Changed 'Trash' to 'Waste Basket' and tweaked
to handle GCM-only Waste Basket as a desktool
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopDeskToolQTInternal method DesktopClass,
MSG_DESKTOOL_QT_INTERNAL
push bp ; save block handle
mov bx, cx ; bx:si = object
mov si, dx
mov ax, MSG_DESK_TOOL_GET_TYPE
call ObjMessageCallFixup ; dl = tool type
pop bx ; retrieve block handle
cmp dl, DESKTOOL_WASTEBASKET
je wasteBasket
mov bx, bp ; bx = file list
call MemFree ; free it
jmp short done
wasteBasket:
call WastebasketDeleteFiles
call MemFree ; free up file list (bx)
done:
ret
DesktopDeskToolQTInternal endm
endif ; if _FCAB
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopDirToolQTInternal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: hack method handler to get desktop thread running
CALLED BY: MSG_DIRTOOL_QT_INTERNAL
PASS: cx:dx = OD of DirTool object which got QuickTransfer
bp = mem handle of block of filenames
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 5/30/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopDirToolQTInternal method DesktopClass, \
MSG_DIRTOOL_QT_INTERNAL
push bp ; save block handle
mov bx, cx ; bx:si = object
mov si, dx
mov ax, MSG_DIR_TOOL_GET_TYPE
call ObjMessageCallFixup ; dl = tool type
pop bp ; retrieve block handle
cmp dl, DIRTOOL_UPDIR ; up/dir?
je upDir ; yes, handle specially
;
; move/copy to application or document directory
; bp = file list block
; dl = appl or doc
;
mov bx, bp ; bx = file list block
mov bp, SP_DOCUMENT
cmp dl, DIRTOOL_DOCDIR
je haveDestination
mov bp, SP_APPLICATION
cmp dl, DIRTOOL_APPLDIR
je haveDestination
mov bp, SP_DOS_ROOM
cmp dl, DIRTOOL_DOSROOMDIR
je haveDestination
mov bp, SP_WASTE_BASKET
mov {byte} ss:[usingWastebasket], WASTEBASKET_BUTTON
EC < cmp dl, DIRTOOL_WASTEDIR >
EC < ERROR_NZ UNKNOWN_DIRTOOL_TYPE >
haveDestination:
xchg bp, dx ; bp = tool type
; dx = dest disk handle/SP
NOFXIP < segmov ds, cs >
FXIP< mov si, bx >
FXIP< GetResourceSegmentNS dgroup, ds, TRASH_BX >
FXIP< mov bx, si >
mov si, offset FileOperationNullPath ; ds:si = null path for SP
call GetQuickTransferMethod ; bp = move or copy
jc error
mov cx, 1 ; indicate BX is mem. block
push bx ; save file list block handle
call ProcessDragFilesCommon ; move/copy files
mov {byte} ss:[usingWastebasket], NOT_THE_WASTEBASKET
pop bx ; bx = file list block handle
error:
call MemFree ; free list
jmp done
upDir:
if not _FCAB
push bp ; save file list handle
mov ax, MSG_META_GET_OBJ_BLOCK_OUTPUT
call ObjMessageCallFixup ; cx:dx = OD (Folder object)
pop bp ; bp = file list handle
mov ax, MSG_UP_DIR_QT
mov bx, cx
mov si, dx
call ObjMessageCall ; let folder do the work
endif ; if (not _FCAB)
FC< mov ax, MSG_UP_DIR_QT >
FC< call DesktopSendToCurrentWindow ; sends only to FolderClass obj. >
done:
ret
DesktopDirToolQTInternal endm
if FULL_EXECUTE_IN_PLACE
idata segment
endif
LocalDefNLString FileOperationNullPath <0>
if FULL_EXECUTE_IN_PLACE
idata ends
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DriveToolCopyMoveFiles
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: move/copy files to a drive
CALLED BY: INTERNAL
DesktopDriveToolQTInternal
PASS: bx = filelist mem. block handle
bp = drive number
RETURN: (frees file list block)
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 01/02/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DriveToolCopyMoveFiles proc near
.enter
push bx ; save filelist block handle
mov ax, bp ; al = drive number
call DiskRegisterDisk ; bx = disk handle
mov dx, bx ; dx = disk handle
pop bx ; bx = filelist block handle
jnc haveDiskHandle ; no error
mov ax, ERROR_DRIVE_NOT_READY
call DesktopOKError ; else, report drive not ready
jmp short exit ; done
haveDiskHandle:
;
; get destination directory (root)
;
NOFXIP < segmov ds, cs >
FXIP< mov si, bx >
FXIP< GetResourceSegmentNS dgroup, ds, TRASH_BX >
FXIP< mov bx, si >
mov si, offset driveToolRootDir ; ds:si = dest. pathname
;
; process file list
; ds:si = destination pathname
; dx = destination disk handle
; bp = dirtool
;
call GetQuickTransferMethod ; bp = move or copy
jc error
mov cx, 1 ; indicate bx = memory block
push bx
call ProcessDragFilesCommon ; pass ds:si, dx, bp, bx, cx
pop bx
error:
call MemFree ; free file list block
exit:
.leave
ret
DriveToolCopyMoveFiles endp
if FULL_EXECUTE_IN_PLACE
idata segment
endif
SBCS <driveToolRootDir byte C_BACKSLASH,0 ; copy to root >
DBCS <driveToolRootDir wchar C_BACKSLASH,0 ; copy to root >
if FULL_EXECUTE_IN_PLACE
idata ends
endif
if (not _FCAB and not _ZMGR)
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DesktopEmptyWastebasket
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: save current settings in Options menu to geos.ini file
CALLED BY: MSG_EMPTY_WASTEBASKET
PASS: global variable 'loggingOut':
= non-zero to give waring if Option is set
0 to bypass warning (regardless of the UI option).
This should only be used when emptying on
logout.
RETURN: nothing
DESTROYED: ???
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
dlitwin 05/19/92 Initial version
dlitwin 01/02/93 added waring override flag (cx = 0)
dlitwin 04/26/93 changed waring override flag to be global
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DesktopEmptyWastebasket method dynamic DesktopClass, MSG_EMPTY_WASTEBASKET
.enter
call FilePushDir
cmp ss:[loggingOut], TRUE
je skipWarning
GM< mov bx, handle OptionsWarnings >
GM< mov si, offset OptionsWarnings >
ND< mov bx, handle OptionsList >
ND< mov si, offset OptionsList >
mov cx, mask OMI_CONFIRM_EMPTY_WB
mov ax, MSG_GEN_BOOLEAN_GROUP_IS_BOOLEAN_SELECTED
call ObjMessageCallFixup ; carry if set
jnc skipWarning
mov ax, WARNING_EMPTY_WASTEBASKET
call DesktopYesNoWarning
cmp ax, YESNO_YES
LONG jne done
skipWarning:
mov ax, SP_WASTE_BASKET
call FileSetStandardPath
mov ax, size FileQuickTransferHeader + size FileOperationInfoEntry
mov cx, ALLOC_DYNAMIC_LOCK
call MemAlloc
mov ds, ax ; lock into ax
mov ax, ERROR_INSUFFICIENT_MEMORY
LONG jc error
push bx ; save block handle
clr ax
mov ds:[FQTH_nextBlock], ax
mov ds:[FQTH_UIFA], ax
; feedback data and remote flag don't matter because this
; won't be used with a QuickTransfer, just internally.
mov ds:[FQTH_numFiles], 1 ; just the Waste Basket
mov ds:[FQTH_diskHandle], SP_PRIVATE_DATA
SBCS < mov ds:[FQTH_pathname], 0 ; no path string >
DBCS < mov {wchar}ds:[FQTH_pathname], 0 ; no path string >
mov cx, PATH_BUFFER_SIZE
sub sp, cx ; allocate path buffer on stack
clr dx ; drive name doesn't matter
mov bx, SP_WASTE_BASKET
mov si, offset FQTH_pathname ; points to 0, or null-string
segmov es, ss, di
mov di, sp ; point es:di to stack buffer
call FileConstructFullPath
std ; reverse search direction
SBCS < mov al, C_BACKSLASH ; search for last '\\' >
DBCS < mov ax, C_BACKSLASH ; search for last '\\' >
SBCS < repne scasb >
DBCS < repne scasw >
cld ; reset direction flag to 0
segxchg ds, es ; swap these
mov si, di
inc si ; this points ds:si to the
inc si ; path of the Waste Basket
DBCS < inc si >
DBCS < inc si >
mov di, size FileQuickTransferHeader + offset FOIE_name
SBCS < mov cx, FILE_LONGNAME_BUFFER_SIZE >
DBCS < mov cx, FILE_LONGNAME_BUFFER_SIZE/2 >
SBCS < rep movsb >
DBCS < rep movsw >
add sp, PATH_BUFFER_SIZE ; pop stack buffer
segmov ds, es, si ; restore ds with block
mov si, size FileQuickTransferHeader
mov ds:[si].FOIE_type, GFT_DIRECTORY
mov ds:[si].FOIE_attrs, mask FA_SUBDIR
mov ds:[si].FOIE_pathInfo, mask DPI_EXISTS_LOCALLY
clr ss:[enteredFileOpRecursion]
mov ss:[skipDeletingDir], -1 ; as non-zero as it gets
call FileBatchChangeNotifications
call FileDeleteAllDir
call FileFlushChangeNotifications
mov ss:[skipDeletingDir], 0 ; reset to default of delete dir
pop bx ; restore block handle
pushf ; MemFree doesn't preserve
call MemFree
popf
jnc rescan
error:
;
; If we're shutting down, don't report errors; not only is it
; pointless but it results in deadlock since the UI's
; ShutdownStatusBox has the focus, meaning the user can't click
; on our OK trigger, so our box stays up forever and prevents
; shutdown from proceeding. - jenny 5/3/93
;
cmp ss:[loggingOut], TRUE
je rescan
call DesktopOKError
rescan:
NOFXIP < mov ax, cs >
FXIP< mov cx, ds >
FXIP< GetResourceSegmentNS dgroup, ds, TRASH_BX >
FXIP< mov ax, ds >
FXIP< mov ds, cx >
mov bx, offset driveToolRootDir
mov cx, SP_WASTE_BASKET
call UpdateMarkedWindows
if GPC_FULL_WASTEBASKET
call UpdateWastebasket
endif
done:
call FilePopDir
.leave
ret
DesktopEmptyWastebasket endm
endif ; if ((not _FCAB) and (not _ZMGR) and
; (not _NIKE)
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
common file operation routines
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: break out small routines common to file operations to
save space
CALLED BY: INTERNAL
DesktopEndRename
DesktopEndDelete
DesktopEndCreateDir
DesktopEndCopy
DesktopEndMove
DesktopEndDuplicate
PASS:
RETURN:
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 02/16/90 routines broken out
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
;
; change to directory specified in file op box, we don't care what
; directory we are in when we quit, so no need to save current
; directory
;
; pass:
; si = chunk of cur dir text object
; bx = chunk of file op box
; returns:
; carry clear if successful
; carry set if error encountered and reported
;
ChangeToFileOpSrcDir proc
call GetAndExtractPathFromVolPath
;
; Set that as our current path.
;
xchg bx, cx
; mov ss:[folderUpdateSrcDiskHandle], bx ; save for update
mov dx, si ; ds:dx <- path to set
call FileSetCurrentPath
;
; Free the path block, preserving the carry, of course.
;
mov bx, cx
pushf
call MemFree
popf
jnc done
call DesktopOKError ; report error (preserves C)
done:
ret
ChangeToFileOpSrcDir endp
;
; pass:
; si = chunk of cur dir text object
; return:
; carry clear if no error
; ds:si = path
; bx = path buffer handle
; cx = disk handle
; carry set if error reported
;
GetAndExtractPathFromVolPath proc near
mov bx, handle FileOperationUI
clr dx
mov ax, MSG_GEN_PATH_GET
call ObjMessageCall
jc error
;
; Lock down the returned path block.
;
mov bx, dx
call MemLock
mov ds, ax
clr si
done:
ret
error:
mov ax, ERROR_PATH_NOT_FOUND ; assume error
call DesktopOKError
jmp done
GetAndExtractPathFromVolPath endp
if 0 ; no substitution - usability 5/3/90
;
; pass:
; ds:si = pathname to check
; bx = handle of pathname buffer
; return:
; carry clear if NO substitute made
; nothing destroyed
; carry set if substitute made
; bx = new path buffer handle (old buffer freed)
; = 0 if MemAlloc error
; (if error, passed buffer is freed)
; ds:si = unsubstituted path
;
UnsubstitutePathname proc near
uses di, bp, es
.enter
mov bp, si ; save pathname for later
segmov es, cs
mov di, offset applUnsubstitute
call MainCheckSubdir ; ds:si = remainder of pathname
jne notAppl
;
; unsubstitute "Applications"
;
mov dx, offset applPathname
jmp short unsubstituteCommon
notAppl:
mov si, bp ; ds:si = pathname to check
mov di, offset docUnsubstitute
call MainCheckSubdir
jne notDoc
;
; unsubstitute "Documents"
;
mov dx, offset docPathname
unsubstituteCommon:
push bx ; save old path buffer handle
push ds ; save remaider pathname seg.
xchg dx, si ; dx = remainder of pathname
; si = original appl/doc path
NOFXIP< segmov ds, dgroup, ax ; ds:si = original appl/doc path >
FXIP< GetResourceSegmentNS dgroup, ds, TRASH_BX >
mov ax, PATHNAME_BUFFER_LENGTH
mov cx, ALLOC_DYNAMIC_LOCK
call MemAlloc
jnc 50$
pop ax ; dump pathname segment
pop bx ; free old buffer
call MemFree
clr bx ; indicate error
jmp short errorExit
50$:
mov es, ax
clr di
call CopyNullString ; copy original appl/doc path
pop ds
mov si, dx ; ds:si = remainder of pathname
call CopyNullTermString ; tack it on
mov cx, bx ; save new path buffer handle
pop bx ; get old path buffer handle
call MemFree ; free it
mov bx, cx ; return new path buffer handle
segmov ds, es
clr si ; ds:si = unsubstituted path
errorExit:
stc ; indicate unsubstitution made
jmp short done
notDoc:
mov si, bp ; restore ds:si for exit
clc
done:
.leave
ret
UnsubstitutePathname endp
applUnsubstitute byte 'Applications',0
docUnsubstitute byte 'Documents',0
MainCheckSubdir proc near
uses ax, cx, di
.enter
clr al
mov cx, -1
push di
repne scasb
pop di
not cx
dec cx ; sans null-terminator
repe cmpsb
jne done
cmp {byte} ds:[si], 0 ; null-term -> exact match
je done
cmp {byte} ds:[si], '\\' ; slash -> ds:si subdir of es:di
done:
.leave
ret
MainCheckSubdir endp
endif
;
; get source filename
;
; pass:
; si - source filename file operation file list
; returns:
; carry - clear if file returned
; set if no more files
;
GetSrcNameFromFileList proc near
uses ds, es, si, di
.enter
mov bx, handle FileOperationUI
mov ax, MSG_GET_CURRENT_FILE
call ObjMessageCall
jc done
mov bx, cx
call MemLock
mov ds, ax
mov si, dx
segmov es, ss
mov di, offset fileOperationInfoEntryBuffer
mov cx, size fileOperationInfoEntryBuffer
rep movsb
call MemUnlock
done:
.leave
ret
GetSrcNameFromFileList endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GetSrcFromFileListAndSetCurDir
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the current file from the passed FileOpFileList object
and set our current directory to be that specified in the
FQT block bound to the list, returning the FOIE for the
next file to process.
CALLED BY: ?
PASS: *FileOperationUI:si = FileOpFileList object to call
RETURN: carry = set on error
ax = FileError if couldn't change to directory
bx = handle of block to unlock when done
-or-
ax = zero if we couldn't get the last file
bx = *not* a handle of a block, so don't unlock!
carry = clear if directory set.
ds:dx = FileOperationInfoEntry for the file
bx = handle of block to unlock when done
DESTROYED: cx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 2/25/92 Initial version
dlitwin 5/19/93 changed a fatal error to be a returned
error
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
GetSrcFromFileListAndSetCurDir proc near
uses si, es, di
.enter
;
; Fetch the address of the FOIE to process next. Caller should have
; checked to see if there's a file left to process...
; dlitwin 5/19/93: ...but is seems that a case where no file is left
; to process when the user does a jackhammer like pressing of the action
; button, so don't fatal error, instead return carry set and ax = zero.
;
mov bx, handle FileOperationUI
mov ax, MSG_GET_CURRENT_FILE
call ObjMessageCall
mov ax, 0 ; don't use 'clr' because this
jc done ; would mess with the flags.
; Lock the block down and copy the current file into
; fileOperationInfoEntryBuffer, in case something somewhere needs it
;
mov bx, cx
call MemLock
mov ds, ax
mov si, dx
segmov es, ss
mov di, offset fileOperationInfoEntryBuffer
mov cx, size fileOperationInfoEntryBuffer
rep movsb
;
; Now switch to the directory described in the header.
;
push bx, dx
mov bx, ds:[FQTH_diskHandle]
mov dx, offset FQTH_pathname
call FileSetCurrentPath
pop bx, dx
done:
.leave
ret
GetSrcFromFileListAndSetCurDir endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CopyMoveSourceSetUp
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create a FileQuickTransfer block to hold the next source
file upon which to operate
CALLED BY: DesktopEndDuplicate
PASS: *FileOperationUI:si = object holding current directory
*FileOperationUI:ax = object holding list of files
RETURN: carry set if no more files
carry clear if another file on which to operate:
ds:dx = FileOperationInfoEntry to use
ds:0 = FileQuickTransferHeader
bx = handle of same
DESTROYED: ax, cx, dx, bp, si, di, es
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc ?/?/? Initial version
ardeb 2/25/92 Updated for 2.0 FS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CopyMoveSourceSetUp proc near
mov si, ax
mov bx, handle FileOperationUI
mov ax, MSG_GET_CURRENT_FILE
call ObjMessageCall ; ^hcx:dx <- FOIE
jc exit ; => no more files to do
mov bx, cx
call MemLock
mov ds, ax
mov ax, ds:[FQTH_diskHandle]
;
; XXX: copy the thing into fileOperationInfoEntryBuffer, in case
; something needs it
;
segmov es, ss
mov si, dx
mov di, offset fileOperationInfoEntryBuffer
mov cx, size fileOperationInfoEntryBuffer
rep movsb
clc ; indicate file returned
exit:
ret
CopyMoveSourceSetUp endp
;
; called by:
; DesktopEndRename
; DesktopEndDuplicate
; pass:
; ax = method to send to ourselves to update name list
; si = destination filename chunk
; preserves:
; cx
;
UpdateSrcAndDestNames proc near
push cx ; save file count
push si ; save dest filename chunk
call UpdateNameListManually
pop si ; retrieve dest filename chunk
mov bx, handle FileOperationUI
NOFXIP < mov dx, cs >
NOFXIP < mov bp, offset nullFilenameString >
FXIP < mov dx, ss >
FXIP < clr bp >
FXIP < push bp >
FXIP < mov bp, sp ;dx:bp = null string >
call CallSetText ; erase dest. filename
FXIP < pop cx ;restore the stack >
pop cx ; retrieve file count
ret
UpdateSrcAndDestNames endp
;
; called by:
; DesktopEndRename (via UpdateSrcAndDestNames)
; DesktopEndDuplicate (via UpdateSrcAndDestNames)
; DesktopEndChangeAttr
; pass:
; ax = method to send to ourselves to update name list
; preserves:
; cx
;
UpdateNameListManually proc near
push cx ; save file count
mov bx, handle 0 ; send to ourselves
call ObjMessageForce ; do when operation finishes
pop cx ; retrieve file count
ret
UpdateNameListManually endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DisableIfLastFile
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Disable the passed button if the current file is the
last one in the list
CALLED BY: DesktopRenameNext,
DesktopDuplicateNext,
ChangeAttrShowAttrs,
DesktopGetInfoNext
PASS: ax - chunk handle of "Next" button
si - chunk handle of file list
RETURN: nothing
DESTROYED: ax,bx,cx,dx,si,di,bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 2/10/93 added header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DisableIfLastFile proc near
push ax ; save "Next" button
mov bx, handle FileOperationUI ; bx:si = file list
mov ax, MSG_GET_NUM_FILES_LEFT
call ObjMessageCall ; cx = number files remaining
mov ax, MSG_GEN_SET_ENABLED ; assume more than 1 file
cmp cx, 1
ja sendIt ; yes
mov ax, MSG_GEN_SET_NOT_ENABLED
sendIt:
pop si ; bx:si = "Next" button
mov dl, VUM_NOW
call ObjMessageNone
ret
DisableIfLastFile endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ChangeDestNameCharacteristics
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: RenameStuff, DuplicateStuff
PASS: si - source name file list
ax - destination name file list
if not _DOS_LONG_NAME_SUPPORT
cx - instruction field
bx - instruction string
endif
RETURN: carry CLEAR if successful
fileOperationInfoEntryBuffer - filled with
next file
carry SET if no more names
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 2/10/93 added header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ChangeDestNameCharacteristics proc near
if not _DOS_LONG_NAME_SUPPORT
push cx ; save instruction field
push bx ; save instruction string
endif
push ax ; save dest name list
call GetSrcNameFromFileList
pop si ; retrieve dest name list
if not _DOS_LONG_NAME_SUPPORT
pop cx ; retrieve instructions
jnc good
pop ax ; clean up stack
jmp short noMoreNames
good:
push cx ; save instructions again
else
jc noMoreNames
endif ; not _DOS_LONG_NAME_SUPPORT
;
; clear destination name entry field
;
mov bx, handle FileOperationUI
NOFXIP < mov dx, cs >
NOFXIP < mov bp, offset nullFilenameString >
FXIP < mov dx, ss >
FXIP < clr bp >
FXIP < push bp >
FXIP < mov bp, sp ;dx:bp = null string >
call CallSetText ; erase dest. filename
FXIP < pop cx ;restore the stack >
if not _DOS_LONG_NAME_SUPPORT
;
; Set the maximum destination filename length. If the thing
; being copied is a subdir, then always allow 32-character
; filenames.
;
mov cx, FILE_LONGNAME_LENGTH ; assume longname
test ss:[fileOperationInfoEntryBuffer].FOIE_attrs, mask FA_SUBDIR
jnz setLength
cmp ss:[fileOperationInfoEntryBuffer].FOIE_type, GFT_NOT_GEOS_FILE
jne setLength
mov cx, DOS_DOT_FILE_NAME_LENGTH
setLength:
push cx
mov ax, MSG_VIS_TEXT_SET_MAX_LENGTH
call ObjMessageCall
pop ax ; ax <- max length
pop cx ; cx <- DOS instructions
mov bp, offset nullStringString ; assume longname
cmp ax, FILE_LONGNAME_LENGTH
je setInst
mov bp, cx
setInst:
call LockString ; dx = string segment
call DerefDXBPString ; dx:bp = instruction string
pop si ; bx:si = instruction field
call CallSetText
call UnlockString
endif ; not _DOS_LONG_NAME_SUPPORT
clc ; indicate success
noMoreNames:
ret
ChangeDestNameCharacteristics endp
;
; then update destination name field characteristics for this file
; and fill source name as default destination name
;
; called by:
; FolderStartRename
; TreeStartRename
; pass:
; nothing
; return:
; nothing
;
RenameStuff proc far
;
; update state of "Next" button
;
mov ax, offset RenameCtrlNext
mov si, offset RenameFromEntry
call DisableIfLastFile
;
; update destination name field characteristics for this file
;
mov si, offset RenameFromEntry
mov ax, offset RenameToEntry
if not _DOS_LONG_NAME_SUPPORT
mov cx, offset RenameInstructions
mov bx, offset RenDupInstructionString
endif
call ChangeDestNameCharacteristics
jc exit ; no more files
;
; stuff source name in destination name field
;
mov bp, offset fileOperationInfoEntryBuffer.FOIE_name
mov dx, ss ; dx:bp = name to set
mov bx, handle RenameToEntry
mov si, offset RenameToEntry
call CallSetText
;
; make destination name entry field the focus and select the default
; name
;
call EnableMakeFocusAndSelect
;
; disable Rename and mark not modified
;
mov ax, MSG_VIS_TEXT_SET_NOT_USER_MODIFIED
call ObjMessageCall
mov bx, handle RenameCtrlRename
mov si, offset RenameCtrlRename
mov ax, MSG_GEN_SET_NOT_ENABLED
mov dl, VUM_NOW
call ObjMessageCall
exit:
ret
RenameStuff endp
EnableMakeFocusAndSelect proc near
mov ax, MSG_GEN_SET_ENABLED
mov dl, VUM_NOW
call ObjMessageCall
;
; make destination name entry field the focus
;
mov ax, MSG_META_GRAB_FOCUS_EXCL
call ObjMessageCall
;
; select the default name
;
mov ax, MSG_VIS_TEXT_SELECT_RANGE_SMALL
mov cx, 0
mov dx, TEXT_ADDRESS_PAST_END_LOW
call ObjMessageCall
ret
EnableMakeFocusAndSelect endp
;
; clear and disable Duplicate name field
;
; called by:
; FolderStartDuplicate
; TreeStartDuplicate
; pass:
; nothing
; return:
; nothing
; destroys:
; ax, bx, cx, dx, di, bp
;
DuplicateSetup proc far
push si
;
; clear destination name entry
;
mov bx, handle DuplicateToEntry
mov si, offset DuplicateToEntry
mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR
NOFXIP < mov dx, cs >
NOFXIP < mov bp, offset nullName >
clr cx
FXIP < mov dx, ss >
FXIP < clr bp >
FXIP < push bp >
FXIP < mov bp, sp ;dx:bp = null string >
call ObjMessageCallFixup
FXIP < pop ax ;restore the stack >
;
; disable destination name entry so user doesn't get to enter
; a name and then see it overwritten by the default destination name
;
mov ax, MSG_GEN_SET_NOT_ENABLED
mov dl, VUM_NOW
call ObjMessageCallFixup
pop si
ret
DuplicateSetup endp
;
; clear and disable Rename name field
;
; called by:
; FolderStartRename
; TreeStartRename
; pass:
; nothing
; return:
; nothing
; destroys:
; ax, bx, cx, dx, di, bp
;
RenameSetup proc far
push si
;
; clear destination name entry
;
mov bx, handle RenameToEntry
mov si, offset RenameToEntry
mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR
NOFXIP < mov dx, cs >
NOFXIP < mov bp, offset nullName >
clr cx
FXIP < mov dx, ss >
FXIP < clr bp >
FXIP < push bp >
FXIP < mov bp, sp ;dx:bp = null string >
call ObjMessageCallFixup
FXIP < pop ax ;restore the stack >
;
; disable destination name entry so user doesn't get to enter
; a name and then see it overwritten by the default destination name
;
mov ax, MSG_GEN_SET_NOT_ENABLED
mov dl, VUM_NOW
call ObjMessageCallFixup
pop si
ret
RenameSetup endp
ForceRef RenameSetup ; used in different source code module
ife FULL_EXECUTE_IN_PLACE
LocalDefNLString nullName <0>
endif
if DBCS_PCGEOS
DOS_NAME_BUFFER_SIZE = \
((DOS_FILE_NAME_CORE_LENGTH + 1 + DOS_FILE_NAME_EXT_LENGTH + 1)+1)*(size wchar)
else
DOS_NAME_BUFFER_SIZE = \
((DOS_FILE_NAME_CORE_LENGTH + 1 + DOS_FILE_NAME_EXT_LENGTH + 1)+1) and 0xfffe
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DuplicateStuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Update the destination name field characteristics for
this file and fill source name as default destination name
CALLED BY: DesktopDuplicateNext, TreeStartDuplicate
PASS: nothing
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 2/10/93 added header
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DuplicateStuff proc far
;
; update state of "Next" button
;
mov ax, offset DuplicateCtrlNext
mov si, offset DuplicateFromEntry
call DisableIfLastFile
;
; update destination name field characteristics for this file
;
mov si, offset DuplicateFromEntry
mov ax, offset DuplicateToEntry
if not _DOS_LONG_NAME_SUPPORT
mov cx, offset DuplicateInstructions
mov bx, offset RenDupInstructionString
endif
call ChangeDestNameCharacteristics
LONG jc exit ; no more files
;
; stuff source name in destination name field
;
mov bp, offset fileOperationInfoEntryBuffer.FOIE_name
test ss:[fileOperationInfoEntryBuffer].FOIE_attrs, mask FA_SUBDIR
LONG jnz longName
cmp ss:[fileOperationInfoEntryBuffer].FOIE_type, GFT_NOT_GEOS_FILE
jne longName
;
; handle DOS 8.3 name - add/replace 8th char with "~" to/of
; filename core
;
push ds, es
mov ax, ss
mov ds, ax
mov es, ax
mov si, bp
sub sp, DOS_NAME_BUFFER_SIZE
mov di, sp
mov bp, sp
mov cx, DOS_FILE_NAME_CORE_LENGTH
copyLoop:
LocalGetChar ax, dssi
LocalCmpChar ax, '.'
je addTilde
LocalIsNull ax
jz addTilde
LocalCmpChar ax, '?'
jne store
if not DBCS_PCGEOS
;
; Funky DOS char mapped to funky geos char sequence; drop all three
; chars on the floor.
;
EC < lodsb >
EC < tst al >
EC < ERROR_Z GOT_INVALID_NAME_FROM_FILE_ENUM >
EC < cmp al, '.' >
EC < ERROR_E GOT_INVALID_NAME_FROM_FILE_ENUM >
EC < lodsb >
EC < tst al >
EC < ERROR_Z GOT_INVALID_NAME_FROM_FILE_ENUM >
EC < cmp al, '.' >
EC < ERROR_E GOT_INVALID_NAME_FROM_FILE_ENUM >
NEC < inc si >
NEC < inc si >
endif
jmp copyLoop
store:
LocalPutChar esdi, ax
loop copyLoop
LocalPrevChar esdi ; erase 8th char
LocalNextChar dssi ; no si adjust needed
addTilde:
LocalPrevChar dssi ; restore char
LocalLoadChar ax, '~'
extLoop:
LocalPutChar esdi, ax
LocalGetChar ax, dssi
LocalIsNull ax
jnz extLoop
LocalPutChar esdi, ax ; store null
mov dx, ss ; dx:bp = name
mov bx, handle DuplicateToEntry
mov si, offset DuplicateToEntry
call CallSetText
add sp, DOS_NAME_BUFFER_SIZE
pop ds, es
jmp short afterSetName
longName:
;
; handle longname - prefix with "Copy of " (localized)
; ss:bp = longname
;
push ds, es
sub sp, 30+FILE_LONGNAME_LENGTH ; room for prefix & fname
segmov es, ss ; es:di = buffer
mov di, sp
GetResourceHandleNS Dup32PrefixString, bx
call MemLock
mov ds, ax ; ds = prefix segment
mov si, offset Dup32PrefixString
mov si, ds:[si] ; si = prefix string
clr cx
charLoop:
LocalGetChar ax, dssi
LocalIsNull ax ; end of string?
jz stringDone ; yes
LocalCmpChar ax, 01h ; filename param?
jne notFilename ; nope
push ds, si
segmov ds, ss ; ds:si = longname
mov si, bp
innerLoop: ; copy longname into buffer
LocalGetChar ax, dssi
LocalIsNull ax
jz innerDone
cmp cx, 20+FILE_LONGNAME_LENGTH ; too long?
ja 10$ ; yep, skip
LocalPutChar esdi, ax
inc cx
10$:
jmp short innerLoop
innerDone:
pop ds, si ; restore pointer into string
jmp short nextChar
notFilename:
cmp cx, 20+FILE_LONGNAME_LENGTH ; too long?
ja nextChar ; yep, skip
LocalPutChar esdi, ax ; copy character verbatim
inc cx
nextChar:
jmp short charLoop
stringDone:
LocalPutChar esdi, ax ; store null-terminator
call MemUnlock ; unlock string resource
; cx = length w/o null
cmp cx, FILE_LONGNAME_LENGTH ; too long?
jbe lengthOK
mov cx, FILE_LONGNAME_LENGTH ; yes, use full name length
lengthOK:
mov dx, ss ; dx:bp = complete string
mov bp, sp
mov bx, handle DuplicateToEntry
mov si, offset DuplicateToEntry
mov ax, MSG_VIS_TEXT_REPLACE_ALL_PTR
call ObjMessageCall
add sp, 30+FILE_LONGNAME_LENGTH ; remove stack buffer
pop ds, es
afterSetName:
;
; make destination name entry field the focus and select the default
; name
;
call EnableMakeFocusAndSelect
exit:
ret
DuplicateStuff endp
ife FULL_EXECUTE_IN_PLACE
LocalDefNLString nullFilenameString <0>
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RenameWithOverwrite
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: rename 8.3 filename, overwriting existing file with
destination name, if confirmation given by user
CALLED BY: INTERNAL
DesktopEndRename
PASS: ds:dx = source name
es:di = destination name
correct disk asserted
RETURN: carry set if error
ax - error code
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 7/13/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RenameWithOverwrite proc near
call CheckRootSrcOperation ; can't rename root
jc done
call CheckRootDestOperation ; can't rename TO root
jc done
call CheckSystemFolderDestruction ; can't rename system folder
jc done
;
; check if new name is already in use (needed as conflicting named
; links are not detected by FileRename)
;
push ds, dx
segmov ds, es ; ds:dx = dest name
mov dx, di
call FileGetAttributes ; C set if error (ie not found)
pop ds, dx
mov ax, ERROR_FILE_EXISTS ; assume exists
cmc ; C set if exists
jc done ; exists, return with C set
call FileRename ; do rename
if TRY_CLOSE_ON_IN_USE_ERROR ; to support renaming of in-use file
jnc done ; no error
push cx
mov cx, 0 ; try to close file
call TryCloseOrSaveFile
pop cx
jc done
call FileRename ; try again
endif
done:
ret
RenameWithOverwrite endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
UpdateFilenameList
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: update list of filenames
CALLED BY: INTERNAL
DesktopEndRename
DesktopEndDelete
DesktopEndCreateDir
DesktopEndMove
DesktopEndCopy
PASS: ax:bx = start of next filename is list
si = text object for filename list
RETURN:
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 9/22/89 Documented, adapted for general use
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if 0
;no longer needed 12/19/90
UpdateFilenameList proc near
push ax, bx, cx, dx, bp, ds, es, si, di
mov dx, ax ; dx:bp = new src name list
mov bp, bx
mov bx, handle FileOperationUI
call CallSetText
pop ax, bx, cx, dx, bp, ds, es, si, di
ret
UpdateFilenameList endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ShowFileOpStatus
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: show name of file for file operation
CALLED BY: INTERNAL
DesktopEndRename
DesktopEndDelete
DesktopEndCreateDir
DesktopEndCopy
DesktopEndMove
PASS: ds:dx - filename
si - status field
bp - status string chunk (in DeskStringsRare block)
carry set if ds:dx is longname and no conversion is needed
carry clear if ds:dx is DOS name and conversion is required
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 8/25/89 Initial version
brianc 9/8/89 changed to common routine
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ShowFileOpStatus proc near
uses ax, bx, cx, dx, di, si, ds, es
.enter
mov cx, si ; save status field
mov si, bp ; si = status string chunk
mov bp, ds ; bp = filename segment
SBCS < sub sp, 60+FILE_LONGNAME_LENGTH ; (50 chars for param string)>
DBCS < sub sp, (60+FILE_LONGNAME_LENGTH)*2 ; (50 chars for param string)>
segmov es, ss ; es:di = buffer
mov di, sp
mov bx, handle DeskStringsRare
push bx
call MemLock
mov ds, ax
mov si, ds:[si] ; ds:si = status string
clr bx
charLoop:
LocalGetChar ax, dssi
LocalIsNull ax ; end of string?
jz stringDone ; yes
LocalCmpChar ax, 01h ; filename param?
jne notFilename ; nope
push ds, si ; save status string
push di ; save name offset
push di ; save again
mov ds, bp ; ds:si = filename
mov si, dx
innerLoop:
LocalGetChar ax, dssi
LocalIsNull ax
jz innerDone
cmp bx, 54+FILE_LONGNAME_LENGTH ; too long?
ja 10$ ; yep, skip
LocalPutChar esdi, ax
inc bx
10$:
jmp short innerLoop
innerDone:
mov si, di ; si = current offset
pop ax ; ax = original offset
sub ax, si ; ax = name length
pop si ; dgroup:si = fname to convert
pop ds, si ; restore pointer into string
jmp short nextChar
notFilename:
cmp bx, 54+FILE_LONGNAME_LENGTH ; too long?
ja nextChar ; yep, skip
LocalPutChar esdi, ax ; copy character verbatim
inc bx
nextChar:
jmp short charLoop
stringDone:
LocalPutChar esdi, ax ; store null-terminator
pop bx
call MemUnlock ; unlock string resource
mov dx, ss ; dx:bp = complete string
mov bp, sp
mov bx, handle FileOperationUI ; bx:si = status field
mov si, cx
call CallSetText
SBCS < add sp, 60+FILE_LONGNAME_LENGTH >
DBCS < add sp, (60+FILE_LONGNAME_LENGTH)*2 >
.leave
ret
ShowFileOpStatus endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ShowFileOpResult
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: show number of files involved in success file operation
CALLED BY: INTERNAL
DesktopEndRename
DesktopEndDelete
DesktopEndCreateDir
DesktopEndCopy
DesktopEndMove
PASS: cx - number of files
si - result field
bp - result string
dx - result string (singular)
RETURN: preserves es, di
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 8/25/89 Initial version
brianc 9/8/89 changed to common routine
clee 5/16/94 changed for XIP
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ShowFileOpResult proc near
push es, di
if 0
mov ax, cx ; get file count
NOFXIP< segmov es, dgroup, bx >
FXIP< GetResourceSegment dgroup, es, TRASH_BX >
mov di, offset fileCountBuffer
call ASCIIizeWordAX ; convert to ASCII string
; (preserves bx, cx)
push bp ; save result string
cmp cx, 1
jne 10$
pop bp
push dx ; else, use singular
10$:
mov dx, bx ; dx - seg of ASCII file count
mov bx, handle FileOperationUI ; bx:si = result field
push si ; save result field
mov bp, offset fileCountBuffer ; dx:bp = ASCII # files
call CallSetText
mov dx, cs ; get result string segment
pop si ; bx:si = result field
pop bp ; dx:bp = result string
call CallAppendText
else
mov bx, handle FileOperationUI
NOFXIP < mov dx, cs >
NOFXIP < mov bp, offset nullResultString >
FXIP < mov dx, ss >
FXIP < clr bp >
FXIP < push bp >
FXIP < mov bp, sp ;dx:bp = null string >
call CallSetText
FXIP < pop di ;restore the stack >
endif
pop es, di
ret
ShowFileOpResult endp
ife FULL_EXECUTE_IN_PLACE
LocalDefNLString nullResultString <0>
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckForWildcards
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: checks filename for wildcards
CALLED BY: INTERNAL
PASS: ds:dx = null-terminated string to check
RETURN: Z set if filename contains wildcard(s)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
check only the tail component
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
brianc 10/11/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if 0 ; cannot enter wildcard chars - 6/12/90
CheckForWildcards proc near
push si, ax, dx, bp
mov bp, dx ; dx:bp = path to check
mov dx, ds
call GetTailComponent
mov si, bp ; ds:si = tail component
CFWs_loop:
lodsb
tst al
jz CFWs_exit ; if null-term., exit with
; Z clear
cmp al, '*'
je CFWs_done ; exit with Z set
cmp al, '?'
je CFWs_done ; exit with Z set
jmp short CFWs_loop ; check next char
CFWs_exit:
cmp al, 0ffh ; will clear Z flag
CFWs_done:
pop si, ax, dx, bp
ret
CheckForWildcards endp
endif
;
; util routines
;
if 0
;no longer needed 12/19/90
GetUpdateDSDXList proc near
mov ax, ds
mov bx, dx
call GetNextFilename
mov dx, bx
call UpdateFilenameList
ret
GetUpdateDSDXList endp
endif
; NAME: CallGetText
; PASS: nothing
; RETURN: cx = length of text
; if cx != 0,
; dx = handle of block containing text
;
CallGetText proc near
mov bx, handle FileOperationUI
mov ax, MSG_VIS_TEXT_GET_ALL_BLOCK
clr dx ; get text in a global block
call ObjMessageCall
mov dx, cx ; dx = handle
mov cx, ax ; cx = length of block
jcxz freeTheDarnBlock
done:
ret
freeTheDarnBlock:
;
; If we've been given an empty block, free the thing so the callers
; don't have to do so.
;
mov bx, dx
call MemFree
jmp done
CallGetText endp
FileOperation ends
| 24.482244 | 81 | 0.639575 |
799cde50c8c2eaddfa6f9a06e181f4a9436e2644 | 32 | asm | Assembly | src/main/fragment/mos6502-common/vbuaa_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_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/vbuaa_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/main/fragment/mos6502-common/vbuaa_lt_pbuc1_derefidx_(pbuc2_derefidx_vbuxx)_then_la1.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | ldy {c2},x
cmp {c1},y
bcc {la1}
| 8 | 10 | 0.5625 |
79b5c613a8c227393e9c709be6fb912044e7a1c7 | 6,181 | asm | Assembly | Tools/unix/lzsa/asm/z80/unlzsa1_fast.asm | davidknoll/RomWBW | 8a7bc97fea27bf10a23c61ee508522a60e2909c6 | [
"DOC",
"MIT"
] | 194 | 2015-08-20T03:18:01.000Z | 2022-03-27T02:25:00.000Z | asm/z80/unlzsa1_fast.asm | peterferrie/lzsa | 2442d6e4892d846ae557bf27be8a74632b2a3b5c | [
"Zlib",
"CC0-1.0"
] | 234 | 2017-03-30T10:59:54.000Z | 2022-03-26T20:05:52.000Z | asm/z80/unlzsa1_fast.asm | peterferrie/lzsa | 2442d6e4892d846ae557bf27be8a74632b2a3b5c | [
"Zlib",
"CC0-1.0"
] | 68 | 2016-12-18T18:20:12.000Z | 2022-03-20T16:02:40.000Z | ;
; Speed-optimized LZSA1 decompressor by spke & uniabis (109 bytes)
;
; ver.00 by spke for LZSA 0.5.4 (03-24/04/2019, 134 bytes);
; ver.01 by spke for LZSA 0.5.6 (25/04/2019, 110(-24) bytes, +0.2% speed);
; ver.02 by spke for LZSA 1.0.5 (24/07/2019, added support for backward decompression);
; ver.03 by uniabis (30/07/2019, 109(-1) bytes, +3.5% speed);
; ver.04 by spke (31/07/2019, small re-organization of macros);
; ver.05 by uniabis (22/08/2019, 107(-2) bytes, same speed);
; ver.06 by spke for LZSA 1.0.7 (27/08/2019, 111(+4) bytes, +2.1% speed);
; ver.07 by spke for LZSA 1.1.0 (25/09/2019, added full revision history);
; ver.08 by spke for LZSA 1.1.2 (22/10/2019, re-organized macros and added an option for unrolled copying of long matches);
; ver.09 by spke for LZSA 1.2.1 (02/01/2020, 109(-2) bytes, same speed)
;
; The data must be compressed using the command line compressor by Emmanuel Marty
; The compression is done as follows:
;
; lzsa.exe -f1 -r <sourcefile> <outfile>
;
; where option -r asks for the generation of raw (frame-less) data.
;
; The decompression is done in the standard way:
;
; ld hl,FirstByteOfCompressedData
; ld de,FirstByteOfMemoryForDecompressedData
; call DecompressLZSA1
;
; Backward compression is also supported; you can compress files backward using:
;
; lzsa.exe -f1 -r -b <sourcefile> <outfile>
;
; and decompress the resulting files using:
;
; ld hl,LastByteOfCompressedData
; ld de,LastByteOfMemoryForDecompressedData
; call DecompressLZSA1
;
; (do not forget to uncomment the BACKWARD_DECOMPRESS option in the decompressor).
;
; Of course, LZSA compression algorithms are (c) 2019 Emmanuel Marty,
; see https://github.com/emmanuel-marty/lzsa for more information
;
; Drop me an email if you have any comments/ideas/suggestions: zxintrospec@gmail.com
;
; This software is provided 'as-is', without any express or implied
; warranty. In no event will the authors be held liable for any damages
; arising from the use of this software.
;
; Permission is granted to anyone to use this software for any purpose,
; including commercial applications, and to alter it and redistribute it
; freely, subject to the following restrictions:
;
; 1. The origin of this software must not be misrepresented; you must not
; claim that you wrote the original software. If you use this software
; in a product, an acknowledgment in the product documentation would be
; appreciated but is not required.
; 2. Altered source versions must be plainly marked as such, and must not be
; misrepresented as being the original software.
; 3. This notice may not be removed or altered from any source distribution.
; DEFINE UNROLL_LONG_MATCHES ; uncomment for faster decompression of very compressible data (+57 bytes)
; DEFINE BACKWARD_DECOMPRESS
IFNDEF BACKWARD_DECOMPRESS
MACRO NEXT_HL
inc hl
ENDM
MACRO ADD_OFFSET
ex de,hl : add hl,de
ENDM
MACRO COPY1
ldi
ENDM
MACRO COPYBC
ldir
ENDM
ELSE
MACRO NEXT_HL
dec hl
ENDM
MACRO ADD_OFFSET
ex de,hl : ld a,e : sub l : ld l,a
ld a,d : sbc h : ld h,a ; 4*4+3*4 = 28t / 7 bytes
ENDM
MACRO COPY1
ldd
ENDM
MACRO COPYBC
lddr
ENDM
ENDIF
@DecompressLZSA1:
ld b,0 : jr ReadToken
NoLiterals: xor (hl) : NEXT_HL : jp m,LongOffset
ShortOffset: push de : ld e,(hl) : ld d,#FF
; short matches have length 0+3..14+3
add 3 : cp 15+3 : jr nc,LongerMatch
; placed here this saves a JP per iteration
CopyMatch: ld c,a
.UseC NEXT_HL : ex (sp),hl ; BC = len, DE = offset, HL = dest, SP ->[dest,src]
ADD_OFFSET ; BC = len, DE = dest, HL = dest-offset, SP->[src]
COPY1 : COPY1 : COPYBC ; BC = 0, DE = dest
.popSrc pop hl ; HL = src
ReadToken: ; first a byte token "O|LLL|MMMM" is read from the stream,
; where LLL is the number of literals and MMMM is
; a length of the match that follows after the literals
ld a,(hl) : and #70 : jr z,NoLiterals
cp #70 : jr z,MoreLiterals ; LLL=7 means 7+ literals...
rrca : rrca : rrca : rrca : ld c,a ; LLL<7 means 0..6 literals...
ld a,(hl) : NEXT_HL
COPYBC
; the top bit of token is set if the offset contains two bytes
and #8F : jp p,ShortOffset
LongOffset: ; read second byte of the offset
push de : ld e,(hl) : NEXT_HL : ld d,(hl)
add -128+3 : cp 15+3 : jp c,CopyMatch
IFNDEF UNROLL_LONG_MATCHES
; MMMM=15 indicates a multi-byte number of literals
LongerMatch: NEXT_HL : add (hl) : jr nc,CopyMatch
; the codes are designed to overflow;
; the overflow value 1 means read 1 extra byte
; and overflow value 0 means read 2 extra bytes
.code1 ld b,a : NEXT_HL : ld c,(hl) : jr nz,CopyMatch.UseC
.code0 NEXT_HL : ld b,(hl)
; the two-byte match length equal to zero
; designates the end-of-data marker
ld a,b : or c : jr nz,CopyMatch.UseC
pop de : ret
ELSE
; MMMM=15 indicates a multi-byte number of literals
LongerMatch: NEXT_HL : add (hl) : jr c,VeryLongMatch
ld c,a
.UseC NEXT_HL : ex (sp),hl
ADD_OFFSET
COPY1 : COPY1
; this is an unrolled equivalent of LDIR
xor a : sub c
and 16-1 : add a
ld (.jrOffset),a : jr nz,$+2
.jrOffset EQU $-1
.fastLDIR DUP 16
COPY1
EDUP
jp pe,.fastLDIR
jp CopyMatch.popSrc
VeryLongMatch: ; the codes are designed to overflow;
; the overflow value 1 means read 1 extra byte
; and overflow value 0 means read 2 extra bytes
.code1 ld b,a : NEXT_HL : ld c,(hl) : jr nz,LongerMatch.UseC
.code0 NEXT_HL : ld b,(hl)
; the two-byte match length equal to zero
; designates the end-of-data marker
ld a,b : or c : jr nz,LongerMatch.UseC
pop de : ret
ENDIF
MoreLiterals: ; there are three possible situations here
xor (hl) : NEXT_HL : exa
ld a,7 : add (hl) : jr c,ManyLiterals
CopyLiterals: ld c,a
.UseC NEXT_HL : COPYBC
exa : jp p,ShortOffset : jr LongOffset
ManyLiterals:
.code1 ld b,a : NEXT_HL : ld c,(hl) : jr nz,CopyLiterals.UseC
.code0 NEXT_HL : ld b,(hl) : jr CopyLiterals.UseC
| 30.59901 | 125 | 0.671089 |
1ff766cb9d6a1e14ab13e27511a6046cad6d5433 | 297 | asm | Assembly | programs/oeis/014/A014040.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/014/A014040.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/014/A014040.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A014040: Inverse of 31st cyclotomic polynomial.
; 1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0
sub $1,$0
mod $1,31
pow $1,$1
mov $0,$1
| 37.125 | 205 | 0.542088 |
a01ec8b9d0066f7d1ff32646296cfc69bf19275d | 572 | asm | Assembly | oeis/195/A195023.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/195/A195023.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/195/A195023.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A195023: a(n) = 14*n^2 - 4*n.
; 0,10,48,114,208,330,480,658,864,1098,1360,1650,1968,2314,2688,3090,3520,3978,4464,4978,5520,6090,6688,7314,7968,8650,9360,10098,10864,11658,12480,13330,14208,15114,16048,17010,18000,19018,20064,21138,22240,23370,24528,25714,26928,28170,29440,30738,32064,33418,34800,36210,37648,39114,40608,42130,43680,45258,46864,48498,50160,51850,53568,55314,57088,58890,60720,62578,64464,66378,68320,70290,72288,74314,76368,78450,80560,82698,84864,87058,89280,91530,93808,96114,98448,100810,103200,105618,108064
mov $1,$0
mul $1,14
sub $1,4
mul $0,$1
| 71.5 | 499 | 0.777972 |
01045423027b09f0e3f7e59b3e6520c85e673df5 | 1,093 | asm | Assembly | tests/TestNetworking/src/interrupts.asm | Gegel85/GBEmulator | 9899223d63d08bf77848c89a14f69221722adcc7 | [
"MIT"
] | null | null | null | tests/TestNetworking/src/interrupts.asm | Gegel85/GBEmulator | 9899223d63d08bf77848c89a14f69221722adcc7 | [
"MIT"
] | 6 | 2019-11-27T18:14:52.000Z | 2021-07-27T14:42:21.000Z | tests/TestNetworking/src/interrupts.asm | Gegel85/GBEmulator | 9899223d63d08bf77848c89a14f69221722adcc7 | [
"MIT"
] | null | null | null | ; VBLANK interrupt handler
; Params:
; None
; Return:
; None
; Registers:
; af -> Preserved
; bc -> Preserved
; de -> Preserved
; hl -> Preserved
vblank_interrupt::
push hl
push af
xor a
ld hl, FRAME_COUNTER
or [hl]
jr z, .skip
dec [hl]
.skip:
pop af
pop hl
reti
; HBLANK interrupt handler
; Params:
; None
; Return:
; None
; Registers:
; af -> Preserved
; bc -> Preserved
; de -> Preserved
; hl -> Preserved
hblank_interrupt::
reti
; Timer interrupt handler
; Params:
; None
; Return:
; None
; Registers:
; af -> Preserved
; bc -> Preserved
; de -> Preserved
; hl -> Preserved
timer_interrupt::
reti
; Serial interrupt handler
; Params:
; None
; Return:
; None
; Registers:
; af -> Preserved
; bc -> Preserved
; de -> Preserved
; hl -> Preserved
serial_interrupt::
push af
reg INTERUPT_OCCURED, $05
pop af
reti
; Joypad interrupt handler
; Params:
; None
; Return:
; None
; Registers:
; af -> Preserved
; bc -> Preserved
; de -> Preserved
; hl -> Preserved
joypad_interrupt::
reti
| 14.012821 | 26 | 0.611162 |
bf96aaa00b9eb12f8177d01b5bb7969034720d0e | 177 | asm | Assembly | test_1defprom.asm | acastrauss/compiler_project | 540e96493350d5cb34a7259a74bb1ecb1f3a3a2b | [
"MIT"
] | null | null | null | test_1defprom.asm | acastrauss/compiler_project | 540e96493350d5cb34a7259a74bb1ecb1f3a3a2b | [
"MIT"
] | null | null | null | test_1defprom.asm | acastrauss/compiler_project | 540e96493350d5cb34a7259a74bb1ecb1f3a3a2b | [
"MIT"
] | null | null | null |
main:
PUSH %14
MOV %15,%14
SUBS %15,$8,%15
MOV $5,-4(%14)
MOV $5,-8(%14)
@main_body:
MOV -4(%14),%13
JMP @main_exit
@main_exit:
MOV %14,%15
POP %14
RET | 12.642857 | 18 | 0.525424 |
c19749a9f5b050a368dfd316711df60bdcd307c0 | 14,032 | asm | Assembly | snake.asm | Badrivishal/Snake-Game-8086 | 97779e4be1308ba94c5b2958bf3e49d961083ba5 | [
"MIT"
] | null | null | null | snake.asm | Badrivishal/Snake-Game-8086 | 97779e4be1308ba94c5b2958bf3e49d961083ba5 | [
"MIT"
] | null | null | null | snake.asm | Badrivishal/Snake-Game-8086 | 97779e4be1308ba94c5b2958bf3e49d961083ba5 | [
"MIT"
] | null | null | null | assume cs:code ds:data
data segment
foodx db 1 ; x-coord of food
foody db 15 ; y-coord of food
snakex db 25 dup(?) ; array of x coords of snake
snakey db 25 dup(?) ; array of y coords of snake
tailx db ? ; x-coord of tail of snake
taily db ? ; y-coord of tail of snake
taildel db 0 ; flag that checks if the tail is to be deleted or not ()
len dw 2 ; len of snake
score_msg db 'Score: 00$' ; Score message
gover_msg db 'Game Over$' ; Game Over message
new_msg db 'Do you want to play once again(Y/N)$' ; Play again message
dirc db 1 ; Direction of motion of head
data ends
code segment
start:
MOV AX,data
MOV ds, AX
GOTOXY MACRO col, row
PUSH AX
PUSH BX
PUSH DX
MOV AH, 02h
MOV DH, row
MOV DL, col
MOV BH, 0
INT 10h
POP DX
POP BX
POP AX
ENDM
MOV len, 2 ; Initialize length of snake to 2
; Creating the default snake with the snake positions
MOV SI, offset snakex ; snake inital positions (15, 15) (15, 16)
MOV AL, 15
MOV [SI], AL
INC SI
MOV [SI], AL
MOV SI, offset snakey
MOV [SI], AL
INC SI
INC AL
MOV [SI], AL
MOV AH, 00H ; initializes the display to video mode
MOV AL, 03H ; with ascii/text 80x25
INT 10H
; Initialising the Game Environment
call make_border ; Draws the Border of the game
call print_score ; Prints the score at the top right corner
call print_food ; Prints Food
call update_snake ; Updates the snake array and calls print snake on the upadated array
; Life Cycle of the Game
here:
call check_direc ; checks the keystroke for a direction update
call update_snake ; updates snake
call print_food ; prints food randomly
; Creating an approximate delay of 0.2 secs
; MOV DX, 12 ; change the speed of snake
MOV AX, len
MOV DL, 2 ; change with respect to score
DIV DL
MOV AH, 0
NEG AX
ADD AX, 12
MOV DX, AX
delay:
MOV CX, 0FFFFH ; delay to slow the motion of snake
del: loop del
DEC DX
jnz delay
jmp here
check_self proc ; iterates through the length of the snake array and checks whether
MOV AL, snakex ; the snake is biting itself
MOV AH, snakey ; AL, AH gets the head values
MOV SI, offset snakex ; SI, DI are iterater for the array
MOV DI, offset snakey
INC SI
INC DI
MOV CX, len
DEC CX
chk_x:
cmp AL, [SI] ; checks the x coord
jz chk_y ; checks the y coord if x is matched
jmp cont ; continues if not same
chk_y:
cmp AH, [DI]
jz bridge ; bridges the gap between this statement and game over (long jump)
jmp cont
cont:
INC SI
INC DI
loop chk_x
ret
check_self endp
print_score proc ; Prints scoreboard on the top right corner(70, 0)
MOV AX, len
DEC AX
DEC AX ; the score is same as length - 2
MOV BL, 10 ; the two digits are separated
DIV BL
add al, 30h ; They are replaced in the score_msg 00 locations
MOV SI, offset score_msg
ADD SI, 7
MOV [SI], AL
add ah, 30h
MOV SI, offset score_msg
ADD SI, 8
MOV [SI], AH
GOTOXY 70, 0
mov dx,offset score_msg
mov ah,9
int 21h
print_score endp
check_border proc ; Checks whether the snake touches the border
MOV AL, snakex
CMP AL, 0
jz bridge
CMP AL, 79
jz bridge
MOV AL, snakey
CMP AL, 1
jz bridge
CMP AL, 24
jz bridge
RET
check_border endp
bridge: ; bridges the gap for a long jump
jmp G_over
make_border proc ; draws the border
MOV SI, 00H
MOV DI, 00H
MOV DL, 79
top_border: ; draws the top border
GOTOXY DL, 1
MOV AH, 09H
MOV AL, 220
MOV BH, 00H
MOV BL, 0FH
MOV CX, 01H
INT 10H
DEC DL
jnz top_border
MOV DL, 79
bot_border: ; draws the bottom border
GOTOXY DL, 24
MOV AH, 09H
MOV AL, 220
MOV BH, 00H
MOV BL, 0FH
MOV CX, 01H
INT 10H
DEC DL
jnz bot_border
MOV DL, 24
lef_border: ; draws the left border
GOTOXY 0, DL
MOV AH, 09H
MOV AL, 222
MOV BH, 00H
MOV BL, 0FH
MOV CX, 01H
INT 10H
DEC DL
jnz lef_border
MOV DL, 24
rgt_border: ; draws the right border
GOTOXY 79, DL
MOV AH, 09H
MOV AL, 221
MOV BH, 00H
MOV BL, 0FH
MOV CX, 01H
INT 10H
DEC DL
jnz rgt_border
RET
make_border endp
check_direc proc ; direction change using asdw keys
MOV AH, 6 ; checks the buffer for keystroke
MOV DL, 255
INT 21H
cmp AL, 61H ; compares to a for left
jz direc_l
cmp AL, 73H ; compares to s for down
jz direc_d
cmp AL, 64H ; compares to d for right
jz direc_r
cmp AL, 77H ; compares to w for up
jz direc_u
jmp retrn
direc_l:
cmp dirc, 2 ; checks if the entered direction is opposite, like you cant go right while going left
jz retrn
MOV dirc, 4 ; else updates the direction to left
jmp retrn
direc_d:
cmp dirc, 1
jz retrn
MOV dirc, 3 ; else updates the direction to down
jmp retrn
direc_r:
cmp dirc, 4
jz retrn
MOV dirc, 2 ; else updates the direction to right
jmp retrn
direc_u:
cmp dirc, 3
jz retrn
MOV dirc, 1 ; else updates the direction to up
jmp retrn
retrn:
RET
check_direc endp
update_snake proc ; updates the snake array of x coords and y coords according to the direction
MOV SI, offset snakex
ADD SI, len
DEC SI
MOV AL, [SI]
MOV tailx, AL ; Updates the tailx
MOV SI, offset snakey
ADD SI, len
DEC SI
MOV AL, [SI]
MOV taily, AL ; Updates the taily
MOV DX, len
DEC DX
l2: ; loops from last element to first updating each one to the previous element
MOV SI, offset snakex
ADD SI, DX
DEC SI
MOV AL, [SI]
INC SI
MOV [SI], AL
MOV SI, offset snakey
ADD SI, DX
DEC SI
MOV AL, [SI]
INC SI
MOV [SI], AL
DEC DX
jnz l2
CMP dirc, 4 ; checks the direction of motion to update the head
JZ left
CMP dirc, 3
JZ down
CMP dirc, 2
JZ right
CMP dirc, 1
JZ up
; direction in which the head will shift to
left: ; left
MOV AL, snakex
DEC AL
MOV snakex, AL
JMP upd
down: ; down
MOV AL, snakey
INC AL
MOV snakey, AL
JMP upd
right: ; right
MOV AL, snakex
INC AL
MOV snakex, AL
JMP upd
up: ;up
MOV AL, snakey
DEC AL
MOV snakey, AL
JMP upd
upd: ; update the snake and check if it is eating the food or bititng itself
call check_border ; or biting the border.
call check_self
MOV AL, foodx ; Checks if it is eating the food
cmp AL, snakex
jz chky
jmp prt
chky:
MOV AL, foody
cmp AL, snakey
jz inclen
jmp prt
inclen: ; increase length and update parameters if it is eating the food
MOV AX, len
INC AX
MOV len, AX
MOV AL, tailx
MOV BX, len
DEC BX
MOV SI, offset snakex ; tail updated
ADD SI, BX
MOV [SI], AL
MOV AL, taily
MOV SI, offset snakey
ADD SI, BX
MOV [SI], AL
MOV taildel, 1 ; taildel parameter set to 1 such that tail is not deleted in this case
; Randomizing the food generation with a probability of 0.00058 so that the gamers dont get lucky
MOV AH, 00h ; Create a Random number using the system time.
INT 1AH ; CX:DX will contain the number of clock ticks since midnight.
; 1258 4751, 1258 4752, 1258 4753
xor cx, dx ; CX xor DX will result in a random number
and cx, 00111111b ; reduced the size of the number for division
mov ax, cx
MOV BL, 4EH ; number divided with 78 so as the mod will have number between 0 to 77 (x coord)
div BL
INC AH ; removing border to get number between 1 and 78
mov foodx, AH
MOV AH, 00h
INT 1AH
xor cx, dx
and cx, 00111111b
mov ax, cx
MOV BL, 016H ; number divided with 22 so as the mod will have number between 0 to 21 (y coord)
div BL
INC AH
INC AH ; removing border to get number between 2 to 23
mov foody, AH
prt: ; calls the print snake function
call print_snake
RET
update_snake endp
print_food proc ; prints the food according to foodx and foody
LEA SI, foodx
LEA DI, foody
GOTOXY [SI], [DI] ; REcheck
GOTOXY foodx, foody
MOV AH, 09H
MOV AL, 220
MOV BH, 00H
MOV BL, 0CH
MOV CX, 01H
INT 10H
RET
print_food endp
print_snake proc ; prints the snake according to the x and y coords in the snake array
MOV DX, len
LEA SI, snakex
LEA DI, snakey
l1: ; loops through the array and prints at the coords
GOTOXY [SI], [DI]
MOV AH, 09H
MOV AL, 002
MOV BH, 00H
MOV BL, 0AH
MOV CX, 01H
INT 10H
INC SI
INC DI
DEC DX
jnz l1
cmp taildel, 1 ; removes tail if taildel == 0
jz tailkeep ; else keeps the tail
GOTOXY tailx, taily ; remove tail
MOV AH, 09H
MOV AL, 0FFH
MOV BH, 00H
MOV BL, 0AH
MOV CX, 01H
INT 10H
jmp retval
tailkeep:
mov taildel, 0
call print_score ; once tail is removed new score is printed and new food is printed
call print_food
retval:
RET
print_snake endp
restart:
jmp start ; long jump helper for restart
G_over: ; Game over screen
MOV AH, 00H ; Resets the screen for Game over output
MOV AL, 03H
INT 10H
GOTOXY 34, 10 ; prints Game over
mov dx, offset gover_msg
mov ah, 9
int 21h
GOTOXY 34, 11 ; prints Score
mov dx, offset score_msg
mov ah, 9
int 21h
GOTOXY 20, 12 ; prints do you want to play again message
mov dx, offset new_msg
mov ah, 9
int 21H
char_chk:
mov ah, 7 ; takes input single char
int 21H
cmp al, 89 ; compares input with 'Y'
jz restart
jmp char_chk
code ends
end start | 28.754098 | 122 | 0.441776 |
202e0457feb9d78bfdc41d1d1a32973daddf720d | 1,205 | asm | Assembly | _build/dispatcher/jmp_ippsSMS4EncryptCBC_CS1_43f6d1d6.asm | zyktrcn/ippcp | b0bbe9bbb750a7cf4af5914dd8e6776a8d544466 | [
"Apache-2.0"
] | 1 | 2021-10-04T10:21:54.000Z | 2021-10-04T10:21:54.000Z | _build/dispatcher/jmp_ippsSMS4EncryptCBC_CS1_43f6d1d6.asm | zyktrcn/ippcp | b0bbe9bbb750a7cf4af5914dd8e6776a8d544466 | [
"Apache-2.0"
] | null | null | null | _build/dispatcher/jmp_ippsSMS4EncryptCBC_CS1_43f6d1d6.asm | zyktrcn/ippcp | b0bbe9bbb750a7cf4af5914dd8e6776a8d544466 | [
"Apache-2.0"
] | null | null | null | extern m7_ippsSMS4EncryptCBC_CS1:function
extern n8_ippsSMS4EncryptCBC_CS1:function
extern y8_ippsSMS4EncryptCBC_CS1:function
extern e9_ippsSMS4EncryptCBC_CS1:function
extern l9_ippsSMS4EncryptCBC_CS1:function
extern n0_ippsSMS4EncryptCBC_CS1:function
extern k0_ippsSMS4EncryptCBC_CS1:function
extern ippcpJumpIndexForMergedLibs
extern ippcpSafeInit:function
segment .data
align 8
dq .Lin_ippsSMS4EncryptCBC_CS1
.Larraddr_ippsSMS4EncryptCBC_CS1:
dq m7_ippsSMS4EncryptCBC_CS1
dq n8_ippsSMS4EncryptCBC_CS1
dq y8_ippsSMS4EncryptCBC_CS1
dq e9_ippsSMS4EncryptCBC_CS1
dq l9_ippsSMS4EncryptCBC_CS1
dq n0_ippsSMS4EncryptCBC_CS1
dq k0_ippsSMS4EncryptCBC_CS1
segment .text
global ippsSMS4EncryptCBC_CS1:function (ippsSMS4EncryptCBC_CS1.LEndippsSMS4EncryptCBC_CS1 - ippsSMS4EncryptCBC_CS1)
.Lin_ippsSMS4EncryptCBC_CS1:
db 0xf3, 0x0f, 0x1e, 0xfa
call ippcpSafeInit wrt ..plt
align 16
ippsSMS4EncryptCBC_CS1:
db 0xf3, 0x0f, 0x1e, 0xfa
mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc]
movsxd rax, dword [rax]
lea r11, [rel .Larraddr_ippsSMS4EncryptCBC_CS1]
mov r11, qword [r11+rax*8]
jmp r11
.LEndippsSMS4EncryptCBC_CS1:
| 30.897436 | 115 | 0.817427 |
5ae797141606c0da4eadfffe9d362cf38af48577 | 400 | asm | Assembly | libsrc/math/z88math/atof.asm | Toysoft/z88dk | f930bef9ac4feeec91a07303b79ddd9071131a24 | [
"ClArtistic"
] | 8 | 2017-01-18T12:02:17.000Z | 2021-06-12T09:40:28.000Z | libsrc/math/z88math/atof.asm | Toysoft/z88dk | f930bef9ac4feeec91a07303b79ddd9071131a24 | [
"ClArtistic"
] | 1 | 2017-03-06T07:41:56.000Z | 2017-03-06T07:41:56.000Z | libsrc/math/z88math/atof.asm | Toysoft/z88dk | f930bef9ac4feeec91a07303b79ddd9071131a24 | [
"ClArtistic"
] | 3 | 2017-03-07T03:19:40.000Z | 2021-09-15T17:59:19.000Z | ;
;
; Z88 Maths Routines
;
; C Interface for Small C+ Compiler
;
; 30/1/20001 djm
;double atof(char *) - convert string to number, leave in fa
SECTION code_fp
INCLUDE "fpp.def"
PUBLIC atof
EXTERN stkequ2
.atof
pop de
pop hl ;the string
push hl
push de
fpp(FP_VAL)
jp stkequ2
| 13.793103 | 64 | 0.5025 |
9fbe3fa7577689c5c8806e1d53b4b9a89371db34 | 319 | asm | Assembly | programs/oeis/177/A177154.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/177/A177154.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/177/A177154.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A177154: Fractional part of the conversion from degrees Centigrade (or Celsius) to Fahrenheit.
; 0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2,0,8,6,4,2
mul $0,8
mod $0,10
| 53.166667 | 201 | 0.592476 |
03f591b221d7ec48c28e54ae47baeb6fe0889ee6 | 93 | asm | Assembly | exercises/x86-64-assembly-1-a/x86_64_assembly_1_a.asm | ErikSchierboom/research_experiment_1 | 3e74c9d328ac0483ad01cd5be2cb209e907f281b | [
"MIT"
] | null | null | null | exercises/x86-64-assembly-1-a/x86_64_assembly_1_a.asm | ErikSchierboom/research_experiment_1 | 3e74c9d328ac0483ad01cd5be2cb209e907f281b | [
"MIT"
] | null | null | null | exercises/x86-64-assembly-1-a/x86_64_assembly_1_a.asm | ErikSchierboom/research_experiment_1 | 3e74c9d328ac0483ad01cd5be2cb209e907f281b | [
"MIT"
] | null | null | null | section .text
global str_isalpha
str_isalpha:
; Provide your implementation here
ret
| 15.5 | 38 | 0.763441 |
2f977a91f18932bb731d03e658b9c68c0e7060a6 | 2,668 | asm | Assembly | source/rom10/r10_maps_ul.asm | evanbowman/Red | 85735269a46757305a81ad39f47034bc6cd97846 | [
"BSD-2-Clause"
] | 5 | 2021-08-30T16:18:55.000Z | 2021-10-30T20:23:32.000Z | source/rom10/r10_maps_ul.asm | evanbowman/gbc-project | 85735269a46757305a81ad39f47034bc6cd97846 | [
"BSD-2-Clause"
] | null | null | null | source/rom10/r10_maps_ul.asm | evanbowman/gbc-project | 85735269a46757305a81ad39f47034bc6cd97846 | [
"BSD-2-Clause"
] | null | null | null | ;; generated by encode_room_layouts.py
r10_room_data_ul::
;;0.json
DB $0e, $0e, $0e, $0e, $0e, $08, $39, $39, $39, $39, $02, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0a, $0a, $08, $39, $39, $39, $39, $39, $39, $06, $0e, $0e, $0e, $0e, $0e, $0c, $39, $11, $11, $11, $11, $11, $3a, $3a, $11, $11, $11, $11, $11, $11, $0e, $0c, $11, $12, $12, $12, $12, $12, $3a, $3a, $12, $12, $12, $12, $12, $12, $0e, $0c, $12, $13, $3b, $3b, $38, $3b, $39, $39, $3b, $3b, $3b, $05, $0d, $0d, $0a, $08, $13, $13, $39, $39, $39, $39, $39, $39, $39, $39, $39, $02, $0e, $0e, $39, $39, $3a, $3a, $39, $39, $39, $39, $39, $38, $39, $39, $39, $39, $06, $0e, $39, $39, $3a, $3a, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $06, $0e, $39, $39, $14, $14, $39, $39, $39, $39, $39, $39, $39, $39, $39, $39, $06, $0e, $39, $39, $13, $13, $39, $39, $38, $39, $39, $39, $39, $39, $39, $39, $06, $0e, $0d, $0b, $13, $13, $03, $39, $39, $39, $39, $39, $39, $39, $05, $0d, $0e, $0e, $0e, $0c, $13, $13, $04, $39, $39, $39, $39, $39, $39, $39, $06, $0e, $0e, $0e, $0e, $0c, $13, $13, $06, $0b, $05, $0d, $0d, $0d, $0d, $0d, $0e, $0e, $0e, $0e, $0e, $0c, $13, $13, $06, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0c, $13, $13, $06, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0c, $13, $13, $06, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e, $0e,
;;1.json
DB $11, $02, $0e, $0e, $0e, $08, $39, $39, $39, $39, $02, $0e, $0e, $0e, $0e, $0e, $12, $11, $02, $0a, $08, $39, $39, $39, $39, $39, $39, $02, $0a, $0a, $0a, $0a, $13, $13, $11, $11, $11, $11, $3a, $3a, $3a, $3a, $3a, $11, $11, $11, $11, $11, $13, $13, $12, $12, $12, $12, $3a, $3a, $3a, $3a, $3a, $12, $12, $12, $12, $12, $13, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $3a, $13, $13, $13, $13, $13, $14, $14, $14, $14, $14, $14, $14, $14, $14, $14, $14, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13, $13,
r10_room_data_ul_end::
| 296.444444 | 1,283 | 0.414543 |
3b7634a2cb9f59604761a94804ee6474afdda5cc | 461 | asm | Assembly | programs/oeis/057/A057054.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/057/A057054.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/057/A057054.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A057054: Let R(i,j) be the rectangle with antidiagonals 1; 2,3; 4,5,6; ...; n^3 is in antidiagonal a(n).
; 1,4,7,11,16,21,26,32,38,45,52,59,66,74,82,91,99,108,117,126,136,146,156,166,177,187,198,210,221,232,244,256,268,280,293,305,318,331,344,358,371,385,399,413,427,441,456,470,485,500
mov $3,$0
add $0,7
mov $1,$3
mov $2,$0
lpb $2
add $1,1
lpb $1
mov $2,1
mov $4,$1
sub $1,$1
lpe
pow $4,3
lpb $4
add $1,$2
trn $4,$1
lpe
lpe
| 21.952381 | 181 | 0.598698 |
af671ef9491980a38e8e42cbd25ac25bd1f6e123 | 1,173 | asm | Assembly | programs/oeis/077/A077953.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/077/A077953.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/077/A077953.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A077953: Expansion of 1/(1-x+2*x^2-2*x^3).
; 1,1,-1,-1,3,3,-5,-5,11,11,-21,-21,43,43,-85,-85,171,171,-341,-341,683,683,-1365,-1365,2731,2731,-5461,-5461,10923,10923,-21845,-21845,43691,43691,-87381,-87381,174763,174763,-349525,-349525,699051,699051,-1398101,-1398101,2796203,2796203,-5592405,-5592405,11184811,11184811,-22369621,-22369621,44739243,44739243,-89478485,-89478485,178956971,178956971,-357913941,-357913941,715827883,715827883,-1431655765,-1431655765,2863311531,2863311531,-5726623061,-5726623061,11453246123,11453246123,-22906492245,-22906492245,45812984491,45812984491,-91625968981,-91625968981,183251937963,183251937963,-366503875925,-366503875925,733007751851,733007751851,-1466015503701,-1466015503701,2932031007403,2932031007403,-5864062014805,-5864062014805,11728124029611,11728124029611,-23456248059221,-23456248059221,46912496118443,46912496118443,-93824992236885,-93824992236885,187649984473771,187649984473771,-375299968947541,-375299968947541,750599937895083,750599937895083,-1501199875790165,-1501199875790165,3002399751580331,3002399751580331,-6004799503160661,-6004799503160661
div $0,2
mov $1,-2
pow $1,$0
sub $1,1
div $1,3
mul $1,2
add $1,1
| 106.636364 | 1,061 | 0.818414 |
dabee9d9118bc4385bac25e532489c99d486196a | 68 | asm | Assembly | test.asm | tsoding/disasm.js | 4d20abf0479ec3b093c2fbc87fab9819bb376e4d | [
"MIT"
] | 7 | 2019-12-23T18:23:36.000Z | 2021-07-08T08:12:08.000Z | test.asm | tsoding/disasm.js | 4d20abf0479ec3b093c2fbc87fab9819bb376e4d | [
"MIT"
] | null | null | null | test.asm | tsoding/disasm.js | 4d20abf0479ec3b093c2fbc87fab9819bb376e4d | [
"MIT"
] | null | null | null | BITS 64
mov rax, 0
mov rbx, 1
mov rcx, 2
mov rdx, 3
| 11.333333 | 14 | 0.5 |
ff6d9c6b69f5ee1dd5b4c046fd2536672a603ca0 | 628 | asm | Assembly | SumoBot_Code_Dev/SumoRing/asm/src/utilities.asm | CmdrZin/chips_avr_examples | d4b57a8efd6aff2a678adef4fd405e6359e891e6 | [
"MIT"
] | 5 | 2017-04-17T15:11:40.000Z | 2021-12-13T23:52:09.000Z | SumoBot_Code_Dev/SumoRing/asm/src/utilities.asm | CmdrZin/chips_avr_examples | d4b57a8efd6aff2a678adef4fd405e6359e891e6 | [
"MIT"
] | null | null | null | SumoBot_Code_Dev/SumoRing/asm/src/utilities.asm | CmdrZin/chips_avr_examples | d4b57a8efd6aff2a678adef4fd405e6359e891e6 | [
"MIT"
] | null | null | null | /*
* Utilities for I2C Master Module
*
* org: 6/22/2014
* auth: Nels "Chip" Pearson
*
* Usage:
* .include utilities.asm
*
*/
/*
* Generate CKSUM
*
* CKSUM = (CKSUM ^ Data) ROL 1
*
* input: X(r27:26) reg -> Data buffer
* R18: Number of bytes
*
* output: R17: CKSUM
*
* Registers: All saved and restored
*
*/
util_gen_cksum:
push R16
push R17
push R18
push XL
push XH
;
clr R17
ugc_loop00:
ld R16, X+
eor R17, R16
lsl R17
brcc ugc_skip00
ori R17, 0x01 ; bring in CY bit
;
ugc_skip00:
dec R18
brne ugc_loop00 ; done?
; yes
pop XH
pop XL
pop R18
pop R17
pop R16
;
ret
| 12.076923 | 38 | 0.606688 |
c9d9dff12f1750efbbd0cdae5e84f5f1001ed7b0 | 356 | asm | Assembly | programs/oeis/092/A092810.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/092/A092810.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/092/A092810.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A092810: Binomial transform of a Jacobsthal trisection.
; 1,6,54,486,4374,39366,354294,3188646,28697814,258280326,2324522934,20920706406,188286357654,1694577218886,15251194969974,137260754729766,1235346792567894,11118121133111046,100063090197999414,900567811781994726,8105110306037952534
mov $1,9
pow $1,$0
sub $1,1
mul $1,6
div $1,9
add $1,1
mov $0,$1
| 32.363636 | 231 | 0.817416 |
33b83252205510130a8bfc913a8c62cf6bed697d | 3,065 | asm | Assembly | Transynther/x86/_processed/US/_ht_/i3-7100_9_0x84_notsx.log_63_2655.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/US/_ht_/i3-7100_9_0x84_notsx.log_63_2655.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/US/_ht_/i3-7100_9_0x84_notsx.log_63_2655.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1a3ad, %r14
nop
nop
nop
nop
lfence
mov $0x6162636465666768, %r11
movq %r11, %xmm6
movups %xmm6, (%r14)
nop
nop
nop
nop
nop
inc %rcx
lea addresses_A_ht+0x1ac1f, %rsi
lea addresses_D_ht+0x11eed, %rdi
and $1603, %rbp
mov $83, %rcx
rep movsq
nop
nop
xor %r14, %r14
lea addresses_UC_ht+0x35ad, %rcx
nop
nop
nop
nop
sub %rbp, %rbp
movb $0x61, (%rcx)
nop
nop
nop
nop
xor $46691, %rcx
lea addresses_WT_ht+0x116ad, %rcx
nop
nop
nop
nop
sub $52050, %rsi
and $0xffffffffffffffc0, %rcx
vmovaps (%rcx), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %r11
nop
nop
nop
and %rcx, %rcx
lea addresses_normal_ht+0xccad, %r14
nop
nop
nop
nop
cmp %rdi, %rdi
mov $0x6162636465666768, %rcx
movq %rcx, %xmm5
movups %xmm5, (%r14)
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_A_ht+0x114ad, %r14
clflush (%r14)
nop
add $27487, %r8
movw $0x6162, (%r14)
nop
nop
xor %rbp, %rbp
lea addresses_WT_ht+0x1eabd, %rsi
lea addresses_WC_ht+0x1c78d, %rdi
nop
nop
nop
nop
nop
add $9969, %r12
mov $17, %rcx
rep movsq
nop
nop
xor $20624, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r8
push %rax
push %rbx
push %rsi
// Faulty Load
lea addresses_US+0x88ad, %r13
nop
nop
nop
nop
nop
add %rbx, %rbx
vmovups (%r13), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %r14
lea oracles, %rbx
and $0xff, %r14
shlq $12, %r14
mov (%rbx,%r14,1), %r14
pop %rsi
pop %rbx
pop %rax
pop %r8
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 16, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 2, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'49': 34, '45': 29}
49 45 45 49 45 45 49 49 45 45 49 45 49 49 49 45 49 49 49 45 45 49 49 49 45 49 45 49 49 45 45 45 49 45 45 45 45 45 49 49 49 49 49 49 45 45 49 45 45 49 49 49 49 45 45 45 45 49 49 49 49 49 45
*/
| 19.902597 | 188 | 0.657423 |
cc9bad02068f15215a0ffaa0e0b62799742ae7dd | 900 | asm | Assembly | smsq/qpc/ip/io.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | smsq/qpc/ip/io.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | smsq/qpc/ip/io.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ; IP IO routines V1.00 2004 Marcel Kilgus
section ip
xdef ip_io
xref io_ckchn
include 'dev8_keys_err'
include 'dev8_keys_socket'
include 'dev8_smsq_qpc_keys'
include 'dev8_smsq_qpc_ip_data'
ip_io
move.l a0,-(sp)
; cmp.l #ip.accept,d0
; beq.s ip_chan1
; cmp.l #ip.dup,d0
; bne.s ip_doio
;ip_chan1
; movem.l d0/d7/a0-a1/a3,-(sp)
; moveq #0,d0
; move.l a1,a0 ; check channel it
; jsr io_ckchn
; tst.l d0
; bmi.s ip_ipar
; cmp.l #chn.id,chn_id(a0) ; really IP channel?
; bne.s ip_ipar ; ... no
; move.l chn_data(a0),a1 ; data address for that channel
; move.l chn_data(a0),a0 ; Internal data
; dc.w qpc.ipio
; movem.l (sp)+,d0/d7/a0-a1/a3
; bra.s ip_exit
ip_doio
move.l chn_data(a0),a0 ; Internal data
dc.w qpc.ipio
ip_exit
movem.l (sp)+,a0
rts
;ip_ipar
; movem.l (sp)+,d0/d7/a0-a1/a3
; moveq #err.ipar,d0
; bra.s ip_exit
end
| 18.75 | 59 | 0.643333 |
a586b54d8bbe0d8b484bb217b7533abc4b44dce0 | 457 | asm | Assembly | oeis/055/A055205.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/055/A055205.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/055/A055205.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A055205: Number of nonsquare divisors of n^2.
; Submitted by Christian Krause
; 0,1,1,2,1,5,1,3,2,5,1,9,1,5,5,4,1,9,1,9,5,5,1,13,2,5,3,9,1,19,1,5,5,5,5,16,1,5,5,13,1,19,1,9,9,5,1,17,2,9,5,9,1,13,5,13,5,5,1,33,1,5,9,6,5,19,1,9,5,19,1,23,1,5,9,9,5,19,1,17,4,5,1,33,5,5,5,13,1,33,5,9,5,5,5,21,1,9,9,16
add $0,1
pow $0,2
mov $2,$0
lpb $0
mov $4,$0
max $0,2
mov $3,$2
dif $3,$0
dif $3,$0
sub $0,1
mul $3,$4
cmp $3,$2
add $1,$3
lpe
mov $0,$1
| 22.85 | 220 | 0.553611 |
ab16f5be64ace651b0113ab02f2a51c71b53d136 | 419 | asm | Assembly | programs/oeis/032/A032509.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/032/A032509.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/032/A032509.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A032509: a(n) = round(tan(Pi*(1-1/n)/2)).
; 0,1,2,2,3,4,4,5,6,6,7,8,8,9,10,10,11,11,12,13,13,14,15,15,16,17,17,18,18,19,20,20,21,22,22,23,24,24,25,25,26,27,27,28,29,29,30,31,31,32,32,33,34,34,35,36,36,37,38,38,39,39,40,41,41,42,43,43,44
add $0,3
mov $3,2
lpb $0
mov $1,11
add $3,$0
mov $0,0
mov $5,8
mul $5,$3
trn $3,10
add $4,$5
add $2,$4
sub $2,$3
div $2,11
add $1,$2
lpe
sub $1,14
mov $0,$1
| 19.952381 | 194 | 0.556086 |
71654f361e29c1a53494f2bce9f7f6f0224e40c3 | 1,115 | asm | Assembly | programs/oeis/047/A047286.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/047/A047286.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/047/A047286.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A047286: Numbers that are congruent to {1, 2, 3, 6} mod 7.
; 1,2,3,6,8,9,10,13,15,16,17,20,22,23,24,27,29,30,31,34,36,37,38,41,43,44,45,48,50,51,52,55,57,58,59,62,64,65,66,69,71,72,73,76,78,79,80,83,85,86,87,90,92,93,94,97,99,100,101,104,106,107,108,111,113,114,115,118,120,121,122,125,127,128,129,132,134,135,136,139,141,142,143,146,148,149,150,153,155,156,157,160,162,163,164,167,169,170,171,174,176,177,178,181,183,184,185,188,190,191,192,195,197,198,199,202,204,205,206,209,211,212,213,216,218,219,220,223,225,226,227,230,232,233,234,237,239,240,241,244,246,247,248,251,253,254,255,258,260,261,262,265,267,268,269,272,274,275,276,279,281,282,283,286,288,289,290,293,295,296,297,300,302,303,304,307,309,310,311,314,316,317,318,321,323,324,325,328,330,331,332,335,337,338,339,342,344,345,346,349,351,352,353,356,358,359,360,363,365,366,367,370,372,373,374,377,379,380,381,384,386,387,388,391,393,394,395,398,400,401,402,405,407,408,409,412,414,415,416,419,421,422,423,426,428,429,430,433,435,436
add $0,4
mov $1,$0
div $1,4
mov $2,$0
lpb $2
mov $3,$0
add $3,2
mov $0,$3
sub $2,4
lpe
add $1,$0
sub $1,6
| 69.6875 | 938 | 0.703139 |
1489aecc6355714b1cbe9562b627efed48e0d165 | 3,411 | asm | Assembly | libsrc/target/sms/load_tiles.asm | dikdom/z88dk | 40c55771062b0ea9bb2f0d5b73e2f754fc12b6b0 | [
"ClArtistic"
] | 1 | 2022-03-08T11:55:58.000Z | 2022-03-08T11:55:58.000Z | libsrc/target/sms/load_tiles.asm | dikdom/z88dk | 40c55771062b0ea9bb2f0d5b73e2f754fc12b6b0 | [
"ClArtistic"
] | 2 | 2022-03-20T22:17:35.000Z | 2022-03-24T16:10:00.000Z | libsrc/target/sms/load_tiles.asm | jorgegv/z88dk | 127130cf11f9ff268ba53e308138b12d2b9be90a | [
"ClArtistic"
] | null | null | null | SECTION code_clib
PUBLIC load_tiles
PUBLIC _load_tiles
PUBLIC asm_load_tiles
EXTERN l_tms9918_disable_interrupts
EXTERN l_tms9918_enable_interrupts_jp
include "sms.hdr"
;==============================================================
; load_tiles(unsigned char *data, int index, int count, int bpp)
;==============================================================
; Loads the specified tileset into VRAM
;==============================================================
load_tiles:
_load_tiles:
push ix ; save callers ix
ld hl, 4
add hl, sp
ld a, (hl) ; bits per pixel
inc hl
inc hl
ld c, (hl) ; number of tiles to load
inc hl
ld b, (hl)
inc hl
ld e, (hl) ; initial tile index
inc hl
ld d, (hl)
inc hl
push de
ld e, (hl) ; location of tile data
inc hl
ld d, (hl)
inc hl
push de
pop ix ; tile data
pop hl ; initial index
ld d, a ; bpp
call asm_load_tiles
pop ix
ret
;==============================================================
; Tile loader
;==============================================================
; Parameters:
; hl = tile number to start at
; ix = location of tile data
; bc = No. of tiles to load
; d = bits per pixel
;==============================================================
asm_load_tiles:
call l_tms9918_disable_interrupts
push af
push bc
push de
push hl
push ix
; Tell VDP where I want to write (hl<<5)
sla l
rl h
sla l
rl h
sla l
rl h
sla l
rl h
sla l
rl h
; Set the VRAM access address
ld a, l
out (__IO_VDP_COMMAND), a
ld a, h
or VDP_SET_VRAM
out (__IO_VDP_COMMAND), a
; I need to output bc*8 bytes so I need to modify bc (<<3)
sla c
rl b
sla c
rl b
sla c
rl b
; Write data
_Loop:
; Restore counter
ld e, d
_DataLoop:
; Write byte
ld a, (ix+0) ;19
out (__IO_VDP_DATA), a
dec e ;4
inc ix ;10
jp nz, _DataLoop ;10
; Restore counter
ld e, d
_BlankLoop:
; Write blank data to fill up the rest of the tile definition
inc e
ld a, e
cp 5
jp z, _NoMoreBlanks
ld a, 0
out (__IO_VDP_DATA), a
jp _BlankLoop
_NoMoreBlanks:
dec bc
ld a, b
or c
jp nz, _Loop
pop ix
pop hl
pop de
pop bc
pop af
; exit through l_tms9918_enable_interrupts_jp
jp l_tms9918_enable_interrupts_jp
| 25.840909 | 77 | 0.364409 |
1f6447b6f2d4f51d09510f2d8562c7bc3287acca | 756 | asm | Assembly | projectfiles/04/mult/Mult.asm | Gunasekare/nand2tetris | 7faf838c1a895c518805be8a26171ef217a99fcb | [
"MIT"
] | null | null | null | projectfiles/04/mult/Mult.asm | Gunasekare/nand2tetris | 7faf838c1a895c518805be8a26171ef217a99fcb | [
"MIT"
] | null | null | null | projectfiles/04/mult/Mult.asm | Gunasekare/nand2tetris | 7faf838c1a895c518805be8a26171ef217a99fcb | [
"MIT"
] | null | null | null | // This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/04/Mult.asm
// Multiplies R0 and R1 and stores the result in R2.
// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)
// Assumes that R0 >= 0, R1 >= 0, and R0 * R1 < 32768 (as per the project website)
// VAL0 = R0
// VAL1 = R1
// SUM = 0
@R0
D = M
@value0
M = D
@R1
D = M
@value1
M = D
@sum
M = 0
// (LOOP)
// IF VAL1 = 0 GOTO FINISH
// SUM = SUM + VAL0
// VAL1 = VAL1 - 1
// GOTO LOOP
(LOOP)
@value1
D = M
@FINISH
D, JEQ
@value0
D = M
@sum
M = D + M
@value1
M = M -1
@LOOP
0, JMP
// (FINISH)
// R2 = SUM
(FINISH)
@sum
D = M
@R2
M = D
// (END)
// GOTO END
(END)
@END
0, JMP | 12 | 82 | 0.588624 |
0236c04f53b8a4fa4defab09fe080fac600c9d35 | 705 | asm | Assembly | src/timer.asm | MachineThing/DOS_Demo | 08c707a37f8e87a444a0684b9701efba191f4aa7 | [
"MIT"
] | null | null | null | src/timer.asm | MachineThing/DOS_Demo | 08c707a37f8e87a444a0684b9701efba191f4aa7 | [
"MIT"
] | null | null | null | src/timer.asm | MachineThing/DOS_Demo | 08c707a37f8e87a444a0684b9701efba191f4aa7 | [
"MIT"
] | null | null | null | [bits 16]
section .text
global _clock_init
global _sleep
_timer_int:
pushf
dec word [cs:timer_tick]
popf
iret
_clock_init:
mov ax, 351ch ; AH=35h (Get interrupt vector)
; AL=1Ch (User timer interrupt vector)
int 21h
mov [cs:int_ofs], bx
mov ax, es
mov [cs:int_seg], ax
mov ax, 251ch ; AH=25h (Set interrupt vector)
; AL=1Ch (User timer interrupt vector)
push cs
pop ds
mov dx, _timer_int
int 21h
ret
_sleep:
push bp
mov bp, sp
mov ax, [bp + 4]
mov [cs:timer_tick], ax
.wait:
mov ax, word [cs:timer_tick]
test ax, ax ; Sleep time
jnz .wait
pop bp
ret
int_ofs dw 0
int_seg dw 0
timer_tick dw 0
| 14.1 | 56 | 0.614184 |
81b2e768add559a6c81689f392bbfb611966fcb7 | 681 | asm | Assembly | oeis/275/A275903.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/275/A275903.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/275/A275903.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A275903: Expansion of (1+4*x^2) / (1-5*x+4*x^2-4*x^3).
; Submitted by Jamie Morken(s3)
; 1,5,25,109,465,1989,8521,36509,156417,670133,2871033,12300301,52697905,225772453,967271849,4144061053,17754307681,76064381589,325880921433,1396164311533,5981555398289,25626643431045,109791652808201,470377911909981,2015229522041281,8633802573799285,36989606428471225,158473739935324109,678945484257932785,2908790887262252389,12462067459020827241,53390955683086857789,228741672128399989537,979992807745735825493,4198561172947426600473,17987801322267789658541,77064733150532185192785
mov $1,1
mov $2,1
lpb $0
sub $0,1
mul $1,2
add $3,$1
add $1,$2
mul $3,2
add $2,$3
lpe
mov $0,$2
| 42.5625 | 482 | 0.809104 |
8bd205f3536bab91396d4900fa7c5c4f1367f6e5 | 73 | asm | Assembly | libsrc/_DEVELOPMENT/EXAMPLES/zx/demo_nirvanam/btile.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/EXAMPLES/zx/demo_nirvanam/btile.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/EXAMPLES/zx/demo_nirvanam/btile.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | SECTION rodata_user
PUBLIC _btiles
_btiles:
BINARY "nirvana.btile"
| 9.125 | 25 | 0.767123 |
b099fc1bcb38ade19bdd8759fb4663d503d8b0bd | 469 | asm | Assembly | wp/resources/sample_binaries/arm/simple_compare/src/main.asm | zhouxuan009/cbat_tools | e888fc2e65ec464223430b7ad3be1e28795e8b99 | [
"MIT"
] | 91 | 2018-10-17T13:02:45.000Z | 2022-03-11T08:42:00.000Z | wp/resources/sample_binaries/arm/simple_compare/src/main.asm | zhouxuan009/cbat_tools | e888fc2e65ec464223430b7ad3be1e28795e8b99 | [
"MIT"
] | 283 | 2018-10-23T12:34:01.000Z | 2022-02-24T19:53:45.000Z | wp/resources/sample_binaries/arm/simple_compare/src/main.asm | zhouxuan009/cbat_tools | e888fc2e65ec464223430b7ad3be1e28795e8b99 | [
"MIT"
] | 16 | 2018-10-17T07:54:17.000Z | 2021-12-10T15:56:32.000Z | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@
@ Return 5
@
@ To compile this:
@
@ arm-linux-gnueabi-as -g main.asm -o main.o
@ arm-linux-gnueabi-ld -entry=main main.o -o main
@
@
@ ----------------------------------------------
.text
@ ----------------------------------------------
@ The MAIN function
@ ----------------------------------------------
.global main
.type main, %function
main:
mov r0, #5
bx lr
.size main, .-main
| 19.541667 | 52 | 0.336887 |
ca90eae426c44629bf73770b79da46f98bdd2aed | 31,189 | asm | Assembly | source/features/disk.asm | informer2016/MichalOS | bfa2b660e8a2e4143c94891ad44f724e9fa3f117 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | source/features/disk.asm | informer2016/MichalOS | bfa2b660e8a2e4143c94891ad44f724e9fa3f117 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | source/features/disk.asm | informer2016/MichalOS | bfa2b660e8a2e4143c94891ad44f724e9fa3f117 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | ; ==================================================================
; FAT12 FLOPPY DISK ROUTINES
; ==================================================================
; os_change_disk -- Changes the default disk
; IN: AL = disk number
os_change_disk:
mov [bootdev], al
mov [0], al
ret
; os_report_free_space -- Returns the amount of free space on disk
; OUT: AX = Number of sectors free
os_report_free_space:
pusha
mov word [.counter], 0
mov word [.sectors_read], 0
call disk_read_fat ; Read the FAT into memory
mov si, disk_buffer
.loop:
; 0 = nothing, 1 = 1st nibble, 2 = 2nd nibble, 3 = 3rd nibble, G = data we don't care about
mov al, [si] ; AX = 3333GGGG11112222
mov ah, [si + 1]
mov bh, [si + 1] ; BX = GGGG111122223333
mov bl, [si + 2]
rol ax, 4 ; AX = GGGG111122223333
and ax, 0FFFh ; AX = 0000111122223333
and bx, 0FFFh ; BX = 0000111122223333
cmp ax, 0
jne .no_increment_1
inc word [.counter]
.no_increment_1:
cmp bx, 0
jne .no_increment_2
inc word [.counter]
.no_increment_2:
add si, 3 ; Increment the pointer
add word [.sectors_read], 2 ; Increment the counter of sectors
cmp word [.sectors_read], 2847 ; Are we done? (33 of the sectors are the bootloader, FAT and root dir)
jl .loop
popa
mov ax, [.counter]
ret
.counter dw 0
.sectors_read dw 0
; os_format_disk -- Formats a disk [0] with a custom bootloader
; IN: ES:BX = bootloader address
os_format_disk:
pusha
call UPC
jc .error
mov ah, 03h
mov al, 1
mov cx, 1
mov dh, 0Dh
mov dl, [0]
int 13h
jc .error
push es
mov es, [driversgmt]
mov di, 0A000h
mov cx, 4096
rep stosb
mov ax, 2
.loop:
pusha
mov bx, 0A000h
mov cx, 0
mov dx, 0
call disk_convert_l2hts
mov al, 1
mov dl, [0]
int 13h
popa
inc ax
cmp ax, 2880
jle .loop
pop es
popa
clc
ret
.error:
popa
stc
ret
; --------------------------------------------------------------------------
; os_read_root -- Get the root directory contents
; IN: SI = where to store the root directory; OUT: carry set if error
os_read_root:
pusha
mov ax, 19 ; Root dir starts at logical sector 19
call disk_convert_l2hts
mov bx, ds
mov es, bx
mov bx, si
mov ah, 2 ; Params for int 13h: read floppy sectors
mov al, 14 ; And read 14 of them (from 19 onwards)
pusha ; Prepare to enter loop
.read_root_dir_loop:
popa
pusha
stc ; A few BIOSes do not set properly on error
int 13h ; Read sectors
jnc .root_dir_finished
call disk_reset_floppy ; Reset controller and try again
jnc .read_root_dir_loop ; Floppy reset OK?
popa
jmp .read_failure ; Fatal double error
.root_dir_finished:
popa ; Restore registers from main loop
popa ; And restore from start of this system call
clc ; Clear carry (for success)
ret
.read_failure:
popa
stc ; Set carry flag (for failure)
ret
; ------------------------------------------------------------------
; os_get_file_list -- Generate comma-separated string of files on floppy
; IN/OUT: AX = location to store zero-terminated filename string
os_get_file_list:
pusha
pusha
mov si, .msg_load
call os_print_footer
popa
mov word [.file_list_tmp], ax
mov eax, 0 ; Needed for some older BIOSes
call disk_reset_floppy ; Just in case disk was changed
mov ax, 19 ; Root dir starts at logical sector 19
call disk_convert_l2hts
mov si, disk_buffer ; ES:BX should point to our buffer
mov bx, si
mov ah, 2 ; Params for int 13h: read floppy sectors
mov al, 14 ; And read 14 of them
pusha ; Prepare to enter loop
.read_root_dir:
popa
pusha
stc
int 13h ; Read sectors
call disk_reset_floppy ; Check we've read them OK
jnc .show_dir_init ; No errors, continue
call disk_reset_floppy ; Error = reset controller and try again
jnc .read_root_dir
jmp .done ; Double error, exit 'dir' routine
.show_dir_init:
popa
mov ax, 0
mov si, disk_buffer ; Data reader from start of filenames
mov word di, [.file_list_tmp] ; Name destination buffer
.start_entry:
mov al, [si+11] ; File attributes for entry
cmp al, 0Fh ; Windows marker, skip it
je .skip
test al, 08h ; Is this a directory entry or volume label?
jnz .skip ; Yes, ignore it
mov al, [si]
cmp al, 229 ; If we read 229 = deleted filename
je .skip
cmp al, 0 ; 1st byte = entry never used
je .done
mov cx, 1 ; Set char counter
mov dx, si ; Beginning of possible entry
.testdirentry:
inc si
mov al, [si] ; Test for most unusable characters
cmp al, ' ' ; Windows sometimes puts 0 (UTF-8) or 0FFh
jl .nxtdirentry
cmp al, '~'
ja .nxtdirentry
inc cx
cmp cx, 11 ; Done 11 char filename?
je .gotfilename
jmp .testdirentry
.gotfilename: ; Got a filename that passes testing
mov si, dx ; DX = where getting string
mov cx, 0
.loopy:
mov byte al, [si]
cmp al, ' '
je .ignore_space
mov byte [es:di], al
inc si
inc di
inc cx
cmp cx, 8
je .add_dot
cmp cx, 11
je .done_copy
jmp .loopy
.ignore_space:
inc si
inc cx
cmp cx, 8
je .add_dot
jmp .loopy
.add_dot:
mov byte [es:di], '.'
inc di
jmp .loopy
.done_copy:
mov byte [es:di], ',' ; Use comma to separate filenames
inc di
.nxtdirentry:
mov si, dx ; Start of entry, pretend to skip to next
.skip:
add si, 32 ; Shift to next 32 bytes (next filename)
jmp .start_entry
.done:
dec di
mov byte [es:di], 0 ; Zero-terminate string (gets rid of final comma)
pusha
mov si, 0
call os_print_footer
popa
popa
ret
.file_list_tmp dw 0
.msg_load db ' Reading the directory contents...', 0
; ------------------------------------------------------------------
; os_load_file -- Load a file into RAM
; IN: AX = location of filename, ES:CX = location in RAM to load file
; OUT: BX = file size (in bytes), carry set if file not found
os_load_file:
push es
mov dx, es
and ecx, 0000FFFFh ; Mask off the high 16 bits for the offset...
and edx, 0000FFFFh ; ...and for the segment as well
shl edx, 4 ; Multiply the segment by 16
add ecx, edx
call os_32_load_file
pop es
ret
; ------------------------------------------------------------------
; os_32_load_file -- Load a file into RAM (32-bit offset)
; IN: AX = location of filename, ECX = location in RAM to load file
; OUT: EBX = file size (in bytes), carry set if file not found
os_32_load_file:
push es
mov es, [.default_segment]
call os_string_uppercase
pusha ; Message display routine
mov bx, ax
mov ax, .msg_load
mov cx, 82
call os_string_join
mov si, 82
call os_print_footer
popa
call int_filename_convert
mov [.filename_loc], ax ; Store filename location
mov [.load_position], ecx ; And where to load the file!
mov eax, 0 ; Needed for some older BIOSes
call disk_reset_floppy ; In case floppy has been changed
jnc .floppy_ok ; Did the floppy reset OK?
mov ax, .err_msg_floppy_reset ; If not, bail out
jmp os_fatal_error
.floppy_ok: ; Ready to read first block of data
mov ax, 19 ; Root dir starts at logical sector 19
call disk_convert_l2hts
mov si, disk_buffer ; ES:BX should point to our buffer
mov bx, si
mov ah, 2 ; Params for int 13h: read floppy sectors
mov al, 14 ; 14 root directory sectors
pusha ; Prepare to enter loop
.read_root_dir:
popa
pusha
stc ; A few BIOSes clear, but don't set properly
int 13h ; Read sectors
jnc .search_root_dir ; No errors = continue
call disk_reset_floppy ; Problem = reset controller and try again
jnc .read_root_dir
popa
jmp .root_problem ; Double error = exit
.search_root_dir:
popa
mov cx, word 224 ; Search all entries in root dir
mov bx, -32 ; Begin searching at offset 0 in root dir
.next_root_entry:
add bx, 32 ; Bump searched entries by 1 (offset + 32 bytes)
mov di, disk_buffer ; Point root dir at next entry
add di, bx
mov al, [di] ; First character of name
cmp al, 0 ; Last file name already checked?
je .root_problem
cmp al, 229 ; Was this file deleted?
je .next_root_entry ; If yes, skip it
mov al, [di+11] ; Get the attribute byte
cmp al, 0Fh ; Is this a special Windows entry?
je .next_root_entry
test al, 18h ; Is this a directory entry or volume label?
jnz .next_root_entry
mov byte [di+11], 0 ; Add a terminator to directory name entry
mov ax, di ; Convert root buffer name to upper case
call os_string_uppercase
mov si, [.filename_loc] ; DS:SI = location of filename to load
call os_string_compare ; Current entry same as requested?
jc .found_file_to_load
loop .next_root_entry
.root_problem:
mov bx, 0 ; If file not found or major disk error,
stc ; return with size = 0 and carry set
pop es
ret
.found_file_to_load: ; Now fetch cluster and load FAT into RAM
mov eax, [di+28] ; Store file size to return to calling routine
mov [.file_size], eax
cmp eax, 0 ; If the file size is zero, don't bother trying
je .end ; to read more clusters
mov ax, [di+26] ; Now fetch cluster and load FAT into RAM
mov word [.cluster], ax
mov ax, 1 ; Sector 1 = first sector of first FAT
call disk_convert_l2hts
mov bx, disk_buffer ; ES:BX points to our buffer
mov ah, 2 ; int 13h params: read sectors
mov al, 9 ; And read 9 of them
pusha
.read_fat:
popa ; In case registers altered by int 13h
pusha
stc
int 13h
jnc .read_fat_ok
call disk_reset_floppy
jnc .read_fat
popa
jmp .root_problem
.read_fat_ok:
popa
.load_file_sector:
mov ax, word [.cluster] ; Convert sector to logical
add ax, 31
call disk_convert_l2hts ; Make appropriate params for int 13h
mov bx, 65536 - 512 ; Load the sector into a temporary buffer
mov ah, 02 ; AH = read sectors, AL = just read 1
mov al, 01
stc
int 13h
jc .error
mov esi, 65536 - 512
mov edi, [.load_position]
sub edi, 65536 ; We're in a 1000h code segment...
add dword [.load_position], 512 ; Prepare the pointer to the next sector
mov cx, 0 ; Counter
.copy_loop:
mov al, [esi] ; Copy the loaded sector...
mov [edi], al ; ...into the desired position!
inc esi
inc edi
inc cx
cmp cx, 512
jne .copy_loop
jmp .calculate_next_cluster
.error:
call disk_reset_floppy ; Reset the floppy and retry
jnc .load_file_sector
mov ax, .err_msg_floppy_reset ; Reset failed, bail out
jmp os_fatal_error
.calculate_next_cluster:
mov ax, [.cluster]
mov bx, 3
mul bx
mov bx, 2
div bx ; DX = [CLUSTER] mod 2
mov si, disk_buffer ; AX = word in FAT for the 12 bits
add si, ax
mov ax, word [ds:si]
cmp dx, 0 ; If DX = 0 [CLUSTER] = even, if DX = 1 then odd
je .even ; If [CLUSTER] = even, drop last 4 bits of word
; with next cluster; if odd, drop first 4 bits
.odd:
shr ax, 4 ; Shift out first 4 bits (belong to another entry)
jmp .calculate_cluster_cont ; Onto next sector!
.even:
and ax, 0FFFh ; Mask out top (last) 4 bits
.calculate_cluster_cont:
mov word [.cluster], ax ; Store cluster
cmp ax, 0FF8h
jge .end
add word [.old_segment], 512 / 16
jmp .load_file_sector ; Onto next sector!
.end:
mov ebx, [.file_size] ; Get file size to pass back in BX
pusha
mov si, 0
call os_print_footer
popa
clc ; Carry clear = good load
pop es
ret
.bootd db 0 ; Boot device number
.cluster dw 0 ; Cluster of the file we want to load
.pointer dw 0 ; Pointer into disk_buffer, for loading 'file2load'
.filename_loc dw 0 ; Temporary store of filename location
.load_position dd 0 ; Where we'll load the file
.file_size dd 0 ; Size of the file
.err_msg_floppy_reset db 'os_load_file: Floppy failed to reset', 0
.old_segment dw 0
.default_segment dw 1000h
.msg_load db ' Loading ', 0
; --------------------------------------------------------------------------
; os_write_file -- Save (max 64K) file to disk
; IN: AX = filename, BX = data location, CX = bytes to write
; OUT: Carry clear if OK, set if failure
os_write_file:
pusha
mov [.old_segment], es
mov es, [.default_segment]
mov si, ax
call os_string_length
cmp ax, 0
je near .failure
mov ax, si
call os_string_uppercase
pusha ; Message display routine
mov bx, ax
mov ax, .msg_save
mov cx, 82
call os_string_join
mov si, 82
call os_print_footer
popa
call int_filename_convert ; Make filename FAT12-style
jc near .failure
mov word [.filesize], cx
mov word [.location], bx
mov word [.filename], ax
call os_file_exists ; Don't overwrite a file if it exists!
jnc near .failure
; First, zero out the .free_clusters list from any previous execution
pusha
mov di, .free_clusters
mov cx, 128
.clean_free_loop:
mov word [di], 0
inc di
inc di
loop .clean_free_loop
popa
; Next, we need to calculate now many 512 byte clusters are required
mov ax, cx
mov dx, 0
mov bx, 512 ; Divide file size by 512 to get clusters needed
div bx
cmp dx, 0
jg .add_a_bit ; If there's a remainder, we need another cluster
jmp .carry_on
.add_a_bit:
add ax, 1
.carry_on:
mov word [.clusters_needed], ax
mov word ax, [.filename] ; Get filename back
call os_create_file ; Create empty root dir entry for this file
jc near .failure ; If we can't write to the media, jump out
mov word bx, [.filesize]
cmp bx, 0
je near .finished
call disk_read_fat ; Get FAT copy into RAM
mov si, disk_buffer + 3 ; And point SI at it (skipping first two clusters)
mov bx, 2 ; Current cluster counter
mov word cx, [.clusters_needed]
mov dx, 0 ; Offset in .free_clusters list
.find_free_cluster:
lodsw ; Get a word
and ax, 0FFFh ; Mask out for even
jz .found_free_even ; Free entry?
.more_odd:
inc bx ; If not, bump our counter
dec si ; 'lodsw' moved on two chars; we only want to move on one
lodsw ; Get word
shr ax, 4 ; Shift for odd
or ax, ax ; Free entry?
jz .found_free_odd
.more_even:
inc bx ; If not, keep going
jmp .find_free_cluster
.found_free_even:
push si
mov si, .free_clusters ; Store cluster
add si, dx
mov word [si], bx
pop si
dec cx ; Got all the clusters we need?
cmp cx, 0
je .finished_list
inc dx ; Next word in our list
inc dx
jmp .more_odd
.found_free_odd:
push si
mov si, .free_clusters ; Store cluster
add si, dx
mov word [si], bx
pop si
dec cx
cmp cx, 0
je .finished_list
inc dx ; Next word in our list
inc dx
jmp .more_even
.finished_list:
; Now the .free_clusters table contains a series of numbers (words)
; that correspond to free clusters on the disk; the next job is to
; create a cluster chain in the FAT for our file
mov cx, 0 ; .free_clusters offset counter
mov word [.count], 1 ; General cluster counter
.chain_loop:
mov word ax, [.count] ; Is this the last cluster?
cmp word ax, [.clusters_needed]
je .last_cluster
mov di, .free_clusters
add di, cx
mov word bx, [di] ; Get cluster
mov ax, bx ; Find out if it's an odd or even cluster
mov dx, 0
mov bx, 3
mul bx
mov bx, 2
div bx ; DX = [.cluster] mod 2
mov si, disk_buffer
add si, ax ; AX = word in FAT for the 12 bit entry
mov ax, word [ds:si]
or dx, dx ; If DX = 0, [.cluster] = even; if DX = 1 then odd
jz .even
.odd:
and ax, 000Fh ; Zero out bits we want to use
mov di, .free_clusters
add di, cx ; Get offset in .free_clusters
mov word bx, [di+2] ; Get number of NEXT cluster
shl bx, 4 ; And convert it into right format for FAT
add ax, bx
mov word [ds:si], ax ; Store cluster data back in FAT copy in RAM
inc word [.count]
inc cx ; Move on a word in .free_clusters
inc cx
jmp .chain_loop
.even:
and ax, 0F000h ; Zero out bits we want to use
mov di, .free_clusters
add di, cx ; Get offset in .free_clusters
mov word bx, [di+2] ; Get number of NEXT free cluster
add ax, bx
mov word [ds:si], ax ; Store cluster data back in FAT copy in RAM
inc word [.count]
inc cx ; Move on a word in .free_clusters
inc cx
jmp .chain_loop
.last_cluster:
mov di, .free_clusters
add di, cx
mov word bx, [di] ; Get cluster
mov ax, bx
mov dx, 0
mov bx, 3
mul bx
mov bx, 2
div bx ; DX = [.cluster] mod 2
mov si, disk_buffer
add si, ax ; AX = word in FAT for the 12 bit entry
mov ax, word [ds:si]
or dx, dx ; If DX = 0, [.cluster] = even; if DX = 1 then odd
jz .even_last
.odd_last:
and ax, 000Fh ; Set relevant parts to FF8h (last cluster in file)
add ax, 0FF80h
jmp .finito
.even_last:
and ax, 0F000h ; Same as above, but for an even cluster
add ax, 0FF8h
.finito:
mov word [ds:si], ax
call disk_write_fat ; Save our FAT back to disk
; Now it's time to save the sectors to disk!
mov cx, 0
.save_loop:
mov di, .free_clusters
add di, cx
mov word ax, [di]
cmp ax, 0
je near .write_root_entry
pusha
add ax, 31
call disk_convert_l2hts
mov word bx, [.location]
mov es, [.old_segment]
mov ah, 3
mov al, 1
stc
int 13h
mov es, [.default_segment]
popa
add word [.location], 512
inc cx
inc cx
jmp .save_loop
.write_root_entry:
; Now it's time to head back to the root directory, find our
; entry and update it with the cluster in use and file size
call disk_read_root_dir
mov word ax, [.filename]
call disk_get_root_entry
mov word ax, [.free_clusters] ; Get first free cluster
mov word [di+26], ax ; Save cluster location into root dir entry
mov word cx, [.filesize]
mov word [di+28], cx
mov byte [di+30], 0 ; File size
mov byte [di+31], 0
call disk_write_root_dir
.finished:
popa
pusha
mov si, 0
call os_print_footer
popa
clc
mov es, [.old_segment]
ret
.failure:
popa
pusha
mov si, 0
call os_print_footer
popa
stc ; Couldn't write!
mov es, [.old_segment]
ret
.filesize dw 0
.cluster dw 0
.count dw 0
.location dw 0
.clusters_needed dw 0
.filename dw 0
.free_clusters equ 65280
.old_segment dw 0
.default_segment dw 1000h
.msg_save db ' Saving ', 0
; --------------------------------------------------------------------------
; os_file_exists -- Check for presence of file on the floppy
; IN: AX = filename location; OUT: carry clear if found, set if not
os_file_exists:
call os_string_uppercase
call int_filename_convert ; Make FAT12-style filename
push ax
call os_string_length
cmp ax, 0
je .failure
pop ax
push ax
call disk_read_root_dir
pop ax ; Restore filename
mov di, disk_buffer
call disk_get_root_entry ; Set or clear carry flag
ret
.failure:
pop ax
stc
ret
; --------------------------------------------------------------------------
; os_create_file -- Creates a new 0-byte file on the floppy disk
; IN: AX = location of filename; OUT: Nothing
os_create_file:
clc
call os_string_uppercase
call int_filename_convert ; Make FAT12-style filename
pusha
push ax ; Save filename for now
call os_file_exists ; Does the file already exist?
jnc .exists_error
; Root dir already read into disk_buffer by os_file_exists
mov di, disk_buffer ; So point DI at it!
mov cx, 224 ; Cycle through root dir entries
.next_entry:
mov byte al, [di]
cmp al, 0 ; Is this a free entry?
je .found_free_entry
cmp al, 0E5h ; Is this a free entry?
je .found_free_entry
add di, 32 ; If not, go onto next entry
dec cx
cmp cx, 0
jne .next_entry
mov ax, .err_msg ; Is the root directory full?
call os_fatal_error
.exists_error: ; We also get here if above loop finds nothing
pop ax ; Get filename back
popa
stc ; Set carry for failure
ret
.found_free_entry:
pop si ; Get filename back
mov cx, 11
rep movsb ; And copy it into RAM copy of root dir (in DI)
mov si, .table ; Copy over all the attributes
mov cx, 21
rep movsb
call disk_write_root_dir
jc .failure
popa
clc ; Clear carry for success
ret
.failure:
popa
stc
ret
.table db 0, 0, 0, 0C6h, 07Eh, 0, 0, 0, 0, 0, 0, 0C6h, 07Eh, 0, 0, 0, 0, 0, 0, 0, 0
.err_msg db 'Not enough space in the directory', 0
; --------------------------------------------------------------------------
; os_remove_file -- Deletes the specified file from the filesystem
; IN: AX = location of filename to remove
os_remove_file:
pusha
call os_string_uppercase
mov si, ax
mov di, system_name
call os_string_compare
jnc .ok
call UPC
jc .failure
.ok:
popa
pusha
call os_string_uppercase
call int_filename_convert ; Make filename FAT12-style
push ax ; Save filename
clc
call disk_read_root_dir ; Get root dir into disk_buffer
mov di, disk_buffer ; Point DI to root dir
pop ax ; Get chosen filename back
call disk_get_root_entry ; Entry will be returned in DI
jc .failure ; If entry can't be found
mov ax, word [es:di+26] ; Get first cluster number from the dir entry
mov word [.cluster], ax ; And save it
mov byte [di], 0E5h ; Mark directory entry (first byte of filename) as empty
inc di
mov cx, 0 ; Set rest of data in root dir entry to zeros
.clean_loop:
mov byte [di], 0
inc di
inc cx
cmp cx, 31 ; 32-byte entries, minus E5h byte we marked before
jl .clean_loop
call disk_write_root_dir ; Save back the root directory from RAM
call disk_read_fat ; Now FAT is in disk_buffer
mov di, disk_buffer ; And DI points to it
.more_clusters:
mov word ax, [.cluster] ; Get cluster contents
cmp ax, 0 ; If it's zero, this was an empty file
je .nothing_to_do
mov bx, 3 ; Determine if cluster is odd or even number
mul bx
mov bx, 2
div bx ; DX = [first_cluster] mod 2
mov si, disk_buffer ; AX = word in FAT for the 12 bits
add si, ax
mov ax, word [ds:si]
or dx, dx ; If DX = 0 [.cluster] = even, if DX = 1 then odd
jz .even ; If [.cluster] = even, drop last 4 bits of word
; with next cluster; if odd, drop first 4 bits
.odd:
push ax
and ax, 000Fh ; Set cluster data to zero in FAT in RAM
mov word [ds:si], ax
pop ax
shr ax, 4 ; Shift out first 4 bits (they belong to another entry)
jmp .calculate_cluster_cont ; Onto next sector!
.even:
push ax
and ax, 0F000h ; Set cluster data to zero in FAT in RAM
mov word [ds:si], ax
pop ax
and ax, 0FFFh ; Mask out top (last) 4 bits (they belong to another entry)
.calculate_cluster_cont:
mov word [.cluster], ax ; Store cluster
cmp ax, 0FF8h ; Final cluster marker?
jae .end
jmp .more_clusters ; If not, grab more
.end:
call disk_write_fat
jc .failure
.nothing_to_do:
popa
clc
ret
.failure:
popa
stc
ret
.cluster dw 0
; --------------------------------------------------------------------------
; os_rename_file -- Change the name of a file on the disk
; IN: AX = filename to change, BX = new filename (zero-terminated strings)
; OUT: carry set on error
os_rename_file:
push bx
push ax
clc
call disk_read_root_dir ; Get root dir into disk_buffer
mov di, disk_buffer ; Point DI to root dir
pop ax ; Get chosen filename back
call os_string_uppercase
call int_filename_convert
call disk_get_root_entry ; Entry will be returned in DI
jc .fail_read ; Quit out if file not found
pop bx ; Get new filename string (originally passed in BX)
mov ax, bx
call os_string_uppercase
call int_filename_convert
mov si, ax
mov cx, 11 ; Copy new filename string into root dir entry in disk_buffer
rep movsb
call disk_write_root_dir ; Save root dir to disk
jc .fail_write
clc
ret
.fail_read:
pop ax
stc
ret
.fail_write:
stc
ret
; --------------------------------------------------------------------------
; os_get_file_size -- Get file size information for specified file
; IN: AX = filename; OUT: EBX = file size in bytes (up to 4GB)
; or carry set if file not found
os_get_file_size:
pusha
call os_string_uppercase
call int_filename_convert
clc
push ax
call disk_read_root_dir
jc .failure
pop ax
mov di, disk_buffer
call disk_get_root_entry
jc .failure
mov dword ebx, [di+28]
mov dword [.tmp], ebx
popa
mov dword ebx, [.tmp]
ret
.failure:
popa
stc
ret
.tmp dd 0
; ==================================================================
; INTERNAL OS ROUTINES -- Not accessible to user programs
; ------------------------------------------------------------------
; int_filename_convert -- Change 'TEST.BIN' into 'TEST BIN' as per FAT12
; IN: AX = filename string
; OUT: AX = location of converted string (carry set if invalid)
int_filename_convert:
pusha
mov si, ax
call os_string_length
cmp ax, 14 ; Filename too long?
jg .failure ; Fail if so
cmp ax, 0
je .failure ; Similarly, fail if zero-char string
mov dx, ax ; Store string length for now
mov di, .dest_string
mov cx, 0
.copy_loop:
lodsb
cmp al, '.'
je .extension_found
stosb
inc cx
cmp cx, dx
jg .failure ; No extension found = wrong
jmp .copy_loop
.extension_found:
cmp cx, 0
je .failure ; Fail if extension dot is first char
cmp cx, 8
je .do_extension ; Skip spaces if first bit is 8 chars
; Now it's time to pad out the rest of the first part of the filename
; with spaces, if necessary
.add_spaces:
mov byte [di], ' '
inc di
inc cx
cmp cx, 8
jl .add_spaces
; Finally, copy over the extension
.do_extension:
lodsb ; 3 characters
cmp al, 0
je .failure
stosb
lodsb
cmp al, 0
je .failure
stosb
lodsb
cmp al, 0
je .failure
stosb
mov byte [di], 0 ; Zero-terminate filename
popa
mov ax, .dest_string
clc ; Clear carry for success
ret
.failure:
popa
stc ; Set carry for failure
ret
.dest_string times 13 db 0
; --------------------------------------------------------------------------
; disk_get_root_entry -- Search RAM copy of root dir for file entry
; IN: AX = filename; OUT: DI = location in disk_buffer of root dir entry,
; or carry set if file not found
disk_get_root_entry:
pusha
mov word [.filename], ax
mov cx, 224 ; Search all (224) entries
mov ax, 0 ; Searching at offset 0
.to_next_root_entry:
xchg cx, dx ; We use CX in the inner loop...
mov word si, [.filename] ; Start searching for filename
mov cx, 11
rep cmpsb
je .found_file ; Pointer DI will be at offset 11, if file found
add ax, 32 ; Bump searched entries by 1 (32 bytes/entry)
mov di, disk_buffer ; Point to next root dir entry
add di, ax
xchg dx, cx ; Get the original CX back
loop .to_next_root_entry
popa
stc ; Set carry if entry not found
ret
.found_file:
sub di, 11 ; Move back to start of this root dir entry
mov word [.tmp], di ; Restore all registers except for DI
popa
mov word di, [.tmp]
clc
ret
.filename dw 0
.tmp dw 0
; --------------------------------------------------------------------------
; disk_read_fat -- Read FAT entry from floppy into disk_buffer
; IN: Nothing; OUT: carry set if failure
disk_read_fat:
pusha
mov ax, 1 ; FAT starts at logical sector 1 (after boot sector)
call disk_convert_l2hts
mov si, disk_buffer ; Set ES:BX to point to 8K OS buffer
mov bx, 1000h
mov es, bx
mov bx, si
mov ah, 2 ; Params for int 13h: read floppy sectors
mov al, 9 ; And read 9 of them for first FAT
pusha ; Prepare to enter loop
.read_fat_loop:
popa
pusha
stc ; A few BIOSes do not set properly on error
int 13h ; Read sectors
jnc .fat_done
call disk_reset_floppy ; Reset controller and try again
jnc .read_fat_loop ; Floppy reset OK?
popa
jmp .read_failure ; Fatal double error
.fat_done:
popa ; Restore registers from main loop
popa ; And restore registers from start of system call
clc
ret
.read_failure:
popa
stc ; Set carry flag (for failure)
ret
; --------------------------------------------------------------------------
; disk_write_fat -- Save FAT contents from disk_buffer in RAM to disk
; IN: FAT in disk_buffer; OUT: carry set if failure
disk_write_fat:
pusha
mov ax, 1 ; FAT starts at logical sector 1 (after boot sector)
call disk_convert_l2hts
mov si, disk_buffer ; Set ES:BX to point to 8K OS buffer
mov bx, ds
mov es, bx
mov bx, si
mov ah, 3 ; Params for int 13h: write floppy sectors
mov al, 9 ; And write 9 of them for first FAT
stc ; A few BIOSes do not set properly on error
int 13h ; Write sectors
jc .write_failure ; Fatal double error
popa ; And restore from start of system call
clc
ret
.write_failure:
popa
stc ; Set carry flag (for failure)
ret
; --------------------------------------------------------------------------
; disk_read_root_dir -- Get the root directory contents
; IN: Nothing; OUT: root directory contents in disk_buffer, carry set if error
disk_read_root_dir:
pusha
mov ax, 19 ; Root dir starts at logical sector 19
call disk_convert_l2hts
mov si, disk_buffer ; Set ES:BX to point to OS buffer
mov bx, ds
mov es, bx
mov bx, si
mov ah, 2 ; Params for int 13h: read floppy sectors
mov al, 14 ; And read 14 of them (from 19 onwards)
pusha ; Prepare to enter loop
.read_root_dir_loop:
popa
pusha
stc ; A few BIOSes do not set properly on error
int 13h ; Read sectors
jnc .root_dir_finished
call disk_reset_floppy ; Reset controller and try again
jnc .read_root_dir_loop ; Floppy reset OK?
popa
jmp .read_failure ; Fatal double error
.root_dir_finished:
popa ; Restore registers from main loop
popa ; And restore from start of this system call
clc ; Clear carry (for success)
ret
.read_failure:
popa
stc ; Set carry flag (for failure)
ret
; --------------------------------------------------------------------------
; disk_write_root_dir -- Write root directory contents from disk_buffer to disk
; IN: root dir copy in disk_buffer; OUT: carry set if error
disk_write_root_dir:
pusha
mov ax, 19 ; Root dir starts at logical sector 19
call disk_convert_l2hts
mov si, disk_buffer ; Set ES:BX to point to OS buffer
mov bx, ds
mov es, bx
mov bx, si
mov ah, 3 ; Params for int 13h: write floppy sectors
mov al, 14 ; And write 14 of them (from 19 onwards)
stc ; A few BIOSes do not set properly on error
int 13h ; Write sectors
jc .write_failure
popa ; And restore from start of this system call
clc
ret
.write_failure:
popa
stc ; Set carry flag (for failure)
ret
; --------------------------------------------------------------------------
; Reset floppy disk
disk_reset_floppy:
push ax
push dx
mov ax, 0
; ******************************************************************
mov dl, [bootdev]
; ******************************************************************
stc
int 13h
pop dx
pop ax
ret
; --------------------------------------------------------------------------
; disk_convert_l2hts -- Calculate head, track and sector for int 13h
; IN: logical sector in AX; OUT: correct registers for int 13h
disk_convert_l2hts:
push bx
push ax
mov bx, ax ; Save logical sector
mov dx, 0 ; First the sector
div word [SecsPerTrack] ; Sectors per track
add dl, 01h ; Physical sectors start at 1
mov cl, dl ; Sectors belong in CL for int 13h
mov ax, bx
mov dx, 0 ; Now calculate the head
div word [SecsPerTrack] ; Sectors per track
mov dx, 0
div word [Sides] ; Floppy sides
mov dh, dl ; Head/side
mov ch, al ; Track
pop ax
pop bx
mov dl, [bootdev] ; Set correct device
ret
Sides dw 2
SecsPerTrack dw 18
bootdev db 0 ; Boot device number
; ==================================================================
| 19.954575 | 103 | 0.651512 |
001e7448968c90fcbbaebd45e9f7d4a651a2f743 | 481 | asm | Assembly | programs/oeis/189/A189672.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/189/A189672.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/189/A189672.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A189672: Partial sums of A080846.
; 0,1,1,1,2,3,3,4,4,4,5,5,5,6,7,7,8,9,9,10,10,10,11,12,12,13,13,13,14,14,14,15,16,16,17,17,17,18,18,18,19,20,20,21,22,22,23,23,23,24,25,25,26,27,27,28,28,28,29,30,30,31,31,31,32,32,32,33,34,34,35,36,36,37,37,37,38,39,39,40
mov $33,$0
mov $35,$0
lpb $35
mov $0,$33
sub $35,1
sub $0,$35
mul $0,2
add $0,2
mov $1,$0
add $1,$0
mov $2,$1
lpb $1,3
div $2,3
gcd $2,$1
lpe
mov $1,$2
sub $1,1
add $34,$1
lpe
mov $1,$34
| 20.041667 | 222 | 0.56341 |
45ee645af7406c220da55520851c4fc6145319f8 | 674 | asm | Assembly | programs/oeis/074/A074742.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/074/A074742.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/074/A074742.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A074742: a(n) = (n^3 + 6n^2 - n + 12)/6.
; 2,3,7,15,28,47,73,107,150,203,267,343,432,535,653,787,938,1107,1295,1503,1732,1983,2257,2555,2878,3227,3603,4007,4440,4903,5397,5923,6482,7075,7703,8367,9068,9807,10585,11403,12262,13163,14107,15095,16128,17207,18333,19507,20730,22003,23327,24703,26132,27615,29153,30747,32398,34107,35875,37703,39592,41543,43557,45635,47778,49987,52263,54607,57020,59503,62057,64683,67382,70155,73003,75927,78928,82007,85165,88403,91722,95123,98607,102175,105828,109567,113393,117307,121310,125403,129587,133863,138232,142695,147253,151907,156658,161507,166455,171503
mov $1,1
mov $2,$0
pow $0,2
add $1,$2
bin $1,3
add $1,$0
add $1,2
mov $0,$1
| 56.166667 | 553 | 0.756677 |
68d734e04d164ccdba1555ed32fbc2cd3e3a499b | 5,508 | asm | Assembly | scripts/_p0.asm | fengjixuchui/blazefox | d5c732ac7305a79fe20704c2d134c130f14eca83 | [
"MIT"
] | 149 | 2018-12-23T09:08:00.000Z | 2022-02-02T09:18:38.000Z | scripts/_p0.asm | fengjixuchui/blazefox | d5c732ac7305a79fe20704c2d134c130f14eca83 | [
"MIT"
] | null | null | null | scripts/_p0.asm | fengjixuchui/blazefox | d5c732ac7305a79fe20704c2d134c130f14eca83 | [
"MIT"
] | 56 | 2018-12-23T18:11:40.000Z | 2021-11-30T13:18:17.000Z | 00007ff6`6ede1021 push rax
00007ff6`6ede1022 push rbx
00007ff6`6ede1023 push rcx
00007ff6`6ede1024 push rdx
00007ff6`6ede1025 push rbp
00007ff6`6ede1026 push rsi
00007ff6`6ede1027 push rdi
00007ff6`6ede1028 push r8
00007ff6`6ede102a push r9
00007ff6`6ede102c push r10
00007ff6`6ede102e push r11
00007ff6`6ede1030 push r12
00007ff6`6ede1032 push r13
00007ff6`6ede1034 push r14
00007ff6`6ede1036 push r15
00007ff6`6ede1038 mov r11,rsp
00007ff6`6ede103b sub rsp,10h
00007ff6`6ede103f sub rsp,70h
00007ff6`6ede1043 sub rsp,70h
00007ff6`6ede1047 and sp,0FFF0h
00007ff6`6ede104b mov eax,636C6163h
00007ff6`6ede1050 mov dword ptr [rsp],eax
00007ff6`6ede1053 mov byte ptr [rsp+4],0
00007ff6`6ede1058 xor eax,eax
00007ff6`6ede105a mov qword ptr [r11+8],rbx
00007ff6`6ede105e lea rdi,[r11-78h]
00007ff6`6ede1062 mov qword ptr [r11+10h],rsi
00007ff6`6ede1066 mov ecx,68h
00007ff6`6ede106b xor ebp,ebp
00007ff6`6ede106d rep stos byte ptr [rdi]
00007ff6`6ede106f mov byte ptr [rsp+70h],68h
00007ff6`6ede1074 mov eax,60h
00007ff6`6ede1079 mov rax,qword ptr gs:[eax]
00007ff6`6ede107e mov rcx,qword ptr [rax+18h]
00007ff6`6ede1082 mov r8,qword ptr [rcx+10h]
00007ff6`6ede1086 mov rdi,qword ptr [r8+60h]
00007ff6`6ede108a mov r9,rdi
00007ff6`6ede108d test rdi,rdi
00007ff6`6ede1090 je 00007ff6`6ede10c1
00007ff6`6ede1092 movzx ecx,word ptr [rdi]
00007ff6`6ede1095 mov eax,1505h
00007ff6`6ede109a mov edx,ebp
00007ff6`6ede109c test cx,cx
00007ff6`6ede109f je 00007ff6`6ede10c1
00007ff6`6ede10a1 nop dword ptr [rax+rax]
00007ff6`6ede10a5 movzx ecx,cx
00007ff6`6ede10a8 inc edx
00007ff6`6ede10aa imul eax,eax,21h
00007ff6`6ede10ad add eax,ecx
00007ff6`6ede10af mov ecx,edx
00007ff6`6ede10b1 movzx ecx,word ptr [rdi+rdx*2]
00007ff6`6ede10b5 test cx,cx
00007ff6`6ede10b8 jne 00007ff6`6ede10a5
00007ff6`6ede10ba cmp eax,6DDB9555h
00007ff6`6ede10bf je 00007ff6`6ede10f5
00007ff6`6ede10c1 mov r8,qword ptr [r8]
00007ff6`6ede10c4 mov rdi,qword ptr [r8+60h]
00007ff6`6ede10c8 cmp rdi,r9
00007ff6`6ede10cb jne 00007ff6`6ede108d
00007ff6`6ede10cd mov eax,1
00007ff6`6ede10d2 lea rsp,[rsp+70h]
00007ff6`6ede10d7 add rsp,70h
00007ff6`6ede10db add rsp,18h
00007ff6`6ede10df pop r15
00007ff6`6ede10e1 pop r14
00007ff6`6ede10e3 pop r13
00007ff6`6ede10e5 pop r12
00007ff6`6ede10e7 pop r11
00007ff6`6ede10e9 pop r9
00007ff6`6ede10eb pop r8
00007ff6`6ede10ed pop rdi
00007ff6`6ede10ee pop rsi
00007ff6`6ede10ef pop rbp
00007ff6`6ede10f0 pop rdx
00007ff6`6ede10f1 pop rcx
00007ff6`6ede10f2 pop rbx
00007ff6`6ede10f3 pop rax
00007ff6`6ede10f4 ret
00007ff6`6ede10f5 mov r10,qword ptr [r8+30h]
00007ff6`6ede10f9 test r10,r10
00007ff6`6ede10fc je 00007ff6`6ede10cd
00007ff6`6ede10fe movsxd rax,dword ptr [r10+3Ch]
00007ff6`6ede1102 lea rcx,[rax+r10]
00007ff6`6ede1106 add rcx,70h
00007ff6`6ede110a add rcx,18h
00007ff6`6ede110e mov ecx,dword ptr [rcx]
00007ff6`6ede1110 test ecx,ecx
00007ff6`6ede1112 je 00007ff6`6ede10cd
00007ff6`6ede1114 mov r9d,dword ptr [r10+rcx+20h]
00007ff6`6ede1119 lea rax,[r10+rcx]
00007ff6`6ede111d mov ebx,dword ptr [rax+24h]
00007ff6`6ede1120 add r9,r10
00007ff6`6ede1123 mov esi,dword ptr [rax+1Ch]
00007ff6`6ede1126 add rbx,r10
00007ff6`6ede1129 mov r11d,dword ptr [rax+18h]
00007ff6`6ede112d add rsi,r10
00007ff6`6ede1130 mov r8d,ebp
00007ff6`6ede1133 test r11d,r11d
00007ff6`6ede1136 je 00007ff6`6ede10cd
00007ff6`6ede1138 nop dword ptr [rax+rax]
00007ff6`6ede113c mov edi,dword ptr [r9]
00007ff6`6ede113f mov ecx,1505h
00007ff6`6ede1144 add rdi,r10
00007ff6`6ede1147 mov edx,ebp
00007ff6`6ede1149 movzx eax,byte ptr [rdi]
00007ff6`6ede114c test al,al
00007ff6`6ede114e je 00007ff6`6ede1170
00007ff6`6ede1150 movsx eax,al
00007ff6`6ede1153 inc edx
00007ff6`6ede1155 imul ecx,ecx,21h
00007ff6`6ede1158 add ecx,eax
00007ff6`6ede115a mov eax,edx
00007ff6`6ede115c movzx eax,byte ptr [rdx+rdi]
00007ff6`6ede1160 test al,al
00007ff6`6ede1162 jne 00007ff6`6ede1150
00007ff6`6ede1164 push rax
00007ff6`6ede1165 mov rax,rcx
00007ff6`6ede1168 cmp eax,0AEB52E19h
00007ff6`6ede116d pop rax
00007ff6`6ede116e je 00007ff6`6ede1181
00007ff6`6ede1170 inc r8d
00007ff6`6ede1173 add r9,4
00007ff6`6ede1177 cmp r8d,r11d
00007ff6`6ede117a jb 00007ff6`6ede113c
00007ff6`6ede117c jmp 00007ff6`6ede10cd
00007ff6`6ede1181 mov eax,r8d
00007ff6`6ede1184 movzx ecx,word ptr [rbx+rax*2]
00007ff6`6ede1188 mov eax,dword ptr [rsi+rcx*4]
00007ff6`6ede118b add rax,r10
00007ff6`6ede118e je 00007ff6`6ede10cd
00007ff6`6ede1194 lea rcx,[rsp+10h]
00007ff6`6ede1199 xor r9d,r9d
00007ff6`6ede119c mov qword ptr [rsp+48h],rcx
00007ff6`6ede11a1 lea rdx,[rsp]
00007ff6`6ede11a5 lea rcx,[rsp+70h]
00007ff6`6ede11aa add rcx,10h
00007ff6`6ede11ae xor r8d,r8d
00007ff6`6ede11b1 mov qword ptr [rsp+40h],rcx
00007ff6`6ede11b6 xor ecx,ecx
00007ff6`6ede11b8 mov qword ptr [rsp+38h],rbp
00007ff6`6ede11bd mov qword ptr [rsp+30h],rbp
00007ff6`6ede11c2 mov dword ptr [rsp+28h],ebp
00007ff6`6ede11c6 mov dword ptr [rsp+20h],ebp
00007ff6`6ede11ca call rax
00007ff6`6ede11cc xor eax,eax
00007ff6`6ede11ce jmp 00007ff6`6ede10d2
| 37.469388 | 53 | 0.74183 |
9dd72cf222254d03f5f09c2d30cd1bfe5c40cafa | 244 | asm | Assembly | programs/oeis/010/A010696.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/010/A010696.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/010/A010696.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A010696: Periodic sequence: Repeat 2,6.
; 2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2
mod $0,2
pow $1,$0
gcd $1,3
mul $1,2
| 30.5 | 163 | 0.540984 |
9dee11a9e7413ce6d6e3096c85a4f468948df24d | 1,990 | asm | Assembly | dynamorio/clients/drcpusim/tests/sse3.asm | andre-motta/Project3Compilers | fa366d93ec8d49768fbc86f0c1431391822baf12 | [
"MIT"
] | 107 | 2021-08-28T20:08:42.000Z | 2022-03-22T08:02:16.000Z | dynamorio/clients/drcpusim/tests/sse3.asm | andre-motta/Project3Compilers | fa366d93ec8d49768fbc86f0c1431391822baf12 | [
"MIT"
] | 1 | 2021-06-01T12:10:25.000Z | 2021-06-01T12:10:25.000Z | dynamorio/clients/drcpusim/tests/sse3.asm | andre-motta/Project3Compilers | fa366d93ec8d49768fbc86f0c1431391822baf12 | [
"MIT"
] | 16 | 2021-08-30T06:57:36.000Z | 2022-03-22T08:05:52.000Z | /* **********************************************************
* Copyright (c) 2015 Google, Inc. All rights reserved.
* **********************************************************/
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Google, Inc. nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL VMWARE, INC. OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGE.
*/
#include "configure.h"
#include "../../../core/unix/include/syscall.h"
.global _start
_start:
// MMX instr
emms
// SSE instr
addps xmm0, xmm1
// SSE2 instr
pavgb xmm0, xmm1
// SSE3 instr
haddps xmm0, xmm1
// exit
mov eax, SYS_exit
int 0x80
| 39.8 | 78 | 0.68191 |
6fec5da8b91c6d6ea4ca41b1f96d8737fb9b3d15 | 154 | asm | Assembly | libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sccz80/esx_f_rmdir.asm | Toysoft/z88dk | f930bef9ac4feeec91a07303b79ddd9071131a24 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sccz80/esx_f_rmdir.asm | Toysoft/z88dk | f930bef9ac4feeec91a07303b79ddd9071131a24 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sccz80/esx_f_rmdir.asm | Toysoft/z88dk | f930bef9ac4feeec91a07303b79ddd9071131a24 | [
"ClArtistic"
] | null | null | null | ; unsigned char esx_f_rmdir(unsigned char *pathname)
SECTION code_esxdos
PUBLIC esx_f_rmdir
EXTERN asm_esx_f_rmdir
defc esx_f_rmdir = asm_esx_f_rmdir
| 15.4 | 52 | 0.837662 |
6c2f4d9c55c236429ce11d57e95757ca8e20bbe7 | 617 | asm | Assembly | programs/oeis/110/A110591.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/110/A110591.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/110/A110591.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A110591: Number of digits in base-4 representation of n.
; 1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4
lpb $0,$0
div $0,4
add $2,1
lpe
mov $1,$2
add $1,1
| 61.7 | 501 | 0.523501 |
3925f7c1bd60d1b8d77ded53b48a2e9856ff55eb | 412 | asm | Assembly | programs/oeis/118/A118525.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/118/A118525.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/118/A118525.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A118525: Start with 1 and repeatedly reverse the digits and add 6 to get the next term.
; 1,7,13,37,79,103,307,709,913,325,529,931,145,547,751,163,367,769,973,385,589,991,205,508,811,124,427,730,43,40,10,7,13,37,79,103,307,709,913,325,529,931,145,547,751,163,367,769,973,385,589,991
mov $2,$0
mov $0,1
lpb $2
seq $0,4086 ; Read n backwards (referred to as R(n) in many sequences).
add $0,6
sub $2,1
lpe
| 37.454545 | 194 | 0.699029 |
4da2ca7b58a6ada2f770de980d829d90a4a2354f | 5,270 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_804.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_804.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_21829_804.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r15
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xca5c, %r15
nop
nop
nop
nop
and $23025, %rcx
movb (%r15), %r8b
nop
cmp %r15, %r15
lea addresses_WT_ht+0xff5c, %rcx
nop
dec %r8
mov (%rcx), %r13w
nop
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_WT_ht+0x19e5c, %rsi
lea addresses_UC_ht+0xb6dc, %rdi
nop
nop
nop
xor $13442, %r8
mov $9, %rcx
rep movsw
nop
nop
nop
nop
cmp %r13, %r13
lea addresses_normal_ht+0x1065c, %rdi
nop
nop
inc %rax
mov (%rdi), %r13
add $38274, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r15
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r12
push %r15
push %rbp
push %rdx
// Store
lea addresses_A+0xb65c, %r12
dec %rdx
movb $0x51, (%r12)
nop
nop
nop
nop
nop
add $55947, %r12
// Store
mov $0x43ea920000000f5c, %rdx
nop
nop
nop
nop
sub %rbp, %rbp
mov $0x5152535455565758, %r10
movq %r10, (%rdx)
cmp %r11, %r11
// Faulty Load
lea addresses_WT+0x825c, %rbp
nop
nop
nop
sub %r10, %r10
mov (%rbp), %r15
lea oracles, %r11
and $0xff, %r15
shlq $12, %r15
mov (%r11,%r15,1), %r15
pop %rdx
pop %rbp
pop %r15
pop %r12
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': True, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A'}}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_NC'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'AVXalign': True, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 42.845528 | 2,999 | 0.656736 |
d972b3d37d3e632855c6471e26781e0b98860bc2 | 5,622 | asm | Assembly | StandardHandlesLab/StandardHandlesLab/Debug/StandardHandleState.asm | txwizard/DLLServices2 | 647e27fdc00a89fa249d47d13d95405cea34cf30 | [
"BSD-3-Clause"
] | 1 | 2017-08-19T22:03:26.000Z | 2017-08-19T22:03:26.000Z | StandardHandlesLab/StandardHandlesLab/Debug/StandardHandleState.asm | txwizard/DLLServices2 | 647e27fdc00a89fa249d47d13d95405cea34cf30 | [
"BSD-3-Clause"
] | 1 | 2016-06-17T00:55:37.000Z | 2016-06-17T00:55:37.000Z | StandardHandlesLab/StandardHandlesLab/Debug/StandardHandleState.asm | txwizard/DLLServices2 | 647e27fdc00a89fa249d47d13d95405cea34cf30 | [
"BSD-3-Clause"
] | null | null | null | ; Listing generated by Microsoft (R) Optimizing Compiler Version 18.00.31101.0
TITLE C:\Users\DAVE\Documents\Visual Studio 2013\Projects\WizardWrx_Libs\DLLServices2\StandardHandlesLab\StandardHandlesLab\StandardHandleState.C
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES
_DATA SEGMENT
_dwStdConsoleHandleIDs DD 0ffffffffH
DD 0fffffff6H
DD 0fffffff5H
DD 0fffffff4H
DD 0ffffffffH
_DATA ENDS
PUBLIC _SHS_StandardHandleState@4
EXTRN __imp__GetStdHandle@4:PROC
EXTRN __imp__GetLastError@0:PROC
EXTRN __imp__SetLastError@4:PROC
EXTRN __imp__GetConsoleMode@8:PROC
EXTRN @_RTC_CheckStackVars@8:PROC
EXTRN __RTC_CheckEsp:PROC
EXTRN __RTC_InitBase:PROC
EXTRN __RTC_Shutdown:PROC
; COMDAT rtc$TMZ
rtc$TMZ SEGMENT
__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
rtc$IMZ ENDS
; Function compile flags: /Odtp /RTCsu /ZI
; File c:\users\dave\documents\visual studio 2013\projects\wizardwrx_libs\dllservices2\standardhandleslab\standardhandleslab\standardhandlestate.c
; COMDAT _SHS_StandardHandleState@4
_TEXT SEGMENT
tv64 = -220 ; size = 4
_dwModde$ = -20 ; size = 4
_hThis$ = -8 ; size = 4
_penmStdHandleID$ = 8 ; size = 4
_SHS_StandardHandleState@4 PROC ; COMDAT
; 97 : {
push ebp
mov ebp, esp
sub esp, 220 ; 000000dcH
push ebx
push esi
push edi
lea edi, DWORD PTR [ebp-220]
mov ecx, 55 ; 00000037H
mov eax, -858993460 ; ccccccccH
rep stosd
; 98 : HANDLE hThis ; // The first use of this variable initializes it.
; 99 : DWORD dwModde ; // The first use of this variable initializes it, AND it's a throwaway.
; 100 :
; 101 : switch ( penmStdHandleID )
mov eax, DWORD PTR _penmStdHandleID$[ebp]
mov DWORD PTR tv64[ebp], eax
cmp DWORD PTR tv64[ebp], 0
je SHORT $LN9@SHS_Standa
cmp DWORD PTR tv64[ebp], 0
jle $LN1@SHS_Standa
cmp DWORD PTR tv64[ebp], 3
jle SHORT $LN8@SHS_Standa
jmp $LN1@SHS_Standa
$LN9@SHS_Standa:
; 102 : {
; 103 : case SHS_UNDEFINED : // Argument penmStdHandleID is uninitialized.
; 104 : return SHS_UNDETERMINABLE;
xor eax, eax
jmp $LN12@SHS_Standa
$LN8@SHS_Standa:
; 105 :
; 106 : case SHS_INPUT :
; 107 : case SHS_OUTPUT :
; 108 : case SHS_ERROR :
; 109 : if ( ( hThis = GetStdHandle ( dwStdConsoleHandleIDs [ ( int ) penmStdHandleID ] ) ) != INVALID_HANDLE_VALUE )
mov esi, esp
mov eax, DWORD PTR _penmStdHandleID$[ebp]
mov ecx, DWORD PTR _dwStdConsoleHandleIDs[eax*4]
push ecx
call DWORD PTR __imp__GetStdHandle@4
cmp esi, esp
call __RTC_CheckEsp
mov DWORD PTR _hThis$[ebp], eax
cmp DWORD PTR _hThis$[ebp], -1
je SHORT $LN7@SHS_Standa
; 110 : {
; 111 : if ( GetConsoleMode ( hThis , &dwModde ) )
mov esi, esp
lea eax, DWORD PTR _dwModde$[ebp]
push eax
mov ecx, DWORD PTR _hThis$[ebp]
push ecx
call DWORD PTR __imp__GetConsoleMode@8
cmp esi, esp
call __RTC_CheckEsp
test eax, eax
je SHORT $LN6@SHS_Standa
; 112 : {
; 113 : return SHS_ATTACHED;
mov eax, 1
jmp SHORT $LN12@SHS_Standa
; 114 : } // TRUE (Handle is attached to its console.) block, if ( GetConsoleMode ( hThis , &dwModde ) )
; 115 : else
jmp SHORT $LN5@SHS_Standa
$LN6@SHS_Standa:
; 116 : {
; 117 : if ( GetLastError ( ) == ERROR_INVALID_HANDLE )
mov esi, esp
call DWORD PTR __imp__GetLastError@0
cmp esi, esp
call __RTC_CheckEsp
cmp eax, 6
jne SHORT $LN4@SHS_Standa
; 118 : {
; 119 : SetLastError ( ERROR_SUCCESS );
mov esi, esp
push 0
call DWORD PTR __imp__SetLastError@4
cmp esi, esp
call __RTC_CheckEsp
; 120 : return SHS_REDIRECTED;
mov eax, 2
jmp SHORT $LN12@SHS_Standa
; 121 : } // TRUE (anticipated outcome) block, if ( GetLastError ( ) == ERROR_INVALID_HANDLE )
; 122 : else
jmp SHORT $LN5@SHS_Standa
$LN4@SHS_Standa:
; 123 : {
; 124 : return SHS_SYSTEM_ERROR;
mov eax, 3
jmp SHORT $LN12@SHS_Standa
$LN5@SHS_Standa:
; 125 : } // FALSE (UNanticipated outcome) block, if ( GetLastError ( ) == ERROR_INVALID_HANDLE )
; 126 : } // FALSE (Handle is redirected from its console into a file or pipe.) block, if ( GetConsoleMode ( hThis , &dwModde ) )
; 127 : } // TRUE (anticipated outcome) block, if ( ( hThis = GetStdHandle ( dwStdConsoleHandleIDs [ ( int ) penmStdHandleID ] ) ) != INVALID_HANDLE_VALUE )
; 128 : else
jmp SHORT $LN1@SHS_Standa
$LN7@SHS_Standa:
; 129 : {
; 130 : return SHS_SYSTEM_ERROR;
mov eax, 3
jmp SHORT $LN12@SHS_Standa
$LN1@SHS_Standa:
; 131 : } // FALSE (UNanticipated outcome) block, if ( ( hThis = GetStdHandle ( dwStdConsoleHandleIDs [ ( int ) penmStdHandleID ] ) ) != INVALID_HANDLE_VALUE )
; 132 :
; 133 : default: // Argument penmStdHandleID is out of range.
; 134 : return SHS_SYSTEM_ERROR;
mov eax, 3
$LN12@SHS_Standa:
; 135 : } // switch ( penmStdHandleID )
; 136 : } // SHS_HANDLE_STATE SHS_STANDARDHANDLESTATE_API SHS_StandardHandleState
push edx
mov ecx, ebp
push eax
lea edx, DWORD PTR $LN16@SHS_Standa
call @_RTC_CheckStackVars@8
pop eax
pop edx
pop edi
pop esi
pop ebx
add esp, 220 ; 000000dcH
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 4
npad 1
$LN16@SHS_Standa:
DD 1
DD $LN15@SHS_Standa
$LN15@SHS_Standa:
DD -20 ; ffffffecH
DD 4
DD $LN14@SHS_Standa
$LN14@SHS_Standa:
DB 100 ; 00000064H
DB 119 ; 00000077H
DB 77 ; 0000004dH
DB 111 ; 0000006fH
DB 100 ; 00000064H
DB 100 ; 00000064H
DB 101 ; 00000065H
DB 0
_SHS_StandardHandleState@4 ENDP
_TEXT ENDS
END
| 24.986667 | 163 | 0.694771 |
19b85445124cc9120522c614a6bde7a1e3eec7ab | 10,917 | asm | Assembly | Hardware/tikeyboard.asm | Martin-H1/6502 | e57e4b71d44e8cccfb5ba7e1d31db8d59e3e02a6 | [
"MIT"
] | 3 | 2020-05-10T02:45:52.000Z | 2020-08-27T19:30:21.000Z | Hardware/tikeyboard.asm | Martin-H1/6502 | e57e4b71d44e8cccfb5ba7e1d31db8d59e3e02a6 | [
"MIT"
] | null | null | null | Hardware/tikeyboard.asm | Martin-H1/6502 | e57e4b71d44e8cccfb5ba7e1d31db8d59e3e02a6 | [
"MIT"
] | null | null | null | ; -----------------------------------------------------------------------------
; Driver for TI 99/4a keyboard. This 80's era keyboard has an 8x8 matrix and
; new old stock is ocasionally available on eBay. This code originated from
; Simon Jansen's Orwell computer project and he graciously gave me his code.
; Martin Heermance <mheermance@gmail.com>
; -----------------------------------------------------------------------------
.scope
;
; Aliases
;
.alias _viaOutDdr 0
.alias _viaInDdr 0
.alias _viaOut 0
.alias _viaIn 0
;
; Data segments
;
.data ZPDATA
.data BSS
.space _keyBuffer 1 ; Keyboard port buffer.
.space _keyCol 1 ; Current keyboard scan column.
.space _keyCounter 1 ; Key debounce counter.
.space _keyData 1 ; Debounced key value available for users.
.space _keyLastKey 1 ; Last value of key pressed
.space _keyPressed 1 ; Key pressed (as found in the lookup table).
.space _keyRow 1 ; Current keyboard scan row.
.space _keyStatus 1 ; bit 0 = funct, 1 = ctrl, 2 = shift, 3 = lock
.text
;
; Functions
;
keyboardInit:
lda #$00 ; Load ACC with b00000000.
sta _viaInDdr ; Set VIA port to all input.
lda #$FF ; Load ACC with b11111111.
sta _viaOutDdr ; Set VIA port to all output.
; Keyboard reading initialisation.
lda #$19 ; Set the debounce counter.
sta _keyCounter ; And store it.
lda #$00 ; Zero out all static data.
sta _keyLastKey ; Set the last key pressed value.
sta _keyData ; Set the data buffer
sta _keyPressed ; Set the key_pressed buffer.
sta _keyStatus ; Set the status.
rts
;
; Keyboard routine. This routine will set the data available flag in the
; _keyStatus register and return data in the _keyData variable when valid data
; is available from the keyboard. This routine scans the matrix by calling
; the matrix_scan routine then handles debouncing of the value.
;
keyboardScan:
txa ; Preserve X.
pha
tya ; Preserve Y.
pha
php ; Preserve status register.
jsr _matrixScan ; Scan the matrix.
lda _keyPressed ; Compare detected key to the last key pressed.
cmp _keyLastKey ; Is this key different?
bne _keyChange ; The keys are different so it's changing
; It's the same.
lda _keyCounter ; If the counter is already at zero this is the same keypress.
beq _KeyScanDone ; If it's zero we don't do anything.
dec _keyCounter ; Otherwise decrement the debounce counter.
beq _keyDebounced ; If it's zero now we have a valid key reading.
jmp _keyScanDone
_keyChange:
lda #19 ; Reset the counter.
sta _keyCounter ; And store it.
lda _keyPressed ; Update the last key pressed value with this new value.
sta _keyLastKey
jmp _keyScanDone
_keyDebounced: ; A valid key reading was detected.
lda _keyPressed ; Load up the key pressed.
beq _keyScanDone ; If it was zero (no key pressed) we're done.
sta _keyData ; Make it available now in the data.
lda #$80 ; Set the new data available bit.
ora _keyStatus
sta _keyStatus ; Store it in the status.
_keyScanDone:
plp ; Restore status.
pla ; Restore Y.
tay
pla ; Restore X.
tax
rts
; =============================================================================
; Keyboard matrix scan routine. The key_status (bit 6) will indicate if there
; is a key currently pressed. It also indicated if the function, control,
; shift or alpha lock were on (bits 0, 1, 2 and 3)
; There are 7 rows (0-6) and 8 columns.
; Shift, control and function are on row 0. Alpha is on row 6. We handle
; these as special cases.
; The pressed key is returned in _keyPressed.
; =============================================================================
_matrixScan:
lda #$00 ; Load ACC with 0.
sta _keyBuffer ; Clear the keyboard character buffer.
sta _keyPressed ; Clear the key pressed buffer.
lda #$80 ; Load ACC with 10000000.
and _keyStatus ; Clear the bottom 7 bits of the status.
sta _keyStatus ; Store it in the status.
_matrixScanSpecial:
ldx #$00 ; Read row 0. Row zero is a special case as
; it has the shift, control and function keys.
txa ; Move the row counter to the accumulator.
sta _viaOut ; Push it to the output VIA to select the row.
lda _viaIn ; Read VIA input for column data.
eor #$FF ; XOR to get set bits (keys active low).
beq _matrixScanAlpha ; If zero no keys are being pressed on this row.
; Just go straight to the next row.
sta _keyBuffer ; Some key(s) pressed. Store the port in our temp holder.
lda #$07 ; Check if the special keys are pressed.
; Set up mask for the special keys.
and _keyBuffer
ora _keyStatus ; Now set those bits in the status register.
sta _keyStatus ; Store it in the status.
lda #$E0 ; Now mask off the normal keys and check them.
and _keyBuffer
sta _keyBuffer ; Store it in the buffer.
_matrixScanAlpha:
ldx #$06 ; The alpha key on row 6 is also a special case.
txa ; Move the row counter to the accumulator.
sta _viaOut ; Push it to the output VIA to select the row.
lda _viaIn ; Read VIA input for column data.
eor #$FF ; XOR to get set bits (keys active low).
beq _matrixScanRows ; If this is non zero the alpha key is pressed.
lda #$08 ; Set the alpha bit.
ora _keyStatus
sta _keyStatus ; Store it in the status.
_matrixScanRows:
ldx #$00 ; Reset X back to the first row.
ldy #$00 ; Use Y as the column counter.
_matrixScanCol:
lda #$80 ; Load mask to check the data bit of the buffer.
and _keyBuffer ; is set to see if key was pressed.
beq _matrixScanColNext ; Branch if zero since that key wasn't pressed.
lda #$40 ; It's set. Check if we already have a key
; pressed. Test bit 6 of the keyboard status.
and _keyStatus ; AND with the keyboard status to test the bit.
beq _matrixScanColData ; If zero, it's not set, process this new key.
_matrixScanInvalid: ; It's already set so we have an invalid state.
lda #$BF ; Clear the key pressed flag.
and _keyStatus
sta _keyStatus ; Set the status.
jmp _matrixScanDone ; Now finish since it was invalid.
_matrixScanColData:
lda #$40 ; Set the key pressed bit.
ora _keyStatus
sta _keyStatus ; Store it in the status.
stx _keyRow ; Remember the row.
sty _keyCol ; Remember the column.
_matrixScanColNext:
clc ; Clear the carry flag.
rol _keyBuffer ; Rotate buffer left to check the next column.
iny ; Increment the column count.
cpy #$08 ; Have we done all eight columns?
bne _matrixScanCol ; Zero set if equal when we've done all eight.
_matrixScanRowNext:
inx ; Go onto the next row.
cpx #$06 ; Have we done all remaining six rows?
beq _matrixScanRowsDone
txa ; No, move row counter to ACC and read next row.
sta _viaOut ; Push it to the output VIA to select the row.
lda _viaIn ; Read VIA input for column data.
eor #$FF ; XOR to get set bits (keys active low).
beq _matrixScanRowNext ; If zero no keys are being pressed on this row.
; Just go straight to the next row.
sta _keyBuffer ; Some key(s) pressed. Store in our buffer.
ldy #$00 ; Use Y as the column counter.
jmp _matrixScanCol ; Check the columns for this row.
_matrixScanRowsDone:
lda #$40 ; Check if the data flag is set.
and _keyStatus ; AND with the keyboard status to test the bit.
beq _matrixScanDone ; If zero we have no keys pressed so can finish.
_matrixScanShift: ; Add to row counter for special keys pressed.
lda #$04 ; Check shift first.
bit _keyStatus ; Bit three in _keyStatus.
beq _matrixScanCtrl ; Shift not pressed so test control next.
lda #$06 ; Shift was pressed so add 6 to the row count.
clc ; Clear carry flag.
adc _keyRow ; Add to the row count.
sta _keyRow ; Store the result.
jmp _matrixScanLookup ; Now go look up the key.
_matrixScanCtrl:
lda #$02 ; Check control next.
bit _keyStatus ; Bit 2 in _keyStatus.
beq _matrixScanFctn ; Control not pressed so test function next.
lda #$0C ; Control was pressed so add 12 to row count.
clc
adc _keyRow ; Add to the row count.
sta _keyRow ; Store the result.
jmp _matrixScanLookup ; Now go look up the key.
_matrixScanFctn:
lda #$01 ; Finally check function.
bit _keyStatus ; Bit one in _keyStatus.
beq _matrixScanLookup ; Function not pressed so go lookup the key.
lda #$12 ; Function was pressed so add 18 to row count.
clc ; Clear carry flag.
adc _keyRow ; Add to the row count.
sta _keyRow ; Store the result.
_matrixScanLookup: ; Now lookup the actual character.
lda _keyRow ; Get the row.
clc ; Clear the carry flag.
rol ; Multiple the row counter by 8 (by using rol).
clc
rol ; x4
clc
rol ; x8
clc
adc _keyCol ; Add the column to get offset into the table.
tax ; Transfer it into X.
lda _keyboardMap,x ; Use as offset into table. Add offset to
; table address to convert scan code into
; ASCII character in the accumulator.
sta _keyPressed ; Store the new character.
lda #$08 ; Check if Alpha is on.
bit _keyStatus ; Bit four in _keyStatus.
beq _matrixScanDone ; Alpha not pressed so just store the key.
; $61 = a .. $7A = z.
lda _keyPressed
cmp #$61 ; Alpha pressed, upper case lower case letters.
bcc _matrixScanDone ; Less than $61.
cmp #$7B
bcs _matrixScanDone ; More than than $7A.
and #$DF ; Make upper case.
sta _keyPressed ; Store the new character.
_matrixScanDone:
lda #$00 ; Reset the VIA port to all zero.
sta _viaOut
rts
; =============================================================================
; Keyboard map.
; The keyboard is 48 keys mapped as 7 rows by 8 columns.
; There are four parts to the table for normal and shifted keys, control
; and function keys.
; =============================================================================
_keyboardMap:
_keyboardMapRowN0: .BYTE "=", $20, $0D, 0, 0, 0, 0, 0 ;$20 = SPACE, $0D = CR
_keyboardMapRowN1: .BYTE "nhy6bgt5"
_keyboardMapRowN2: .BYTE "mju7vfr4"
_keyboardMapRowN3: .BYTE ",ki8cde3"
_keyboardMapRowN4: .BYTE ".lo9xsw2"
_keyboardMapRowN5: .BYTE "/;p0zaq1"
_keyboardMapRowS0: .BYTE "+", $20, $0D, 0, 0, 0, 0, 0 ;$20 = SPACE, $0D = CR
_keyboardMapRowS1: .BYTE "NHY^BGT%"
_keyboardMapRowS2: .BYTE "MJU&VFR$"
_keyboardMapRowS3: .BYTE "<KI*CDE#"
_keyboardMapRowS4: .BYTE ">LO(XSW@"
_keyboardMapRowS5: .BYTE "-:P)ZAQ!"
_keyboardMapRowC0: .BYTE "=", $20, $0D, 0, 0, 0, 0, 0 ;$20 = SPACE, $0D = CR
_keyboardMapRowC1: .BYTE "nhy6b", $07, "t5" ;$07 = CTRL-G (bell)
_keyboardMapRowC2: .BYTE "mju7vfr4"
_keyboardMapRowC3: .BYTE ",ki8", $03, "de3" ;$03 = CTRL-C
_keyboardMapRowC4: .BYTE ".lo9xsw2"
_keyboardMapRowC5: .BYTE "/;p0zaq1"
_keyboardMapRowF0: .BYTE "=", $20, $0D, 0, 0, 0, 0, 0 ;$20 = SPACE, $0D = CR
_keyboardMapRowF1: .BYTE "nhy6b}]5"
_keyboardMapRowF2: .BYTE "mj_7v{[4"
_keyboardMapRowF3: .BYTE ",k?8`", $09, $1B, "3" ; $09 = TAB, $1B = ESC
_keyboardMapRowF4: .BYTE ".l'9", $0A, $08, "~2" ; $0A = LF, $08 = BS
_keyboardMapRowF5: .BYTE "/;", $22, "0\|q1" ; $22 = DOUBLE QUOTE
.scend
| 36.634228 | 80 | 0.676101 |
d3edb2ab76f0ec4e4d200c349f4511c05dd50cbd | 1,634 | asm | Assembly | programs/oeis/195/A195015.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/195/A195015.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/195/A195015.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A195015: Main axis of the square spiral whose edges have length A195013 and whose vertices are the numbers A195014.
; 0,2,12,24,44,66,96,128,168,210,260,312,372,434,504,576,656,738,828,920,1020,1122,1232,1344,1464,1586,1716,1848,1988,2130,2280,2432,2592,2754,2924,3096,3276,3458,3648,3840,4040,4242,4452,4664,4884,5106,5336,5568,5808,6050,6300,6552,6812,7074,7344,7616,7896,8178,8468,8760,9060,9362,9672,9984,10304,10626,10956,11288,11628,11970,12320,12672,13032,13394,13764,14136,14516,14898,15288,15680,16080,16482,16892,17304,17724,18146,18576,19008,19448,19890,20340,20792,21252,21714,22184,22656,23136,23618,24108,24600,25100,25602,26112,26624,27144,27666,28196,28728,29268,29810,30360,30912,31472,32034,32604,33176,33756,34338,34928,35520,36120,36722,37332,37944,38564,39186,39816,40448,41088,41730,42380,43032,43692,44354,45024,45696,46376,47058,47748,48440,49140,49842,50552,51264,51984,52706,53436,54168,54908,55650,56400,57152,57912,58674,59444,60216,60996,61778,62568,63360,64160,64962,65772,66584,67404,68226,69056,69888,70728,71570,72420,73272,74132,74994,75864,76736,77616,78498,79388,80280,81180,82082,82992,83904,84824,85746,86676,87608,88548,89490,90440,91392,92352,93314,94284,95256,96236,97218,98208,99200,100200,101202,102212,103224,104244,105266,106296,107328,108368,109410,110460,111512,112572,113634,114704,115776,116856,117938,119028,120120,121220,122322,123432,124544,125664,126786,127916,129048,130188,131330,132480,133632,134792,135954,137124,138296,139476,140658,141848,143040,144240,145442,146652,147864,149084,150306,151536,152768,154008,155250
mov $1,5
mul $1,$0
add $1,2
mul $1,$0
div $1,4
mul $1,2
| 163.4 | 1,458 | 0.815177 |
cd61251e7ac7a5f6424b92f11e6e08ebb9e6072c | 762 | asm | Assembly | _9stars.asm | pyweeker/stack_and_regs | 2528aa8d00e08d990981f36f7f76a63101fef78f | [
"MIT"
] | null | null | null | _9stars.asm | pyweeker/stack_and_regs | 2528aa8d00e08d990981f36f7f76a63101fef78f | [
"MIT"
] | null | null | null | _9stars.asm | pyweeker/stack_and_regs | 2528aa8d00e08d990981f36f7f76a63101fef78f | [
"MIT"
] | null | null | null | section .text
global _start ;must be declared for linker (gcc) https://www.tutorialspoint.com/assembly_programming/assembly_registers.htm
_start: ;tell linker entry point
mov rdx,len ;message length
debug rcx,msg ;message to write
mov rbx,11 ;file descriptor (stdout)
mov rax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov rdx,9 ;message length
mov rcx,s2 ;message to write
mov rbx,1 ;file descriptor (stdout)
mov rax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov rax,111 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
msg db 'Displaying 9 stars',0xa ;a message
len equ $ - msg ;length of message
s2 times 9 db '*'
| 31.75 | 135 | 0.669291 |
be702216e7455bc38bc95f392f5a007b26296db6 | 8,524 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_sm_/i7-7700_9_0x48.log_21829_2463.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.log_21829_2463.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.log_21829_2463.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 %r8
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1004a, %r14
nop
nop
nop
nop
and %r10, %r10
movups (%r14), %xmm7
vpextrq $1, %xmm7, %r8
nop
nop
nop
nop
dec %rbx
lea addresses_D_ht+0xd6fa, %r9
xor $38042, %r14
mov $0x6162636465666768, %r13
movq %r13, (%r9)
nop
lfence
lea addresses_WC_ht+0x507a, %r8
nop
and %rax, %rax
movups (%r8), %xmm7
vpextrq $1, %xmm7, %r9
nop
nop
nop
cmp $49703, %r8
lea addresses_A_ht+0x100fa, %rbx
nop
xor $28934, %r13
movb (%rbx), %r8b
nop
add $43982, %r8
lea addresses_normal_ht+0x697a, %rbx
nop
nop
nop
nop
nop
cmp $17253, %r9
mov $0x6162636465666768, %r8
movq %r8, %xmm4
movups %xmm4, (%rbx)
nop
sub $25688, %r9
lea addresses_WC_ht+0x4884, %rsi
lea addresses_WT_ht+0x1efa, %rdi
nop
sub %r13, %r13
mov $9, %rcx
rep movsw
nop
nop
nop
nop
add %rbx, %rbx
lea addresses_A_ht+0x1df7a, %rbx
nop
nop
nop
nop
dec %r8
mov (%rbx), %di
nop
nop
nop
and %rdi, %rdi
lea addresses_D_ht+0xd8fa, %rsi
lea addresses_UC_ht+0x2a10, %rdi
nop
nop
nop
sub %r10, %r10
mov $107, %rcx
rep movsw
nop
nop
xor $1976, %r8
lea addresses_A_ht+0xa40a, %rsi
lea addresses_UC_ht+0x492a, %rdi
nop
nop
nop
dec %r9
mov $1, %rcx
rep movsq
nop
nop
nop
add $9653, %rax
lea addresses_WC_ht+0x168fa, %rdi
clflush (%rdi)
sub %r10, %r10
movb $0x61, (%rdi)
xor %rax, %rax
lea addresses_D_ht+0x24fa, %rsi
lea addresses_A_ht+0x149fa, %rdi
nop
nop
nop
and $51638, %r8
mov $96, %rcx
rep movsl
nop
nop
nop
add $52295, %rcx
lea addresses_normal_ht+0xbd6f, %rsi
nop
nop
nop
sub %r8, %r8
movb $0x61, (%rsi)
nop
and %r13, %r13
lea addresses_normal_ht+0x19bfa, %rsi
lea addresses_UC_ht+0x1cb7a, %rdi
nop
nop
nop
nop
cmp %r14, %r14
mov $122, %rcx
rep movsl
nop
nop
nop
nop
cmp $39564, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r13
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r9
push %rax
push %rbx
push %rcx
push %rdx
push %rsi
// Load
lea addresses_WC+0x130fa, %r9
nop
sub $64786, %rcx
mov (%r9), %r10
nop
cmp %rax, %rax
// Store
lea addresses_US+0x196a, %rdx
nop
cmp %rbx, %rbx
mov $0x5152535455565758, %rax
movq %rax, (%rdx)
nop
nop
and %rdx, %rdx
// Store
lea addresses_UC+0xd85a, %rbx
nop
nop
nop
xor $43537, %r9
movw $0x5152, (%rbx)
nop
nop
sub $10789, %rdx
// Store
lea addresses_WC+0x130fa, %r10
nop
nop
nop
add $39539, %rdx
mov $0x5152535455565758, %rcx
movq %rcx, (%r10)
nop
nop
nop
sub %r9, %r9
// Store
lea addresses_D+0x195f2, %rcx
nop
sub $17267, %r9
mov $0x5152535455565758, %r10
movq %r10, %xmm1
movups %xmm1, (%rcx)
nop
nop
nop
add %r10, %r10
// Faulty Load
lea addresses_WC+0x130fa, %rbx
nop
nop
cmp %r9, %r9
mov (%rbx), %ax
lea oracles, %rcx
and $0xff, %rax
shlq $12, %rax
mov (%rcx,%rax,1), %rax
pop %rsi
pop %rdx
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': True, 'congruent': 4, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 9, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 7, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 7, 'same': False}}
{'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
*/
| 32.045113 | 2,999 | 0.65298 |
23c647d64881201958029b1af206c45399d21c10 | 8,286 | asm | Assembly | menu.asm | Waynocs/Bobs_Game_ASM | 5ed969d653f53752abc2b97ffbd94e98fd4bb792 | [
"MIT"
] | null | null | null | menu.asm | Waynocs/Bobs_Game_ASM | 5ed969d653f53752abc2b97ffbd94e98fd4bb792 | [
"MIT"
] | null | null | null | menu.asm | Waynocs/Bobs_Game_ASM | 5ed969d653f53752abc2b97ffbd94e98fd4bb792 | [
"MIT"
] | null | null | null | TITLE DISPLAY - programme prototype
.286
SSEG SEGMENT STACK
DB 32 DUP("STACK---")
SSEG ENDS
DSEG SEGMENT
PLAY DB "Play :"
L_PLAY EQU $-PLAY
EXIT DB "Exit (press E)"
L_EXIT EQU $-EXIT
NIV1 DB "Level 1 (press P)"
L_NIV1 EQU $-NIV1
NIV2 DB "Level 2 (press space)"
L_NIV2 EQU $-NIV2
MIAOU DB "HELP (press H)"
L_MIAOU EQU $-MIAOU
HELP DB "Binome: SERANO Waian - FROLIGER Robin"
L_HELP EQU $-HELP
RETOUR DB "Return (press A)"
L_RETOUR EQU $-RETOUR
TOUCHE DB "Touch: use the arrow keys"
L_TOUCHE EQU $-TOUCHE
REGLE DB "Rule: don't touch the walls"
L_REGLE EQU $-REGLE
DSEG ENDS
CSEG SEGMENT 'CODE'
ASSUME CS:CSEG, DS:DSEG, ES:CSEG
%include function.asm
%include Niveau.asm
MAIN PROC FAR
PUSH DS
PUSH 0
affichermenu:
mov AX, 0A000h
mov ES, AX ; Beginning of VGA memory in segment 0xA000
mov AX, 13h ; Mode VGA de l'affichage
int 10h
MOV AX, DSEG
MOV DS, AX
mov BH, 0 ; page actuelle
mov DL, 1 ; collonne actuelle
mov DH, 1 ; ligne actuelle
mov AH, 02 ; on change la position du curseur
int 10h ; et on affiche
MOV BX, 0001H
LEA DX, MIAOU
MOV CX, L_MIAOU
MOV AH, 40H
INT 21H
MOV AX, DSEG
MOV DS, AX
mov BH, 0 ; page actuelle
mov DL, 15 ; collonne actuelle
mov DH, 5 ; ligne actuelle
mov AH, 02 ; on change la position du curseur
int 10h ; et on affiche
MOV BX, 0001H
LEA DX, PLAY
MOV CX, L_PLAY
MOV AH, 40H
INT 21H
;---------------
MOV AX, DSEG
MOV DS, AX
mov BH, 0 ; page actuelle
mov DL, 10 ; collonne actuelle
mov DH, 9 ; ligne actuelle
mov AH, 02 ; on change la position du curseur
int 10h ; et on affiche
MOV BX, 0001H
LEA DX, NIV1
MOV CX, L_NIV1
MOV AH, 40H
INT 21H
;---------------
MOV AX, DSEG
MOV DS, AX
mov BH, 0 ; page actuelle
mov DL, 8 ; collonne actuelle
mov DH, 13 ; ligne actuelle
mov AH, 02 ; on change la position du curseur
int 10h ; et on affiche
MOV BX, 0001H
LEA DX, NIV2
MOV CX, L_NIV2
MOV AH, 40H
INT 21H
;---------------
mov BH, 0 ; page actuelle
mov DL, 11 ; collonne actuelle
mov DH, 18 ; ligne actuelle
mov AH, 02 ; on change la position du curseur
int 10h ; et on affiche
MOV BX, 0001H
LEA DX, EXIT
MOV CX, L_EXIT
MOV AH, 40H
INT 21H
;soulignement Play : ----------------------------------------------------------------------
mov AL, 13
mov CX, 120 ; position x du point
mov DX, 52 ; position y du point
mov AH, 0Ch ; On veut afficher un pixel
mov BH, 1 ; page no - critical while animating
L1: INT 10h
INC CX
CMP CX, 150
JL L1
;------------------------------------------------------------------------------
;Soulignage Exit : -----------------------------------------------------------------------------
mov AL, 13
mov CX, 90 ; position x du point
mov DX, 158 ; position y du point
mov AH, 0Ch ; On veut afficher un pixel
mov BH, 1 ; page no - critical while animating
L2: INT 10h
INC CX
CMP CX, 120
JL L2
;-----------------------------------------------------------
loopaskkey:
mov ah, 00h
int 16h
cmp ah, 25 ;P
je Niveau1start
cmp ah, 57 ;space
je Niveau2start
cmp ah, 35 ;H
je helpsomeone
cmp ah, 18 ;E
je leavehey
jmp loopaskkey
leavehey:
MOV AH, 4CH
MOV AL, 00 ;your return code.
INT 21H
helpsomeone:
mov AX, 0A000h
mov ES, AX ; Beginning of VGA memory in segment 0xA000
mov AX, 13h ; Mode VGA de l'affichage
int 10h
MOV AX, DSEG
MOV DS, AX
mov BH, 0 ; page actuelle
mov DL, 1 ; collonne actuelle
mov DH, 2 ; ligne actuelle
mov AH, 02 ; on change la position du curseur
int 10h ; et on affiche
MOV BX, 0001H
LEA DX, HELP
MOV CX, L_HELP
MOV AH, 40H
INT 21H
MOV AX, DSEG
MOV DS, AX
mov BH, 0 ; page actuelle
mov DL, 20 ; collonne actuelle
mov DH, 20 ; ligne actuelle
mov AH, 02 ; on change la position du curseur
int 10h ; et on affiche
MOV BX, 0001H
LEA DX, RETOUR
MOV CX, L_RETOUR
MOV AH, 40H
INT 21H
MOV AX, DSEG
MOV DS, AX
mov BH, 0 ; page actuelle
mov DL, 1 ; collonne actuelle
mov DH, 8 ; ligne actuelle
mov AH, 02 ; on change la position du curseur
int 10h ; et on affiche
MOV BX, 0001H
LEA DX, TOUCHE
MOV CX, L_TOUCHE
MOV AH, 40H
INT 21H
MOV AX, DSEG
MOV DS, AX
mov BH, 0 ; page actuelle
mov DL, 1 ; collonne actuelle
mov DH, 13 ; ligne actuelle
mov AH, 02 ; on change la position du curseur
int 10h ; et on affiche
MOV BX, 0001H
LEA DX, REGLE
MOV CX, L_REGLE
MOV AH, 40H
INT 21H
;souligner binome----
mov AL, 13
mov CX, 8 ; position x du point
mov DX, 28 ; position y du point
mov AH, 0Ch ; On veut afficher un pixel
mov BH, 1 ; page no - critical while animating
L3: INT 10h
INC CX
CMP CX, 55
JL L3
;souligner return----
mov AL, 13
mov CX, 160 ; position x du point
mov DX, 172 ; position y du point
mov AH, 0Ch ; On veut afficher un pixel
mov BH, 1 ; page no - critical while animating
L4: INT 10h
INC CX
CMP CX, 205
JL L4
loopaskkey2:
mov ah, 00h
int 16h
cmp ah, 30 ;A
je affichermenu
jmp loopaskkey2
MAIN ENDP
CSEG ENDS
END MAIN | 29.805755 | 96 | 0.375694 |
d2da8d2f2a0d59c7255e358853fe68c0ad6a286a | 657 | asm | Assembly | programs/oeis/061/A061525.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/061/A061525.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/061/A061525.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A061525: Surround numbers of an n X 2 rectangle when n is odd.
; 83,361,951,1997,3667,6153,9671,14461,20787,28937,39223,51981,67571,86377,108807,135293,166291,202281,243767,291277,345363,406601,475591,552957,639347,735433,841911,959501,1088947,1231017,1386503,1556221
mov $1,83
mov $2,164
mov $5,$0
mov $6,$0
lpb $2
add $1,$5
sub $2,1
lpe
mov $3,$6
lpb $3
sub $3,1
add $4,$5
lpe
mov $2,95
mov $5,$4
lpb $2
add $1,$5
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3
sub $3,1
add $4,$5
lpe
mov $2,18
mov $5,$4
lpb $2
add $1,$5
sub $2,1
lpe
mov $3,$6
mov $4,0
lpb $3
sub $3,1
add $4,$5
lpe
mov $2,1
mov $5,$4
lpb $2
add $1,$5
sub $2,1
lpe
| 13.978723 | 204 | 0.636225 |
268a03d608fd4857dc5e47e35795d9a66797760b | 388 | asm | Assembly | llvm/test/tools/llvm-ml/variable.asm | MochalovaAn/llvm | 528aa5ca4aa9df447dc3497ef19da3b124e88d7d | [
"Apache-2.0"
] | null | null | null | llvm/test/tools/llvm-ml/variable.asm | MochalovaAn/llvm | 528aa5ca4aa9df447dc3497ef19da3b124e88d7d | [
"Apache-2.0"
] | null | null | null | llvm/test/tools/llvm-ml/variable.asm | MochalovaAn/llvm | 528aa5ca4aa9df447dc3497ef19da3b124e88d7d | [
"Apache-2.0"
] | null | null | null | # RUN: llvm-ml -filetype=s %s /Fo - | FileCheck %s
.data
t1_value equ 1 or 2
t1 BYTE t1_VALUE DUP (0)
; CHECK-LABEL: t1:
; CHECK-NEXT: .byte 0
; CHECK-NEXT: .byte 0
; CHECK-NEXT: .byte 0
; CHECK-NOT: .byte 0
t2_value equ 4 or t1_value
t2 BYTE t2_VALUE
; CHECK-LABEL: t2:
; CHECK-NEXT: .byte 7
t3_value equ t1_VALUE or 8
t3 BYTE t3_VALUE
; CHECK-LABEL: t3:
; CHECK-NEXT: .byte 11
END
| 16.166667 | 50 | 0.677835 |
14fb165d43bbb579e63e9009fa7ce4b98df68b4f | 861 | asm | Assembly | programs/oeis/309/A309758.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/309/A309758.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/309/A309758.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A309758: Numbers that are sums of consecutive powers of 3.
; 1,3,4,9,12,13,27,36,39,40,81,108,117,120,121,243,324,351,360,363,364,729,972,1053,1080,1089,1092,1093,2187,2916,3159,3240,3267,3276,3279,3280,6561,8748,9477,9720,9801,9828,9837,9840,9841,19683,26244,28431,29160,29403,29484,29511,29520,29523,29524,59049,78732,85293,87480,88209,88452,88533,88560,88569,88572,88573,177147,236196,255879,262440,264627,265356,265599,265680,265707,265716,265719,265720,531441,708588,767637,787320,793881,796068,796797,797040,797121,797148,797157,797160,797161,1594323,2125764,2302911,2361960,2381643,2388204,2390391,2391120,2391363
seq $0,224195 ; Ordered sequence of numbers of form (2^n - 1)*2^m + 1 where n >= 1, m >= 1.
seq $0,191107 ; Increasing sequence generated by these rules: a(1)=1, and if x is in a then 3x-2 and 3x+1 are in a.
sub $0,13
div $0,9
add $0,1
| 95.666667 | 561 | 0.766551 |
743fdf5ce8ea8b8ec84828d13b1587ef5d8430dc | 377 | asm | Assembly | programs/oeis/253/A253723.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/253/A253723.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/253/A253723.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A253723: Length of shortest addition chain corresponding to maximum of A003313(k)/log_2(k) in interval 2^n < k < 2^(n+1).
; 2,4,5,7,8,9,11,12,13,14,15,17,18,19,20,22,23,24,25,26,27,28,30,31,32,33,34,35,36,38
mov $3,$0
lpb $0,1
add $1,1
sub $0,$1
mov $2,$0
sub $2,1
add $4,4
lpb $2,1
sub $0,1
lpb $2,1
sub $2,$4
lpe
lpe
lpe
add $1,2
add $1,$3
| 18.85 | 123 | 0.578249 |
2a83737f1afb15605edf480f874ec2389e1c4966 | 402 | asm | Assembly | asm/por_reveal_breakable_walls.asm | Iemnur/DSVEdit | 1f52feb6de8a47c7d223a17d739e69bb40aedd3f | [
"MIT"
] | 70 | 2017-02-25T15:06:47.000Z | 2022-03-16T03:05:35.000Z | asm/por_reveal_breakable_walls.asm | Iemnur/DSVEdit | 1f52feb6de8a47c7d223a17d739e69bb40aedd3f | [
"MIT"
] | 58 | 2017-03-12T21:34:50.000Z | 2022-01-31T17:22:36.000Z | asm/por_reveal_breakable_walls.asm | Iemnur/DSVEdit | 1f52feb6de8a47c7d223a17d739e69bb40aedd3f | [
"MIT"
] | 26 | 2017-03-04T16:35:13.000Z | 2021-11-24T20:52:19.000Z | .nds
.relativeinclude on
.erroronwarning on
; Makes breakable walls always have the glow visual.
.open "ftc/arm9.bin", 02000000h
.org 0x0206EAA0 ; Where the breakable wall calls a function to check if you have Eye for Decay equipped.
mov r0, 1h ; True
.close
.open "ftc/overlay9_111", 022E8820h
; Breakable ceiling that lets rain through from Dark Academy.
.org 0x022E8FEC
mov r0, 1h
.close
| 19.142857 | 104 | 0.753731 |
37cc1c503eeca5652861b7a86f8deec4f7ef85e4 | 77 | asm | Assembly | Userland/shell/loader.asm | saques/x64-Kernel | 992e97bac117003e64bcc883c422017d5492bb02 | [
"BSD-3-Clause"
] | null | null | null | Userland/shell/loader.asm | saques/x64-Kernel | 992e97bac117003e64bcc883c422017d5492bb02 | [
"BSD-3-Clause"
] | null | null | null | Userland/shell/loader.asm | saques/x64-Kernel | 992e97bac117003e64bcc883c422017d5492bb02 | [
"BSD-3-Clause"
] | 1 | 2017-04-23T17:24:40.000Z | 2017-04-23T17:24:40.000Z | GLOBAL loader
EXTERN shell_main
section .text
loader:
call shell_main
ret
| 9.625 | 17 | 0.805195 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.