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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c2a3116abae503b00ed0dca599cbdd20419092b1 | 1,663 | asm | Assembly | programs/oeis/236/A236223.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/236/A236223.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/236/A236223.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A236223: Sum of the fifteenth powers of the first n primes.
; 32768,14381675,30531959800,4778093469743,4182026262885394,55367919276976151,2917790970786791944,18098918000661590243,284734153465052835850,8913922901063237276799,32379184892907923206750,365825452844723230295243,1920923767836261141183844,5097994133634216803098151,17161342484454585041813494,90298494373483204766301651,455708280934100194626604550,1058195065469140598428463451,3519254151383232611798063494,9392460110768725965665394045,18301746135670226938845158902,47436165643215819847877448101,108554482498081648190990175808,282675060309080933978623071657,915926249445870320021899026250,2076895204815868855188855077751,3634862621416633435711238030158,6393894162131967339820291163601,10036376621819487402777206149750,16290646999516771622419989824007,52353145657601609404123997686150,109773971564282694903060639647601,222184892894671669185656418119594,361893127177726945643400553383693,757983262324171798309891992898442,1241770279351190009919796749638193,2109720436527134626461106003470886,3633120839224841174674303768049393,5824649058412072579491094660492936,9545922187226111561376989023021293,15751689173563435403701338101181992,23082949193660544798949667270946693,39507765029795512230369369361935044,58710347329564827715183186949572101,84831563449127872463388942367530194,115226143419366840912027722003333193,188379933117020019352448123872671844,356095334431123261737663943961944451,575066967797044691016526804634670094,824832344624002951234398735643354043
mov $2,$0
mov $3,$0
add $3,1
lpb $3
mov $0,$2
sub $3,1
sub $0,$3
seq $0,40 ; The prime numbers.
pow $0,15
add $1,$0
lpe
mov $0,$1
| 103.9375 | 1,457 | 0.91822 |
a4bb3667a3a44eb077361e51dd237fd9502ddeec | 1,418 | asm | Assembly | logokoala.asm | SalesforceFoundation/c64-salesforce-demo | b3896b11efd9ad0e5a7de5bda5784c1051367bf9 | [
"BSD-3-Clause"
] | 1 | 2017-11-03T18:34:30.000Z | 2017-11-03T18:34:30.000Z | logokoala.asm | SalesforceFoundation/c64-salesforce-demo | b3896b11efd9ad0e5a7de5bda5784c1051367bf9 | [
"BSD-3-Clause"
] | null | null | null | logokoala.asm | SalesforceFoundation/c64-salesforce-demo | b3896b11efd9ad0e5a7de5bda5784c1051367bf9 | [
"BSD-3-Clause"
] | 2 | 2022-02-08T15:51:21.000Z | 2022-02-26T14:08:52.000Z | ;From http://www.lemon64.com/forum/viewtopic.php?t=36491&sid=0c9db642484183b7b07bf8d768f056c8
;Koala Picture Code by Stranger on CSDb
PICTURE = $2000
BITMAP = PICTURE
VIDEO = PICTURE+$1f40
COLOR = PICTURE+$2328
BACKGROUND = PICTURE+$2710
*=$0801
; BASIC stub: "1 SYS 2061"
!by $0b,$08,$01,$00,$9e,$32,$30,$36,$31,$00,$00,$00
JMP $5000
* = $5000
sei
lda #$00
sta $d020 ; Border Color
lda BACKGROUND
sta $d021 ; Screen Color
; Transfer Video and Color
ldx #$00
.LOOP
; Transfers video data
lda VIDEO,x
sta $0400,x
lda VIDEO+$100,x
sta $0500,x
lda VIDEO+$200,x
sta $0600,x
lda VIDEO+$2e8,x
sta $06e8,x
; Transfers color data
lda COLOR,x
sta $d800,x
lda COLOR+$100,x
sta $d900,x
lda COLOR+$200,x
sta $da00,x
lda COLOR+$2e8,x
sta $dae8,x
inx
bne .LOOP
;
; Bitmap Mode On
;
lda #$3b
sta $d011
;
; MultiColor On
;
lda #$d8
sta $d016
;Wait Code by PeteD on Lemon64
lda #$18
sta $d018
ldx #60*3 ;60 fps * 3 seconds
lda #128
loop1 cmp $d012 ;check if the raster has reached line 128
bne loop1 ;no, so keep checking
loop2 cmp $d012 ;if it has you want to make sure you dont catch it more than once per frame
beq loop2 ;so wait till it isn't 0 any more
dex
bne loop1 ;loop round 60*3 times
;File must be at same directory ofcourse
* = $1ffe
!binary "resources/qtlfu_ko_fs.koala",,0
| 19.162162 | 96 | 0.641749 |
3f7b15df5ced7363309482f21941b873c072fd5b | 668 | asm | Assembly | oeis/052/A052333.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/052/A052333.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/052/A052333.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A052333: Riesel problem: start with n; repeatedly double and add 1 until reach a prime. Sequence gives prime reached, or 0 if no prime is ever reached.
; Submitted by Jamie Morken(s4)
; 3,5,7,19,11,13,31,17,19,43,23,103,223,29,31,67,71,37,79,41,43,367,47,199,103,53,223,463,59,61,127,131,67,139,71,73,151,311,79,163,83,5503,738197503,89,367,751,191,97,199,101,103,211,107,109,223,113,463
mov $2,$0
mov $0,1
mov $1,$2
add $2,2
lpb $2
sub $2,1
mov $3,$1
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $4,$0
pow $4,2
cmp $4,$0
lpb $0
trn $0,9
lpe
add $1,1
mul $1,2
mul $2,$4
lpe
mov $0,$1
div $0,2
| 25.692308 | 203 | 0.654192 |
41751f6b27458dec180c7027d7c3e7fcb53c19ab | 916 | asm | Assembly | programs/oeis/062/A062811.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/062/A062811.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/062/A062811.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A062811: a(n) = Sum_{i=1..n} i^(n - i) + (i - n)^i.
; 1,1,3,9,21,65,215,713,2809,11425,49339,234825,1148013,6009153,33216239,190115849,1152491825,7244099617,47387741107,323632894729,2280785100549,16702573959489,126413562204231,986688266888777,7960928383114409,66059744250227873,564580510931670763,4962212040742355401,44764418668513423837,414808745144474065473,3939573381401000528607,38344969590828092452233,382252498322240849438561,3897897403419867582775841,40660903537530645943298147,433417329186437296971587977,4719033515902524102603304693,52460286231559875671117788225,594972672845600725471073744055,6882818724513274258516608189897,81162251563216361021330444155737,975194500666856359452972329005217,11935009172505313395852335586678299,148703053669264310626246133461299785
add $0,1
lpb $0
add $2,1
cmp $3,0
mul $3,$0
sub $0,1
pow $3,$4
add $1,$3
mov $4,$2
lpe
sub $1,1
mul $1,2
add $1,1
mov $0,$1
| 50.888889 | 722 | 0.836245 |
15ac6e34a42ff3ebae628daf150d42bd5896198e | 432 | asm | Assembly | programs/oeis/134/A134235.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/134/A134235.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/134/A134235.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A134235: Triangle read by rows: a(1) = 1; then n-th row = n terms of (n+2), (n+4), (n+6),...n.
; 1,4,2,5,7,3,6,8,10,4,7,9,11,13,5,8,10,12,14,16,6,9,11,13,15,17,19,7,10,12,14,16,18,20,22,8,11,13,15,17,19,21,23,25,9,12,14,16,18,20,22,24,26,28,10
mul $0,2
add $0,2
mov $1,1
mov $2,1
lpb $0,1
mov $4,$0
sub $0,1
add $1,1
sub $0,$1
add $1,1
lpe
mov $1,15
mov $3,$2
sub $3,$0
div $3,$4
sub $3,$4
add $3,1
sub $1,$3
sub $1,14
| 18.782609 | 148 | 0.555556 |
b554a4b11325a17ccf4d4ce470523a167de1a479 | 40 | asm | Assembly | codes/low-level/ch05/macro_asm_parts.asm | zhoujiagen/learning-system-programming | 2a18e9f8558433708837ba4bd0fae5d7c11bf110 | [
"MIT"
] | null | null | null | codes/low-level/ch05/macro_asm_parts.asm | zhoujiagen/learning-system-programming | 2a18e9f8558433708837ba4bd0fae5d7c11bf110 | [
"MIT"
] | null | null | null | codes/low-level/ch05/macro_asm_parts.asm | zhoujiagen/learning-system-programming | 2a18e9f8558433708837ba4bd0fae5d7c11bf110 | [
"MIT"
] | null | null | null | %define a mov rax,
%define b rbx
a b | 13.333333 | 18 | 0.625 |
41b8c0d0e8f9cd949f5cef26e6963e70fbf5d9d4 | 4,417 | asm | Assembly | src/displaybcd.asm | hackneyc/CastleEscape | cbf676a4358bdb32d5b2b5251dd17951af19b5df | [
"BSD-3-Clause"
] | null | null | null | src/displaybcd.asm | hackneyc/CastleEscape | cbf676a4358bdb32d5b2b5251dd17951af19b5df | [
"BSD-3-Clause"
] | 11 | 2021-01-26T02:59:18.000Z | 2021-02-05T04:45:55.000Z | src/displaybcd.asm | hackneyc/CastleEscape | cbf676a4358bdb32d5b2b5251dd17951af19b5df | [
"BSD-3-Clause"
] | null | null | null | extern printChar
public addBCD
public decBCD
public display2BCD
public display4BCD
public displayBCD
public incBCD
public subBCD
include "defs.inc"
section CODE_2
; On entry:
; a[3:0] = BCD value to display, a[7:4] must be zero
; bc = Character screen location b=Ypos, c=XPos
;
; All registers are preserved
displayBCD:
push af
add '0'
call printChar
pop af
ret
;
; Display 2 BCD digits
;
; Entry:
; b - Y screen position
; c - X screen position
; hl - Pointer to BCD value
;
display2BCD:
push af
push bc
xor a ; Zero a
rld ; Get high order nibble from (hl)
call displayBCD ; Display the character
inc c ; Increment x screen location
rld ; Get low order nibble from (hl)
call displayBCD
inc c ; Increment x screen location
rld ; Put the low order nibble back in (hl)
pop bc
pop af
ret
;
; Display 4 BCD digits
;
; Entry:
; b - Y screen position
; c - X screen position
; hl - Pointer to BCD value
;
display4BCD:
push bc
inc hl
call display2BCD
dec hl
inc c
inc c
call display2BCD
pop bc
ret
;
; Add the BCD value in 'l' to the BCD value pointed to by 'de'.
;
; Entry:
; de - Pointer to BCD value to be incremented
; l - BCD value to be added
;
addBCD:
push af
push de
ld a, (de) ; Get low byte of BCD value
add l ; Add the BCD value passed in
daa ; Adjust result for BCD
ld (de), a ; Save the updated BCD value
jr nc, addBCDDone ; If nc, no wraparound
inc de ; There was a wraparound
ld a, (de) ; Get high byte of BCD value
or a ; Clear the carry flag
inc a ; Increment the value
daa ; Adjust result for BCD
ld (de), a ; Save the incremented BCD value
addBCDDone:
pop de
pop af
ret
;
; Subtract the BCD value in 'l' from the BCD value pointed to by 'de'.
;
; Entry:
; de - Pointer to BCD value
; l - BCD value
;
subBCD:
push af
push de
ld a, (de) ; Get low byte of BCD value
sbc l ; Add the BCD value passed in
daa ; Adjust result for BCD
cheat:
IFNDEF CHEAT
ld (de), a ; Save the updated BCD value
ELSE
nop ; Cheat enabled, do not update
ENDIF
jr nc, subBCDDone ; If nc, no wraparound
inc de ; There was a wraparound
ld a, (de) ; Get high byte of BCD value
or a ; Clear the carry flag
dec a ; Decrement the value
daa ; Adjust result for BCD
ld (de), a ; Save the incremented BCD value
subBCDDone:
pop de
pop af
ret
;
; Increment the BCD value pointed to by 'de'
;
; Entry:
; de - Pointer to BCD value to be incremented
;
incBCD:
push hl
ld l, 1
call addBCD
pop hl
ret
;
; Decrement the BCD value pointed to by 'de'
;
; Entry:
; de - Pointer to BCD value
;
decBCD:
push hl
ld l, 1
call subBCD
pop hl
ret
| 26.291667 | 79 | 0.4048 |
fc8304b87090999a406f5c39e05c936272a50893 | 606 | asm | Assembly | oeis/340/A340806.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/340/A340806.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/340/A340806.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A340806: a(n) = Sum_{k=1..n-1} (k^n mod n).
; Submitted by Jamie Morken(s3)
; 0,1,3,2,10,13,21,4,27,45,55,38,78,77,105,8,136,93,171,146,210,209,253,172,250,325,243,294,406,365,465,16,528,561,595,402,666,665,741,372,820,673,903,726,945,897,1081,536,1029,1125,1275,1170,1378,765,1485,924,1596,1653,1711,1078,1830,1705,1890,32,2080,2057,2211,1666,2346,2205,2485,1668,2628,2701,2625,2470,2926,2665,3081,1064,2187,3321,3403,3026,3570,3569,3741,3564,3916,3165,4095,3542,4278,3901,4465,2608,4656,3773,4752,3330
add $0,1
mov $2,$0
lpb $0
mov $4,$0
sub $0,1
pow $4,$2
mod $4,$2
add $3,$4
lpe
mov $0,$3
| 40.4 | 427 | 0.693069 |
4b961ff14a524a52f620c20e1af6de1c71f6591d | 203 | asm | Assembly | programs/oeis/038/A038364.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/038/A038364.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/038/A038364.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A038364: Numbers n such that n = (product of digits of n) + (sum of digits of n).
; 0,19,29,39,49,59,69,79,89,99
lpb $0,1
sub $0,1
mov $2,4
add $1,5
mov $3,5
lpe
add $2,$1
add $1,$3
add $1,$2
| 15.615385 | 83 | 0.581281 |
26d412f8885a07d295696228b4219b25ce44cadb | 4,606 | asm | Assembly | ladder.asm | dsprenkels/curve13318-haswell | 8f281e2dd5938bf8b7f0e246c99491739cbd8090 | [
"CC0-1.0"
] | 1 | 2019-10-12T17:52:30.000Z | 2019-10-12T17:52:30.000Z | ladder.asm | dsprenkels/curve13318-haswell | 8f281e2dd5938bf8b7f0e246c99491739cbd8090 | [
"CC0-1.0"
] | null | null | null | ladder.asm | dsprenkels/curve13318-haswell | 8f281e2dd5938bf8b7f0e246c99491739cbd8090 | [
"CC0-1.0"
] | null | null | null | ; Ladder for shared secret point multiplication
;
; Author: Daan Sprenkels <hello@dsprenkels.com>
%include "ge_double.mac.asm"
%include "ge_add.mac.asm"
%include "select.mac.asm"
global crypto_scalarmult_curve13318_avx2_ladder
section .text
crypto_scalarmult_curve13318_avx2_ladder:
; Double-and-add ladder for shared secret point multiplication
;
; Arguments:
; ge q: [rdi]
; uint8_t *windows: [rsi]
; ge ptable[16]: [rdx]
;
%xdefine stack_size 7*10*32
%xdefine tmp rsp + 6*10*32
; prologue
push rbp
mov rbp, rsp
and rsp, -32
sub rsp, stack_size
; just use the red zone ¯\_(ツ)_/¯
mov qword [rsp - 8], r8
mov qword [rsp - 16], r9
mov qword [rsp - 24], r10
mov qword [rsp - 32], r11
mov qword [rsp - 40], r12
mov qword [rsp - 48], r13
mov qword [rsp - 56], rbx
; start loop
xor rcx, rcx
.ladderstep:
mov rbx, 5
.ladderstep_double:
ge_double rdi, rdi, rsp
sub rbx, 1
jnz .ladderstep_double
.ladderstep_compute_idx:
; Our lookup table is one-based indexed. The neutral element is not stored
; in `ptable`, but written by `select`. The mapping from `bits` to `idx`
; is defined by the following:
;
; compute_idx :: Word5 -> Word5
; compute_idx bits
; | 0 <= bits < 16 = bits - 1 // sign is (+)
; | 16 <= bits < 32 = ~bits // sign is (-)
movzx r10, byte [rsi + rcx] ; bits
mov rax, r10 ; copy bits
shr r10, 4
and r10, 1 ; sign
lea r11, [r10 - 1] ; ~signmask
neg r10 ; signmask
lea r9, [rax - 1] ; bits - 1
and r9, r11 ; (bits - 1) & ~signmask
not rax ; ~bits
and rax, r10 ; ~bits & signmask
mov r8, rax
or r8, r9 ; idx (not zx'd)
and r8, 0x1F ; force idx to be in [0, 0x1F]
; At this point r10 is signmask. It will not be killed in select.
.ladderstep_select:
select r8, rdx
; - ymm0: {X[0],X[1],X[2],X[3],X[4],X[5],X[6],X[7]}
; - ymm1: {X[8],X[9],Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]}
; - ymm2: {Y[6],Y[7],Y[8],Y[9],Z[0],Z[1],Z[2],Z[3]}
; - ymm3: {Z[4],Z[5],Z[6],Z[7],Z[8],Z[9], ??, ??}
.ladderstep_invert_y:
vmovdqa yword [tmp + 0*32], ymm0
; conditionally negate Y if sign == 1 (i.e. if signmask == 0xFFF...)
vmovq xmm15, r10
vpbroadcastq ymm15, xmm15 ; signmask
vpcmpeqd ymm14, ymm14, ymm14
vpxor ymm14, ymm14, ymm15 ; ~signmask
; conditionally negate Y
vmovdqa ymm13, yword [rel .const_4P_at_Y + 0*32]
vpsubd ymm13, ymm13, ymm1
vpand ymm13, ymm13, ymm15
vpand ymm12, ymm1, ymm14
vpor ymm13, ymm13, ymm12
vpblendd ymm1, ymm1, ymm13, 0b11111100
vmovdqa yword [tmp + 1*32], ymm1
vmovdqa ymm13, yword [rel .const_4P_at_Y + 1*32]
vpsubd ymm13, ymm13, ymm2
vpand ymm13, ymm13, ymm15
vpand ymm12, ymm2, ymm14
vpor ymm13, ymm13, ymm12
vpblendd ymm2, ymm2, ymm13, 0b00001111
vmovdqa yword [tmp + 2*32], ymm2
vmovdqa yword [tmp + 3*32], ymm3
.ladderstep_add:
; add q and p into q
ge_add rdi, tmp, rdi, rsp
; loop repeat
add rcx, 1
cmp rcx, 51
jl .ladderstep
.end:
; epilogue
mov rbx, qword [rsp - 56]
mov r13, qword [rsp - 48]
mov r12, qword [rsp - 40]
mov r11, qword [rsp - 32]
mov r10, qword [rsp - 24]
mov r9, qword [rsp - 16]
mov r8, qword [rsp - 8]
mov rsp, rbp
pop rbp
vzeroupper
ret
section .rodata
align 32, db 0
.MASK26: times 4 dq 0x3FFFFFF
.MASK25: times 4 dq 0x1FFFFFF
.const_2p37P_2p37P_2p37P_2p37P:
times 4 dq 0x7FFFFDA000000000
times 4 dq 0x3FFFFFE000000000
times 4 dq 0x7FFFFFE000000000
.const_4P_at_Y:
dd 0x0000000, 0x0000000, 0xFFFFFB4, 0x7FFFFFC, 0xFFFFFFC, 0x7FFFFFC, 0xFFFFFFC, 0x7FFFFFC
dd 0xFFFFFFC, 0x7FFFFFC, 0xFFFFFFC, 0x7FFFFFC, 0x0000000, 0x0000000, 0x0000000, 0x0000000
.select_idxs:
times 8 dd 0
times 8 dd 1
times 8 dd 2
times 8 dd 3
times 8 dd 4
times 8 dd 5
times 8 dd 6
times 8 dd 7
times 8 dd 8
times 8 dd 9
times 8 dd 10
times 8 dd 11
times 8 dd 12
times 8 dd 13
times 8 dd 14
times 8 dd 15
.select_neutral_idx:
; Select only the third limb
times 8 dd 0x1F
.const_y0_is_1:
times 8 dd 0, 0, 1, 0, 0, 0, 0, 0
align 16, db 0
.const_2p37P_0:
dq 0x7FFFFDA000000000, 0x00
dq 0x3FFFFFE000000000, 0x00
dq 0x7FFFFFE000000000, 0x00
align 8, db 0
.const_2p32P:
dq 0x3FFFFED00000000
dq 0x1FFFFFF00000000
dq 0x3FFFFFF00000000
align 8, db 0
.const_19: dq 19
| 25.731844 | 89 | 0.604863 |
aaca8736933f5a90601dd137f5e1ebac6670a020 | 562 | asm | Assembly | oeis/158/A158766.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/158/A158766.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/158/A158766.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A158766: a(n) = 1444*n^2 + 38.
; 38,1482,5814,13034,23142,36138,52022,70794,92454,117002,144438,174762,207974,244074,283062,324938,369702,417354,467894,521322,577638,636842,698934,763914,831782,902538,976182,1052714,1132134,1214442,1299638,1387722,1478694,1572554,1669302,1768938,1871462,1976874,2085174,2196362,2310438,2427402,2547254,2669994,2795622,2924138,3055542,3189834,3327014,3467082,3610038,3755882,3904614,4056234,4210742,4368138,4528422,4691594,4857654,5026602,5198438,5373162,5550774,5731274,5914662,6100938,6290102
pow $0,2
mul $0,1444
add $0,38
| 80.285714 | 496 | 0.825623 |
c9a64d142c6e80f01336be755210c0e947168848 | 450 | asm | Assembly | programs/oeis/262/A262342.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/262/A262342.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/262/A262342.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A262342: Area of Lewis Carroll's paradoxical F(2n+1) X F(2n+3) rectangle.
; 10,65,442,3026,20737,142130,974170,6677057,45765226,313679522,2149991425,14736260450,101003831722,692290561601,4745030099482,32522920134770,222915410843905,1527884955772562,10472279279564026,71778070001175617
add $0,3
mov $1,2
mov $2,1
mov $3,2
lpb $0
sub $0,$3
sub $0,1
add $2,1
add $2,$1
add $1,$2
add $2,$1
sub $2,4
add $1,$2
sub $1,2
mov $3,0
lpe
| 22.5 | 210 | 0.713333 |
a2291a2a803f33a29d83c5c3daa40019ab2f52c9 | 3,682 | asm | Assembly | audio/music/unusedsong.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | 1 | 2022-02-15T00:19:44.000Z | 2022-02-15T00:19:44.000Z | audio/music/unusedsong.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | audio/music/unusedsong.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | Music_UnusedSong_Ch1::
tempo 144
volume 7, 7
vibrato 5, 1, 6
Music_UnusedSong_branch_a91b::
note_type 12, 1, 0
octave 6
note E_, 1
rest 1
octave 5
note B_, 1
rest 1
octave 6
note C#, 1
rest 1
octave 5
note B_, 1
octave 6
note E_, 1
rest 4
note E_, 2
rest 2
note D#, 1
rest 1
octave 5
note B_, 1
rest 1
octave 6
note C#, 1
rest 1
octave 5
note B_, 1
octave 6
note D#, 1
rest 8
note C#, 1
rest 1
note D#, 1
rest 1
note C#, 1
octave 5
note B_, 1
rest 2
octave 6
note C#, 1
rest 1
note D#, 1
rest 1
note C#, 1
octave 5
note B_, 1
rest 2
octave 6
note D#, 4
note C#, 4
note D#, 1
note E_, 1
rest 1
note F#, 1
rest 1
octave 5
note B_, 2
rest 1
octave 6
note E_, 1
rest 1
octave 5
note B_, 1
rest 1
octave 6
note C#, 1
rest 1
octave 5
note B_, 1
octave 6
note E_, 1
rest 8
note D#, 1
rest 1
octave 5
note B_, 1
rest 1
octave 6
note C#, 1
rest 1
octave 5
note B_, 1
octave 6
note D#, 1
rest 4
octave 5
note B_, 2
rest 2
octave 6
note C#, 1
rest 1
note D#, 1
rest 1
note C#, 1
octave 5
note B_, 1
rest 2
octave 6
note C#, 1
rest 1
note D#, 1
rest 1
note E_, 1
note F#, 1
rest 2
note F#, 4
note E_, 4
note F#, 1
note G#, 1
rest 1
note F#, 1
rest 1
note D#, 2
rest 3
octave 5
note A_, 2
rest 2
note B_, 2
rest 2
octave 6
note C#, 2
rest 2
note E_, 2
note F#, 8
rest 2
note E_, 2
note D#, 2
note C#, 2
rest 2
octave 5
note G#, 2
rest 2
note A_, 2
rest 2
note B_, 2
rest 2
octave 6
note D#, 2
note E_, 8
rest 2
note D#, 2
note C#, 2
note D#, 2
octave 5
note A_, 2
note G#, 2
note A_, 2
note A#, 1
note B_, 1
rest 4
note F#, 2
rest 2
note B_, 2
note A#, 2
note B_, 2
octave 6
note C_, 1
note C#, 1
rest 8
octave 5
note F#, 2
note F_, 2
note F#, 2
note G#, 2
note A_, 2
octave 6
note E_, 2
note D#, 2
note C#, 2
octave 5
note B_, 2
rest 6
note B_, 2
rest 6
sound_loop 0, Music_UnusedSong_branch_a91b
sound_ret
Music_UnusedSong_Ch2::
tempo 144
volume 7, 7
toggle_perfect_pitch
vibrato 6, 1, 5
Music_UnusedSong_branch_a9d8::
note_type 12, 1, 0
octave 6
note E_, 1
rest 1
note G#, 1
rest 1
note F#, 1
rest 1
note A_, 1
note G#, 1
rest 8
note D#, 1
rest 1
note F#, 1
rest 1
note E_, 1
rest 1
note G#, 1
note F#, 1
rest 4
octave 5
note B_, 2
rest 2
octave 6
note C#, 1
rest 1
note D#, 1
rest 1
note E_, 1
note F#, 1
rest 2
note C#, 1
rest 1
note D#, 1
rest 1
note E_, 1
note F#, 1
rest 2
note F#, 4
note E_, 4
note F#, 1
note G#, 1
rest 1
note F#, 1
rest 1
note D#, 2
rest 1
note E_, 1
rest 1
note G#, 1
rest 1
note F#, 1
rest 1
note A_, 1
note G#, 1
rest 4
note E_, 2
rest 2
note D#, 1
rest 1
note F#, 1
rest 1
note E_, 1
rest 1
note G#, 1
note F#, 1
rest 8
note C#, 1
rest 1
note D#, 1
rest 1
note E_, 1
note F#, 1
rest 2
note C#, 1
rest 1
note D#, 1
rest 1
note E_, 1
note F#, 1
rest 2
note F#, 4
note E_, 4
note F#, 1
note G#, 1
rest 1
note B_, 1
rest 1
note F#, 2
rest 1
note C#, 2
rest 2
note D#, 2
rest 2
note E_, 2
rest 2
note G#, 2
rest 2
note D#, 8
rest 2
note E_, 2
note D#, 2
note C#, 2
octave 5
note B_, 2
rest 2
octave 6
note C#, 2
rest 2
note D#, 2
rest 2
note F#, 2
rest 2
note C#, 8
rest 2
note D#, 2
note C#, 2
octave 5
note B_, 2
note A_, 2
note G#, 2
note A_, 2
note G#, 1
note F#, 1
rest 8
note B_, 2
note A#, 2
note B_, 2
note A_, 1
note G#, 1
rest 4
note G#, 2
rest 2
note F#, 2
note F_, 2
note F#, 2
note G#, 2
note A_, 2
note E_, 2
note C#, 2
note E_, 2
note F#, 2
rest 6
note D#, 2
rest 6
sound_loop 0, Music_UnusedSong_branch_a9d8
sound_ret
| 10.861357 | 43 | 0.597501 |
ac4276bdb3828f95c18811baaf15de38418df0b1 | 1,391 | asm | Assembly | engine/overworld/emotion_bubbles.asm | etdv-thevoid/pokemon-rgb-enhanced | 5b244c1cf46aab98b9c820d1b7888814eb7fa53f | [
"MIT"
] | 9 | 2020-07-12T19:44:21.000Z | 2022-03-03T23:32:40.000Z | engine/overworld/emotion_bubbles.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 7 | 2020-07-16T10:48:52.000Z | 2021-01-28T18:32:02.000Z | engine/overworld/emotion_bubbles.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 2 | 2021-03-28T18:33:43.000Z | 2021-05-06T13:12:09.000Z | EmotionBubble:
ld a, [wWhichEmotionBubble]
ld c, a
ld b, 0
ld hl, EmotionBubblesPointerTable
add hl, bc
add hl, bc
ld e, [hl]
inc hl
ld d, [hl]
ld hl, vChars1 + $780
lb bc, BANK(EmotionBubbles), $04
call CopyVideoData
ld a, [wUpdateSpritesEnabled]
push af
ld a, $ff
ld [wUpdateSpritesEnabled], a
ld a, [wd736]
bit 6, a ; are the last 4 OAM entries reserved for a shadow or fishing rod?
ld hl, wOAMBuffer + 4 * 35 + $3 ; $8f
ld de, wOAMBuffer + 4 * 39 + $3 ; $9f
jr z, .next
ld hl, wOAMBuffer + 4 * 31 + $3 ; $7f
ld de, wOAMBuffer + 4 * 35 + $3 ; $8f
; Copy OAM data 16 bytes forward to make room for emotion bubble OAM data at the
; start of the OAM buffer.
.next
ld bc, $90
.loop
ld a, [hl]
ld [de], a
dec hl
dec de
dec bc
ld a, c
or b
jr nz, .loop
; get the screen coordinates of the sprite the bubble is to be displayed above
ld hl, wSpriteStateData1 + 4
ld a, [wEmotionBubbleSpriteIndex]
swap a
ld c, a
ld b, 0
add hl, bc
ld a, [hli]
ld b, a
inc hl
ld a, [hl]
add $8
ld c, a
ld de, EmotionBubblesOAM
xor a
call WriteOAMBlock
ld c, 60
call DelayFrames
pop af
ld [wUpdateSpritesEnabled], a
call DelayFrame
jp UpdateSprites
EmotionBubblesPointerTable:
dw EmotionBubbles
dw EmotionBubbles + $40
dw EmotionBubbles + $80
EmotionBubblesOAM:
db $F8,$00,$F9,$00
db $FA,$00,$FB,$00
EmotionBubbles:
INCBIN "gfx/emotion_bubbles.2bpp"
| 18.546667 | 80 | 0.676492 |
65691734e29b25e629f6bdf60ca4f831eccfbf3b | 370 | asm | Assembly | programs/oeis/038/A038723.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/038/A038723.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/038/A038723.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A038723: a(n) = 6*a(n-1) - a(n-2), n >= 2, a(0)=1, a(1)=4.
; 1,4,23,134,781,4552,26531,154634,901273,5253004,30616751,178447502,1040068261,6061962064,35331704123,205928262674,1200237871921,6995498968852,40772755941191,237641036678294,1385073464128573
mov $1,1
lpb $0,1
sub $0,1
add $3,$1
add $3,$1
sub $1,1
add $1,$3
mov $2,$3
add $2,$1
mov $1,$2
lpe
| 24.666667 | 191 | 0.664865 |
0311233efbb4309322ff4004b2ffbd2dadfa4550 | 922 | asm | Assembly | programs/oeis/213/A213830.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/213/A213830.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/213/A213830.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A213830: Antidiagonal sums of the convolution array A213828.
; 2,18,78,230,540,1092,1988,3348,5310,8030,11682,16458,22568,30240,39720,51272,65178,81738,101270,124110,150612,181148,216108,255900,300950,351702,408618,472178,542880,621240,707792,803088,907698,1022210,1147230,1283382,1431308,1591668,1765140,1952420,2154222,2371278,2604338,2854170,3121560,3407312,3712248,4037208,4383050,4750650,5140902,5554718,5993028,6456780,6946940,7464492,8010438,8585798,9191610,9828930,10498832,11202408,11940768,12715040,13526370,14375922,15264878,16194438,17165820,18180260,19239012,20343348,21494558,22693950,23942850,25242602,26594568,28000128,29460680,30977640,32552442,34186538,35881398,37638510,39459380,41345532,43298508,45319868,47411190,49574070,51810122,54120978,56508288,58973720,61518960,64145712,66855698,69650658,72532350,75502550
mov $1,$0
add $0,1
pow $1,2
add $1,$0
add $0,1
bin $0,2
add $1,$0
mul $1,$0
mov $0,$1
| 70.923077 | 771 | 0.830803 |
6f4d42876c47192fee9a33138768788ce7b3e0c0 | 288 | asm | Assembly | dd/nd/proctab.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | dd/nd/proctab.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | dd/nd/proctab.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ; ND SuperBASIC procedures / functions
section procs
xdef nd_proctab
include 'dev8_mac_proc'
nd_proctab
proc_stt
proc_def FSERVE ; file server
proc_def NFS_USE
proc_end
proc_stt
proc_end
end
| 16 | 46 | 0.559028 |
bfb78a85f80c06d9c11a41f5f461cc3397243511 | 287 | asm | Assembly | src/test/resources/data/searchtests/opt-test10-expected.asm | cpcitor/mdlz80optimizer | 75070d984e1f08474e6d397c7e0eb66d8be0c432 | [
"Apache-2.0"
] | null | null | null | src/test/resources/data/searchtests/opt-test10-expected.asm | cpcitor/mdlz80optimizer | 75070d984e1f08474e6d397c7e0eb66d8be0c432 | [
"Apache-2.0"
] | null | null | null | src/test/resources/data/searchtests/opt-test10-expected.asm | cpcitor/mdlz80optimizer | 75070d984e1f08474e6d397c7e0eb66d8be0c432 | [
"Apache-2.0"
] | null | null | null | org #4000
execute:
ld hl, v1
ld (hl), 5
ld iy, v2
ld (iy + 0), 1
ld (iy + 1), 2
ld (iy + 2), 3
ld (iy + 3), 4
ld l, v3
ld (hl), 11
inc l
ld (hl), 12
loop:
jr loop
org #c000
v1:
org $ + 1
v2:
org $ + 4
v3:
org $ + 2 | 10.62963 | 18 | 0.38676 |
43914904b60cb2de41c755c2445b41833f536f70 | 5,098 | asm | Assembly | compiled/prime.asm | GGN-2015/Coffee | 6119f51917604930299a0119bc0a4e19843aaa4b | [
"MIT"
] | 1 | 2022-03-13T11:08:45.000Z | 2022-03-13T11:08:45.000Z | compiled/prime.asm | GGN-2015/Coffee | 6119f51917604930299a0119bc0a4e19843aaa4b | [
"MIT"
] | null | null | null | compiled/prime.asm | GGN-2015/Coffee | 6119f51917604930299a0119bc0a4e19843aaa4b | [
"MIT"
] | null | null | null | STACKSG SEGMENT STACK
GLOBAL_BUILTIN_GETS_BUF DW 129 DUP(0)
GLOBAL_BUILTIN_GETS_CHARCOUNT DW 1 DUP(0)
DW 16254 DUP(0)
STACKSG ENDS
CODESG SEGMENT
ASSUME CS:CODESG, DS:STACKSG, SS:STACKSG
FUNC_isprime: ; localVar: 2, arguCnt: 1
PUSH BP
MOV BP, SP
SUB SP, 4
MOV AX, [BP+4]
MOV [BP-2], AX
MOV AX, WORD PTR [BP-2] ;optimized by O1
MOV BX, 1 ;optimized by O1
MOV CX, 1
SUB AX, BX
JLE JUMP_36
MOV CX, 0
JUMP_36:
MOV AX, CX ;optimized by O1
AND AX, AX
JNZ JUMP_37
JMP ENDIF_9
JUMP_37:
MOV AX, 0
JMP ENDFUNC_isprime
ENDIF_9:
MOV AX, 2
MOV [BP-4], AX
WHILE_7:
MOV AX, WORD PTR [BP-2] ;optimized by O1
MOV BX, 1 ;optimized by O1
SUB AX, BX
MOV BX, WORD PTR [BP-4] ;optimized by O1
MOV CX, 1
SUB AX, BX
JGE JUMP_38
MOV CX, 0
JUMP_38:
MOV AX, CX ;optimized by O1
AND AX, AX
JNZ JUMP_39
JMP ENDWHILE_7
JUMP_39:
MOV AX, WORD PTR [BP-2] ;optimized by O1
MOV BX, WORD PTR [BP-4] ;optimized by O1
MOV DX, 0
CMP AX, 0
JGE JUMP_40
MOV DX, 0FFFFH
JUMP_40:
IDIV BX
MOV AX, DX ;optimized by O1
MOV BX, 0 ;optimized by O1
MOV CX, 1
SUB AX, BX
JE JUMP_41
MOV CX, 0
JUMP_41:
MOV AX, CX ;optimized by O1
AND AX, AX
JNZ JUMP_42
JMP ENDIF_10
JUMP_42:
MOV AX, 0
JMP ENDFUNC_isprime
ENDIF_10:
MOV AX, WORD PTR [BP-4] ;optimized by O1
MOV BX, 1 ;optimized by O1
ADD AX, BX
MOV [BP-4], AX
JMP WHILE_7
ENDWHILE_7:
MOV AX, 1
JMP ENDFUNC_isprime
ENDFUNC_isprime:
ADD SP, 4
POP BP
RET
FUNC_main: ; localVar: 1, arguCnt: 0
PUSH BP
MOV BP, SP
SUB SP, 2
MOV AX, 1
MOV [BP-2], AX
WHILE_8:
MOV AX, 1000
MOV BX, WORD PTR [BP-2] ;optimized by O1
MOV CX, 1
SUB AX, BX
JGE JUMP_43
MOV CX, 0
JUMP_43:
MOV AX, CX ;optimized by O1
AND AX, AX
JNZ JUMP_44
JMP ENDWHILE_8
JUMP_44:
PUSH WORD PTR [BP-2]
CALL FUNC_isprime
ADD SP, 2
AND AX, AX
JNZ JUMP_45
JMP ENDIF_11
JUMP_45:
PUSH WORD PTR [BP-2]
CALL FUNC_printInt
ADD SP, 2
MOV DX, 32 ;optimized by O1
MOV AH, 2
INT 21H
ENDIF_11:
MOV AX, WORD PTR [BP-2] ;optimized by O1
MOV BX, 1 ;optimized by O1
ADD AX, BX
MOV [BP-2], AX
JMP WHILE_8
ENDWHILE_8:
ENDFUNC_main:
ADD SP, 2
POP BP
RET
FUNC_printInt: ; localVar: 12, arguCnt: 1
PUSH BP
MOV BP, SP
SUB SP, 24
MOV AX, [BP+4]
MOV [BP-2], AX
MOV AX, 0
MOV [BP-24], AX
MOV AX, WORD PTR [BP-2] ;optimized by O1
MOV BX, 0 ;optimized by O1
MOV CX, 1
SUB AX, BX
JL JUMP_26
MOV CX, 0
JUMP_26:
MOV AX, CX ;optimized by O1
AND AX, AX
JNZ JUMP_27
JMP ENDIF_7
JUMP_27:
MOV AX, WORD PTR [BP-2] ;optimized by O1
NEG AX
MOV [BP-2], AX
MOV DX, 45 ;optimized by O1
MOV AH, 2
INT 21H
ENDIF_7:
MOV AX, WORD PTR [BP-2] ;optimized by O1
MOV BX, 0 ;optimized by O1
MOV CX, 1
SUB AX, BX
JE JUMP_28
MOV CX, 0
JUMP_28:
MOV AX, CX ;optimized by O1
AND AX, AX
JNZ JUMP_29
JMP ELSE_8
JUMP_29:
MOV DX, 48 ;optimized by O1
MOV AH, 2
INT 21H
JMP ENDIF_8
ELSE_8:
WHILE_5:
MOV AX, WORD PTR [BP-2] ;optimized by O1
MOV BX, 0 ;optimized by O1
MOV CX, 1
SUB AX, BX
JNE JUMP_30
MOV CX, 0
JUMP_30:
MOV AX, CX ;optimized by O1
AND AX, AX
JNZ JUMP_31
JMP ENDWHILE_5
JUMP_31:
MOV AX, BP
SUB AX, 22
PUSH AX
PUSH WORD PTR [BP-24]
MOV AX, WORD PTR [BP-2] ;optimized by O1
MOV BX, 10 ;optimized by O1
MOV DX, 0
CMP AX, 0
JGE JUMP_32
MOV DX, 0FFFFH
JUMP_32:
IDIV BX
MOV CX, DX ;optimized by O1
POP BX
POP AX
ADD BX, BX
ADD BX, AX
MOV [BX], CX
MOV AX, WORD PTR [BP-2] ;optimized by O1
MOV BX, 10 ;optimized by O1
MOV DX, 0
CMP AX, 0
JGE JUMP_33
MOV DX, 0FFFFH
JUMP_33:
IDIV BX
MOV [BP-2], AX
MOV AX, WORD PTR [BP-24] ;optimized by O1
MOV BX, 1 ;optimized by O1
ADD AX, BX
MOV [BP-24], AX
JMP WHILE_5
ENDWHILE_5:
WHILE_6:
MOV AX, WORD PTR [BP-24] ;optimized by O1
MOV BX, 0 ;optimized by O1
MOV CX, 1
SUB AX, BX
JG JUMP_34
MOV CX, 0
JUMP_34:
MOV AX, CX ;optimized by O1
AND AX, AX
JNZ JUMP_35
JMP ENDWHILE_6
JUMP_35:
MOV AX, BP
SUB AX, 22
PUSH AX
MOV AX, WORD PTR [BP-24] ;optimized by O1
MOV BX, 1 ;optimized by O1
SUB AX, BX
MOV BX, AX ;optimized by O1
POP AX
ADD BX, BX
ADD BX, AX
MOV AX, WORD PTR [BX] ;optimized by O1
MOV BX, 48 ;optimized by O1
ADD AX, BX
MOV DX, AX ;optimized by O1
MOV AH, 2
INT 21H
MOV AX, WORD PTR [BP-24] ;optimized by O1
MOV BX, 1 ;optimized by O1
SUB AX, BX
MOV [BP-24], AX
JMP WHILE_6
ENDWHILE_6:
ENDIF_8:
ENDFUNC_printInt:
ADD SP, 24
POP BP
RET
ENTER_POINT:
MOV AX, STACKSG
MOV DS, AX
MOV SS, AX
MOV SP, 32768
CALL FUNC_main
MOV AH, 4CH
INT 21H
CODESG ENDS
END ENTER_POINT
| 18.951673 | 48 | 0.587093 |
60efd0f89eabbbe6a06be5f23b13062a16acc5fa | 469 | asm | Assembly | oeis/084/A084474.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/084/A084474.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/084/A084474.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A084474: Write n in binary and replace 0 with 0000.
; Submitted by Christian Krause
; 1,10000,11,100000000,100001,110000,111,1000000000000,1000000001,1000010000,1000011,1100000000,1100001,1110000,1111,10000000000000000,10000000000001,10000000010000,10000000011,10000100000000
seq $0,84473 ; Replace 0 with 0000 in binary representation of n.
seq $0,7088 ; The binary numbers (or binary words, or binary vectors, or binary expansion of n): numbers written in base 2.
| 67 | 191 | 0.808102 |
2a94917c53c0a2a7afa124f18750d333a62d83d4 | 822 | asm | Assembly | Working Disassembly/General/Sprites/Buggernaut/Map - Buggernaut.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/Buggernaut/Map - Buggernaut.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | null | null | null | Working Disassembly/General/Sprites/Buggernaut/Map - Buggernaut.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | null | null | null | Map_360EB4: dc.w Frame_360EC0-Map_360EB4
dc.w Frame_360EC8-Map_360EB4
dc.w Frame_360EDC-Map_360EB4
dc.w Frame_360EF6-Map_360EB4
dc.w Frame_360EFE-Map_360EB4
dc.w Frame_360F12-Map_360EB4
Frame_360EC0: dc.w 1
dc.b $F8, 9, 0, 0,$FF,$F4
Frame_360EC8: dc.w 3
dc.b $F8, 9, 0, 0,$FF,$F4
dc.b $EC, 5, 0, 6, 0, 4
dc.b $EC, 5, 8, 6,$FF,$F0
Frame_360EDC: dc.w 3
dc.b $F8, 9, 0, 0,$FF,$F4
dc.b $F8, 5, 0, 6,$FF,$F8
dc.b $FC, 5,$10, 6, 0, 4
dc.b $FC
dc.b 5
dc.b $18
dc.b 6
dc.b $FF
dc.b $F0
Frame_360EF6: dc.w 1
dc.b $F8, 5, 0, $A,$FF,$F8
Frame_360EFE: dc.w 3
dc.b $F8, 5, 0, $A,$FF,$F8
dc.b $F5, 4, 0, $E, 0, 0
dc.b $F5, 4, 8, $E,$FF,$F4
Frame_360F12: dc.w 3
dc.b $F8, 5, 0, $A,$FF,$F8
dc.b $FD, 4,$10, $E, 0, 0
dc.b $FD, 4,$18, $E,$FF,$F4
| 24.909091 | 40 | 0.543796 |
e552a6db6fb9e56a6793074a8b6469a10ac94600 | 489 | asm | Assembly | util/cv/vcurs.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | util/cv/vcurs.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | util/cv/vcurs.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ; visible strings for cursor/caps V0.00 1988 Tony Tebby QJUMP
section cv
xdef cv_vcurs
;+++
; Table of visible strings for cursor keys and caps.
; 5 (positive) relative byte pointer to byte length strings.
;---
cv_vcurs
dc.b left-*
dc.b right-*
dc.b up-*
dc.b down-*
dc.b caps-*
left dc.b 1,$bc
right dc.b 1,$bd
up dc.b 1,$be
down dc.b 1,$bf
caps dc.b 4,'CAPS'
end
| 21.26087 | 69 | 0.519427 |
e63811d902176c746533a750ff64c98491465ba1 | 826 | asm | Assembly | oeis/037/A037117.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/037/A037117.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/037/A037117.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A037117: Trajectory of 3 under map n->39n+1 if n odd, n->n/2 if n even
; Submitted by Jon Maiga
; 3,118,59,2302,1151,44890,22445,875356,437678,218839,8534722,4267361,166427080,83213540,41606770,20803385,811332016,405666008,202833004,101416502,50708251,1977621790,988810895,38563624906,19281812453,751990685668,375995342834,187997671417,7331909185264,3665954592632,1832977296316,916488648158,458244324079,17871528639082,8935764319541,348494808462100,174247404231050,87123702115525,3397824382505476,1698912191252738,849456095626369,33128787729428392,16564393864714196,8282196932357098
add $0,1
mov $1,$0
mov $0,3
lpb $1
mov $2,$0
mod $2,2
add $3,1
sub $3,$2
mov $4,$0
lpb $2
mul $0,13
add $0,1
mul $0,3
sub $0,2
sub $2,1
lpe
lpb $3
div $0,2
sub $3,1
lpe
sub $1,1
lpe
mov $0,$4
| 29.5 | 486 | 0.745763 |
4ae0b0b46f8bf347321bc0b06bb3580c4f7c1ecc | 185 | asm | Assembly | data/wildPokemon/route16.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 16 | 2018-08-28T21:47:01.000Z | 2022-02-20T20:29:59.000Z | data/wildPokemon/route16.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 5 | 2019-04-03T19:53:11.000Z | 2022-03-11T22:49:34.000Z | data/wildPokemon/route16.asm | longlostsoul/EvoYellow | fe5d0d372c4e90d384c4005a93f19d7968f2ff13 | [
"Unlicense"
] | 2 | 2019-12-09T19:46:02.000Z | 2020-12-05T21:36:30.000Z | Route16Mons:
db $19
db 22,NATU ;day
db 22,DODUO
db 23,RATTATA
db 24,YANMA ;day
db 24,DODUO
db 26,SPEAROW
db 23,YANMA ;day
db 24,FEAROW
db 25,RATICATE
db 26,RATICATE
db $00
| 12.333333 | 17 | 0.691892 |
4dd16667fc37723ad7233cd196760c30e881a3ce | 1,074 | asm | Assembly | s2/sfx-original/AD - Inhaling Bubble.asm | Cancer52/flamedriver | 9ee6cf02c137dcd63e85a559907284283421e7ba | [
"0BSD"
] | 9 | 2017-10-09T20:28:45.000Z | 2021-06-29T21:19:20.000Z | s2/sfx-original/AD - Inhaling Bubble.asm | Cancer52/flamedriver | 9ee6cf02c137dcd63e85a559907284283421e7ba | [
"0BSD"
] | 12 | 2018-08-01T13:52:20.000Z | 2022-02-21T02:19:37.000Z | s2/sfx-original/AD - Inhaling Bubble.asm | Cancer52/flamedriver | 9ee6cf02c137dcd63e85a559907284283421e7ba | [
"0BSD"
] | 2 | 2018-02-17T19:50:36.000Z | 2019-10-30T19:28:06.000Z | Sound2D_InhalingBubble_Header:
smpsHeaderStartSong 2, 1
smpsHeaderVoice Sound2D_InhalingBubble_Voices
smpsHeaderTempoSFX $01
smpsHeaderChanSFX $01
smpsHeaderSFXChannel cFM5, Sound2D_InhalingBubble_FM5, $0E, $00
; FM5 Data
Sound2D_InhalingBubble_FM5:
smpsSetvoice $00
smpsModSet $01, $01, $21, $6E
dc.b nCs3, $07, nRst, $06
smpsModSet $01, $01, $44, $1E
dc.b nAb3, $08
smpsStop
Sound2D_InhalingBubble_Voices:
; Voice $00
; $35
; $05, $09, $08, $07, $1E, $0D, $0D, $0E, $0C, $15, $03, $06
; $16, $0E, $09, $10, $2F, $2F, $1F, $1F, $15, $12, $12, $80
smpsVcAlgorithm $05
smpsVcFeedback $06
smpsVcUnusedBits $00
smpsVcDetune $00, $00, $00, $00
smpsVcCoarseFreq $07, $08, $09, $05
smpsVcRateScale $00, $00, $00, $00
smpsVcAttackRate $0E, $0D, $0D, $1E
smpsVcAmpMod $00, $00, $00, $00
smpsVcDecayRate1 $06, $03, $15, $0C
smpsVcDecayRate2 $10, $09, $0E, $16
smpsVcDecayLevel $01, $01, $02, $02
smpsVcReleaseRate $0F, $0F, $0F, $0F
smpsVcTotalLevel $80, $12, $12, $15
| 29.027027 | 64 | 0.624767 |
95d79da9488f93e5ae3e8b79b5c80f68eb07086f | 698 | asm | Assembly | oeis/174/A174755.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/174/A174755.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/174/A174755.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A174755: x-values in the solution to x^2-47*y^2=1.
; Submitted by Jon Maiga
; 1,48,4607,442224,42448897,4074651888,391124132351,37543842053808,3603817713033217,345928956609135024,33205576016763929087,3187389368652728057328,305956173814645129574401,29368605296837279711085168,2819080152322564207134601727,270602326017669326605210680624,25975004217543932789893090738177,2493329802558199878503131500184368,239333686041369644403510730926961151,22973540530168927662858527037488086128,2205220557210175685990015084867929307137,211678199951646696927378589620283725399024
mov $3,1
lpb $0
sub $0,$3
add $4,$2
mov $1,$4
mul $1,47
add $2,1
add $2,$1
add $4,$2
lpe
mov $0,$4
mul $0,47
add $0,1
| 38.777778 | 486 | 0.833811 |
650fa7537d607d1ad95309780035266eb9acce76 | 471 | asm | Assembly | oeis/217/A217730.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/217/A217730.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/217/A217730.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A217730: Expansion of (1+2*x-x^3)/(1-4*x^2+2*x^4).
; Submitted by Jon Maiga
; 1,2,4,7,14,24,48,82,164,280,560,956,1912,3264,6528,11144,22288,38048,76096,129904,259808,443520,887040,1514272,3028544,5170048,10340096,17651648,35303296,60266496,120532992,205762688,411525376,702517760,1405035520,2398545664,4797091328,8189147136,16378294272,27959497216
mov $1,1
mov $2,1
lpb $0
sub $0,2
mul $1,2
add $1,$2
add $2,$1
lpe
lpb $0
div $0,4
add $2,$1
lpe
mov $0,$2
| 26.166667 | 272 | 0.719745 |
9da0a47ccc19f4e37875f71a4028960ef2635a0d | 379 | asm | Assembly | programs/oeis/048/A048038.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/048/A048038.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/048/A048038.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A048038: Number of nonempty subsets of {1,2,...,n} in which exactly 1/2 of the elements are <= (n+1)/3.
; 0,1,2,3,9,14,20,55,83,119,329,494,714,2001,3002,4367,12375,18563,27131,77519,116279,170543,490313,735470,1081574,3124549,4686824,6906899,20030009,30045014,44352164,129024479,193536719,286097759
mov $1,$0
mov $2,$0
add $2,2
mov $0,$2
div $0,3
add $1,1
bin $1,$0
sub $1,1
| 31.583333 | 195 | 0.712401 |
13da60066e8f32b338f809e564d410ebb6bda43b | 755 | asm | Assembly | oeis/163/A163833.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/163/A163833.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/163/A163833.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A163833: a(n) = n*(6*n^2 + 15*n + 5)/2.
; Submitted by Jamie Morken(s2)
; 0,13,59,156,322,575,933,1414,2036,2817,3775,4928,6294,7891,9737,11850,14248,16949,19971,23332,27050,31143,35629,40526,45852,51625,57863,64584,71806,79547,87825,96658,106064,116061,126667,137900,149778,162319,175541,189462,204100,219473,235599,252496,270182,288675,307993,328154,349176,371077,393875,417588,442234,467831,494397,521950,550508,580089,610711,642392,675150,709003,743969,780066,817312,855725,895323,936124,978146,1021407,1065925,1111718,1158804,1207201,1256927,1308000,1360438,1414259
mov $1,$0
mul $0,3
sub $0,1
mov $3,$1
sub $3,2
mul $0,$3
div $0,2
mov $2,$1
mul $2,$1
add $1,1
mov $4,$2
mul $4,3
add $0,$4
add $2,2
mul $2,$1
mov $4,$2
mul $4,3
add $0,$4
sub $0,7
| 31.458333 | 498 | 0.736424 |
0b665e9792a5d4399c8b4c6db267e36e934112bc | 192 | asm | Assembly | libsrc/_DEVELOPMENT/adt/wv_stack/c/sdcc_iy/wv_stack_shrink_to_fit.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/wv_stack/c/sdcc_iy/wv_stack_shrink_to_fit.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/wv_stack/c/sdcc_iy/wv_stack_shrink_to_fit.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; int wv_stack_shrink_to_fit(wv_stack_t *s)
SECTION code_adt_wv_stack
PUBLIC _wv_stack_shrink_to_fit
EXTERN _b_vector_shrink_to_fit
defc _wv_stack_shrink_to_fit = _b_vector_shrink_to_fit
| 17.454545 | 54 | 0.875 |
7dd40ac36f88146fdbe66994d59f90e58e853596 | 100,402 | asm | Assembly | calcsys.asm | denglend/calcsys | 3dee09376f1f3b08be49ca001d4e206604508a1f | [
"BSD-3-Clause"
] | 3 | 2022-01-20T03:57:08.000Z | 2022-01-20T13:23:48.000Z | calcsys.asm | denglend/calcsys | 3dee09376f1f3b08be49ca001d4e206604508a1f | [
"BSD-3-Clause"
] | 1 | 2018-10-16T11:40:08.000Z | 2018-10-16T11:40:08.000Z | calcsys.asm | denglend/calcsys | 3dee09376f1f3b08be49ca001d4e206604508a1f | [
"BSD-3-Clause"
] | null | null | null | ;Calcsys 1.3 for the TI-83 Plus and the TI-73 (and TI-83?)
;(c) 2000ish Detached Solutions, Dan Englender
;So what's new in 1.4?
;This is just a bug fix release, although the source has been released again
; (the last release was 1.1).
;Bug fixes:
; Flag byte 20 now displays correctly
; Displays correct size information for archived variables
; Hex Editor now views RAM pages on 84P correctly
;So what's new in 1.3?
;Not too much in fact, this version is mostly just to add TI-83 Plus Silver Edition
; support (link console). (Actually, it's turned into a more substantial update
; than I expected. I kept finding more things to do)
;A new sub-section was added to the VAT section: Applications. (Yes, I know that
; apps aren't in the VAT. You think I could implement this if I didn't know?
; sheesh...). In this sub-section you can quickly find info on loaded apps, and
; jump to the Hex Editor with Alpha+H.
;New Console commands:
; ROM - Displays address and page of the entry point address you provide
; DISROM (DR) - Disassembles the routine for the entry point address you provide
;Some bug fixes:
; Hopefully all disasembler bugs are gone. These were all problems with the text
; or size of IX/IY instructions.
; VAT types greater than 17 are reported as "Other"
; TI-73 only VAT types are now supported
; Menus now exit correctly with the CLEAR button.
; You can now set the L virtual register in the console
; SEARCH now searches page zero (thanks to Michael Vincent for that report)
; SEARCH now works correctly on the Silver Edition
; You can set/reset bit seven of flags
;So what's new in 1.2? (Other than the previous sentence now ryhming....)
;Version 1.2 was completely rewritten from scratch. This means there's a ton of
; cool new features, right? Wrong...Oh well.
;Well, it's written for ZDS now. A side effect of this is that there is now a
; TI-73 version of Calcsys. Nifty huh?
;The TI-73 version is almost identical to the TI-83 Plus version. There are a
; couple of differences, but nothing major.
;On to other things...You can no longer log stuff from Port Monitor. I noticed
; that logging the ports had absolutely no use, so I took it out.
;The about screen has been completely changed. It looks sort of cool now. The
; calc info stuff that used to be at the end of the about screen is now in the
; console.
;There have been a few changes to the Console, most notably a much nicer input
; routine, but there's some other stuff too...
;You can no longer run BASIC programs from the Console, but you can run assembly
; programs.
;My favorite change is most likely the addition of the Search capability to the
; Console. It lets you search the entire ROM for a string of values.
;A 16bit find has been added to the Hex Editor, and bookmarks added to both the
; Hex Editor and Disassembler.
;The Link Console now has a cursor and can bulk output.
;Hopefully the few bugs that were left in version 1.1 are now gone.
;Just about everything runs faster since I coded it better this time around.
;Contact Information
;Detached Solutions -- http://www.detachedsolutions.com
;Dan Englender -- dan@detachedsolutions.com
;Complaints about flash applications and signing -- 5th floor
DEFINE TI83P
; DEFINE BETA
; DEFINE TI73
IFDEF TI83P
include "../ti83plus.inc"
ENDIF
IFDEF TI73
include "../ti73asm.inc"
ENDIF
IFDEF ION
include "../squish.inc"
ENDIF
include "calcsyhd.inc"
include "calcsequ.inc"
GLOBALS ON
jp Init
ld hl,SCounter
set 3,(hl)
ret
Init:
;Initialization Code
IFDEF TI83P
B_CALL SetTblGraphDraw
B_CALL ForceFullScreen
B_CALL EnableAPD
ENDIF
IFDEF ION
set apdAble,(iy+apdFlags)
ENDIF
IFDEF TI73
AppOffErr
B_CALL DisableAPI
ld hl,DummyReturn
ld (appRawKeyHandle),hl
in a,(6)
ld (appPage),a
call SetTblGraphDraw
call ForceFullScreen
B_CALL EnableApd
ENDIF
ld hl,HexAddr
ld bc,InitBlank
B_CALL MemClear ;Initialize memory variables
ld a,0C9h
ld (ConstRetAddr),a
MainLoop:
;Main Menu (1)
ld hl,MainMenu
jr MainLoopCont
MainLoop2:
;Main Menu (2)
ld hl,MainMenu2
MainLoopCont:
res appAutoScroll,(iy+appFlags)
res curAble,(iy+curFlags)
res textWrite,(iy+sGrFlags)
ld a,(flags+shiftFlags)
and 7
ld (flags+shiftFlags),a
ld de,0800h
ld (winTop),de
jp HomeTextMenu
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- Hex Editor --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
HexEditor:
;Calcsys Hex Editor
call ClrLCDAndHomeUp
call DispHexScreen
HexEditorLoop:
ld hl,HexEditorKeys
jp ReactionMenu
HexBookMark:
sub k0
ld b,a
add a,a
add a,b
ld l,a
ld h,0
ld de,BookMarks
add hl,de
in a,(4)
and 8
jr nz,HexBookMarkNoSet
ld de,(HexAddr)
ld (hl),e
inc hl
ld (hl),d
inc hl
ld a,(HexPage)
ld (hl),a
jr HexEditor
HexBookMarkNoSet:
push hl
B_CALL LdHLInd
ld (HexAddr),hl
pop hl
inc hl
inc hl
ld a,(hl)
ld (HexPage),a
jr HexEditor
HexUp:
ld de,-4
jr HexMove
HexDown:
ld de,4
jr HexMove
HexLeft:
ld de,-1
jr HexMove
HexRight:
ld de,1
jr HexMove
HexAdd:
ld de,100h
jr HexMove
HexSub:
ld de,-100h
jr HexMove
HexMul:
ld de,1000h
jr HexMove
HexDiv:
ld de,-1000h
jr HexMove
HexBOL:
ld de,-10h
jr HexMove
HexEOL:
ld de,10h
HexMove:
ld hl,(HexAddr)
add hl,de
ld (HexAddr),hl
jr HexEditor
HexGoto:
ld hl,(HexAddr)
call GotoScreen
ld (HexAddr),hl
jp HexEditor
HexRomPage:
ld a,(HexPage)
call RomPageScreen
ld (HexPage),a
jp HexEditor
HexSwitchDis:
ld a,(HexPage)
ld (DisPage),a
ld hl,(HexAddr)
ld (DisAddr),hl
jp Disassemble
HexFind2:
call FindScreen2
push hl
IFNDEF ION
ld hl,HexFindCode2
ld de,ramCode
ld bc,HexFindCode2Len
ldir
ENDIF
ld hl,(HexAddr)
pop de
push hl
ld hl,0DADAh
or a
sbc hl,de
push af
pop hl
ld a,l
pop hl
and 64 ; 7
ld b,a
ld a,(SCounter)
or b
ld (SCounter),a
ld bc,0
IFNDEF ION
call ramCode
ENDIF
IFDEF ION
call HexFindCode2
ENDIF
jp HexEditor
HexFindCode2:
IFNDEF ION
in a,(6)
ELSE
in a,(2)
ENDIF
push af
ld a,(HexPage)
IFNDEF ION
out (6),a
ELSE
or 88h
out (2),a
ENDIF
HexFindCode2Loop:
ld a,d
cpir
jr nz,HexFindCode2LoopDone
ld a,(hl)
cp e
jr nz,HexFindCode2Loop
dec hl
HexFindCode2LoopDone:
ld (HexAddr),hl
pop af
IFNDEF ION
out (6),a
ELSE
out (2),a
ENDIF
ret
HexFindCode2Len EQU $-HexFindCode2
HexFind:
call FindScreen
IFNDEF ION
ld hl,HexFindCode
ld de,8100h
ld bc,HexFindCodeLen
ldir
ENDIF
ld hl,(HexAddr)
ld bc,0
IFNDEF ION
call ramCode
ELSE
call HexFindCode
ENDIF
jp HexEditor
HexFindCode:
ld d,a
IFNDEF ION
in a,(6)
ELSE
in a,(2)
ENDIF
push af
ld a,(HexPage)
IFNDEF ION
out (6),a
ELSE
or 88h
out (2),a
ENDIF
ld a,d
cpir
dec hl
ld (HexAddr),hl
pop af
IFNDEF ION
out (6),a
ELSE
out (2),a
ENDIF
jp HexEditor
HexFindCodeE:
HexFindCodeLen EQU HexFindCodeE - HexFindCode
HexEdit:
ld hl,(HexAddr)
ld de,8000h
or a
sbc hl,de
jp c,HexEditorLoop
ld hl,0500h
ld (curRow),hl
call GetHexA
ld hl,(HexAddr)
ld de,SCounter
B_CALL CpHLDE
jp z,HexEditor
ld (hl),a
jp HexEditor
DispHexScreen:
;Display Hex Editor
ld hl,(HexAddr)
ld b,4
DispHexScreenLoop:
ld a,4
sub b
add a,a
ld e,a
ld d,0
ld (curRow),de
push bc
call DispHexRow
pop bc
djnz DispHexScreenLoop
ret
DispHexRow:
;Display Hex Row (Really two rows)
call DispHexHL
ld a,':'
B_CALL PutC
ld b,4
DispHexRowLoop:
push bc
call GetHexVal
push hl
cp 0D6h ;New Line char
jr nz,NoNewLine
ld a,Lcolon
NoNewLine:
ld hl,curRow
inc (hl)
B_CALL PutMap
dec (hl)
pop hl
call GetHexVal
call DispHexA
inc hl
ld a,' '
B_CALL PutC
pop bc
djnz DispHexRowLoop
ret
GetHexVal:
;Gets value from ROM/RAM
ld a,(HexPage)
ld b,a
IFNDEF ION
IFDEF TI73
call LoadCIndPaged
ELSE
; B_CALL LoadCIndPaged
bit 6,h
jr z,$f
bit 7,h
jr nz,$f
di
in a,(7)
push af
ld a,b
out (7),a
set 7,h
res 6,h
ld c,(hl)
res 7,h
set 6,h
pop af
out (7),a
ei
ld a,c
ret
$$:
B_CALL LoadCIndPaged
ENDIF
ELSE
ld c,(hl)
ENDIF
ld a,c
DummyReturn:
ret
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- Shared Routines --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
OldLine:
push hl
ld hl,curRow
dec (hl)
inc hl
ld (hl),0
pop hl
ret
IGetKey:
;Internal GetKey call
push hl
push de
push bc
B_CALL GetKey
pop bc
pop de
pop hl
res onInterrupt,(iy+onFlags)
IFDEF TI73
cp kMath
jr nz,IGNotkMath
push af
ld a,(flags+indicFlags)
xor 1<<shiftAlpha
ld (flags+indicFlags),a
and 1<<shiftAlpha
jr nz,IGNotAOff
res shiftALock,(iy+indicFlags)
IGNotAOff:
pop af
IGNotkMath:
cp kAlpha
jr nz,IGNotkText
set shiftAlpha,(iy+indicFlags)
set shiftALock,(iy+indicFlags)
IGNotkText:
ENDIF
cp kQuit
ret nz
Quit:
ld a,' '
ld (curUnder),a
IFNDEF ION
B_JUMP JForceCmdNoChar
ELSE
B_CALL DelRes
ret
ENDIF
FindScreen2:
ld hl,FindScreenTXT2
call DispHomeTextC
jp GetHexHL
FindScreen:
ld hl,FindScreenTXT
call DispHomeTextC
jp GetHexA
RomPageScreen:
push af
ld hl,RomPageScreenTXT
call DispHomeTextC
pop af
call DispHexA
B_CALL NewLine
ld hl,RomPageScreenTXT2
call PutSApp
jp GetHexA
GotoScreen:
push hl
ld hl,GotoScreenTXT
call DispHomeTextC
pop hl
call DispHexHL
B_CALL NewLine
ld hl,GotoScreenTXT2
call PutSApp
jp GetHexHL
ReactionMenu:
;does stuff on key presses
;A will hold the key press # (just in case you
; want to have the same label for multiple key
; presses)
push hl
call IGetKey
pop hl
push hl
ld c,(hl)
inc hl ;hl->key codes
ld b,0
push bc
cpir
pop de ;de=~trials
pop hl
jr nz,ReactionMenu
ex de,hl
or a
sbc hl,bc
ex de,hl ;de = real trials, hl -> structure
ld c,(hl)
ld b,0
add hl,bc
inc hl
dec e
sla e
add hl,de
push af
B_CALL LdHLInd
pop af
jp (hl)
Race:
B_CALL GrBufClr
ld hl,0
ld a,28
ld (RaceLast),a
RaceLoop:
push hl
B_CALL GrBufCpy
call RaceAddRow
ld a,1
ld (plotSScreen+63*12+5),a
rrca
ld (plotSScreen+63*12+6),a
ld a,0FEh
out (1),a
in a,(1)
cp 0FDh
call z,RaceMoveLeft
cp 0FBh
call z,RaceMoveRight
call RaceCheckHit
pop hl
ret nz
inc hl
jr RaceLoop
RaceAddRow:
ld de,plotSScreen+767
ld hl,plotSScreen+755
ld bc,756
lddr
inc hl
push hl
ld bc,12
B_CALL MemClear
pop hl
dec c
ld b,9
call RandNum
sub 4
ld b,a
ld a,(RaceLast)
add a,b
cp 240
jr c,RaceLastOK1
xor a
RaceLastOK1:
cp 64
jr c,RaceLastOK2
ld a,63
RaceLastOK2:
or a
jr nz,RaceLastOK3
inc a
RaceLastOK3:
ld (RaceLast),a
ld b,a
ld c,8
RaceAddRowLoopy
ld (hl),255
inc hl
dec c
jr nz,RaceAddRowLoopy
RaceAddRowLoop:
ld hl,plotSScreen+11
scf
ld c,12
RaceAddRowLoop2:
rl (hl)
dec hl
dec c
jr nz,RaceAddRowLoop2
djnz RaceAddRowLoop
ret
RaceMoveLeft:
ld hl,plotSScreen+11
ld de,24
ld c,63
RaceMoveLeftLoop1:
ld b,12
scf
RaceMoveLeftLoop2:
rl (hl)
dec hl
djnz RaceMoveLeftLoop2
add hl,de
dec c
jr nz,RaceMoveLeftLoop1
ret
RaceMoveRight:
ld hl,plotSScreen
ld c,63
RaceMoveRightLoop1:
ld b,12
scf
RaceMoveRightLoop2:
rr (hl)
inc hl
djnz RaceMoveRightLoop2
dec c
jr nz,RaceMoveRightLoop1
ret
RaceCheckHit:
ld a,(plotSScreen+62*12+5)
and 2
ret nz
ld a,(plotSScreen+62*12+6)
and 64
ret
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- Disassembler --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
Disassemble:
;Calcsys Disassembler
call DisDispScreen
DisLoop:
ld hl,DisKeys
jp ReactionMenu
DisGetVal:
ld a,(DisPage)
push bc
push de
ld b,a
IFNDEF ION
IFDEF TI83P
B_CALL LoadCIndPaged
ELSE
call LoadCIndPaged
ENDIF
ELSE
ld c,(hl)
ENDIF
ld a,c
pop de
pop bc
ret
DisBookMark:
sub k0
ld b,a
add a,a
add a,b
ld l,a
ld h,0
ld de,BookMarks
add hl,de
in a,(4)
and 8
jr nz,DisBookMarkNoSet
ld de,(DisAddr)
ld (hl),e
inc hl
ld (hl),d
inc hl
ld a,(DisPage)
ld (hl),a
jr Disassemble
DisBookMarkNoSet:
push hl
B_CALL LdHLInd
ld (DisAddr),hl
pop hl
inc hl
inc hl
ld a,(hl)
ld (DisPage),a
jr Disassemble
DisSwitchHex:
ld hl,(DisAddr)
ld (HexAddr),hl
ld a,(DisPage)
ld (HexPage),a
jp HexEditor
DisGoto:
ld hl,(DisAddr)
call GotoScreen
ld (DisAddr),hl
jr Disassemble
DisRomPage:
ld a,(DisPage)
call RomPageScreen
ld (DisPage),a
jr Disassemble
DisUp:
ld hl,(DisAddr)
dec hl
ld (DisAddr),hl
jr Disassemble
DisDown:
ld hl,(DisAddr)
call DisGetLength
ld e,a
ld d,0
add hl,de
ld (DisAddr),hl
jp Disassemble
DisDispScreen:
call ClrLCDAndHomeUp
ld b,8
ld hl,(DisAddr)
DisDispScreenLoop:
ld a,8
sub b
ld (curRow),a
sub a
ld (curCol),a
push bc
push hl
call DispHexHL
ld a,':'
B_CALL PutC
pop hl
push hl
call DisName
xor a
ld (OP1+15),a
ld hl,OP1
call PutSApp
pop hl
call DisGetLength
ld e,a
ld d,0
add hl,de
pop bc
djnz DisDispScreenLoop
ret
DisGetLength:
;Returns the size of the instruction at HL in A
push hl
call DisGetVal
cp 0EDh
jr z,DisGetLengthED
cp 0DDh
jr z,DisGetLengthRec
cp 0FDh
jr z,DisGetLengthRec
cp 0CBh
jr z,DisGetLengthCB
ld l,a
ld h,0
add hl,hl
ld de,dtab1
add hl,de
ld a,(hl)
pop hl
ret
DisGetLengthCB:
ld a,2
pop hl
ret
DisGetLengthED:
inc hl
call DisGetVal
ld b,dtabedsize
ld hl,dtabed
DisGetLengthEDLoop:
cp (hl)
inc hl
jr z,DisGetLengthEDFind
inc hl
inc hl
djnz DisGetLengthEDLoop
ld a,2
pop hl
ret
DisGetLengthEDFind:
ld a,(hl)
pop hl
ret
DisGetLengthRec:
inc hl
ld a,(hl)
push af
call DisGetLength ;Recurse around the mulberry bush
; cp 1
; jr z,DisGetLengthNoOff
; inc a
;DisGetLengthNoOff:
pop bc
inc a
inc a
pop hl
cp 5
jr nz,DisGetLengthRecNo5
dec a
ret
DisGetLengthRecNo5:
cp 3
ret nz
push af
push hl
ld a,b
ld hl,IXIYNoOffset
ld bc,IXIYNoOffsetNum ;Loads account for -3
cpir
pop hl
pop bc
ld a,b
ret nz
dec a
ret
DisNameED:
inc hl
call DisGetVal
push hl
ld b,dtabedsize
ld hl,dtabed
DisNameEDLoop:
cp (hl)
jr z,DisNameEDFound
inc hl
inc hl
inc hl
djnz DisNameEDLoop
ld de,OP1
ld hl,EDUnknownTXT
B_CALL StrCopy
pop hl
ret
DisNameEDFound:
inc hl
inc hl
ld a,(hl)
push af
ld a,dtabedsize
sub b
ld hl,dstred
call FindIndexText
ld de,OP1
B_CALL StrCopy
pop af
pop hl
inc hl
jp DisNameCont
DisNameCB:
inc hl
call DisGetVal
ld b,a
and 7
ld c,a
ld a,b
srl a
srl a
srl a
push bc
ld hl,dstrcb
call FindIndexText
ld de,OP1
B_CALL StrCopy
pop bc
ld l,c
ld h,0
add hl,hl
add hl,hl
ld bc,dregstxt
add hl,bc
ld bc,4
ldir
xor a
ld (de),a
ret
DisNameFD:
ld de,'y'*256+'i'
ld (TempDDFD),de
jr DisNameDDCont
DisNameDDUnknown:
pop hl
ld de,OP1
ld hl,DDUnknownTXT
ld a,(TempDDFD+1)
cp 'y'
jr nz,DisNameDDUnknownOK
ld hl,FDUnknownTXT
DisNameDDUnknownOK
B_CALL StrCopy
ret
DisNameDD:
ld de,'x'*256+'i'
ld (TempDDFD),de
DisNameDDCont:
inc hl
call DisGetVal
ld (DisTempDD),a
inc hl
push hl
cp 22h
jr z,DisNameDDLoad
cp 21h
jr z,DisNameDDLoad
cp 2Ah
jr nz,DisNameDDNoLoad
DisNameDDLoad:
call DisGetVal
ld (DisTempDD+1),a
inc hl
call DisGetVal
ld (DisTempDD+2),a
jr DisNameDDLoadCont
DisNameDDNoLoad:
inc hl
call DisGetVal
ld (DisTempDD+1),a
DisNameDDLoadCont:
ld hl,DisTempDD
call DisName
ld hl,OP1
DisNameDDLoop:
ld a,(hl)
cp 'h'
jr z,DisNameDDFound
or a
jr z,DisNameDDUnknown
inc hl
jr DisNameDDLoop
DisNameDDFound:
inc hl
ld a,(hl)
cp 'l'
jr nz,DisNameDDLoop
inc hl
push hl ;hl = insertion point
; ld hl,DisTempDD
; call DisGetLength
; dec a
ld a,(DisTempDD)
ld hl,IXIYNoOffset
ld bc,IXIYNoOffsetNum
cpir
jr nz,DisNameDDLengthOK
pop hl
dec hl
ld a,(TempDDFD+1)
ld (hl),a
dec hl
ld a,(TempDDFD)
ld (hl),a
pop hl
ret
DisNameDDLengthOK:
pop hl
push hl
ld de,15
add hl,de
ld d,h
ld e,l
inc de
; inc de
; inc de
ld bc,15
lddr ;bah
pop hl
dec hl
dec hl
ld a,(TempDDFD+1)
ld (hl),a
dec hl
ld a,(TempDDFD)
ld (hl),a
inc hl
inc hl ;HL-> Plus or Minus
pop de
ld (hl),'+'
ex de,hl
call DisGetVal ;A=Index offset byte
ex de,hl
cp 80h
jr c,DisNameDDAdd
ld (hl),'-'
neg
DisNameDDAdd:
ex de,hl
call HexToASCII
inc de
ld a,h
ld (de),a
inc de
ld a,(de)
ld b,a
ld a,l
ld (de),a
inc de
ld a,b
cp ','
ret z
xor a
ld (de),a
ret
DisName:
;Loads name for instruction at HL
;into OP1
call DisGetVal
cp 0EDh
jp z,DisNameED
cp 0CBh
jp z,DisNameCB
cp 0DDh
jp z,DisNameDD
cp 0FDh
jp z,DisNameFD
push hl
ld hl,dstr
push af
call FindIndexText
ld de,OP1
B_CALL StrCopy
pop af
ld h,0
ld l,a
add hl,hl
ld bc,dtab1
add hl,bc
inc hl
ld a,(hl)
pop hl
inc hl
;de still points to end of string in OP1
DisNameCont:
or a
ret z
dec a
jp z,DisDisp1Tag
dec a
jp z,DisDisp2Tag
dec a
jr z,DisDisp1TagRel
dec a
jr z,DisDisp2Emb
dec a
jr z,DisDisp2TagPtr
dec a
jr z,DisDispOut
DisDispIn:
call DisGetVal
call HexToASCII
ex de,hl
ld hl,OP1+6
ld (hl),d
inc hl
ld (hl),e
inc hl
ld (hl),')'
inc hl
ld (hl),0
ret
DisDispOut:
call DisGetVal
call HexToASCII
ld a,h
ld (OP1+4),a
ld a,l
ld (OP1+5),a
ret
DisDisp2TagPtr:
call DisDisp2Tag
ret
DisDisp2Emb:
inc hl
call DisGetVal
push hl
call HexToASCII
ld a,h
ld (OP1+3),a
ld a,l
ld (OP1+4),a
pop hl
dec hl
call DisGetVal
call HexToASCII
ld a,h
ld (OP1+5),a
ld a,l
ld (OP1+6),a
ret
DisDisp1TagRel:
call DisGetVal
ld b,0
ld c,a
cp 82h
jr c,DisDisp1TagRelNo
ld a,c
neg
ld c,a
or a
sbc hl,bc
inc hl
jr DisDisp2TagCont
DisDisp1TagRelNo:
inc hl
add hl,bc
DisDisp2TagCont:
push hl
ld a,h
call HexToASCII
ld a,h
ld (de),a
inc de
ld a,l
ld (de),a
inc de
pop hl
ld a,l
DisDisp1TagCont:
call HexToASCII
ld a,h
ld (de),a
inc de
ld a,l
ld (de),a
inc de
xor a
ld (de),a
ret
DisDisp2Tag:
; B_CALL LdHLInd
call DisGetVal
ld b,a
inc hl
call DisGetVal
ld h,a
ld l,b
jr DisDisp2TagCont
DisDisp1Tag:
call DisGetVal
jr DisDisp1TagCont
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- Port Monitor --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
PortMon:
;Calcsys Port Monitor
ld hl,PortMonTXT
call DispHomeTextC
PortMonLoop2:
ld hl,0007h
ld (curRow),hl
push hl
ld hl,BlankTXT
call PutSApp
pop hl
ld (curRow),hl
ld a,(CurPort)
cp NumPortNames+1 ;Does this port have a name?
jr nc,PortMonLoop
ld hl,PortNames
call FindIndexText ;Get Port Name from List
call PutSApp
PortMonLoop:
ld hl,0601h
ld (curRow),hl
ld a,(CurPort)
ld c,a
call DispHexA
in a,(c)
ld hl,0402h
ld (curRow),hl
push af
ld l,a
ld h,0
B_CALL DispHL
pop af
ld hl,0503h
ld (curRow),hl
push af
call DispHexA
pop af
ld hl,0504h
ld (curRow),hl
call DispBinA
PortMonKeyGet:
B_CALL GetCSC
cp skUp
jr z,PortMonUp
cp skDown
jr z,PortMonDown
cp skRight
jr z,PortMonRight
cp skLeft
jr z,PortMonLeft
cp skEnter
jr z,PortMonEdit
cp skClear
jp z,MainLoop
jr PortMonLoop
PortMonUp:
ld b,1
jr PortMonMove
PortMonDown:
ld b,-1
jr PortMonMove
PortMonLeft:
ld b,-5
jr PortMonMove
PortMonRight:
ld b,5
PortMonMove:
ld a,(CurPort)
add a,b
ld (CurPort),a
jp PortMonLoop2
PortMonEdit:
ld hl,0005h
ld (curRow),hl
ld hl,PortMonTXT2
call PutSApp
call GetHexA
push af
ld a,(CurPort)
ld c,a
pop af
out (c),a
jp PortMon
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- System Flags --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
SysFlags:
;Calcsys System Flags
xor a
ld (CurTopFlag),a
SysFlagMainLoop:
call DispMainFlagScreen
ld hl,SysFlagKeys
jp ReactionMenu
SysFlag6:
ld a,(CurTopFlag)
add a,5
ld (CurTopFlag),a
cp 041h
jr nz,SysFlagMainLoop
xor a
ld (CurTopFlag),a
jr SysFlagMainLoop
SysFlag1:
xor a
jr SysFlagChoose
SysFlag2:
ld a,1
jr SysFlagChoose
SysFlag3:
ld a,2
jr SysFlagChoose
SysFlag4:
ld a,3
jr SysFlagChoose
SysFlag5:
ld a,4
SysFlagChoose:
ld c,a
ld a,(CurTopFlag)
add a,c
ld c,a
ld b,0
ld hl,flags
add hl,bc
SysFlagChoosenLoop2:
call DispOtherFlagScreen
SysFlagChoosenLoop:
call IGetKey
cp kClear
jr z,SysFlagMainLoop
sub k0
cp 8
jr nc,SysFlagChoosenLoop
or a
ld b,a
ld a,1
jr z,SysFlagBitSkip
SysFlagBitLoop:
sla a
djnz SysFlagBitLoop
SysFlagBitSkip:
xor (hl)
ld (hl),a
jr SysFlagChoosenLoop2
DispMainFlagScreen:
ld hl,SysFlagScreen
call DispHomeTextC
ld hl,0301h
ld (curRow),hl
ld a,(CurTopFlag)
ld hl,flagscreentext
call FindIndexText
ld b,5
DispMainFlagScreenLoop:
ld a,6
sub b
ld (curRow),a
ld c,a
ld a,3
ld (curCol),a
call PutSApp
ld a,14
ld (curCol),a
dec c
ld a,(CurTopFlag)
add a,c
call DispHexA
djnz DispMainFlagScreenLoop
ret
DispOtherFlagScreen:
push hl
call ClrLCDAndHomeUp
pop hl
xor a
call GetFlagNameOffset
ld c,(hl) ;Used for rotate of flag bits
ex de,hl ;DE = Flag Addr, HL = strings to disp
DispOtherFlagScreenLoop:
push af
add a,'0'
B_CALL PutC
ld a,'.'
B_CALL PutC
ld a,' '
B_CALL PutC
call PutSApp
ld a,14
ld (curCol),a
ld a,':'
B_CALL PutC
xor a
rr c
adc a,'0'
B_CALL PutC
pop af
inc a
cp 8
jr nz,DispOtherFlagScreenLoop
ex de,hl
ret
GetFlagNameOffset:
push hl
ld a,l
ld hl,bitstrings
IFDEF TI83P
sub 0F0h
ENDIF
IFDEF TI73
sub 05Bh
ENDIF
IFDEF ION
sub 67h
ENDIF
cp 32
jr c,GetFlagNameOffsetSkip
push af
ld a,255
call FindIndexText
xor a
cpir
pop af
GetFlagNameOffsetSkip:
add a,a
add a,a
add a,a
call FindIndexText
ex de,hl
pop hl
ret
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- Console --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
Console:
;Calcsys Console
B_CALL ClrScrnFull
B_CALL HomeUp
ld hl,ConsoleTXT
call PutSApp
ConsoleLoop:
B_CALL NewLine
set appAutoScroll,(iy+appFlags)
ld hl,ConsoleBuffer
push hl
ld bc,CBufSize*2
B_CALL MemClear
pop hl
ld b,CBufSize
call StringInput
B_CALL NewLine
Parse:
;Parses the Console Buffer
;A bit better than last time, but still not so great
ld a,' '
ld bc,CBufSize
ld hl,ConsoleBuffer
cpir ;Find space (first command)
jr nz,DoParse
ld de,Argument
B_CALL StrCopy
DoParse:
ld b,NumConComs
ld hl,ConTXT
ld de,ConsoleBuffer
DoParseLoop:
call ParseCompStr
jr z,DoParseFound
call NextString
djnz DoParseLoop
ParseErrCommand:
ld hl,ConErrCommandTXT
call PutSApp
jr ConsoleLoop
ParseErrArgument:
ld hl,ConErrArgumentTXT
call PutSApp
jr ConsoleLoop
ParseErrArchived:
ld hl,ConErrArchivedTXT
call PutSApp
jr ConsoleLoop
ParseErrMemory:
ld hl,ConErrMemoryTXT
call PutSApp
jr ConsoleLoop
DoParseFound:
ld hl,(ParseEndAddr)
ld a,(hl)
or a
jr z,DoParseFoundOK
cp ' '
jr nz,ParseErrCommand
DoParseFoundOK:
push hl
ld a,NumConComs
sub b
add a,a
ld e,a
ld d,0
ld hl,ConAddrs
add hl,de
pop de ;So they can get secondary args
;Yet another dumb and completely
;useless innovation.
B_CALL LdHLInd
jp (hl) ;Run Individual Parse
ParseSmile:
ld hl,SmileTXT
call PutSApp
ld b,100
call RandNum
ld (SmileNum),a
ld b,6
ParseSmileLoop:
push bc
B_CALL NewLine
ld hl,SmileGuessTXT
call PutSApp
call GetHexA
ld c,a
ld a,(SmileNum)
cp c
jr z,ParseSmileWin
jr c,ParseSmileSmall
B_CALL NewLine
ld hl,SmileSmallTXT
call PutSApp
jr SmileNext
ParseSmileSmall:
B_CALL NewLine
ld hl,SmileBigTXT
call PutSApp
SmileNext:
pop bc
djnz ParseSmileLoop
B_CALL NewLine
ld hl,SmileLoseTXT
call PutSApp
jp ConsoleLoop
ParseSmileWin:
pop bc
B_CALL NewLine
ld hl,SmileWinTXT
call PutSApp
ld hl,SCounter
set 0,(hl)
jp ConsoleLoop
ParseMouse:
IFNDEF ION
B_CALL AppStartMouse
ParseMouseLoop:
B_CALL AppUpdateMouse
cp 0Ch
jp z,ConsoleLoop
jr ParseMouseLoop
ELSE
jp ConsoleLoop
ENDIF
ParseSet:
call ParseFindReg
jr z,ParseSetIsReg
ld hl,Argument
call ASCIIToHex
ld d,a
jp nc,ParseErrArgument
call ASCIIToHex
jp nc,ParseErrArgument
ld e,a
ld a,(hl)
inc hl
cp ','
jp nz,ParseErrArgument
ex de,hl
ld bc,8000h
push hl
or a
sbc hl,bc
pop hl
jp c,ParseErrArchived
ex de,hl
push de
call ParseCheckString
pop hl
jp z,ParseErrArgument
ld a,(hl)
push af
call DispHexHL
ld a,':'
B_CALL PutC
ld a,' '
B_CALL PutC
pop af
call DispHexA
ld a,'.'
B_CALL PutC
ld a,'.'
B_CALL PutC
ld a,'.'
B_CALL PutC
jp ConsoleLoop
ParseSetIsReg:
ld a,(hl)
cp ','
jp nz,ParseErrArgument
inc hl
dec b
jr nz,ParseSet16bit
call ASCIIToHex
jp nc,ParseErrArgument
ld (de),a
call DispHexA
jp ConsoleLoop
ParseSet16bit:
call ASCIIToHex
jp nc,ParseErrArgument
ld c,a
call ASCIIToHex
jp nc,ParseErrArgument
ld (de),a
ld l,a
ld a,c
ld h,a
inc de
ld (de),a
call DispHexHL
jp ConsoleLoop
ParseFindReg:
;checks data at DE in an attempt to find
;text of register names. Returns HL = pointer
;after register text, or Z=0 if no registers.
;Also returns DE as pointer to memory address
;for virtual register and B=1 if 8-bit, and
;B=2 for 16-bit.
ex de,hl
ParseFindRegLoop:
inc hl
ld a,(hl)
cp ' '
jr z,ParseFindRegLoop
;Help Me!!! I can't resist....writing....
;more....really...unoptimized...code!!!
;Ah well, so this parser is probably even
;worse than the original. (Don't tell anyone).
inc hl
ld b,1
cp 'I'
jr z,ParseFindFoundI
sub 'A'
jr z,ParseFindFoundA
dec a
jr z,ParseFindFoundB
dec a
jr z,ParseFindFoundC
dec a
jr z,ParseFindFoundD
dec a
jr z,ParseFindFoundE
sub 3
jr z,ParseFindFoundH
sub 4
ret nz
ParseFindFoundL:
ld de,VirL
ret
ParseFindFoundE:
ld de,VirE
ret
ParseFindFoundC:
ld de,VirC
ret
ParseFindFoundA:
ld de,VirAF
ld a,(hl)
inc hl
cp 'F'
jr nz,ParseFindFoundAA
ld b,2
ret
ParseFindFoundAA:
inc de
cp a
dec hl
ret
ParseFindFoundB:
ld de,VirBC
ld a,(hl)
inc hl
cp 'C'
jr nz,ParseFindFoundAA
ld b,2
ret
ParseFindFoundD:
ld de,VirDE
ld a,(hl)
inc hl
cp 'E'
jr nz,ParseFindFoundAA
ld b,2
ret
ParseFindFoundH:
ld de,VirHL
ld a,(hl)
inc hl
cp 'L'
jr nz,ParseFindFoundAA
ld b,2
ret
ParseFindFoundI:
ld a,(hl)
inc hl
ld b,2
cp 'X'
ret
ParseShow:
call ParseFindReg
jr nz,ParseShowPlain
dec b
jr nz,ParseShow16bit
ld a,(de)
call DispHexA
jp ConsoleLoop
ParseShow16bit:
ex de,hl
B_CALL LdHLInd
call DispHexHL
jp ConsoleLoop
ParseShowPlain:
ld hl,Argument
B_CALL StrLength
ld a,c
cp 4
jr nz,ParseShowPlainCont
call ASCIIToHex
jr nc,ParseShowPlainCont
ld d,a
call ASCIIToHex
jr nc,ParseShowPlainCont
ld e,a
ex de,hl
ld a,(hl)
push af
call DispHexHL
ld a,':'
B_CALL PutC
ld a,' '
B_CALL PutC
pop af
call DispHexA
jp ConsoleLoop
ParseShowPlainCont:
ld b,5
ld hl,VirAFTXT
ld de,VirAF
ParseShowLoop:
push bc
call PutSApp
push hl
ld a,(de)
ld l,a
inc de
ld a,(de)
ld h,a
inc de
push de
call DispHexHL
call DispBlank
pop de
pop hl
pop bc
djnz ParseShowLoop
jp ConsoleLoop
ParseRace:
call Race
push hl
ld hl,(curRow)
push hl
B_CALL HomeUp
ld b,127
ld hl,textShadow
ParseRaceLoop:
ld a,(hl)
B_CALL PutC
inc hl
djnz ParseRaceLoop
ld a,(hl)
B_CALL PutMap
pop hl
ld (curRow),hl
pop hl
ld de,500h
B_CALL CpHLDE
jr c,ParseRaceNoGood
ld a,(SCounter)
or 00100000b
ld (SCounter),a
ParseRaceNoGood:
call DispHexHL
jp ConsoleLoop
ParseClear:
call ClrLCDAndHomeUp
call OldLine
jp ConsoleLoop
ParseHexGet:
ld hl,Argument
call ASCIIToHex
ret nc
ld d,a
call ASCIIToHex
ret nc
ld e,a
ld a,(hl)
cp ','
inc hl
jr nz,retnc
call ASCIIToHex
ret nc
ld c,a
call ASCIIToHex
ret nc
ld l,a
ld h,c
ret
retnc:
or a
ret
ParseRef:
ld hl,Argument
call ASCIIToHex
jr nc,ParseRefNoAddr
ld d,a
call ASCIIToHex
jr nc,ParseRefNoAddr
ld e,a
ld b,NumRefAddrs
ld hl,RefAddrs
ParseRefAddrLoop:
push hl
B_CALL LdHLInd
B_CALL CpHLDE
pop hl
inc hl
inc hl
jr z,ParseRefAddrFound
djnz ParseRefAddrLoop
jp ParseErrArgument
ParseRefAddrFound:
ld a,NumRefAddrs
sub b
ld hl,RefDescs
call FindIndexText
call PutSApp
jp ConsoleLoop
ParseRefNoAddr:
ld b,NumRefAddrs
ld hl,RefDescs
ld de,Argument
ParseRefStrLoop:
call ParseCompStr
jr z,ParseRefDescFound
call NextString
djnz ParseRefStrLoop
jp ParseErrArgument
ParseRefDescFound:
ld a,NumRefAddrs
sub b
ld l,a
ld h,0
add hl,hl
ld de,RefAddrs
add hl,de
B_CALL LdHLInd
call DispHexHL
jp ConsoleLoop
ParseDump:
IFDEF TI83P
ld hl,ParseDumpPageTXT
call PutSApp
call GetHexA
push af
B_CALL NewLine
ld hl,ParseDumpFromTXT
call PutSApp
call GetHexHL
push hl
B_CALL NewLine
ld hl,ParseDumpToTXT
call PutSApp
call GetHexHL
push hl
B_CALL NewLine
ld hl,ParseDumpSizeTXT
call PutSApp
call GetHexHL
ld b,h
ld c,l
pop de
pop hl
pop af
B_CALL FlashToRam
ENDIF
jp ConsoleLoop
ParseWhom:
ld hl,ParseWhomTXT
call PutSApp
ld hl,SCounter
set 1,(hl)
jp ConsoleLoop
ParseHexAdd:
call ParseHexGet
jp nc,ParseErrArgument
add hl,de
call DispHexHL
jp ConsoleLoop
ParseHexSub:
call ParseHexGet
jp nc,ParseErrArgument
or a
ex de,hl
sbc hl,de
call DispHexHL
jp ConsoleLoop
ParseHexMul:
call ParseHexGet
jp nc,ParseErrArgument
ld h,e
B_CALL HTimesL
call DispHexHL
jp ConsoleLoop
ParseHexDiv:
call ParseHexGet
jp nc,ParseErrArgument
ex de,hl
ld a,e
B_CALL DivHLByA
push af
call DispHexHL
ld a,' '
B_CALL PutC
pop af
call DispHexA
jp ConsoleLoop
ParseHex:
ld hl,Argument
call ConsoleGet16Arg
jp nz,ParseErrArgument
B_CALL DispHL
jp ConsoleLoop
PopRetZ:
pop af
RetZ:
cp a
ret
ParseROM:
ld hl,Argument
call ConsoleGet16Arg
jp nz,ParseErrArgument
call GetROMHL
jp ConsoleLoop
ParseDisROM:
ld hl,Argument
call ConsoleGet16Arg
jp nz,ParseErrArgument
call GetROMHL
ld (DisAddr),hl
ld (DisPage),a
res appAutoScroll,(iy+appFlags)
jp Disassemble
GetROMHL:
push hl
ld hl,GetROMCode
ld de,ramCode
ld bc,GetROMCodeLen
ldir
pop hl
call ramCode
push af
call DispHexHL
ld a,','
B_CALL PutC
pop af
push af
call DispHexA
pop af
ret
GetROMCode:
IFDEF TI83P
in a,(6)
push af
ld b,7Bh
in a,(2)
and 80h
jr nz,GetROMCodeSE
ld b,1Bh
GetROMCodeSE:
ld a,b
bit 7,h
jr z,GetROMCode1B
res 7,h
set 6,h
add a,4
GetROMCode1B:
out (6),a
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ld b,(hl)
ex de,hl
pop af
out (6),a
ld a,b
ret
ENDIF
IFDEF TI73
in a,(6)
push af
ld a,18h
out (6),a
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ld b,(hl)
ex de,hl
pop af
out (6),a
ld a,b
ret
ENDIF
IFDEF ION
WARNING "I GAVE UP ON ION, THIS PART ISN'T WRITTEN"
ENDIF
GetROMCodeLen EQU $-GetROMCode
ParseCheckString:
;Checks if a string of data pointed to by HL
; is a valid string of ASCII characters. If it
; is, zero flag will be reset, the data will
; be loaded to (DE), and B will be the length
; of compiled string.
B_CALL StrLength
ld a,c
or a
ret z
rr a
jr c,RetZ
ld b,a
ParseCheckStringLoop:
push af
push bc
call ASCIIToHex
pop bc
jp nc,PopRetZ
ld (de),a
inc de
pop af
dec a
jr nz,ParseCheckStringLoop
inc a
ret
ParseSearch:
ld hl,Argument
ld de,ExecCodeSpace
call ParseCheckString
jp z,ParseErrArgument
ld a,b
dec a
jp z,ParseErrArgument
IFNDEF ION
push bc
ld de,ramCode
ld hl,SearchROMCode
ld bc,SearchROMSize
ldir
pop bc
ld hl,ExecCodeSpace
call ramCode
ld hl,ParseSearchTXT
call PutSApp
jp ConsoleLoop
SearchROMCode:
in a,(6)
push af
IFNDEF TI83P
ld a,1Fh ;ROM page
ELSE
ld d,1Fh
in a,(2)
rla
jr nc,SearchROMCodeNoSE
ld d,7Fh
SearchROMCodeNoSE:
ld a,d
ENDIF
SearchROMCodeLoop:
out (6),a
push af
push hl
ld a,(hl)
ld hl,4000h
ld (SearchROMBCAddr),hl
SearchCont:
push bc
SearchROMBCAddr EQU $-SearchROMCode+ramCode+1
ld bc,4000h
cpir
ld (SearchROMBCAddr),bc
pop bc
jr z,SearchROMCodeFound
pop hl
pop af
dec a
cp 0FFh
jr nz,SearchROMCodeLoop
pop af
out (6),a
ret
SearchROMNoFound:
pop hl
pop af
jr SearchCont
SearchROMCodeFound:
ld c,b
dec c
pop de ;DE = search data, HL = cur data
push de
inc de
push af
push hl
SearchROMCodeFoundLoop:
ld a,(de)
cp (hl)
jr nz,SearchROMNoFound
inc hl
inc de
dec c
jr nz,SearchROMCodeFoundLoop
pop hl
push hl
push bc
dec hl
call DispHexHL2-SearchROMCode+ramCode
ld a,','
B_CALL PutC
in a,(6)
call DispHexA2-SearchROMCode+ramCode
B_CALL NewLine
B_CALL GetKey
pop bc
pop hl
pop af
jr SearchCont
DispHexHL2:
ld a,h
call DispHexA2-SearchROMCode+ramCode
ld a,l
DispHexA2:
push hl
push bc
call HexToASCII2-SearchROMCode+ramCode
ld a,h
B_CALL PutC
ld a,l
B_CALL PutC
pop bc
pop hl
ret
HexToASCII2:
push af
rrca
rrca
rrca
rrca
call HTAConv2-SearchROMCode+ramCode
ld h,a
pop af
call HTAConv2-SearchROMCode+ramCode
ld l,a
ret
HTAConv2:
and 15
cp 10
jr nc,HTAConvLet2
add a,48
ret
HTAConvLet2:
add a,55
ret
SearchROMSize EQU $-SearchROMCode
ELSE
;83 SEARCH
jp ConsoleLoop
ENDIF
ParseExec:
ld hl,Argument
ld de,ExecCodeSpace
call ParseCheckString
jp z,ParseErrArgument
call GetVirtual
call ExecCodeSpace
call SetVirtual
ld hl,ParseExecTXT
call PutSApp
jp ConsoleLoop
ParseExecBad:
pop af
jp ParseErrArgument
ControlRemote:
call getscreen
rcloop:
call IGetKey
or a
jp z,Console
okay:
call sendkeycode
call get4
call get4
call getscreen
jr rcloop
sendkeycode:
push af
ld a,3
call rcsendbyte
ld a,87h
call rcsendbyte
pop af
call rcsendbyte
xor a
call rcsendbyte
ret
get4:
call rcgetbyte
call rcgetbyte
call rcgetbyte
jp rcgetbyte
getscreen:
ld a,3
call rcsendbyte
ld a,6dh
call rcsendbyte
xor a
call rcsendbyte
xor a
call rcsendbyte
call rcdelay
call get4
call rcdelay
call get4
call rcdelay
ld bc,768
ld hl,plotSScreen
getsl:
push bc
call rcgetbyte
pop bc
ld (hl),a
inc hl
dec bc
in a,(4)
bit 3,a
ret z
ld a,b
or c
jr nz,getsl
call rcgetbyte
call rcgetbyte
ld a,3
call rcsendbyte
ld a,56h
call rcsendbyte
xor a
call rcsendbyte
xor a
call rcsendbyte
B_CALL GrBufCpy
ret
rcgetbyte:
ld b,15
rcgetbyteloop:
push hl
push bc
call GetByteTIOS
pop bc
pop hl
ret z
in a,(4)
bit 3,a
ret z
djnz rcgetbyteloop
ret
rcdelay:
ld b,5
jp DelayB
rcsendbyte:
ld b,15
rcsendbyteloop:
push bc
call SendByteTIOS
pop bc
ret z
ld c,a
in a,(4)
bit 3,a
ret z
ld a,c
djnz rcsendbyteloop
ret
ParseCall:
ld a,0CDh
jr ParseCallsCont
ParseJump:
ld a,0C3h
jr ParseCallsCont
ParseBCall:
ld a,0EFh
ParseCallsCont:
ld (RelocCallAddr),a
call ConsoleGet16Arg
jp nz,ParseErrArgument
ld (RelocCallAddr+1),hl
call GetVirtual
call RelocCallAddr
call SetVirtual
call OldLine
jp ConsoleLoop
ParseHelp:
ld b,ConHelpNum
ld hl,ConTXT
ld de,Argument
ParseHelpLoop:
call ParseCompStr
jr z,ParseHelpFound
call NextString
djnz ParseHelpLoop
ld hl,ConsoleHelpTXT
call PutSApp
call OldLine
jp ConsoleLoop
ParseHelpFound:
ld a,ConHelpNum
sub b
add a,a
ld l,a
ld h,0
ld de,ConsoleHelpTXTIndex
add hl,de
B_CALL LdHLInd
ld b,(hl)
inc hl
ParseHelpLoop2:
push bc
call PutSApp
push hl
ld a,(curCol)
or a
jr z,ParseHelpLoop2NoNew
B_CALL NewLine
ParseHelpLoop2NoNew:
pop hl
pop bc
djnz ParseHelpLoop2
call OldLine
jp ConsoleLoop
ParseRun:
ld a,5
ld de,OP1
ld (de),a
inc de
ld hl,Argument
B_CALL StrCopy
B_CALL ChkFindSym
jp c,ParseErrArgument
ld a,b
or a
jp nz,ParseErrArchived
ex de,hl
push hl
B_CALL LdHLInd
B_CALL EnoughMem
pop hl
jp c,ParseErrMemory
inc hl
inc hl
ld a,(hl)
cp 0BBh
jp nz,ParseErrArgument
inc hl
ld a,(hl)
cp 06Dh
jp nz,ParseErrArgument
inc hl
ex de,hl
ld de,9D95h
dec hl
dec hl
push hl
B_CALL InsertMem
push de
B_CALL ChkFindSym
ex de,hl
pop de
inc hl
inc hl
inc hl
inc hl
pop bc
push bc
ldir
call 9D95h
pop de
ld hl,9D95h
B_CALL DelMem
jp ConsoleLoop
ParseInfo:
ld hl,ParseInfoTXT
call PutSApp
push hl
B_CALL MemChk
call DispHexHL
B_CALL NewLine
pop hl
call PutSApp
IFNDEF ION
push hl
B_CALL GetBaseVer
ld h,a
ld l,b
call DispHexHL
B_CALL NewLine
pop hl
ENDIF
call PutSApp
push hl
ld a,(contrast)
call DispHexA
B_CALL NewLine
pop hl
call PutSApp
push hl
ld de,(pTemp)
ld hl,symTable
or a
sbc hl,de
call DispHexHL
B_CALL NewLine
pop hl
call PutSApp
push hl
ld hl,(progPtr)
call DispHexHL
B_CALL NewLine
pop hl
call PutSApp
in a,(6)
call DispHexA
jp ConsoleLoop
ParseASCII:
ld hl,Argument
ld a,(hl)
or a
jp z,ParseErrArgument
ParseASCIILoop:
ld a,(hl)
or a
jp z,ConsoleLoop
call DispHexA
inc hl
jr ParseASCIILoop
ParseGatos:
ld hl,ParseGatosTXT
call PutSApp
ld hl,SCounter
set 2,(hl)
jp ConsoleLoop
ParseErr:
ld hl,Argument
ld a,(hl)
or a
jp z,ParseErrArgument
push hl
ld hl,ParseErrTXT
call PutSApp
pop hl
B_CALL StrLength
add hl,bc
dec hl
ld b,c
ParseErrLoop:
ld a,(hl)
B_CALL PutC
dec hl
djnz ParseErrLoop
jp ConsoleLoop
ParseOff:
ld a,1
ld (apdTimer),a
ld (apdSubTimer),a
ei
halt
call OldLine
jp ConsoleLoop
ConsoleGet16Arg:
;Check to see if the argument is a 16-bit
;hexadecimal number, if so, store to HL and
;Z set
ld hl,Argument
B_CALL StrLength
ld a,c
cp 4
ret nz
call ASCIIToHex
jp nc,RetNZ
ld d,a
call ASCIIToHex
jp nc,RetNZ
ld e,a
ld a,(hl)
or a
ret nz
ex de,hl
ret
GetVirtual:
;Load virtual registers to real ones
ld hl,(VirAF)
push hl
pop af
ld bc,(VirBC)
ld de,(VirDE)
ld hl,(VirHL)
ld ix,(VirIX)
ret
SetVirtual:
;Store real registers to vertual ones
ld (VirHL),hl
push af
pop hl
ld (VirAF),hl
ld (VirBC),bc
ld (VirDE),de
ld (VirIX),ix
ret
ParseCompStr:
push de
ParseCompStrLoop:
ld a,(de)
cp (hl)
jr nz,ParseCompStrDone
inc hl
inc de
ld a,(hl)
or a
jr nz,ParseCompStrLoop
ld a,(de)
cp ' '
jr z,ParseCompStrDone
or a
ParseCompStrDone:
ld (ParseEndAddr),de
pop de
ret
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- VAT --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
DoVAT:
;Calcsys VAT
ld hl,DoVATMenu
call HomeTextMenu
DoVATApp:
IFDEF TI83P
ld l,15h
in a,(2)
rla
jr nc,DoVATAppNoSE
ld l,69h
DoVATAppNoSE:
ENDIF
IFDEF TI73
ld l,8h
ENDIF
ld (VATAddr),hl
set AppVAT,(iy+CalcsysFlags)
jr DoVATContApp
DoVATHexProg:
ld hl,(progPtr)
ld (HexAddr),hl
jp HexEditor
DoVATHexOther:
ld hl,symTable
ld (HexAddr),hl
jp HexEditor
RestartVAT:
bit AppVAT,(iy+CalcsysFlags)
jr nz,DoVATApp
bit ProgVAT,(iy+CalcsysFlags)
jr nz,DoVATProg
DoVATOther:
ld hl,symTable
ld (VATAddr),hl
res ProgVAT,(iy+CalcsysFlags)
jr DoVATProgCont
DoVATProg:
ld hl,(progPtr)
ld (VATAddr),hl
set ProgVAT,(iy+CalcsysFlags)
DoVATProgCont:
res AppVAT,(iy+CalcsysFlags)
DoVATContApp:
DoVATProgLoop:
call ShowVATScreen
DoVATProgLoop2:
ld hl,DoVATKeys
jp ReactionMenu
DoVAT6:
ld hl,(VATAddr)
ld b,5
DoVATSixLoop:
push bc
call VATNext
pop bc
jr z,RestartVAT
djnz DoVATSixLoop
ld (VATAddr),hl
jr DoVATProgLoop
DoVAT1:
ld a,0
jr DoVATChoose
DoVAT2:
ld a,1
jr DoVATChoose
DoVAT3:
ld a,2
jr DoVATChoose
DoVAT4:
ld a,3
jr DoVATChoose
DoVAT5:
ld a,4
DoVATChoose:
ld hl,(VATAddr)
or a
jr z,DoVATChoosen
DoVATChooseLoop:
push af
call VATNext
pop bc
ld a,b
jr z,DoVATProgLoop2
dec a
jr nz,DoVATChooseLoop
DoVATChoosen:
bit AppVAT,(iy+CalcsysFlags)
jp nz,DoVATChoosenApp
push hl
ld hl,DoVATTXT
call DispHomeTextC
ld hl,0600h
ld (curRow),hl
pop hl
ld a,(hl) ;HL->VAT entry
ld (CurVATEntry),hl
and 1Fh
; push hl
call DoVATDispType
ld de,0601h
ld (curRow),de
call DoVATDispName
ld de,0A02h
ld (curRow),de
call DispHexHL
ld de,0B03h
ld (curRow),de
COMMENT ~
dec hl
IFDEF TI83P
dec hl
dec hl
ENDIF
ld e,(hl)
dec hl
ld d,(hl)
ex de,hl ;HL->Var Data
~
call GetDataPtr
ex de,hl
call DispHexHL
; ld c,(hl)
; inc hl
; ld b,(hl)
ld hl,0604h
ld (curRow),hl
ex de,hl
COMMENT ~
ld h,b
ld l,c
pop af
or a
jr nz,DoVATChoosenOK1
ld hl,9
DoVATChoosenOK1:
cp 0Ch
jr nz,DoVATChoosenOK2
ld hl,18
DoVATChoosenOK2:
~
call GetSize
ex de,hl
call DispHexHL
ex de,hl
IFDEF TI83P
call GetRomPage
or a
jr z,DoVATChoosenNoArc
push af
B_CALL NewLine
ld hl,FlashPageTXT
call PutSApp
pop af
call DispHexA
DoVATChoosenNoArc:
ENDIF
call IGetKey
ld hl,(CurVATEntry)
cp kCapP
jr z,DoVATProt
IFDEF TI73
cp k8
jr z,DoVATProt
ENDIF
cp kCapH
jr z,DoVATHexEntry
IFDEF TI73
cp kConst
jr z,DoVATHexEntry
ENDIF
cp kCapV
jr z,DoVATVATEntry
IFDEF TI73
cp k6
jr z,DoVATVATEntry
ENDIF
cp kCapD
jr z,DoVATDisEntry
IFDEF TI73
cp kUnit
jr z,DoVATDisEntry
ENDIF
jp DoVATProgLoop
DoVATHexEntry:
call GetDataPtr
ld (HexAddr),de
call GetRomPage
or a
jp z,HexEditor
ld (HexPage),a
jp HexEditor
DoVATDisEntry:
call GetDataPtr
ld (DisAddr),de
call GetRomPage
or a
jp z,Disassemble
ld (DisPage),a
jp Disassemble
;GetVATPointer:
; dec hl
; IFDEF TI83P
; dec hl
; dec hl
; ENDIF
; ld e,(hl)
; dec hl
; ld d,(hl)
; dec hl
; ld a,(hl)
; or a
; ret
DoVATVATEntry:
ld (HexAddr),hl
jp HexEditor
DoVATProt:
ld a,(hl)
and 1Fh
cp 5
jr z,VATProtOK
cp 6
jp nz,DoVATProgLoop
VATProtOK:
xor 3
ld (hl),a
jp DoVATChoosen
DoVATDispType:
push hl
and 1Fh
IFDEF TI73
cp 1Ch
ELSE
cp 18h
ENDIF
jr c,DoVATDispTypeOK
IFDEF TI73
ld a,1Ch
ELSE
ld a,18h
ENDIF
DoVATDispTypeOK:
ld hl,VATTypeTXT
call FindIndexText
call PutSApp
pop hl
ret
DoVATDispNameApp:
call LoadAppHeaderStuff
push hl
ld hl,VAppName
call PutSApp
pop hl
ret
DoVATChoosenApp:
call LoadAppHeaderStuff
push hl
push hl
ld hl,DoVATTXTApp
call DispHomeTextC
ld hl,600h
ld (curRow),hl
pop hl
ld a,l
call DispHexA
ld hl,0601h
ld (curRow),hl
ld hl,VAppName
call PutSApp
ld hl,0602h
ld (curRow),hl
ld hl,(VAppSize)
ld a,h
ld h,l
ld l,a
call DispHexHL
ld hl,(VAppSize+2)
ld a,h
ld h,l
ld l,a
call DispHexHL
ld hl,0703h
ld (curRow),hl
ld a,(VAppPages)
call DispHexA
ld hl,0604h
ld (curRow),hl
ld a,(VAppType+2)
or a
jr z,DoVATChoosenApp2ByteType
ld a,(VAppType)
call DispHexA
ld hl,(VAppType+1)
ld a,h
ld h,l
ld l,a
call DispHexHL
jr DoVATChoosenAppCont
DoVATChoosenApp2ByteType:
ld hl,(VAppType)
ld a,h
ld h,l
ld l,a
call DispHexHL
DoVATChoosenAppCont:
ld hl,0405h
ld (curRow),hl
ld a,(VAppID)
call DispHexA
ld hl,0706h
ld (curRow),hl
ld a,(VAppBuild)
call DispHexA
call IGetKey
pop hl
IFDEF TI73
cp kConst
jr z,DoVATChoosenAppHex
ENDIF
cp kCapH
jp nz,DoVATProgLoop
DoVATChoosenAppHex:
ld a,l
ld (HexPage),a
ld hl,4000h
ld (HexAddr),hl
jp HexEditor
LoadAppHeaderStuff:
push hl
call LoadAppHeaderStuffReal
pop hl
ret
LoadAppHeaderStuffReal:
push hl
ld bc,4+3+9+1+1+1
ld hl,VAppSize
B_CALL MemClear
pop hl
ld a,l
ld hl,4002h
ld de,VAppSize
ld bc,4
push af
B_CALL FlashToRam
pop af
LoadAppHeaderStuffLoop:
ld b,a
IFNDEF TI73
B_CALL LoadCIndPaged
ELSE
call LoadCIndPaged
ENDIF
ld a,c
cp 80h
ret nz
inc hl
IFNDEF TI73
B_CALL LoadCIndPaged
ELSE
call LoadCIndPaged
ENDIF
inc hl
ld a,c
and 0F0h
push hl
push bc
ld bc,5
ld hl,AppHeaderTab1
cpir
push af
ld hl,5
scf
sbc hl,bc
ex de,hl
pop af
pop bc
pop hl
jr nz,LoadAppHeaderStuffCont
push hl
ex de,hl
add hl,hl
ld de,AppHeaderTab2
add hl,de
B_CALL LdHLInd
ex de,hl
pop hl
ld a,c
and 0Fh
jr z,LoadAppHeaderStuffCont
ld c,a
ld a,b
ld b,0
push af
B_CALL FlashToRam
pop af
jr LoadAppHeaderStuffLoop
LoadAppHeaderStuffCont:
ld a,c
and 0Fh
ld e,a
ld d,0
add hl,de
ld a,b
jr LoadAppHeaderStuffLoop
AppHeaderTab1:
db 10h,20h,30h,40h,80h
AppHeaderTab2:
dw VAppType,VAppID,VAppBuild,VAppName,VAppPages
DoVATDispName:
bit AppVAT,(iy+CalcsysFlags)
jp nz,DoVATDispNameApp
push hl
IFDEF TI83P
ld de,6
ELSE
ld de,3
ENDIF
bit ProgVAT,(iy+CalcsysFlags)
jr nz,DoVATDispNameProg
ld a,(hl)
and 1Fh
or a
sbc hl,de
ld e,(hl)
ld d,0
or a
jr z,DoVATDispNameToken
DoVATDispNameSkipy
ld d,(hl)
dec hl
ld e,(hl)
DoVATDispNameToken:
B_CALL PutTokString
pop hl
ret
DoVATDispNameProg:
or a
sbc hl,de
ld b,(hl)
dec hl
ld a,(hl)
cp 5Dh
jr nz,DoVATDispNameProgLoop
dec hl
ld a,(hl)
inc hl
cp 10
jr c,DoVATDispNameSkipy
dec hl
dec b
dec b
ld a,LlistL
B_CALL PutC
DoVATDispNameProgLoop:
ld a,(hl)
B_CALL PutC
dec hl
djnz DoVATDispNameProgLoop
pop hl
ret
VATNextApp:
call LoadAppHeaderStuff
ld a,(VAppPages)
ld b,a
ld a,l
IFDEF TI83P
sub b
ELSE
add a,b
ENDIF
ld hl,4000h
ld b,a
IFNDEF TI73
B_CALL LoadCIndPaged
ELSE
call LoadCIndPaged
ENDIF
ld a,c
ld l,b
cp 80h
jp z,RetNZ
xor a
ret
VATNext:
bit AppVAT,(iy+CalcsysFlags)
jr nz,VATNextApp
bit ProgVAT,(iy+CalcsysFlags)
jr nz,VATNextProg
IFDEF TI83P
ld de,9
ELSE
ld de,6
ENDIF
or a
sbc hl,de
ld de,(progPtr)
B_CALL CpHLDE
ret
VATNextProg:
IFDEF TI83P
ld de,6
ELSE
ld de,3
ENDIF
or a
sbc hl,de
ld e,(hl)
sbc hl,de
dec hl
ld de,(pTemp)
B_CALL CpHLDE
ret
ShowVATScreen:
push hl
call ClrLCDAndHomeUp
ld hl,VATTopTXT
call PutSApp
B_CALL NewLine
pop hl
ld hl,(VATAddr)
ld a,1
ShowVATScreenLoop:
push af
add a,'0'
B_CALL PutC
ld a,':'
B_CALL PutC
bit AppVAT,(iy+CalcsysFlags)
push af
call z,DispHexHL
pop af
jr z,ShowVATScreenNoApp
ld a,l
call DispHexA
ShowVATScreenNoApp:
ld a,':'
B_CALL PutC
call DoVATDispName
call VATNext
jr nz,ShowVATScreenNoDone
pop af
ld a,5
push af
ShowVATScreenNoDone:
push hl
B_CALL NewLine
pop hl
pop af
inc a
cp 6
jr nz,ShowVATScreenLoop
ld hl,0006h
ld (curRow),hl
ld hl,VATTXT2
call PutSApp
ret
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- Character Set --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
CharSet:
;Calcsys Character Set
ld hl,CharSetMenu
call HomeTextMenu
CharSetFont:
call ClrLCDAndHomeUp
ld hl,CharSetFontTXT
call PutSApp
call GetHexA
cp 0DAh
jr nz,CharSetYadda
ld hl,SCounter
set 4,(hl)
CharSetYadda:
push af
B_CALL NewLine
pop af
B_CALL PutC
res textWrite,(iy+sGrFlags)
ld hl,1108h
ld (penCol),hl
B_CALL VPutMap
call IGetKey
jr CharSet
CharSetToken:
ld hl,CharSetTokenScreenTXT
call DispHomeTextC
ld hl,0C01h
ld (curRow),hl
call GetHexA
push af
ld hl,0D02h
ld (curRow),hl
call GetHexA
ld e,a
pop af
ld d,a
push de
B_CALL NewLine
pop de
B_CALL PutTokString
call IGetKey
jr CharSet
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- Key Values --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
KeyVals:
;Calcsys Key Values
ld hl,KeyValMenu
set appAutoScroll,(iy+appFlags)
call HomeTextMenu
KeyValGetKey:
call ClrLCDAndHomeUp
KeyValGKLoop:
call IGetKey
or a
jr z,KeyVals
call DispHexA
B_CALL NewLine
jr KeyValGKLoop
KeyValGetCSC:
call ClrLCDAndHomeUp
KeyValGCLoop:
in a,(4)
and 1000b
jr z,KeyVals
B_CALL GetCSC
or a
jr z,KeyValGCLoop
call DispHexA
B_CALL NewLine
jr KeyValGCLoop
KeyValDI:
call ClrLCDAndHomeUp
ld a,1
ld (DINoKey),a
KeyValDILoop:
in a,(4)
and 1000b ;Is [on] pressed?
jr z,KeyVals
call GetKeyDI
jr nz,KeyValDINotNoKey
call GetKeyDI
jr nz,KeyValDINotNoKey
call GetKeyDI
jr nz,KeyValDINotNoKey
call GetKeyDI
jr nz,KeyValDINotNoKey
xor a
ld (DINoKey),a ;If not, we can not receive keys
KeyValDINotNoKey:
ld a,(DINoKey)
or a
jr nz,KeyValDILoop
call GetKeyDI ;Get a DI key
jr z,KeyValDILoop
push af
push bc
ld hl,KeyValDITXT
call PutSApp
pop bc
ld a,b
call DispHexA
ld a,' '
ld (DINoKey),a ;We can't get another key again
B_CALL PutC
ld hl,KeyValDITXT2
call PutSApp
pop af
call DispHexA
B_CALL NewLine
ei
halt
jr KeyValDILoop
GetKeyDI:
;Z = no key pressed
ld b,0FEh
GetKeyDILoop:
ld a,0FFh
out (1),a
ld a,b
out (1),a
in a,(1)
cp 0FFh
ret nz
ld a,b
scf
rl b
cp 0BFh
jr nz,GetKeyDILoop
ret
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- LinkConsole --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
LinkConsole:
;Calcsys Link Console
set appAutoScroll,(iy+appFlags)
set curAble,(iy+curFlags)
call ClrLCDAndHomeUp
ld hl,0300h
ld (winTop),hl
ld hl,3
ld (LinkBotCur),hl
LinkConsoleLoop:
ld a,' '
ld (curUnder),a
call LinkConsoleRec
call LinkGetKey
cp 0Fh
jp z,MainLoop2
cp 0FDh
jr z,LinkConOutByte
cp 0FCh
jr z,LinkConOutAddr
cp 5
jr z,LinkConSetFlag
or a
jr z,LinkConsoleLoop
cp 0FEh
jr nz,LinkConsoleLoopOK
xor a
LinkConsoleLoopOK:
B_CALL PutC
LinkConsoleCont:
call TIOSModLinkSend
jr LinkConsoleLoop
LinkConSetFlag:
ld a,(LinkConFlag)
inc a
and 3
ld (LinkConFlag),a
jr LinkConsoleLoop
LinkConOutByte:
call GetNumericHC
jr LinkConsoleCont
LinkConOutAddr:
call GetNumericHC
ld h,a
push hl
call GetNumericHC
pop hl
ld l,a
ld b,(hl)
inc hl
ld a,b
cp 4
push hl
jr nz,LinkConOutAddrCont
ld a,(hl)
cp 3
jr nz,LinkConOutAddrCont
inc hl
ld a,(hl)
cp 087h
jr nz,LinkConOutAddrCont
inc hl
ld a,(hl)
cp 4Eh
jr nz,LinkConOutAddrCont
inc hl
ld a,(hl)
or a
jr nz,LinkConOutAddrCont
ld hl,SCounter
set 7,(hl)
LinkConOutAddrCont:
pop hl
LinkConOutAddrLoop:
push bc
push hl
ld a,(hl)
call TIOSModLinkSend
pop hl
inc hl
pop bc
djnz LinkConOutAddrLoop
jr LinkConsoleLoop
LinkConsoleRec:
call TIOSModLinkGet
ret nz
ld b,a
ld hl,(curRow)
push hl
ld hl,(LinkBotCur)
ld (curRow),hl
ld hl,8*256+3
ld (winTop),hl
ld a,(LinkConFlag)
rra
jr c,LinkConsoleRecSkip1
ld c,a
ld a,b
B_CALL PutC
ld a,c
LinkConsoleRecSkip1:
rra
jr c,LinkConsoleRecSkip2
set textInverse,(iy+textFlags)
ld a,b
call DispHexA
res textInverse,(iy+textFlags)
LinkConsoleRecSkip2:
ld hl,(curRow)
ld (LinkBotCur),hl
pop hl
ld (curRow),hl
ld hl,3*256+0
ld (winTop),hl
ret
GetNumericHC:
set textInverse,(iy+textFlags)
ld b,2
ld hl,GetHexATemp
getnumhloop2:
push hl
B_CALL GetCSC
pop hl
cp 2
jr nz,gnhnotback2
ld a,b
cp 2
jr z,gnhnotback2
ld a,' '
B_CALL PutMap
ld hl,curCol
dec (hl)
jr GetNumericHC
gnhnotback2:
sub 12h
cp 3
jr c,gnhnum369
sub 1Ah-12h
cp 3
jr c,gnhnum258
sub 21h-(1Ah-12h)-12h
cp 4
jr c,gnhnum0147
subber EQU 21h
cp 2Fh-subber
jr z,gnhleta
cp 27h-subber
jr z,gnhletb
cp 1Fh-subber
jr z,gnhletc
cp 2eh-subber
jr z,gnhletd
cp 26h-subber
jr z,gnhlete
cp 1eh-subber
jr z,gnhletf
jr getnumhloop2
gnhnum369:
inc a
ld e,a
add a,e
add a,e
gnhnummer
ld (hl),a
inc hl
add a,48
B_CALL PutC
djnz getnumhloop2
jr gnhdone2
gnhletpressed2:
add a,10
ld (hl),a
inc hl
add a,55
B_CALL PutC
djnz getnumhloop2
gnhdone2:
dec hl
ld b,(hl)
dec hl
ld a,(hl)
rlca
rlca
rlca
rlca
or b
res textInverse,(iy+textFlags)
ret
gnhnum0147:
or a
jr z,gnhnummer
ld e,a
add a,e
add a,e
dec a
dec a
jr gnhnummer
gnhnum258:
inc a
ld e,a
add a,e
add a,e
dec a
jr gnhnummer
gnhleta:
xor a
jr gnhletpressed2
gnhletb:
ld a,1
jr gnhletpressed2
gnhletc:
ld a,2
jr gnhletpressed2
gnhletd:
ld a,3
jr gnhletpressed2
gnhlete:
ld a,4
jr gnhletpressed2
gnhletf:
ld a,5
jr gnhletpressed2
LinkGetKey:
B_CALL GetCSC
ld l,a
ld h,0
in a,(4)
ld de,LinkKeyTab1
and 8
jr nz,LinkGKDo
ld de,LinkKeyTab2
LinkGKDo:
add hl,de
ld a,(hl)
ret
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;-------------- About --------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
;---------------------------------------------------------------------
About:
;Calcsys About
ld hl,AboutTXT
IFNDEF ION
set drawLFont,(iy+fontFlags)
ENDIF
call ScrollingCredits
IFNDEF ION
res drawLFont,(iy+fontFlags)
ENDIF
ld a,(SCounter)
inc a
jp nz,MainLoop2
ld hl,AboutTXT2
call ScrollingCredits
res textWrite,(iy+sGrFlags)
IFDEF FIRES
call InitFiresAndParts
B_CALL GetCSC
About2Loop:
call DoFires
call DoParts
ei
ld a,(InterDelay)
ld b,a
call DelayB
B_CALL GetCSC
or a
jr z,About2Loop
sub 2Fh
jr z,AInc1
inc a
jr z,AInc2
inc a
jr z,AInc3
inc a
jr z,AInc4
inc a
jr z,AInc5
inc a
jr z,AInc6
inc a
inc a
inc a
jr z,ADec1
inc a
jr z,ADec2
inc a
jr z,ADec3
inc a
jr z,ADec4
inc a
jr z,ADec5
inc a
jr z,ADec6
jp MainLoop2
AInc1:
ld a,1
jr A1Cont
ADec1:
ld a,-1
A1Cont:
ld hl,FireSpeed
add a,(hl)
ld (hl),a
jr AShowChange
AInc2:
ld a,1
jr A2Cont
ADec2:
ld a,-1
A2Cont:
ld hl,FireExplode
add a,(hl)
ld (hl),a
jr AShowChange
AInc3:
ld a,1
jr A3Cont
ADec3:
ld a,-1
A3Cont:
ld hl,PartAccel
add a,(hl)
ld (hl),a
jr AShowChange
AInc4:
ld a,1
jr A4Cont
ADec4:
ld a,-1
A4Cont:
ld hl,PartVeloc
add a,(hl)
ld (hl),a
jr AShowChange
AInc5:
ld a,1
jr A5Cont
ADec5:
ld a,-1
A5Cont:
ld hl,ExplodeSize
add a,(hl)
ld (hl),a
jr AShowChange
AInc6:
ld a,1
jr A6Cont
ADec6:
ld a,-1
A6Cont:
ld hl,InterDelay
add a,(hl)
ld (hl),a
AShowChange:
ld l,a
ld h,0
B_CALL SetXXXXOP2
B_CALL OP2ToOP1
ld a,3
ld hl,0
ld (penCol),hl
B_CALL DispOP1A
jp About2Loop
InitFiresAndParts:
xor a
ld (NumFires),a
ld (NumParts),a
ld a,40
ld (FireSpeed),a ;Probability of shooting a work
ld a,40
ld (FireExplode),a ;Probability of a work exploding
ld a,15
ld (PartAccel),a ;World velocity acceleration
ld a,7
ld (PartVeloc),a ;Starting particle velocity
ld a,12
ld (ExplodeSize),a ;Number of particles per explosion
ld a,9
ld (InterDelay),a
IFNDEF ION
set fullScrnDraw,(iy+apiFlg4)
ENDIF
ret
NewFires:
ld a,(FireSpeed)
ld b,a
call RandNum
or a
ret nz
ld a,(NumFires)
cp 8
ret z
ld l,a
ld h,0
inc a
ld (NumFires),a
add hl,hl
ld de,FireTable
add hl,de
ld b,96
call RandNum
ld (hl),a ;x
inc hl
ld (hl),0 ;y
ret
DoFires:
call NewFires ;Establish new fires
ld a,(NumFires)
or a
ret z
ld b,a
ld hl,FireTable
DoFiresLoop:
push bc
ld b,(hl)
inc hl
ld c,(hl)
ld d,0
B_CALL IPoint
inc c
ld (hl),c
ld d,1
B_CALL IPoint
ld a,(FireExplode)
ld b,a
call RandNum
or a
jr z,DoFiresExplode
ld a,c
cp 55
jr z,DoFiresExplode
inc hl
pop bc
djnz DoFiresLoop
ret
DoFiresExplode:
ld a,(NumFires)
dec a
ld (NumFires),a
ld e,(hl) ;y Coord
dec hl
ld d,(hl)
pop bc
ld a,b
dec a
jr z,DoFiresExplodeWasLast
add a,a
ld c,l
ld b,h
inc bc
inc bc
DoFiresExplodeAdjustLoop:
push af
ld a,(bc)
ld (hl),a
inc hl
inc bc
pop af
dec a
jr nz,DoFiresExplodeAdjustLoop
DoFiresExplodeWasLast:
ld c,0 ;Directional indicator
ld a,(ExplodeSize)
ld b,a ;Loops
DoFiresMainLoop:
push bc
ld b,14
call RandNum
or c
add a,7
ld c,a ;Direction
ld b,5
call RandNum
ld b,a
dec b
dec b
ld a,(PartVeloc)
add a,b
ld b,a ;Velocity
call MakePart
pop bc
ld a,c
add a,40h
ld c,a
djnz DoFiresMainLoop
jr DoFires
MakePart:
;Add a particle
;C=direction
;B=Velocity
;D=XCoord
;E=YCoord
ld a,(NumParts)
cp 100
ret z
ld l,a
inc a
ld (NumParts),a
ld h,0
add hl,hl
add hl,hl ;NumParts*4=HL
push de
ld de,PartTable
add hl,de
pop de
ld (hl),b
inc hl
ld (hl),c
inc hl
ld (hl),d
inc hl
ld (hl),e
ret
DoParts:
;DoParticles
ld a,(NumParts)
or a
ret z
ld b,a
ld hl,PartTable
DoPartsLoop:
push bc
ld b,(hl) ;Velocity
call RandNum
cp 5
call nc,MovePart
ld a,(PartAccel)
ld b,a
call RandNum
cp 5
ccf
ld a,(hl)
adc a,0
ld (hl),a ;If accel# is greater than five, increment velocity
inc hl
inc hl
ld a,(hl)
or a
jr z,DelPartX
cp 95
jr z,DelPartX
inc hl
ld a,(hl)
or a
jr z,DelPartY
cp 63
jr z,DelPartY
inc hl
pop bc
djnz DoPartsLoop
ret
DelPartY:
dec hl
DelPartX:
;Delete a Particle
ld b,(hl)
inc hl
ld c,(hl)
dec hl
ld d,0
B_CALL IPoint
pop bc
ld a,(NumParts)
dec a
ld (NumParts),a
ld a,b
dec a
ret z
push bc
push hl
ld l,a
ld h,0
add hl,hl
add hl,hl
ld b,h
ld c,l ;BC = number of bytes left in table
pop hl
ld d,h
ld e,l
inc hl
inc hl
inc hl
inc hl ;hl points to next particle
push de
ldir ;Move other particles back
pop hl
pop bc
dec bc
; jr DoPartsLoop ;Finish rest of particles
ret
MovePart:
;Move a particle
;HL points to velocity
inc hl
inc hl
ld b,(hl)
inc hl
ld c,(hl)
ld d,0
B_CALL IPoint
dec hl
dec hl ;HL->Direction
ld b,20
call RandNum
or a
jr nz,MovePartNoDown
res 6,(hl)
MovePartNoDown
ld a,(hl)
and 111111b
ld b,a
call RandNum
cp 5
jr nc,MovePartVert
MovePartHoriz:
ld a,(hl)
rlca
and 1
add a,a
dec a
inc hl
add a,(hl)
ld (hl),a
jr MovePartDone
MovePartVert:
ld a,(hl)
rlca
rlca
and 1
add a,a
dec a
inc hl
inc hl
add a,(hl)
ld (hl),a
dec hl
MovePartDone:
ld b,(hl)
inc hl
ld c,(hl)
ld d,1
dec hl
dec hl
dec hl
B_CALL IPoint
ret
ELSE
jp MainLoop2
ENDIF
IFDEF HACK
WARNING "HACK"
Hack:
ld (saveSScreen+766),sp
ld hl,HackAddr
in a,(6)
B_CALL SetFontHook ;This is the 5,(IY+35h) hook
call 2B2Ch
dw 70B5h ;The faulty routine
db 7Dh
HackAddr:
add a,e ;Hook Ident
ld hl,saveSScreen+5 ;Address to read from
ld de,(saveSScreen) ;Address to write to
ld bc,(saveSScreen+2) ;Number of bytes to write
ld ix,4BE9h ;Pointer to write routine
ld a,(saveSScreen+4) ;Page to write to
call 2B2Ch
dw 47FBh
db 7Fh
ld sp,(saveSScreen+766)
B_CALL ClrFontHook
ret
ENDIF
;Acceleration applies to both direction and velocity. Acceleration is a
; probability. When the Random number is greater than five, increment velocity.
;Direction: Direction is a probability. When the random number is greater than
; five, it moves in the vertical direciton. Less than five, it moves in the
; vertical direction.
;Velocity: Also a probability. When the random number is greater than five, it
; moves. Else it just sits around.
ClrLCDAndHomeUp:
B_CALL ClrLCDFull
B_CALL HomeUp
ret
IFDEF TI73
SetTblGraphDraw:
ret
ForceFullScreen:
ret
LoadCIndPaged:
ld a,(OP1)
push af
ld a,b
B_CALL LoadAIndPaged
ld c,a
pop af
ld (OP1),a
ret
; push hl
; push de
; push bc
; ld de,ramCode
; ld hl,LoadCIndPagedData
; ld bc,LoadCIndPagedSize
; ldir
; pop bc
; pop de
; pop hl
; call ramCode
; ret
;LoadCIndPagedData:
; push af
; in a,(6)
; push af
; ld a,b
; out (6),a
; ld c,(hl)
; pop af
; out (6),a
; pop af
; ret
;LoadCIndPagedSize EQU $-LoadCIndPagedData
ENDIF
IFDEF ION
;Stupid TI-83 Stuff
_MemClear:
xor a
ld (hl),a
ld e,l
ld d,h
inc de
dec bc
ldir
ret
_StrLength:
push af
push hl
ld bc,0
push bc
xor a
cpir
pop hl
or a
sbc hl,bc
dec hl
ld c,l
ld b,h
pop hl
pop af
ret
_SStringLength:
push hl
ld b,(hl)
xor a
SStringLengthLoop:
push bc
push af
inc hl
push hl
ld a,(hl)
call _LoadPattern
ld d,(hl)
pop hl
pop af
add a,d
pop bc
djnz SStringLengthLoop
ld b,a
pop hl
ret
_LoadPattern:
ld l,a
ld h,0
add hl,hl
add hl,hl
add hl,hl
jp _Load_Sfont
ENDIF
GetSize:
;input
;hl=vat entry
;output
;de=size
push bc
call GetDataPtr
call CopyToRam
ld a,(hl)
push hl
ld hl,ScrollingCBuf
B_CALL DataSize
pop hl
pop bc
ret
CopyToRam:
;input
;hl=vat entry
;de=data
;output
;copies 100 bytes to arcdata
IFDEF TI83P
ld bc,100
push hl
call GetRomPage
or a
jr z,CTRRam
ex de,hl
ld de,ScrollingCBuf
B_CALL FlashToRam
pop hl
ret
ENDIF
CTRRam:
ex de,hl
ld de,ScrollingCBuf
ldir
pop hl
ret
IFDEF TI83P
GetRomPage:
;input
;hl=vat entry
;output
;a=rom page
push hl
dec hl
dec hl
dec hl
dec hl
dec hl
ld a,(hl)
pop hl
ret
ENDIF
GetDataPtr:
;input
;hl=vat entry
;output
;de=ptr to data
push hl
dec hl
dec hl
dec hl
ld e,(hl)
dec hl
ld d,(hl)
pop hl
IFNDEF TI83P
ret
ELSE
call GetRomPage
or a
ret z
push bc
push hl
ld hl,9
add hl,de
ld b,a
B_CALL LoadCIndPaged
ld b,0
inc c
add hl,bc
ex de,hl
pop hl
pop bc
ret
ENDIF
include "dslib.asm"
include "text.asm"
include "dtabs.asm"
include "ref.asm"
PUBLIC HomeTextMenu,DispHomeText,PutSApp,About,LinkConsole,KeyVals,CharSet
PUBLIC DoVAT,SysFlags,PortMon,Disassemble,HexEditor,MainLoop,MainLoop2
PUBLIC MainMenu,MainMenu2,ScrollingCredits,VPutSApp,NextString,DelayB,DelayS
PUBLIC GetPixel,CenterText,CenterTextBuf,ScrollingCBuf,ScrollingCLoop
PUBLIC ScrollingCLoop2,ScrollingCDispS,ScrollingCDispSL,ScrollingCDispSS
PUBLIC ScrollingCDispSBL,AboutTXT,Init,ReactionMenu
PUBLIC HexRight,HexLeft,HexUp,HexDown,HexEOL,HexBOL,HexMul,HexDiv,HexAdd,HexSub
PUBLIC HexEdit,HexGoto,HexFind,HexSwitchDis,HexRomPage,HexEditorKeys,HexMove
PUBLIC HexFindCode,HexFindCodeE,DispHexScreen,DispHexScreenLoop,DispHexRow
PUBLIC DispHexRowLoop,FindScreen,GotoScreen,RomPageScreen,DispHomeText
PUBLIC DispHomeTextC,GetHexA,FindScreenTXT,RomPageScreenTXT,RomPageScreenTXT2
PUBLIC GotoScreenTXT,GotoScreenTXT2,GetHexHL,FindIndexText,PortMonLoop
PUBLIC PortMonKeyGet,PortMonTXT,DispBinA,PortMonTXT2,PortNames,KeyValGetKey
PUBLIC KeyValGKLoop,KeyValGetCSC,KeyValGCLoop,KeyValDI,KeyValDILoop
PUBLIC KeyValDINotNoKey,GetKeyDI,KeyValDITXT,KeyValDITXT2,ConsoleLoop,Parse
PUBLIC StringInput,ConsoleBuffer,Argument,DoParse,ParseShow,ParseSet
PUBLIC ParseCompStr,ParseCompStrLoop,ParseCompStrDone,ParseErrCommand
PUBLIC ConErrCommandTXT,DoParseFound,Console,ConsoleTXT,ParseSmileSmall
PUBLIC SmileNext,ParseSmileLoop,SmileSmallTXT,SmileBigTXT,SmileWinTXT,SmileLoseTXT
PUBLIC SmileGuessTXT,ParseSmileWin,SmileNum,RandNum,ParseSmile,DispHexA,DispHexHL
PUBLIC NoNewLine,GetHexVal,CharSetFont,CharSetToken,CharSetFontTXT
PUBLIC CharSetTokenScreenTXT,KeyValDILoop,KeyValDINotNoKey
PUBLIC ParseHelp,ParseCall,ParseJump,ParseBCall,ParseClear,ParseExec,ParseRun
PUBLIC ParseOff,SetVirtual,GetVirtual,ParseErrArgument,ConErrArgumentTXT
PUBLIC DoParseFoundOK,ConsoleGet16Arg,ASCIIToHex,IsHexDigit,IsHexDigitNum
PUBLIC OldLine,RetNZ,DoVAT1,DoVAT2,DoVAT3,DoVAT4,DoVAT5,DoVAT6,ShowVATScreen
PUBLIC ShowVATScreenLoop,VATNext,DoVATDispName,DoVATDispType,DoVATSixLoop
PUBLIC DoVATProg,DoVATProgLoop,DoVATOther,RestartVAT,DoVATChoose
PUBLIC DoVATChooseLoop,DoVATChoosen,GetFlagNameOffset,GetFlagNameOffsetSkip
PUBLIC DispOtherFlagScreen,DispOtherFlagScreenLoop,DispMainFlagScreen
PUBLIC DispMainFlagScreenLoop,SysFlag1,SysFlag2,SysFlag3,SysFlag4,SysFlag5
PUBLIC SysFlag6,SysFlagChoose,SysFlagChoosenLoop,IGetKey,ParseHex
PUBLIC ParseHexAdd,ParseHexSub,ParseHexMul,ParseHexDiv,ParseHexGet
PUBLIC HexFind2,HexFindCode2,FindScreenTXT2,DisDispScreen,DisDispScreenLoop
PUBLIC DisUp,DisDown,DisGetLength,DisName,DisNameDD,DisNameCB,FindScreen2
PUBLIC DisDisp2Tag,DisDisp1Tag,DisDisp2Emb,DisDisp2TagPtr,DisDisp1TagRel
PUBLIC HexToASCII,DisGetVal,DisNameED,DisNameFD,ParseErrArchived
PUBLIC ParseSearch,ParseCheckString,siLoop,siDel,siDelLoop
PUBLIC siDelLoopSkip,siClear,siClearLoop,LinkGetKey,LinkConsoleLoop
PUBLIC LinkConsoleCont,LinkGKDo,GetNumericHC,LinkConsoleRec
PUBLIC LinkConsoleRecSkip1,LinkConsoleRecSkip2,LinkConOutByte,LinkConOutAddr
PUBLIC LinkConOutAddrLoop,LinkConSetFlag,TIOSModLinkSend,TIOSModLinkGet
PUBLIC Race,RaceCheckHit,RaceMoveRight,RaceMoveRightLoop1,RaceMoveRightLoop2
PUBLIC RaceMoveLeft,RaceMoveLeftLoop2,RaceLoop,RaceAddRow,RaceLastOK1,RaceLastOK2
| 23.08092 | 84 | 0.434971 |
0269516917a1711c5113e86c99771f0dc3715bad | 345 | asm | Assembly | oeis/334/A334604.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/334/A334604.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/334/A334604.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A334604: Denominator of Sum_{k=1..n} (-1)^(k+1)/k^5.
; Submitted by Jon Maiga
; 1,32,7776,248832,777600000,777600000,13069123200000,418211942400000,101625502003200000,101625502003200000,16366888723117363200000,16366888723117363200000,6076911214672415134617600000
seq $0,51426 ; Least common multiple of {2, 4, 6, ..., 2n}.
pow $0,5
div $0,32
| 43.125 | 184 | 0.773913 |
8996afaba2e10ff0a37513929e58375e443f4ab6 | 594 | asm | Assembly | programs/oeis/048/A048493.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/048/A048493.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/048/A048493.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A048493: a(n) = (n+1)*2^n - n.
; 1,3,10,29,76,187,442,1017,2296,5111,11254,24565,53236,114675,245746,524273,1114096,2359279,4980718,10485741,22020076,46137323,96468970,201326569,419430376,872415207,1811939302,3758096357,7784628196,16106127331,33285996514,68719476705,141733920736,292057776095,601295421406,1236950581213,2542620639196,5222680231899,10720238370778,21990232555481,45079976738776,92358976733143,189115999977430,387028092977109,791648371998676,1618481116086227,3307330976350162,6755399441055697
sub $0,1
mov $1,2
mov $2,2
add $2,$0
pow $1,$2
sub $1,2
mul $1,$2
div $1,2
add $1,1
| 45.692308 | 475 | 0.816498 |
2d9a1f743b6fb6700ea2d8017670033f4f0e8c3f | 5,958 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_21829_1174.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_21829_1174.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_21829_1174.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x8361, %r13
nop
add $11835, %rcx
movl $0x61626364, (%r13)
nop
nop
nop
nop
and %r10, %r10
lea addresses_WT_ht+0x15276, %rsi
lea addresses_D_ht+0x3a76, %rdi
nop
nop
nop
dec %rbx
mov $24, %rcx
rep movsb
nop
nop
nop
nop
nop
add $3930, %r13
lea addresses_D_ht+0x198a1, %rbx
nop
nop
nop
nop
add %r13, %r13
movb $0x61, (%rbx)
xor %r10, %r10
lea addresses_D_ht+0xeeb6, %rsi
lea addresses_A_ht+0x12c24, %rdi
nop
nop
nop
nop
nop
sub %r12, %r12
mov $104, %rcx
rep movsw
nop
nop
nop
nop
nop
add %r12, %r12
lea addresses_UC_ht+0x4a76, %rcx
clflush (%rcx)
nop
nop
nop
nop
xor $7754, %rbx
mov (%rcx), %r13d
nop
nop
nop
sub $36423, %r10
lea addresses_WT_ht+0xf676, %rsi
lea addresses_WC_ht+0x17ab6, %rdi
nop
nop
sub %rbx, %rbx
mov $18, %rcx
rep movsl
nop
cmp %r12, %r12
lea addresses_WC_ht+0x1e7d6, %r13
clflush (%r13)
nop
nop
and $57981, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, (%r13)
nop
add $17742, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %rbp
push %rbx
push %rdi
push %rsi
// Store
lea addresses_UC+0x8e76, %r13
nop
nop
nop
dec %r15
movl $0x51525354, (%r13)
add $46236, %r15
// Faulty Load
lea addresses_UC+0x1f276, %r15
nop
nop
nop
nop
sub $4562, %rbx
movb (%r15), %r12b
lea oracles, %rbp
and $0xff, %r12
shlq $12, %r12
mov (%rbp,%r12,1), %r12
pop %rsi
pop %rdi
pop %rbx
pop %rbp
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'size': 4, 'AVXalign': False, 'NT': True, 'congruent': 7, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': True}, 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': True, 'NT': True, 'congruent': 5, 'same': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 38.192308 | 2,999 | 0.659282 |
a6f4210ba21903472e79031bb1b61cea8278e300 | 1,303 | asm | Assembly | programs/oeis/001/A001750.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/001/A001750.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/001/A001750.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A001750: Primes multiplied by 5.
; 10,15,25,35,55,65,85,95,115,145,155,185,205,215,235,265,295,305,335,355,365,395,415,445,485,505,515,535,545,565,635,655,685,695,745,755,785,815,835,865,895,905,955,965,985,995,1055,1115,1135,1145,1165,1195,1205,1255,1285,1315,1345,1355,1385,1405,1415,1465,1535,1555,1565,1585,1655,1685,1735,1745,1765,1795,1835,1865,1895,1915,1945,1985,2005,2045,2095,2105,2155,2165,2195,2215,2245,2285,2305,2315,2335,2395,2435,2455,2495,2515,2545,2605,2615,2705,2735,2785,2815,2845,2855,2885,2935,2965,2995,3005,3035,3065,3085,3095,3155,3205,3215,3235,3265,3295,3305,3365,3385,3415,3455,3505,3545,3595,3635,3665,3695,3715,3755,3785,3805,3845,3865,3935,3985,4045,4055,4105,4115,4135,4145,4195,4265,4285,4295,4315,4385,4405,4415,4435,4535,4555,4595,4645,4685,4705,4735,4765,4835,4855,4885,4915,4955,4985,5045,5065,5095,5105,5155,5165,5195,5245,5255,5305,5315,5345,5435,5455,5465,5485,5515,5545,5585,5615,5645,5755,5765,5815,5855,5905,5935,5965,6005,6065,6085,6115,6145,6155,6185,6245,6295,6385,6395,6415,6445,6455,6485,6505,6515,6535,6595,6605,6635,6805,6835,6865,6905,6995,7045,7115,7135,7145,7165,7195,7235,7255,7265,7295,7355,7405,7415,7435,7445,7465,7495,7555,7615,7655,7715,7745,7765,7795,7835,7855,7895,7915
cal $0,40 ; The prime numbers.
mov $1,$0
sub $1,2
mul $1,5
add $1,10
| 144.777778 | 1,197 | 0.778204 |
31eb8d73773ecc6e1b7f3ddf71de15a6e6eb1369 | 1,242 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca.log_3_1252.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca.log_3_1252.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca.log_3_1252.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r8
push %r9
push %rax
push %rbx
push %rdx
// Store
lea addresses_UC+0x1f07c, %rax
nop
nop
nop
nop
cmp $9324, %r12
movb $0x51, (%rax)
nop
nop
cmp $16248, %r9
// Load
lea addresses_A+0x1783c, %r8
nop
add $43747, %r10
vmovups (%r8), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %rbx
nop
nop
nop
nop
and $63359, %r8
// Faulty Load
lea addresses_RW+0xd9c, %rax
clflush (%rax)
nop
and $2919, %r12
mov (%rax), %r8w
lea oracles, %r9
and $0xff, %r8
shlq $12, %r8
mov (%r9,%r8,1), %r8
pop %rdx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_UC'}}
{'src': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'32': 3}
32 32 32
*/
| 17.492958 | 122 | 0.636071 |
ad0a2573de5eff5839d9ced56ee74fc425c52481 | 1,949 | asm | Assembly | test/mpx.asm | bitwiseworks/nasm-os2 | ef78e4ee1ca3220ac3b60a61b084a693b8032ab6 | [
"BSD-2-Clause"
] | 1 | 2020-06-20T07:35:25.000Z | 2020-06-20T07:35:25.000Z | 3rdParties/src/nasm/nasm-2.15.02/travis/test/mpx.asm | blue3k/StormForge | 1557e699a673ae9adcc8f987868139f601ec0887 | [
"Apache-2.0"
] | 1 | 2020-03-26T19:58:54.000Z | 2020-04-24T08:58:04.000Z | test/mpx.asm | bitwiseworks/nasm-os2 | ef78e4ee1ca3220ac3b60a61b084a693b8032ab6 | [
"BSD-2-Clause"
] | null | null | null | ;Testname=mpx; Arguments=-felf -ompx.o -O0; Files=stdout stderr mpx.o
BITS 32
bndmk bnd1, [eax]
bndmk bnd1, [0x399]
bndmk bnd1, [ecx+0x3]
bndmk bnd1, [eax+ecx]
bndmk bnd1, [ecx*1]
bndmk bnd1, [edx+1*eax+0x3]
; bndmov
bndmov bnd1, [eax]
bndmov bnd1, [0x399]
bndmov bnd1, [ecx+0x3]
bndmov bnd1, [eax+ecx]
bndmov bnd1, [ecx*1]
bndmov bnd1, [edx+1*eax+0x3]
bndmov bnd0, bnd1
bndmov [eax], bnd1
bndmov [0x399], bnd1
bndmov [ecx+0x3], bnd1
bndmov [eax+ecx], bnd1
bndmov [ecx*1], bnd1
bndmov [edx+1*eax+0x3], bnd1
bndmov bnd1, bnd0
; bndcl
bndcl bnd1, [eax]
bndcl bnd1, ecx
bndcl bnd1, [0x399]
bndcl bnd1, [ecx+0x3]
bndcl bnd1, [eax+ecx]
bndcl bnd1, [ecx*1]
bndcl bnd1, [edx+1*eax+0x3]
; bndcu
bndcu bnd1, [eax]
bndcu bnd1, ecx
bndcu bnd1, [0x399]
bndcu bnd1, [ecx+0x3]
bndcu bnd1, [eax+ecx]
bndcu bnd1, [ecx*1]
bndcu bnd1, [edx+1*eax+0x3]
; bndcn
bndcn bnd1, [eax]
bndcn bnd1, ecx
bndcn bnd1, [0x399]
bndcn bnd1, [ecx+0x3]
bndcn bnd1, [eax+ecx]
bndcn bnd1, [ecx*1]
bndcn bnd1, [edx+1*eax+0x3]
; bndstx
bndstx [eax+ebx*1+0x3], bnd0
bndstx [eax+0x3,ebx], bnd0
bndstx [eax+0x3], bnd0, ebx
bndstx [eax+0x3], ebx, bnd0
bndstx [ecx*1], bnd2
bndstx [,ecx*1], bnd2
bndstx [0,ecx*1], bnd2
bndstx [0], bnd2, ecx
bndstx [0], ecx, bnd2
bndstx [edx+0x399], bnd3
bndstx [1*ebx+3], bnd2
bndstx [3,1*ebx], bnd2
bndstx [3], ebx, bnd2
bndstx [edx], bnd1
; bndldx
bndldx bnd0, [eax+ebx*1+0x3]
bndldx bnd2, [ebx+edx+3]
bndldx bnd2, [ecx*1]
bndldx bnd3, [edx+0x399]
bndldx bnd2, [1*ebx+3]
bndldx bnd2, [3], ebx
bndldx bnd1, [edx]
; bnd
bnd ret
bnd call foo
bnd jmp foo ; when it becomes a Jb form - short jmp (eb),
; bnd prefix is silently dropped
bnd jmp near 0 ; near jmp (opcode e9)
; bnd jmp short 0 ; explicit short jmp (opcode eb) : error
bnd jno foo
foo: bnd ret
| 21.655556 | 70 | 0.614674 |
64c421b2deb999e0ab1c219a4730547a3f659ab0 | 9,396 | asm | Assembly | RcloneWrapper_Src/RcloneWrapper.asm | DeviousMalcontent/galaxy-integration-rclone | 891476c1e2839bbdfa4f0309ccbebe208542bc79 | [
"Apache-2.0"
] | null | null | null | RcloneWrapper_Src/RcloneWrapper.asm | DeviousMalcontent/galaxy-integration-rclone | 891476c1e2839bbdfa4f0309ccbebe208542bc79 | [
"Apache-2.0"
] | null | null | null | RcloneWrapper_Src/RcloneWrapper.asm | DeviousMalcontent/galaxy-integration-rclone | 891476c1e2839bbdfa4f0309ccbebe208542bc79 | [
"Apache-2.0"
] | null | null | null | ; #########################################################################
;
; Program: RcloneWrapper
; Purpose: Adds a GUI readout to the command line based Rclone.org client,
; Lists and executes simple commands such as -AddGame,
; handles parsing of -RunGame FileToExecute.exe from GOG galaxy as a
; command line switch,
; handles the adding, editing and updating of Cloud Storage Providers
; i.e OneDriveGames:\Games,
; interfaces and updates GameLibrary.db3 (SQLlite file).
; Author: Mark Albanese
; Date: 30 May 2020
; Version: 1.0
; Release: 1
; Language: x86 Assembly / Microsoft Macro Assembler
; Compiler: MASM32 SDK
;
; #########################################################################
.386
.model flat, stdcall
option casemap :none ; case sensitive
; #########################################################################
include \masm32\include\masm32rt.inc
; #########################################################################
;=================
; local prototypes
;=================
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
WinMain PROTO :DWORD,:DWORD,:DWORD,:DWORD
CatProc PROTO strBase:DWORD, strAdd:DWORD
StrCmpProc PROTO strOne:DWORD, strTwo:DWORD
.const
IDR_MAINMENU equ 101
IDM_ADDGAME equ 40001
.data
ClassName db "RcloneWrapperWinClass",0
AppName db "Rclone.org Wrapper",0
EditClass db "EDIT",0
CreatePipeError db "Error during pipe creation",0
CreateProcessError db "Error during process creation",0
CommandLine db "rclone.exe version",0
;For debug purposes comparing strings...
msgStrEqual db 'The strings are equal.',0
msgStrNotEqual db 'The strings are not equal.',0
.data?
hInstance HINSTANCE ?
inCommandLine LPSTR ?
hwndEdit dd ?
CMDbuffer db MAX_PATH dup(?)
AppPathbuffer db MAX_PATH dup(?)
.code
start:
; #########################################################################
;print "I am just a simple wrapper, waiting for my developer to finish me...",13,10
mov esi, OffSet AppPathbuffer
invoke GetModuleFileName, rv(GetModuleHandle, 0), esi, SizeOf AppPathbuffer
;Check command line and see if any arguments were sent to the program...
call main
invoke GetModuleHandle, NULL
mov hInstance,eax
invoke GetCommandLine
mov inCommandLine,eax
; -------------------------------------------
; Call the applications main window
; -------------------------------------------
invoke WinMain, hInstance,NULL,inCommandLine, SW_SHOWDEFAULT
invoke ExitProcess,eax
; #########################################################################
main proc uses esi edi ebx
local argc:DWORD
invoke GetCommandLineW
lea ecx,argc
invoke CommandLineToArgvW,eax,ecx
mov esi,eax
mov ebx,argc
xor edi,edi
@@:
inc edi
; Convert UNICODE string to ANSI
invoke WideCharToMultiByte,CP_ACP,0,DWORD PTR [esi],-1, ADDR CMDbuffer,256,0,0
; For debug purposes tell me what was sent to the command line...
invoke MessageBox, NULL, ADDR CMDbuffer, ADDR CMDbuffer, MB_OK
add esi,4
dec ebx
jnz @b
; Test to see if strings were actually parsed to the command line or the first argument is just the programs start path, in which case we can ignore it...
invoke lstrcmpi, ADDR AppPathbuffer, ADDR CMDbuffer
.if eax == 0
invoke MessageBox, NULL, ADDR msgStrEqual, ADDR msgStrEqual, MB_OK
.else
; Do nothing...
;invoke MessageBox, NULL, ADDR msgStrNotEqual, ADDR msgStrNotEqual, MB_OK
.endif
ret
main endp
; -------------------------------------------
; Applications Main Window
; -------------------------------------------
WinMain proc hInst:DWORD,hPrevInst:DWORD,CmdLine:DWORD,CmdShow:DWORD
local wc:WNDCLASSEX
local msg:MSG
local hwnd:HWND
mov wc.cbSize,SizeOf WNDCLASSEX
mov wc.style, CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc, OffSet WndProc
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
push hInst
pop wc.hInstance
mov wc.hbrBackground,COLOR_APPWORKSPACE
mov wc.lpszMenuName,IDR_MAINMENU
mov wc.lpszClassName,OffSet ClassName
invoke LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,eax
mov wc.hIconSm,eax
invoke LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
invoke RegisterClassEx, ADDR wc
invoke CreateWindowEx,WS_EX_CLIENTEDGE, ADDR ClassName, ADDR AppName,\
WS_OVERLAPPEDWINDOW+WS_VISIBLE,CW_USEDEFAULT,\
CW_USEDEFAULT,920,512,NULL,NULL,\
hInst,NULL
mov hwnd,eax
.while TRUE
invoke GetMessage, ADDR msg,NULL,0,0
.BREAK .IF (!eax)
invoke TranslateMessage, ADDR msg
invoke DispatchMessage, ADDR msg
.endw
mov eax,msg.wParam
ret
WinMain endp
; -------------------------------------------
; Main window loop
; -------------------------------------------
WndProc proc hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
local rect:RECT
local hRead:DWORD
local hWrite:DWORD
local startupinfo:STARTUPINFO
local pinfo:PROCESS_INFORMATION
local buffer[1024]:byte
local bytesRead:DWORD
local hdc:DWORD
local sat:SECURITY_ATTRIBUTES
.if uMsg==WM_CREATE
invoke CreateWindowEx,NULL, ADDR EditClass,NULL,WS_CHILD+WS_VISIBLE+ES_MULTILINE+ES_AUTOHSCROLL+ES_AUTOVSCROLL,0,0,0,0,hWnd,NULL,hInstance,NULL
mov hwndEdit,eax
.elseif uMsg==WM_CTLCOLOREDIT
invoke SetTextColor,wParam,Green
invoke SetBkColor,wParam,Black
invoke GetStockObject,BLACK_BRUSH
ret
.elseif uMsg==WM_SIZE
mov edx,lParam
mov ecx,edx
shr ecx,16
and edx,0ffffh
invoke MoveWindow,hwndEdit,0,0,edx,ecx,TRUE
.elseif uMsg==WM_COMMAND
.if lParam==0
mov eax,wParam
.if ax==IDM_ADDGAME
mov sat.nLength,SizeOf SECURITY_ATTRIBUTES
mov sat.lpSecurityDescriptor,NULL
mov sat.bInheritHandle,TRUE
invoke CreatePipe, ADDR hRead, ADDR hWrite, ADDR sat,NULL
.if eax==NULL
invoke MessageBox,hWnd, ADDR CreatePipeError, ADDR AppName,MB_ICONERROR+MB_OK
.else
mov startupinfo.cb,SizeOf STARTUPINFO
invoke GetStartupInfo, ADDR startupinfo
mov eax,hWrite
mov startupinfo.hStdOutput,eax
mov startupinfo.hStdError,eax
mov startupinfo.dwFlags,STARTF_USESHOWWINDOW+STARTF_USESTDHANDLES
mov startupinfo.wShowWindow,SW_HIDE
;-------------------------------------------------
; Create process
;-------------------------------------------------
invoke CreateProcess,NULL, ADDR CommandLine,NULL,NULL,TRUE,NULL,NULL,NULL, ADDR startupinfo, ADDR pinfo
.if eax==NULL
invoke MessageBox,hWnd, ADDR CreateProcessError, ADDR AppName,MB_ICONERROR+MB_OK
.else
invoke CloseHandle,hWrite
.while TRUE
invoke RtlZeroMemory, ADDR buffer,1024
invoke ReadFile,hRead, ADDR buffer,1023, ADDR bytesRead,NULL
.if eax==NULL
.break
.else
invoke SendMessage,hwndEdit,EM_SETSEL,-1,0
invoke SendMessage,hwndEdit,EM_REPLACESEL,FALSE, ADDR buffer
.endif
.endw
.endif
invoke CloseHandle,hRead
invoke CloseHandle,pinfo.hProcess
invoke CloseHandle,pinfo.hThread
.endif
.endif
.endif
.elseif uMsg==WM_DESTROY
invoke PostQuitMessage,NULL
.else
invoke DefWindowProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
WndProc endp
; -------------------------------------------
; Procedure for string concatenation.
; -------------------------------------------
CatProc proc strBase:DWORD, strAdd:DWORD
mov edi, strBase
mov al, 0
repne scasb
dec edi
mov esi, strAdd
@@:
mov al, [esi]
mov [edi], al
inc esi
inc edi
test al, al
jnz @B
ret
CatProc endp
;; -------------------------------------------
;; Procedure for string compare.
;; -------------------------------------------
;StrCmpProc proc strOne:DWORD, strTwo:DWORD
; invoke lstrcmp, ADDR strOne, ADDR strTwo
; cmp eax,0
; jne @f
; invoke MessageBox, NULL, ADDR msg1, ADDR msg1, MB_OK
; jmp strnotequal
;@@:
; invoke MessageBox, NULL, ADDR msg2, ADDR msg2, MB_OK
;strnotequal:
; jnz @B
; ret
;StrCmpProc endp
end start | 34.291971 | 159 | 0.540336 |
39a3544dd485e20eb906bce74123376d14e4f5ba | 2,441 | asm | Assembly | Outputs/mixers/m32flat/mix8b.asm | jgunthorpe/muse | 7701cab4377938a8ce3d8c8d2eb68f5f7a7152bf | [
"MIT"
] | null | null | null | Outputs/mixers/m32flat/mix8b.asm | jgunthorpe/muse | 7701cab4377938a8ce3d8c8d2eb68f5f7a7152bf | [
"MIT"
] | null | null | null | Outputs/mixers/m32flat/mix8b.asm | jgunthorpe/muse | 7701cab4377938a8ce3d8c8d2eb68f5f7a7152bf | [
"MIT"
] | null | null | null | ; ASM mixing code
;
; MixAsm_20_xx - For 2.0 <= x incrs
; Shuffles the code around to optimize for the constant motion using a
; variable whole number.
;
; MixAsm_10_20 - For 1.0 <= x < 2.0 incrs
; Shuffles the code around to optimize for the constant motion, uses a
; whole number portion of 1.
;
; MixAsm_05_10 - For 0.5 <= x < 1.0 incrs
; Takes advantage of the fact that a secondary addition does not need to be
; done due to the 0 whole number portion.
;
; MixAsm_03_05 - For 0.3 <= x < 0.5 incrs
; Takes advantage of the fact that in this number range a pattern of
; 2 loops and 3 loops, ie 2,3,2,2,3,2,2,3. varies with the counter.
; Since it never goes below 2 loops it is safe to combine two loops into
; one and do the math that way.
;
; MixAsm_00_03 - For 0.0 <= x < 0.3 incrs
; Takes advantage of the fact that in this number range a pattern of
; 3 loops and 4 loops, ie 3,4,3,3,4,3,3,4. varies with the counter.
; Since it never goes below 3 loops it is safe to combine three loops into
; one and do the math that way.
ideal ; TASM Ideal ode
p386 ; protected mode 386 code
model os2 flat, syscall ; os/2 flat model, system calling
nosmart
public syscall MixAsm_20_xx ; Export the symbol
public syscall MixAsm_10_20 ; Export the symbol
public syscall MixAsm_05_10 ; Export the symbol
public syscall MixAsm_03_05 ; Export the symbol
public syscall MixAsm_00_03 ; Export the symbol
public syscall MixAsm_20_xx_R ; Export the symbol
public syscall MixAsm_10_20_R ; Export the symbol
public syscall MixAsm_05_10_R ; Export the symbol
public syscall MixAsm_03_05_R ; Export the symbol
public syscall MixAsm_00_03_R ; Export the symbol
dataseg
StackSave DD ? ; Place to store esp
VolTable DD ? ; Place to store VolMap
MulIncr DD ? ; Place to store x*Incr
WholeIncr DD ? ; Place to store Add
JumpTarget DD ?
codeseg ; Start the code segment
FORWARD = 1
BACKWARD = 2
DIRECTION = FORWARD
include "Mix8b.inc"
DIRECTION = BACKWARD
include "Mix8b.inc"
end
| 38.140625 | 79 | 0.603032 |
9425491f4f13461840828c1c959be28a55624e14 | 406 | asm | Assembly | 07_Jump_Loop/src/jumploop.asm | junehan-dev/asm-beginning_x64_programming | 3ed924c3687600804823382e6123254f8ea760f8 | [
"MIT"
] | null | null | null | 07_Jump_Loop/src/jumploop.asm | junehan-dev/asm-beginning_x64_programming | 3ed924c3687600804823382e6123254f8ea760f8 | [
"MIT"
] | null | null | null | 07_Jump_Loop/src/jumploop.asm | junehan-dev/asm-beginning_x64_programming | 3ed924c3687600804823382e6123254f8ea760f8 | [
"MIT"
] | null | null | null | extern printf
section .data
number dq 5
fmt db "The sum from 0 to %ld is %ld", 10, 0
section .bss
section .text
global main
main:
push rbp
mov rbp, rsp
mov rbx, 0 ; counter
mov rax, 0 ; sum will be in rax
jloop:
add rax, rbx
inc rbx
cmp rbx, [number]
jle jloop
print:
mov rdi, fmt
mov rsi, [number]
mov rdx, rax
mov rax, 0
call printf
exit:
mov rsp, rbp
pop rbp
ret
| 13.533333 | 46 | 0.637931 |
1d090c66f4a3d54911cd36315750bb5fdf238485 | 5,286 | asm | Assembly | c2000/C2000Ware_1_00_06_00/libraries/math/CLAmath/c28/source/CLAexp10.asm | ramok/Themis_ForHPSDR | d0f323a843ac0a488ef816ccb7c828032855a40a | [
"Unlicense"
] | null | null | null | c2000/C2000Ware_1_00_06_00/libraries/math/CLAmath/c28/source/CLAexp10.asm | ramok/Themis_ForHPSDR | d0f323a843ac0a488ef816ccb7c828032855a40a | [
"Unlicense"
] | null | null | null | c2000/C2000Ware_1_00_06_00/libraries/math/CLAmath/c28/source/CLAexp10.asm | ramok/Themis_ForHPSDR | d0f323a843ac0a488ef816ccb7c828032855a40a | [
"Unlicense"
] | 1 | 2021-07-21T08:10:37.000Z | 2021-07-21T08:10:37.000Z | ;;#############################################################################
;; FILE: CLAexp10.asm
;;
;; DESCRIPTION: CLA Base 10 Exponent function
;;
;; Group: C2000
;; Target Family: C28x+CLA
;;
;;#############################################################################
;; $TI Release: CLA Math Library 4.02.02.00 $
;; $Release Date: Oct 18, 2018 $
;; $Copyright: Copyright (C) 2018 Texas Instruments Incorporated -
;; http://www.ti.com/ ALL RIGHTS RESERVED $
;;#############################################################################
.cdecls C,LIST,"CLAmath.h"
.include "CLAeabi.asm"
;;----------------------------------------------------------------------------
;; Description:
;; Step(1): Calculate absolute of x/LOG10(e) (or x*LN(10))
;;
;; Step(2): Identify the integer and mantissa of the input
;;
;; Step(3): Obtain the e^integer(x) from the table
;;
;; Step(4): Calculate the value of e^(mantissa)by using the polynomial
;; approxiamation,
;; 1 + x*(1+x*0.5(1+(x/3)(1+x/4*(1+Xm/5*(1+Xm/6*(1+Xm/7))))))
;;
;; Step(5): The value of e^x is the product of results from (3)&(4)
;;
;;
;; Benchmark: Cycles = 43
;; Instructions = 43
;;
;; Scratchpad Usage: (Local Function Scratchpad Pointer (SP))
;;
;; |_______|<- exponent10 temporary variable (SP+2)
;; |_______|<- MR3 (SP+0)
;;
;;----------------------------------------------------------------------------
.def _CLAexp10
.sect "Cla1Prog:_CLAexp10"
.align 2
.def __cla_CLAexp10_sp
__cla_CLAexp10_sp .usect ".scratchpad:Cla1Prog:_CLAexp10",4,0,1
_CLAexp10:
.asmfunc
.asg __cla_CLAexp10_sp + 0, _save_MR3
.asg __cla_CLAexp10_sp + 2, _exp10_tmp
; Context Save
MMOV32 @_save_MR3, MR3
; The input argument fVal is refered to as X
; save input argument on scratchpad
MMOV32 @_exp10_tmp,MR0
; Step 1
MMOV32 MR3,MR0 ;
MMOV32 MR1,@_CLALOG10 ;
MMPYF32 MR3,MR3,MR1 ; X = INPUT/LOG10(e) or INPUT*LN(10)
MABSF32 MR3,MR3 ; LOAD |X| TO MR3
; Step 2
MF32TOI32 MR0,MR3 ; MR0 = INTEGER(X)
MFRACF32 MR1,MR3 ; MR1 = MANTISSA(X)
; Step 3
MADD32 MR2,MR0,MR0
MMOV16 MAR1,MR2,#_CLAExpTable
; Step 4
MMOV32 MR2,@_CLAINV7 ; MR2 = 1/7
MMPYF32 MR3,MR2,MR1 ; MR3 = Xm/7
|| MMOV32 MR2,@_CLAINV1 ; MR2 = 1
MADDF32 MR3,MR3,MR2 ; MR3 =(1+Xm/7)
MMOV32 MR2,@_CLAINV6 ; MR2 = 1/6
|| MMPYF32 MR3,MR1,MR3 ; MR3 = Xm(1+Xm/7)
MMPYF32 MR3,MR3,MR2 ; MR3 = Xm(1+Xm/7)/6
|| MMOV32 MR2,@_CLAINV1 ; MR2 = 1
MADDF32 MR3,MR3,MR2 ; MR3 = 1+(Xm/6)*(1+Xm/7)
|| MMOV32 MR0,*MAR1 ; MR0 = e^(INTEGER(X))
MMOV32 MR2,@_CLAINV5 ; MR2 = .2
|| MMPYF32 MR3,MR1,MR3 ; MR3 = Xm(1+Xm/6*(1+Xm/7))
MMPYF32 MR3,MR3,MR2 ; MR3 = Xm(1+Xm/6*(1+Xm/7))/5
|| MMOV32 MR2,@_CLAINV1 ; MR2 = 1
MADDF32 MR3,MR3,MR2 ; MR3 = 1+(Xm/5)*(1+Xm/6*(1+Xm/7))
MMOV32 MR2,@_CLAINV4 ; MR2 = .25
|| MMPYF32 MR3,MR1,MR3 ; MR3 = Xm(1+Xm/5*(1+Xm/6*(1+Xm/7)))
MMPYF32 MR3,MR3,MR2 ; MR3 = Xm(1+Xm/5*(1+Xm/6*(1+Xm/7)))/4
|| MMOV32 MR2,@_CLAINV1 ; MR2 = 1
MADDF32 MR3,MR3,MR2 ; MR3 = 1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7)))
MMOV32 MR2,@_CLAINV3 ; MR2 = .3333333
|| MMPYF32 MR3,MR1,MR3 ; MR3 = Xm(1+(Xm/4)*(1+Xm/5)*(1+Xm/6*(1+Xm/7)))
MMPYF32 MR3,MR3,MR2 ; MR3 = Xm(1+(Xm/4)*(1+Xm/5)*(1+Xm/6*(1+Xm/7)))/3
|| MMOV32 MR2,@_CLAINV1 ; MR2 = 1
MADDF32 MR3,MR3,MR2 ; MR3 = 1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7))))
MMOV32 MR2,@_CLAINV2 ; MR2 = .5
|| MMPYF32 MR3,MR1,MR3 ; MR3 = Xm(1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7)))))
MMPYF32 MR3,MR3,MR2 ; MR3 = Xm(1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7)))))*0.5
|| MMOV32 MR2,@_CLAINV1 ; MR2 = 1
MADDF32 MR3,MR3,MR2 ; MR3 = 1+(1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7)))))Xm/2
MMPYF32 MR3,MR3,MR1 ; MR3 = Xm(1+(1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7)))))Xm/2)
|| MMOV32 MR2,@_CLAINV1 ; MR2 = 1
MADDF32 MR3,MR3,MR2 ; MR3 = e^(Xm)= 1+Xm(1+(1+(Xm/3)*(1+(Xm/4)*(1+Xm/5*(1+Xm/6*(1+Xm/7)))))Xm/2)
; Step 5
MMPYF32 MR3,MR3,MR0 ; MR3 = e^(MANTISSA) x e^(INTEGER(X))
MMOV32 MR1,MR3,UNC
; Calculation of e^-x
MEINVF32 MR2,MR1 ; MR2 = Ye = Estimate(1/Den)
MMPYF32 MR3,MR2,MR1 ; MR3 = Ye*Den
MSUBF32 MR3,#2.0,MR3 ; MR3 = 2.0 - Ye*Den
MMPYF32 MR2,MR2,MR3 ; MR2 = Ye = Ye*(2.0 - Ye*Den)
MMPYF32 MR3,MR2,MR1 ; MR3 = Ye*Den
MSUBF32 MR3,#2.0,MR3 ; MR3 = 2.0 - Ye*Den
MMPYF32 MR2,MR2,MR3 ; MR2 = Ye = Ye*(2.0 - Ye*Den)
|| MMOV32 MR0,@_exp10_tmp ; MR2 = X (set/clear NF,ZF)
; Context Restore and Final Operations
MRCNDD UNC
MMOV32 MR1,MR2,LT ; update e^X with inverse value
MMOV32 MR0,MR1 ; Store Y = e^(X)
MMOV32 MR3,@_save_MR3
.unasg _save_MR3
.unasg _exp10_tmp
.endasmfunc
;; End of File
| 40.976744 | 108 | 0.484109 |
cefb1193d28647dd50b57db8cad66d203caa6222 | 2,816 | asm | Assembly | C/LoDosLib/find_tsr.asm | p-k-p/SysToolsLib | 827be2799e541410cb5c11358cd4ce6859e171ad | [
"Apache-2.0"
] | 232 | 2016-04-27T21:56:11.000Z | 2022-03-29T09:02:15.000Z | C/LoDosLib/find_tsr.asm | p-k-p/SysToolsLib | 827be2799e541410cb5c11358cd4ce6859e171ad | [
"Apache-2.0"
] | 31 | 2016-05-09T09:05:36.000Z | 2022-03-29T19:17:45.000Z | C/LoDosLib/find_tsr.asm | p-k-p/SysToolsLib | 827be2799e541410cb5c11358cd4ce6859e171ad | [
"Apache-2.0"
] | 94 | 2016-06-01T18:10:39.000Z | 2022-03-26T10:44:57.000Z | page 60, 132
;*****************************************************************************;
; ;
; FILE NAME: FIND_TSR.ASM ;
; ;
; DESCRIPTION: Find a TSR int 2F handle ;
; ;
; NOTES: ;
; ;
; HISTORY: ;
; 1994/05/09 JFL Extracted from Mini .COM RESET.ASM. ;
; ;
; (c) Copyright 1993-2017 Hewlett Packard Enterprise Development LP ;
; Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 ;
;*****************************************************************************;
INCLUDE adefine.inc
.286
.code
;===FUNCTION HEADER===========================================================;
; ;
; NAME: find_tsr ;
; ;
; DESCRIPTION: Find a TSR multiplex ID ;
; ;
; PARAMETERS: ;
; ;
; ON ENTRY: BX = Offset of the TSR ID string, NUL terminated. ;
; ;
; ON EXIT: Carry clear: TSR found, AX = handle (0C0H to 0FFH) ;
; Carry set: TSR not found, AX = 0 ;
; ;
; REGS ALTERED: AX ;
; ;
; HISTORY: ;
; ;
;=============================================================================;
CFASTPROC find_tsr
push ds
push es
pusha
mov bp, sp
sub sp, 6 ; Make room for a word and a dword
; Compute the length of the input string
mov [bp-2], ds ; Save a pointer to the input string
mov [bp-4], bx
xor al, al
mov cx, -1
push ds
pop es
mov di, bx
repne scasb
neg cx
dec cx
dec cx
mov [bp-6], cx ; Save the length of the input string
; Check from handle 0C0h to 0FFh
mov ax, 0BF00H ; AH=handle, AL=function 0
next_handle:
add ah, 1 ; Next handle
jc x_find_tsr ; Not found (wrapped past 0FFh)
push ax ; Always destroyed by int 2F
xor cx, cx
mov es, cx ; Clear ES to see if int 2F changes it
int 2fh ; Identify TSR. This may break all regs.
cmp al, -1 ; Is there a TSR with this handle?
pop ax ; Restore handle and function number
jne next_handle ; No such TSR. Try the next handle
mov di, es ; Most TSRs return ID segment in ES
test di, di ; Did ES change?
jnz @F ; Jump if it did
mov es, cx ; But some return it in CX instead
@@:
mov di, bx ; TSR ID offset
lds si, [bp-4] ; Reference string pointer
mov cx, [bp-6] ; Reference string length
cld
repe cmpsb ; Is it the TSR we're looking for?
jne next_handle ; Jump if it's not.
mov al, ah ; Move the handle to AL
xor ah, ah ; Clear AH and carry
x_find_tsr:
mov [bp+14], ax ; Save AX in stack frame
mov sp, bp
popa ; Restore general regs, including new AX
pop es
pop ds
ret
ENDCFASTPROC find_tsr
end
| 26.317757 | 79 | 0.501776 |
d519b75b9f5ac42392b7f48274d4f50ec1401104 | 53 | asm | Assembly | tests/inchexstr/9.asm | NullMember/customasm | 6e34d6432583a41278e6b3596f1817ae82149531 | [
"Apache-2.0"
] | 414 | 2016-10-14T22:39:20.000Z | 2022-03-30T07:52:44.000Z | tests/inchexstr/9.asm | NullMember/customasm | 6e34d6432583a41278e6b3596f1817ae82149531 | [
"Apache-2.0"
] | 100 | 2018-03-22T16:12:24.000Z | 2022-03-26T09:19:23.000Z | tests/inchexstr/9.asm | NullMember/customasm | 6e34d6432583a41278e6b3596f1817ae82149531 | [
"Apache-2.0"
] | 47 | 2017-06-29T15:12:13.000Z | 2022-03-10T04:50:51.000Z | #d inchexstr("data1.txt", "data2.txt") ; error: wrong | 53 | 53 | 0.679245 |
01494dde5331c4258f4515ca9f66855fbbc4b1ad | 1,520 | asm | Assembly | test_cases/caso liset/casoprueba.asm | lorainemg/s-mipsv2-processor | 8988a5ef730aaa7918bd50539f35f5247bd3c0f7 | [
"MIT"
] | null | null | null | test_cases/caso liset/casoprueba.asm | lorainemg/s-mipsv2-processor | 8988a5ef730aaa7918bd50539f35f5247bd3c0f7 | [
"MIT"
] | null | null | null | test_cases/caso liset/casoprueba.asm | lorainemg/s-mipsv2-processor | 8988a5ef730aaa7918bd50539f35f5247bd3c0f7 | [
"MIT"
] | null | null | null | addi r1 r0 76
addi r2 r0 105
addi r3 r0 115
addi r4 r0 101
addi r30 r0 1
add r5 r30 r3
j salta
addi r1 r0 99
tty r1
addi r1 r1 12
tty r1
push r1
sw r1, 0(r31)
addi r2 r0 2
sub r1 r1 r2
tty r1
lw r1, 0(r31)
tty r1
pop r1
addi r25 r0 1
pop r5
pop r4
pop r3
pop r2
pop r1
j inicio
#como
salta:
j dontstop
halt
dontstop:
inicio:
tty r1
tty r2
tty r3
tty r4
tty r5
push r1
push r2
push r3
push r4
push r5
blez r25 continue
halt
continue:
#Liset
push r3
push r4
lw r21, 0(r31)
push r3
pop r6
tty r21
tty r6
#es
addi r8 r0 4
addi r9 r0 7
mulu r8 r9
mflo r8
addi r8 r8 1
add r1 r8 r1
addi r9 r0 5
sub r10 r3 r9
addi r22 r0 1
add r22 r22 r3
pop r4
tty r1
tty r10
tty r22
tty r4
#inte
j continua
addi r27 r0 47
tty r27
addi r27 r0 69
tty r27
addi r27 r0 114
push r27
tty r27
tty r27
addi r27 r0 111
tty r27
pop r27
tty r27
halt
#/Error
aqui:
jr r18
continua:
push r10
push r22
push r4
push r1
addi r1 r0 108
tty r1
#l
addi r29 r0 5
div r1 r29
mfhi r28
pop r1
tty r1
#i
addi r12 r0 10
addi r13 r0 10
mult r12 r13
mflo r12
add r12 r12 r28
tty r12
#g
pop r4
pop r22
pop r10
tty r4
tty r10
tty r22
tty r4
#gente
j next
addi r27 r0 47
tty r27
addi r27 r0 69
tty r27
addi r27 r0 114
push r27
tty r27
tty r27
addi r27 r0 111
tty r27
pop r27
tty r27
halt
#/Error
next:
pop r3
tty r3
push r4
lw r1, 0(r31)
pop r4
tty r1
#se
addi r1 r0 28
jr r1
addi r27 r0 47
tty r27
addi r27 r0 69
tty r27
addi r27 r0 114
push r27
tty r27
tty r27
addi r27 r0 111
tty r27
pop r27
tty r27
halt
#/Error
| 7.272727 | 17 | 0.699342 |
8ee91d442df7be303f99aa6f36cfc555715089ad | 301 | asm | Assembly | src/distrb.asm | dshadoff/Star-Spores_TRS-80_Mod1 | 31fd3fa0597c66fef680e8eecfaa0dcdeee781ae | [
"MIT"
] | 1 | 2021-12-16T05:15:27.000Z | 2021-12-16T05:15:27.000Z | src/distrb.asm | dshadoff/Star-Spores_TRS-80_Mod1 | 31fd3fa0597c66fef680e8eecfaa0dcdeee781ae | [
"MIT"
] | null | null | null | src/distrb.asm | dshadoff/Star-Spores_TRS-80_Mod1 | 31fd3fa0597c66fef680e8eecfaa0dcdeee781ae | [
"MIT"
] | null | null | null | ORG 4F00H
ENTRY EQU 5460H
DISTRB DEFM 'Press <SPACE> for instructions. To play, press "1" or "2" '
DEFM 'for the number of players. Copyright (C) 1982, by '
DEFM 'Dave Shadoff. All rights reserved. Distributed by: C-Soft, '
DEFM 'Mississauga, Ontario, Canada. '
DEFB 00
END ENTRY
| 27.363636 | 73 | 0.677741 |
cc12d7b72a734affa94c705b2eb17b5b2df92026 | 1,017 | asm | Assembly | src/conversion/PrintHexa.asm | jhm-ciberman/calculator-asm | f5305f345d7efdd616b34a485f7460f6789f4d9c | [
"MIT"
] | 2 | 2019-08-03T17:09:30.000Z | 2021-04-01T22:17:09.000Z | src/conversion/PrintHexa.asm | jhm-ciberman/calculator-asm | f5305f345d7efdd616b34a485f7460f6789f4d9c | [
"MIT"
] | null | null | null | src/conversion/PrintHexa.asm | jhm-ciberman/calculator-asm | f5305f345d7efdd616b34a485f7460f6789f4d9c | [
"MIT"
] | 1 | 2019-08-04T21:26:32.000Z | 2019-08-04T21:26:32.000Z | ;;;
; Prints _int as a hexadecimal number.
; User uses the '.h' command to print the stack's top as a hexadecimal number.
;;;
proc PrintHexa uses rax rcx rdx r14 , _int:QWORD ; _int saved in rcx
local _array:QWORD, _rem:QWORD, _num:QWORD, _i:WORD
mov [_num], rcx
fastcall ArrayListCreate, 10 ; Creates aux array
mov [_array], rax
.mainloop:
cmp [_num],0
je .print
; _num = _num / 16
; _rem = _num % 16
mov rax, [_num]
cqo
mov r14, 16
idiv r14
mov [_num], rax
mov [_rem], rdx
; if (_rem < 10) then
cmp [_rem], 10
jge .greater
add [_rem], 48
fastcall ArrayListPush, [_array], [_rem]
jmp .mainloop
.greater:
add [_rem], 55
fastcall ArrayListPush, [_array], [_rem]
jmp .mainloop
.print:
fastcall ArrayListSize, [_array]
cmp eax, 0
je .done
fastcall ArrayListPop, [_array]
fastcall ConsolePrintChar, al
jmp .print
.done:
fastcall ArrayListFree, [_array]
ret
endp
| 19.557692 | 78 | 0.605703 |
9a19790a66c0d990606069f51c8a0b7c2b435684 | 1,566 | asm | Assembly | programs/oeis/220/A220509.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/220/A220509.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/220/A220509.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A220509: n^3 + 3n + 3^n.
; 1,7,23,63,157,383,963,2551,7097,20439,60079,178511,533205,1596559,4785755,14352327,43050865,129145127,387426375,1162268383,3486792461,10460362527,31381070323,94143191063,282429550377,847288625143,2541865845983,7625597504751,22876792476997,68630377389359,205891132121739,617673396313831,1853020188884705,5559060566591559,16677181699705975,50031545099042687,150094635297045885,450283905891048127,1350851717673047075,4052555153019035703,12157665459056992921,36472996377170855447,109418989131512433423,328256967394537157263,984770902183611318197,2954312706550833789903,8862938119652501193403,26588814358957503391751,79766443076872509974097,239299329230617529707879,717897987691852588895399,2153693963075557766443551,6461081889226673299073005,19383245667680019896945759,58149737003040059690547795,174449211009120179071337047,523347633027360537213687305,1570042899082081611640719927,4710128697246244834921798975,14130386091738734504765016623,42391158275216203514294649381,127173474825648610542883526767,381520424476945831628650137323,1144561273430837494885949946663,3433683820292512484657849351617,10301051460877537453973547542663,30903154382632612361920642091223,92709463147897837085761925711551,278128389443693511257285776546397,834385168331080533771857329023999,2503155504993241601315571986429059,7509466514979724803946715958615671,22528399544939174411840147875146105,67585198634817523235520443624707159,202755595904452569706561330873359215,608266787713357709119683992619283407
mov $2,3
mul $2,$0
seq $0,1585 ; a(n) = 3^n + n^3.
add $0,$2
| 195.75 | 1,476 | 0.920179 |
e6ff8d3c0683bd4ea46a66efe8f9a26b5fb3842f | 4,664 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0_notsx.log_21829_442.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0_notsx.log_21829_442.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0_notsx.log_21829_442.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 %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1cf63, %rsi
lea addresses_UC_ht+0x141e3, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
cmp %rbp, %rbp
mov $59, %rcx
rep movsb
nop
nop
cmp $57008, %r13
lea addresses_A_ht+0x10dc7, %rsi
lea addresses_UC_ht+0xb963, %rdi
nop
sub %r12, %r12
mov $47, %rcx
rep movsq
nop
nop
nop
nop
nop
inc %rdi
lea addresses_D_ht+0x18fe9, %rsi
lea addresses_WT_ht+0xc8e3, %rdi
nop
nop
nop
nop
sub %r12, %r12
mov $21, %rcx
rep movsw
inc %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r8
push %rbx
push %rsi
// Faulty Load
lea addresses_PSE+0x1c563, %rbx
add %r8, %r8
mov (%rbx), %r12
lea oracles, %rbx
and $0xff, %r12
shlq $12, %r12
mov (%rbx,%r12,1), %r12
pop %rsi
pop %rbx
pop %r8
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 8, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}}
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': True}}
{'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
| 52.404494 | 2,999 | 0.664451 |
5bd55293e7ef3bafc9225917ecc7f2bee2be2592 | 2,603 | asm | Assembly | programs/oeis/006/A006470.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/006/A006470.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/006/A006470.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A006470: Number of rooted planar maps.
; 2,15,60,175,420,882,1680,2970,4950,7865,12012,17745,25480,35700,48960,65892,87210,113715,146300,185955,233772,290950,358800,438750,532350,641277,767340,912485,1078800,1268520,1484032,1727880,2002770,2311575,2657340,3043287,3472820,3949530,4477200,5059810,5701542,6406785,7180140,8026425,8950680,9958172,11054400,12245100,13536250,14934075,16445052,18075915,19833660,21725550,23759120,25942182,28282830,30789445,33470700,36335565,39393312,42653520,46126080,49821200,53749410,57921567,62348860,67042815,72015300,77278530,82845072,88727850,94940150,101495625,108408300,115692577,123363240,131435460,139924800,148847220,158219082,168057155,178378620,189201075,200542540,212421462,224856720,237867630,251473950,265695885,280554092,296069685,312264240,329159800,346778880,365144472,384280050,404209575,424957500,446548775,469008852,492363690,516639760,541864050,568064070,595267857,623503980,652801545,683190200,714700140,747362112,781207420,816267930,852576075,890164860,929067867,969319260,1010953790,1054006800,1098514230,1144512622,1192039125,1241131500,1291828125,1344168000,1398190752,1453936640,1511446560,1570762050,1631925295,1694979132,1759967055,1826933220,1895922450,1966980240,2040152762,2115486870,2193030105,2272830700,2354937585,2439400392,2526269460,2615595840,2707431300,2801828330,2898840147,2998520700,3100924675,3206107500,3314125350,3425035152,3538894590,3655762110,3775696925,3898759020,4025009157,4154508880,4287320520,4423507200,4563132840,4706262162,4852960695,5003294780,5157331575,5315139060,5476786042,5642342160,5811877890,5985464550,6163174305,6345080172,6531256025,6721776600,6916717500,7116155200,7320167052,7528831290,7742227035,7960434300,8183533995,8411607932,8644738830,8883010320,9126506950,9375314190,9629518437,9889207020,10154468205,10425391200,10702066160,10984584192,11273037360,11567518690,11868122175,12174942780,12488076447,12807620100,13133671650,13466330000,13805695050,14151867702,14504949865,14865044460,15232255425,15606687720,15988447332,16377641280,16774377620,17178765450,17590914915,18010937212,18438944595,18875050380,19319368950,19772015760,20233107342,20702761310,21181096365,21668232300,22164290005,22669391472,23183659800,23707219200,24240195000,24782713650,25334902727,25896890940,26468808135,27050785300,27642954570,28245449232,28858403730,29481953670,30116235825,30761388140,31417549737,32084860920,32763463180,33453499200,34155112860,34868449242,35593654635,36330876540,37080263675,37841965980,38616134622,39402922000,40202481750,41014968750,41840539125
add $0,4
mov $1,$0
bin $0,4
sub $1,2
mul $1,$0
| 289.222222 | 2,513 | 0.890511 |
7a9281ea455d87df62ba7df2e3fd625925e8ef40 | 36,139 | asm | Assembly | kernel.asm | mateusnbm/breakout | efbaf66a9fc6a1dfcc2b14b48f8ffd31c5747271 | [
"MIT"
] | null | null | null | kernel.asm | mateusnbm/breakout | efbaf66a9fc6a1dfcc2b14b48f8ffd31c5747271 | [
"MIT"
] | null | null | null | kernel.asm | mateusnbm/breakout | efbaf66a9fc6a1dfcc2b14b48f8ffd31c5747271 | [
"MIT"
] | null | null | null | org 0x7E00
xor ax, ax
mov ds, ax
jmp begin
color_aux: db 1
game_active: dw 0
game_lifes: dw 3
game_score: dw 0
plat_posx: dw 130
plat_posy: dw 190
ball_posx: dw 153
ball_posy: dw 180
ball_orienx: dw 0
ball_orieny: dw 1
display_bcd: times 35 dw 0
welcome_message: db "breakout"
gover_message: db "game over"
lclear_message: db "congrats"
display_text: times 350 dw 1
blocks_count: dw 50
blocks_active: dw 50
blocks: dw 1,10,36,10, 1,40,36,10, 1,70,36,10, 1,100,36,10, 1,130,36,10, 1,160,36,10, 1,190,36,10, 1,220,36,10, 1,250,36,10, 1,280,36,10, 1,10,44,11, 1,40,44,11, 1,70,44,11, 1,100,44,11, 1,130,44,11, 1,160,44,11, 1,190,44,11, 1,220,44,11, 1,250,44,11, 1,280,44,11, 1,10,52,12, 1,40,52,12, 1,70,52,12, 1,100,52,12, 1,130,52,12, 1,160,52,12, 1,190,52,12, 1,220,52,12, 1,250,52,12, 1,280,52,12, 1,10,60,13, 1,40,60,13, 1,70,60,13, 1,100,60,13, 1,130,60,13, 1,160,60,13, 1,190,60,13, 1,220,60,13, 1,250,60,13, 1,280,60,13, 1,10,68,14, 1,40,68,14, 1,70,68,14, 1,100,68,14, 1,130,68,14, 1,160,68,14, 1,190,68,14, 1,220,68,14, 1,250,68,14, 1,280,68,14
govideo:
mov ah, 0
mov al, 13h
int 10h
ret
paste_buffer:
push ds
xor di, di
xor si, si
mov ax, 0xa000
mov es, ax
mov ax, screen_buffer
shr ax, 4
mov ds, ax
mov cx, 16000
cld
rep movsd
pop ds
ret
clear_buffer:
mov ax, screen_buffer
shr ax, 4
mov es, ax
xor di, di
xor eax, eax
mov cx, 16000
rep stosd
ret
clear_bcd:
mov ax, 35
mov si, display_bcd
cb_loop:
or ax, ax
jz cb_end
mov word [si], 0
add si, 2
dec ax
jmp cb_loop
cb_end:
ret
;di = string address
;ax = number of chars
;si = write address
populate_text:
fill_text:
or ax, ax
jz ft_end
dec ax
ft_char_a:
cmp byte [di], "a"
jne ft_char_b
mov word [si], 0
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 1
mov word [si+34], 1
mov word [si+36], 1
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 1
mov word [si+62], 0
mov word [si+64], 0
mov word [si+66], 0
mov word [si+68], 1
jmp ft_next
ft_char_b:
cmp byte [di], "b"
jne ft_char_c
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 1
mov word [si+34], 1
mov word [si+36], 1
mov word [si+38], 0
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 1
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 0
jmp ft_next
ft_char_c:
cmp byte [di], "c"
jne ft_char_d
mov word [si], 0
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 0
mov word [si+30], 1
mov word [si+32], 0
mov word [si+34], 0
mov word [si+36], 0
mov word [si+38], 0
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 0
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 0
jmp ft_next
ft_char_d:
cmp byte [di], "d"
jne ft_char_e
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 0
mov word [si+34], 0
mov word [si+36], 0
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 1
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 0
jmp ft_next
ft_char_e:
cmp byte [di], "e"
jne ft_char_f
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 0
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 0
mov word [si+30], 1
mov word [si+32], 1
mov word [si+34], 1
mov word [si+36], 1
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 0
mov word [si+60], 1
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 1
jmp ft_next
ft_char_f:
cmp byte [di], "f"
jne ft_char_g
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 0
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 0
mov word [si+30], 1
mov word [si+32], 1
mov word [si+34], 1
mov word [si+36], 1
mov word [si+38], 0
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 0
mov word [si+60], 1
mov word [si+62], 0
mov word [si+64], 0
mov word [si+66], 0
mov word [si+68], 0
jmp ft_next
ft_char_g:
cmp byte [di], "g"
jne ft_char_h
mov word [si], 0
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 0
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 0
mov word [si+30], 1
mov word [si+32], 0
mov word [si+34], 1
mov word [si+36], 1
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 0
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 0
jmp ft_next
ft_char_h:
cmp byte [di], "h"
jne ft_char_i
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 1
mov word [si+34], 1
mov word [si+36], 1
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 1
mov word [si+62], 0
mov word [si+64], 0
mov word [si+66], 0
mov word [si+68], 1
jmp ft_next
ft_char_i:
cmp byte [di], "i"
jne ft_char_j
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 0
mov word [si+12], 0
mov word [si+14], 1
mov word [si+16], 0
mov word [si+18], 0
mov word [si+20], 0
mov word [si+22], 0
mov word [si+24], 1
mov word [si+26], 0
mov word [si+28], 0
mov word [si+30], 0
mov word [si+32], 0
mov word [si+34], 1
mov word [si+36], 0
mov word [si+38], 0
mov word [si+40], 0
mov word [si+42], 0
mov word [si+44], 1
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 0
mov word [si+52], 0
mov word [si+54], 1
mov word [si+56], 0
mov word [si+58], 0
mov word [si+60], 1
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 1
jmp ft_next
ft_char_j:
cmp byte [di], "j"
jne ft_char_k
mov word [si], 0
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 1
mov word [si+10], 0
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 0
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 0
mov word [si+32], 0
mov word [si+34], 0
mov word [si+36], 0
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 0
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 0
jmp ft_next
ft_char_k:
cmp byte [di], "k"
jne ft_char_l
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 1
mov word [si+18], 0
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 1
mov word [si+26], 0
mov word [si+28], 0
mov word [si+30], 1
mov word [si+32], 1
mov word [si+34], 0
mov word [si+36], 0
mov word [si+38], 0
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 1
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 1
mov word [si+58], 0
mov word [si+60], 1
mov word [si+62], 0
mov word [si+64], 0
mov word [si+66], 0
mov word [si+68], 1
jmp ft_next
ft_char_l:
cmp byte [di], "l"
jne ft_char_m
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 0
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 0
mov word [si+30], 1
mov word [si+32], 0
mov word [si+34], 0
mov word [si+36], 0
mov word [si+38], 0
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 0
mov word [si+60], 1
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 1
jmp ft_next
ft_char_m:
cmp byte [di], "m"
jne ft_char_n
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 1
mov word [si+14], 0
mov word [si+16], 1
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 1
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 0
mov word [si+34], 1
mov word [si+36], 0
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 1
mov word [si+62], 0
mov word [si+64], 0
mov word [si+66], 0
mov word [si+68], 1
jmp ft_next
ft_char_n:
cmp byte [di], "n"
jne ft_char_o
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 1
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 0
mov word [si+34], 1
mov word [si+36], 0
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 1
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 1
mov word [si+62], 0
mov word [si+64], 0
mov word [si+66], 0
mov word [si+68], 1
jmp ft_next
ft_char_o:
cmp byte [di], "o"
jne ft_char_p
mov word [si], 0
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 0
mov word [si+34], 0
mov word [si+36], 0
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 0
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 0
jmp ft_next
ft_char_p:
cmp byte [di], "p"
jne ft_char_q
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 1
mov word [si+34], 1
mov word [si+36], 1
mov word [si+38], 0
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 0
mov word [si+60], 1
mov word [si+62], 0
mov word [si+64], 0
mov word [si+66], 0
mov word [si+68], 0
jmp ft_next
ft_char_q:
cmp byte [di], "q"
jne ft_char_r
mov word [si], 0
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 0
mov word [si+34], 0
mov word [si+36], 0
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 1
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 1
mov word [si+58], 1
mov word [si+60], 0
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 1
jmp ft_next
ft_char_r:
cmp byte [di], "r"
jne ft_char_s
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 1
mov word [si+34], 1
mov word [si+36], 1
mov word [si+38], 0
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 1
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 1
mov word [si+58], 0
mov word [si+60], 1
mov word [si+62], 0
mov word [si+64], 0
mov word [si+66], 0
mov word [si+68], 1
jmp ft_next
ft_char_s:
cmp byte [di], "s"
jne ft_char_t
mov word [si], 0
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 0
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 0
mov word [si+30], 1
mov word [si+32], 1
mov word [si+34], 1
mov word [si+36], 1
mov word [si+38], 0
mov word [si+40], 0
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 0
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 1
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 0
jmp ft_next
ft_char_t:
cmp byte [di], "t"
jne ft_char_u
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 0
mov word [si+12], 0
mov word [si+14], 1
mov word [si+16], 0
mov word [si+18], 0
mov word [si+20], 0
mov word [si+22], 0
mov word [si+24], 1
mov word [si+26], 0
mov word [si+28], 0
mov word [si+30], 0
mov word [si+32], 0
mov word [si+34], 1
mov word [si+36], 0
mov word [si+38], 0
mov word [si+40], 0
mov word [si+42], 0
mov word [si+44], 1
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 0
mov word [si+52], 0
mov word [si+54], 1
mov word [si+56], 0
mov word [si+58], 0
mov word [si+60], 0
mov word [si+62], 0
mov word [si+64], 1
mov word [si+66], 0
mov word [si+68], 0
jmp ft_next
ft_char_u:
cmp byte [di], "u"
jne ft_char_v
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 0
mov word [si+34], 0
mov word [si+36], 0
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 0
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 0
jmp ft_next
ft_char_v:
cmp byte [di], "v"
jne ft_char_x
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 1
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 1
mov word [si+30], 1
mov word [si+32], 0
mov word [si+34], 0
mov word [si+36], 0
mov word [si+38], 1
mov word [si+40], 1
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 1
mov word [si+50], 0
mov word [si+52], 1
mov word [si+54], 0
mov word [si+56], 1
mov word [si+58], 0
mov word [si+60], 0
mov word [si+62], 0
mov word [si+64], 1
mov word [si+66], 0
mov word [si+68], 0
jmp ft_next
ft_char_x:
cmp byte [di], "x"
jne ft_char_y
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 0
mov word [si+22], 1
mov word [si+24], 0
mov word [si+26], 1
mov word [si+28], 0
mov word [si+30], 0
mov word [si+32], 0
mov word [si+34], 1
mov word [si+36], 0
mov word [si+38], 0
mov word [si+40], 0
mov word [si+42], 1
mov word [si+44], 0
mov word [si+46], 1
mov word [si+48], 0
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 1
mov word [si+60], 1
mov word [si+62], 0
mov word [si+64], 0
mov word [si+66], 0
mov word [si+68], 1
jmp ft_next
ft_char_y:
cmp byte [di], "y"
jne ft_char_z
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 0
mov word [si+22], 1
mov word [si+24], 0
mov word [si+26], 1
mov word [si+28], 0
mov word [si+30], 0
mov word [si+32], 0
mov word [si+34], 1
mov word [si+36], 0
mov word [si+38], 0
mov word [si+40], 0
mov word [si+42], 0
mov word [si+44], 1
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 0
mov word [si+52], 0
mov word [si+54], 1
mov word [si+56], 0
mov word [si+58], 0
mov word [si+60], 0
mov word [si+62], 0
mov word [si+64], 1
mov word [si+66], 0
mov word [si+68], 0
jmp ft_next
ft_char_z:
cmp byte [di], "z"
jne ft_char_space
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 0
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 1
mov word [si+20], 0
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 1
mov word [si+28], 0
mov word [si+30], 0
mov word [si+32], 0
mov word [si+34], 1
mov word [si+36], 0
mov word [si+38], 0
mov word [si+40], 0
mov word [si+42], 1
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 1
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 0
mov word [si+60], 1
mov word [si+62], 1
mov word [si+64], 1
mov word [si+66], 1
mov word [si+68], 1
jmp ft_next
;
;
ft_char_space:
cmp byte [di], 32
jne ft_next
mov word [si], 0
mov word [si+2], 0
mov word [si+4], 0
mov word [si+6], 0
mov word [si+8], 0
mov word [si+10], 0
mov word [si+12], 0
mov word [si+14], 0
mov word [si+16], 0
mov word [si+18], 0
mov word [si+20], 0
mov word [si+22], 0
mov word [si+24], 0
mov word [si+26], 0
mov word [si+28], 0
mov word [si+30], 0
mov word [si+32], 0
mov word [si+34], 0
mov word [si+36], 0
mov word [si+38], 0
mov word [si+40], 0
mov word [si+42], 0
mov word [si+44], 0
mov word [si+46], 0
mov word [si+48], 0
mov word [si+50], 0
mov word [si+52], 0
mov word [si+54], 0
mov word [si+56], 0
mov word [si+58], 0
mov word [si+60], 0
mov word [si+62], 0
mov word [si+64], 0
mov word [si+66], 0
mov word [si+68], 0
ft_next:
inc di
add si, 70
jmp fill_text
ft_end:
ret
;si = bcd address
;ax = number
;cx = 0
populate_bcd:
cmp ax, 0
jne pb_counter
inc cx
xor dx, dx
push dx
jmp fill_bcd
pb_counter:
cmp ax, 0
je fill_bcd
xor dx, dx
mov bx, 10
div bx
push dx
inc cx
jmp pb_counter
fill_bcd:
cmp cx, 0
je fill_end
dec cx
pop dx
fb_num_0:
cmp dx, 0
jne fb_num_1
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 0
jmp fb_next
fb_num_1:
cmp dx, 1
jne fb_num_2
mov word [si], 0
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 0
mov word [si+8], 0
mov word [si+10], 0
mov word [si+12], 0
jmp fb_next
fb_num_2:
cmp dx, 2
jne fb_num_3
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 0
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 0
mov word [si+12], 1
jmp fb_next
fb_num_3:
cmp dx, 3
jne fb_num_4
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 0
mov word [si+12], 1
jmp fb_next
fb_num_4:
cmp dx, 4
jne fb_num_5
mov word [si], 0
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 0
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 1
jmp fb_next
fb_num_5:
cmp dx, 5
jne fb_num_6
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 1
jmp fb_next
fb_num_6:
cmp dx, 6
jne fb_num_7
mov word [si], 1
mov word [si+2], 0
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 1
jmp fb_next
fb_num_7:
cmp dx, 7
jne fb_num_8
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 0
mov word [si+8], 0
mov word [si+10], 0
mov word [si+12], 0
jmp fb_next
fb_num_8:
cmp dx, 8
jne fb_num_9
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 1
mov word [si+10], 1
mov word [si+12], 1
jmp fb_next
fb_num_9:
mov word [si], 1
mov word [si+2], 1
mov word [si+4], 1
mov word [si+6], 1
mov word [si+8], 0
mov word [si+10], 1
mov word [si+12], 1
fb_next:
add si, 14
jmp fill_bcd
fill_end:
ret
;es = address to write
;di = offset
;ax = posx
;bx = posy
;cx = width
;dx = height
;si = color
draw_rectangle:
;push bx
;add bx, dx
;cmp bx, 320
;pop bx
;ja drec_end
push ax
mov ax, bx
shl ax, 6
shl bx, 8
add bx, ax
pop ax
add ax, bx
mov di, ax
mov ax, si
drec_y:
cmp dx, 0
je drec_end
dec dx
push cx
cld
rep stosb
pop cx
sub di, cx
add di, 320
jmp drec_y
drec_end:
ret
;si = address
;ax = posx
;bx = posy
;dx = qnt letters
;di = color
draw_text:
dc_singles:
or dx, dx
jz dc_end
dec dx
push bx
mov cx, 6
push cx
mov cx, 5
dc_lines:
or cx, cx
jz dc_back_line
dec cx
cmp word [si], 0
je dc_next_square
pusha
mov cx, screen_buffer
shr cx, 4
mov es, cx
mov cx, 2
mov dx, 2
mov si, di
call draw_rectangle
popa
dc_next_square:
add si, 2
add ax, 3
jmp dc_lines
dc_back_line:
pop cx
or cx, cx
jz dc_new_single
dec cx
push cx
mov cx, 5
sub ax, 15
add bx, 3
jmp dc_lines
dc_new_single:
pop bx
add ax, 2
jmp dc_singles
dc_end:
ret
;si = address
;ax = posx
;bx = posy
;dx = qnt numbers
draw_bcd:
db_singles:
or dx, dx
jz db_end
dec dx
db_seg_1:
mov cx, [si]
add si, 2
or cx, cx
jz db_seg_2
pusha
mov cx, screen_buffer
shr cx, 4
mov es, cx
mov cx, 5
mov dx, 2
mov si, 15
call draw_rectangle
popa
db_seg_2:
mov cx, [si]
add si, 2
or cx, cx
jz db_seg_3
pusha
add ax, 3
mov cx, screen_buffer
shr cx, 4
mov es, cx
mov cx, 2
mov dx, 5
mov si, 15
call draw_rectangle
popa
db_seg_3:
mov cx, [si]
add si, 2
or cx, cx
jz db_seg_4
pusha
add ax, 3
add bx, 5
mov cx, screen_buffer
shr cx, 4
mov es, cx
mov cx, 2
mov dx, 5
mov si, 15
call draw_rectangle
popa
db_seg_4:
mov cx, [si]
add si, 2
or cx, cx
jz db_seg_5
pusha
add bx, 8
mov cx, screen_buffer
shr cx, 4
mov es, cx
mov cx, 5
mov dx, 2
mov si, 15
call draw_rectangle
popa
db_seg_5:
mov cx, [si]
add si, 2
or cx, cx
jz db_seg_6
pusha
add bx, 5
mov cx, screen_buffer
shr cx, 4
mov es, cx
mov cx, 2
mov dx, 5
mov si, 15
call draw_rectangle
popa
db_seg_6:
mov cx, [si]
add si, 2
or cx, cx
jz db_seg_7
pusha
mov cx, screen_buffer
shr cx, 4
mov es, cx
mov cx, 2
mov dx, 5
mov si, 15
call draw_rectangle
popa
db_seg_7:
mov cx, [si]
add si, 2
or cx, cx
jz db_next
pusha
add bx, 4
mov cx, screen_buffer
shr cx, 4
mov es, cx
mov cx, 5
mov dx, 2
mov si, 15
call draw_rectangle
popa
db_next:
add ax, 7
jmp db_singles
db_end:
ret
;ax = qnt blocks
;si = address
blocks_reset:
cmp ax, 0
je br_end
dec ax
mov word [si], 1
add si, 8
jmp blocks_reset
br_end:
ret
;ax = qnt blocks
;di = address
draw_tiles:
dt_loop:
cmp ax, 0
je dt_end
dec ax
cmp word [di], 0
je dt_next
push ax
push di
mov ax, screen_buffer
shr ax, 4
mov es, ax
mov ax, [di+2]
mov bx, [di+4]
mov cx, 30
mov dx, 8
mov si, [di+6]
call draw_rectangle
pop di
pop ax
dt_next:
add di, 8
jmp dt_loop
dt_end:
ret
;ax = qnt blocks
;si = blocks address
blocks_hit:
cmp ax, 0
je bh_end
dec ax
cmp word [si], 0
je bh_next
push ax
push si
bh_bottom:
mov ax, [si+4]
add ax, 8
cmp ax, [ball_posy]
jne bh_top
mov ax, [ball_posx]
add ax, 6
cmp ax, [si+2]
jnae bh_top
sub ax, 6
mov bx, [si+2]
add bx, 30
cmp ax, bx
jnbe bh_top
mov word [si], 0
mov word [ball_orieny], 0
add word [game_score], 10
jmp bh_hitten
bh_top:
mov ax, [ball_posy]
add ax, 6
cmp [si+4], ax
jne bh_left
mov ax, [ball_posx]
add ax, 6
cmp ax, [si+2]
jnae bh_left
sub ax, 6
mov bx, [si+2]
add bx, 30
cmp ax, bx
jnbe bh_left
mov word [si], 0
mov word [ball_orieny], 1
add word [game_score], 10
jmp bh_hitten
bh_left:
mov ax, [ball_posx]
add ax, 6
cmp ax, [si+2]
jne bh_right
mov ax, [si+4]
mov bx, [ball_posy]
add bx, 6
cmp bx, ax
jnae bh_right
mov ax, [ball_posy]
mov bx, [si+4]
add bx, 8
cmp ax, bx
jnbe bh_right
mov word [si], 0
mov word [ball_orienx], 1
add word [game_score], 10
jmp bh_hitten
bh_right:
mov ax, [ball_posx]
mov bx, [si+2]
add bx, 30
cmp ax, bx
jne bh_pops
mov ax, [si+4]
mov bx, [ball_posy]
add bx, 6
cmp bx, ax
jnae bh_pops
mov ax, [ball_posy]
mov bx, [si+4]
add bx, 8
cmp ax, bx
jnbe bh_pops
mov word [si], 0
mov word [ball_orienx], 0
add word [game_score], 10
jmp bh_hitten
bh_pops:
pop si
pop ax
bh_next:
add si, 8
jmp blocks_hit
bh_hitten:
pop si
pop ax
dec word [blocks_active]
bh_end:
ret
welcome:
mov ah, 1
int 16h
jz wl_draw
mov ah, 0
int 16h
cmp al, 13
je wl_start
wl_draw:
mov di, welcome_message
mov ax, 8
mov si, display_text
call populate_text
inc byte [color_aux]
mov si, display_text
mov ax, 95
mov bx, 90
xor cx, cx
mov dx, 8
mov di, [color_aux]
call draw_text
call paste_buffer
call clear_buffer
jmp welcome
wl_start:
mov word [game_score], 0
mov word [game_lifes], 3
mov word [plat_posx], 130
mov word [plat_posy], 190
mov word [ball_posx], 153
mov word [ball_posy], 180
mov ax, [blocks_count]
mov word [blocks_active], ax
mov si, blocks
call blocks_reset
jmp gameloop
gameover:
mov ah, 1
int 16h
jz go_draw
mov ah, 0
int 16h
cmp al, 13
je wl_start
go_draw:
mov di, gover_message
mov ax, 9
mov si, display_text
call populate_text
mov si, display_text
mov ax, 95
mov bx, 90
xor cx, cx
mov dx, 9
mov di, 4
call draw_text
call paste_buffer
call clear_buffer
jmp gameover
nextlevel:
mov ah, 1
int 16h
jz nl_draw
mov ah, 0
int 16h
cmp al, 13
je nl_prepare
nl_draw:
mov di, lclear_message
mov ax, 8
mov si, display_text
call populate_text
;
mov si, display_text
mov ax, 95
mov bx, 90
xor cx, cx
mov dx, 8
mov di, 1
call draw_text
call paste_buffer
call clear_buffer
jmp nextlevel
nl_prepare:
;
jmp gameloop
begin:
call govideo
call welcome
gameloop:
keyboard:
mov ah, 1
int 16h
jz move_ball
mov ah, 0
int 16h
plat_left:
cmp al, 'a'
jne plat_right
mov ax, 10
cmp [plat_posx], ax
jl game_init
sub word [plat_posx], 8
jmp move_ball
plat_right:
cmp al, 'd'
jne game_init
mov ax, [plat_posx]
add ax, 50
cmp ax, 310
ja game_init
add word [plat_posx], 8
jmp move_ball
game_init:
cmp al, 'w'
jne move_ball
inc word [game_active]
jmp move_ball
move_ball:
cmp word [game_active], 0
jna gl_draw
hit_plat_top:
mov ax, [ball_posy]
add ax, 6
cmp ax, [plat_posy]
jne hit_plat_left
mov ax, [ball_posx]
add ax, 6
cmp ax, [plat_posx]
jl hit_plat_left
inc word [game_score]
mov ax, [plat_posx]
add ax, 50
cmp word [ball_posx], ax
ja hit_plat_left
mov word [ball_orieny], 1
jmp hit_block
hit_plat_left:
mov ax, [ball_posy]
mov bx, ax
mov cx, [plat_posy]
add bx, 6
cmp bx, cx
jl hit_block
add cx, 5
cmp ax, cx
ja hit_block
mov ax, [ball_posx]
add ax, 6
cmp ax, [plat_posx]
jne hit_plat_right
mov word [ball_orienx], 1
jmp hit_block
hit_plat_right:
mov ax, [ball_posx]
mov bx, [plat_posx]
add bx, 50
cmp ax, bx
jne hit_block
mov word [ball_orienx], 0
jmp hit_block
hit_block:
mov ax, [blocks_count]
mov si, blocks
call blocks_hit
cmp word [blocks_active], 0
jne hit_bounds_left
mov word [game_active], 0
add word [game_score], 50
mov word [ball_posx], 153
mov word [ball_orienx], 0
mov word [ball_orieny], 1
mov word [plat_posx], 130
sub word [plat_posy], 10
mov ax, [plat_posy]
sub ax, 10
mov word [ball_posy], ax
mov ax, [blocks_count]
mov word [blocks_active], ax
mov si, blocks
call blocks_reset
jmp nextlevel
hit_bounds_left:
cmp word [ball_posx], 10
jne hit_bounds_right
cmp word [ball_orienx], 0
je hl_neg
mov word [ball_orienx], 0
jmp sums_ball
hl_neg:
mov word [ball_orienx], 1
jmp sums_ball
hit_bounds_right:
cmp word [ball_posx], 305
jne hit_bounds_top
cmp word [ball_orienx], 0
je hr_neg
mov word [ball_orienx], 0
jmp sums_ball
hr_neg:
mov word [ball_orienx], 1
jmp sums_ball
hit_bounds_top:
cmp word [ball_posy], 14
jne hit_bounds_bottom
cmp word [ball_orieny], 0
je ht_neg
mov word [ball_orieny], 0
jmp sums_ball
ht_neg:
mov word [ball_orieny], 1
jmp sums_ball
hit_bounds_bottom:
cmp word [ball_posy], 195
jne sums_ball
mov word [game_active], 0
mov word [ball_posx], 153
mov ax, [plat_posy]
sub ax, 10
mov word [ball_posy], ax
mov word [ball_orienx], 0
mov word [ball_orieny], 1
dec word [game_lifes]
cmp word [game_lifes], 0
je gameover
sums_ball:
orient_x:
cmp word [ball_orienx], 0
je positive_x
dec word [ball_posx]
jmp orient_y
positive_x:
inc word [ball_posx]
orient_y:
cmp word [ball_orieny], 0
je positive_y
dec word [ball_posy]
jmp gl_draw
positive_y:
inc word [ball_posy]
jmp gl_draw
gl_draw:
mov ax, [blocks_count]
mov di, blocks
call draw_tiles
;
mov ax, screen_buffer
shr ax, 4
mov es, ax
mov ax, 0
mov bx, 0
mov cx, 320
mov dx, 14
mov si, 8
call draw_rectangle
;
mov ax, screen_buffer
shr ax, 4
mov es, ax
mov ax, 0
mov bx, 14
mov cx, 10
mov dx, 186
mov si, 8
call draw_rectangle
;
mov ax, screen_buffer
shr ax, 4
mov es, ax
mov ax, 310
mov bx, 14
mov cx, 10
mov dx, 186
mov si, 8
call draw_rectangle
;
mov ax, screen_buffer
shr ax, 4
mov es, ax
mov ax, [plat_posx]
mov bx, [plat_posy]
mov cx, 50
mov dx, 5
mov si, 7
call draw_rectangle
;
mov ax, screen_buffer
shr ax, 4
mov es, ax
mov ax, [ball_posx]
mov bx, [ball_posy]
mov cx, 6
mov dx, 6
mov si, 9
call draw_rectangle
;
mov si, display_bcd
mov ax, [game_score]
xor cx, cx
call populate_bcd
mov si, display_bcd
mov ax, 10
mov bx, 2
mov dx, 5
call draw_bcd
call clear_bcd
;
mov si, display_bcd
mov ax, [game_lifes]
xor cx, cx
call populate_bcd
mov si, display_bcd
mov ax, 305
mov bx, 2
mov dx, 1
call draw_bcd
call clear_bcd
;
call paste_buffer
call clear_buffer
jmp gameloop
terminate:
times 8192-($-$$) db 0
screen_buffer: times 64000 db 0
| 18.8814 | 645 | 0.578931 |
653fd19711b07d74c16fe87ae668553de7048142 | 697 | asm | Assembly | oeis/021/A021049.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/021/A021049.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/021/A021049.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A021049: Expansion of 1/((1-x)(1-2x)(1-3x)(1-10x)).
; Submitted by Jon Maiga
; 1,16,185,1940,19701,197976,1982785,19837180,198400301,1984089536,19841156985,198412358820,1984125963301,19841266774696,198412689204785,1984126956486860,19841269758316701,198412698163773456,1984126983380078185,19841269839028861300,198412698405974948501,1984126984106812685816,19841269841209324849185,198412698412516859242140,1984126984126439458226701,19841269841268207246791776,198412698412693510595709785,1984126984126969420608909380,19841269841269797150581399301,198412698412698280340364651336
lpb $0
mov $2,$0
sub $0,1
seq $2,16279 ; Expansion of 1/((1-2x)(1-3x)(1-10x)).
add $1,$2
lpe
add $1,1
mov $0,$1
| 53.615385 | 496 | 0.829268 |
9cb283bb3f570cc779cc0bdae6e178a1efcc9a79 | 619 | asm | Assembly | oeis/244/A244802.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/244/A244802.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/244/A244802.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A244802: The 60 degree spoke (or ray) of a hexagonal spiral of Ulam.
; 1,10,43,100,181,286,415,568,745,946,1171,1420,1693,1990,2311,2656,3025,3418,3835,4276,4741,5230,5743,6280,6841,7426,8035,8668,9325,10006,10711,11440,12193,12970,13771,14596,15445,16318,17215,18136,19081,20050,21043,22060,23101,24166,25255,26368,27505,28666,29851,31060,32293,33550,34831,36136,37465,38818,40195,41596,43021,44470,45943,47440,48961,50506,52075,53668,55285,56926,58591,60280,61993,63730,65491,67276,69085,70918,72775,74656,76561,78490,80443,82420,84421,86446,88495,90568,92665,94786
mov $1,$0
mul $1,12
sub $1,3
mul $0,$1
add $0,1
| 68.777778 | 498 | 0.783522 |
3d1a5d3cf1696fa6b9100913da9fef479be32782 | 1,761 | asm | Assembly | programs/oeis/111/A111927.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/111/A111927.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/111/A111927.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A111927: Expansion of x^3 / ((x-1)*(2*x-1)*(x^2-x+1)).
; 0,0,0,1,4,10,21,42,84,169,340,682,1365,2730,5460,10921,21844,43690,87381,174762,349524,699049,1398100,2796202,5592405,11184810,22369620,44739241,89478484,178956970,357913941,715827882,1431655764,2863311529,5726623060,11453246122,22906492245,45812984490,91625968980,183251937961,366503875924,733007751850,1466015503701,2932031007402,5864062014804,11728124029609,23456248059220,46912496118442,93824992236885,187649984473770,375299968947540,750599937895081,1501199875790164,3002399751580330,6004799503160661,12009599006321322,24019198012642644,48038396025285289,96076792050570580,192153584101141162,384307168202282325,768614336404564650,1537228672809129300,3074457345618258601,6148914691236517204,12297829382473034410,24595658764946068821,49191317529892137642,98382635059784275284,196765270119568550569,393530540239137101140,787061080478274202282,1574122160956548404565,3148244321913096809130,6296488643826193618260,12592977287652387236521,25185954575304774473044,50371909150609548946090,100743818301219097892181,201487636602438195784362,402975273204876391568724,805950546409752783137449,1611901092819505566274900,3223802185639011132549802,6447604371278022265099605,12895208742556044530199210,25790417485112089060398420,51580834970224178120796841,103161669940448356241593684,206323339880896712483187370,412646679761793424966374741,825293359523586849932749482,1650586719047173699865498964,3301173438094347399730997929,6602346876188694799461995860,13204693752377389598923991722,26409387504754779197847983445,52818775009509558395695966890,105637550019019116791391933780,211275100038038233582783867561
mov $1,1
mov $3,1
lpb $0
sub $0,1
add $2,$1
add $1,$3
sub $1,$2
mul $3,2
lpe
sub $1,1
mov $0,$1
| 117.4 | 1,596 | 0.894946 |
685298aa2246590650e7a41288a4e295f5a48de8 | 470 | asm | Assembly | ch09/32 bit/Ucase.asm | William0Friend/my_masm | e8073266c03c01424ad84b9ed9cf13e9da1eabb1 | [
"Apache-2.0"
] | null | null | null | ch09/32 bit/Ucase.asm | William0Friend/my_masm | e8073266c03c01424ad84b9ed9cf13e9da1eabb1 | [
"Apache-2.0"
] | null | null | null | ch09/32 bit/Ucase.asm | William0Friend/my_masm | e8073266c03c01424ad84b9ed9cf13e9da1eabb1 | [
"Apache-2.0"
] | null | null | null | ; Upper Case Conversion (Ucase.asm)
; This program tests the Str_ucase procedure, which converts
; the letters in a string to uppercase.
INCLUDE Irvine32.inc
Str_ucase PROTO,
pString:PTR BYTE
.data
string_1 BYTE "abcdef",0
string_2 BYTE "aB234cdEfg",0
string_3 BYTE 0
.code
main PROC
call Clrscr
INVOKE Str_ucase,ADDR string_1
INVOKE Str_ucase,ADDR string_2
INVOKE Str_ucase,ADDR string_3
exit
main ENDP
END main | 17.407407 | 62 | 0.710638 |
08358d660ff510fc4e9d216742f1aaaea51be189 | 3,286 | asm | Assembly | lib/target/coleco/classic/rom.asm | ahjelm/z88dk | c4de367f39a76b41f6390ceeab77737e148178fa | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | lib/target/coleco/classic/rom.asm | ahjelm/z88dk | c4de367f39a76b41f6390ceeab77737e148178fa | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | lib/target/coleco/classic/rom.asm | ahjelm/z88dk | c4de367f39a76b41f6390ceeab77737e148178fa | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ;
; Startup for Colecovision
;
; 1k of memory
EXTERN msx_set_mode
EXTERN asm_im1_handler
EXTERN nmi_vectors
EXTERN asm_interrupt_handler
defc CRT_ORG_BSS = 0x7000
defc CRT_ORG_CODE = 0x8000
defc TAR__fputc_cons_generic = 1
defc TAR__no_ansifont = 1
defc TAR__clib_exit_stack_size = 0
defc TAR__register_sp = 0x7400
defc CRT_KEY_DEL = 127
INCLUDE "crt/classic/crt_rules.inc"
org CRT_ORG_CODE
defb 0x55, 0xaa ;Title screen + 12 second delay, swap to not skip it
defw 0 ;Sprite name table for BIOS
defw 0 ;Sprite order table for BIOS
defw 0 ;Buffer for BIOS
defw 0 ;Controller map for bios
defw program ;Where to start execution from
IF ((__crt_enable_rst & $0202) = $0002)
EXTERN _z80_rst_08h
jp _z80_rst_08h
ELSE
jp restart_ret
ENDIF
IF ((__crt_enable_rst & $0404) = $0004)
EXTERN _z80_rst_10h
jp _z80_rst_10h
ELSE
jp restart_ret
ENDIF
IF ((__crt_enable_rst & $0808) = $0008)
EXTERN _z80_rst_18h
jp _z80_rst_18h
ELSE
jp restart_ret
ENDIF
IF ((__crt_enable_rst & $1010) = $0010)
EXTERN _z80_rst_20h
jp _z80_rst_20h
ELSE
jp restart_ret
ENDIF
IF ((__crt_enable_rst & $2020) = $0020)
EXTERN _z80_rst_28h
jp _z80_rst_28h
ELSE
jp restart_ret
ENDIF
IF ((__crt_enable_rst & $4040) = $0040)
EXTERN _z80_rst_30h
jp _z80_rst_30h
ELSE
jp restart_ret
ENDIF
IF ((__crt_enable_rst & $8080) = $0080)
EXTERN _z80_rst_38h
jp _z80_rst_38h
ELSE
jp asm_im1_handler ;Maskable interrupt
ENDIF
IF (__crt_enable_nmi > 1)
EXTERN _z80_nmi
jp _z80_nmi
ELSE
jp nmi_int ;NMI
ENDIF
defm " / / " ;TODO: Make it customisable
; Restart routines, nothing sorted yet
restart_ret:
ret
program:
INCLUDE "crt/classic/crt_init_sp.asm"
INCLUDE "crt/classic/crt_init_atexit.asm"
call crt0_init_bss
ld (exitsp),sp
ld hl,2
call msx_set_mode
im 1
ei
; Optional definition for auto MALLOC init
; it assumes we have free space between the end of
; the compiled program and the stack pointer
IF DEFINED_USING_amalloc
INCLUDE "crt/classic/crt_init_amalloc.asm"
ENDIF
call _main
cleanup:
rst 0 ;Restart when main finishes
IF (__crt_enable_nmi <= 1)
nmi_int:
push af
push hl
ld a,(__vdp_enable_status)
rlca
jr c,no_vbl
in a,(VDP_STATUS)
ld (__tms9918_status_register),a
no_vbl:
ld hl,nmi_vectors
call asm_interrupt_handler
pop hl
pop af
retn
ENDIF
; Safe BIOS call
msxbios:
push ix
ret
l_dcal:
jp (hl) ;Used for function pointer calls
INCLUDE "crt/classic/crt_runtime_selection.asm"
defc __crt_org_bss = CRT_ORG_BSS
IF DEFINED_CRT_MODEL
defc __crt_model = CRT_MODEL
ELSE
defc __crt_model = 1
ENDIF
INCLUDE "crt/classic/crt_section.asm"
| 22.979021 | 82 | 0.602861 |
9c3df403229798a9721459a1fd5abadeeac3e6b6 | 553 | asm | Assembly | oeis/017/A017296.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/017/A017296.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/017/A017296.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A017296: a(n) = (10*n + 2)^4.
; 16,20736,234256,1048576,3111696,7311616,14776336,26873856,45212176,71639296,108243216,157351936,221533456,303595776,406586896,533794816,688747536,875213056,1097199376,1358954496,1664966416,2019963136,2428912656,2897022976,3429742096,4032758016,4711998736,5473632256,6324066576,7269949696,8318169616,9475854336,10750371856,12149330176,13680577296,15352201216,17172529936,19150131456,21293813776,23612624896,26115852816,28813025536,31713911056,34828517376,38167092496,41740124416,45558341136
mul $0,10
add $0,2
pow $0,4
| 79 | 491 | 0.855335 |
d3f227f603b954acbaa01f98712f12a24d66bc39 | 381 | asm | Assembly | oeis/090/A090439.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/090/A090439.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/090/A090439.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A090439: Alternating row sums of array A090438 ((4,2)-Stirling2).
; Submitted by Christian Krause
; 1,5,37,-887,-168919,-21607859,-2799384755,-337767590383,-11912361112367,21032925955607701,16703816669710968821,10654267957172226744985,6614425802684094455696377,4120103872599589439389105373
mul $0,2
seq $0,62197 ; Row sums of signed triangle A062139 (generalized a=2 Laguerre).
| 54.428571 | 191 | 0.816273 |
3e78f05ae768380523645a2d1ff816125a1dfa24 | 1,989 | asm | Assembly | programs/oeis/054/A054447.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/054/A054447.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/054/A054447.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A054447: Row sums of triangle A054446 (partial row sums triangle of Fibonacci convolution triangle).
; 1,3,9,26,73,201,545,1460,3873,10191,26633,69198,178889,460437,1180545,3016552,7684481,19522203,49473097,125093506,315654537,795016545,1998909985,5017895196,12578040097,31485713511,78716283081,196563649718,490301138569,1221726409005,3041332476929,7564108885712,18796563814401,46670981169459,115793029029257,287079789634794,711252611988425,1761007771397625,4357413674045217,10775548915797124,26632084617519137,65786578170903807,162422534111343241,400813092717691678,988628905346945865,2437412721336123333,6006718169668491649,14796718521896244792,36435157957556556673,89682909386423647179,220667729373328004553,542767748368342252370,1334568739223461854985,3280385633277427249809,8060666331816088275233,19800851355447308929004,48625961485823888311329,119379092271859155036567,293000374362183519532361,718938615606272905881990,1763611383127464076005641,4325187711576717259092573,10604773243264665741298689,25995333401789099237105056,63707424891192732353446913,156094752076557350715290211,382378051673422875464548105,936497669574016771776719290,2293148141751799200963173193,5613990269088914407725771561,13741296062882569266405314593,33628113476771234674540303188,82280752563212343333484324129,201287608778687712511509660207,492335180018358655414503465225,1204014378786438588626516940782,2943955967431073850297537867721,7197166783299295889767594068213,17592362503170922848554729309057,42995278197574365624867060688136,105063764683327359392990869993857,256697885542177719038242847294715,627090537508587772018966677129545,1531716042019111846802550473265186,3740827786207233607626306279628937,9134819025214181929786014616172481,22303665822857225344662277335241761,54449998054152491241769304516841148,132912556683831552950982298652562209,324400748310378146011955461619427015,791674221834382287834117753769977289
seq $0,291264 ; p-INVERT of (0,1,0,1,0,1,...), where p(S) = (1 - 2 S)^2.
div $0,4
| 331.5 | 1,802 | 0.922071 |
056a7ac42544e8aa3db3825dbf35119c4831ece1 | 695 | asm | Assembly | oeis/052/A052939.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/052/A052939.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/052/A052939.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A052939: Expansion of (1-x)*(1+x)/(1-3*x-x^2+2*x^3).
; Submitted by Jamie Morken(s1)
; 1,3,9,28,87,271,844,2629,8189,25508,79455,247495,770924,2401357,7480005,23299524,72575863,226067103,704178124,2193449749,6832393165,21282272996,66292312655,206494424631,643211040556,2003542920989,6240850954261,19439673702660,60552786220263,188616330454927,587522430179724,1830078048553573,5700523914930589,17756604932985892,55310182616781119,172286104953468071,536655287611213548,1671631602553546477,5206977885364916837,16219254683425869892,50521478730535433559,157369735104302336895
mul $0,2
mov $1,1
lpb $0
sub $0,2
add $2,$1
mul $1,2
add $1,$2
mov $4,$3
mov $3,$2
mov $2,$4
lpe
mov $0,$1
| 40.882353 | 485 | 0.795683 |
0a4a895d1b02feb09f6a03c7f92706fa565fe17d | 481 | asm | Assembly | data/mapObjects/CeladonDiner.asm | AmateurPanda92/pokemon-rby-dx | f7ba1cc50b22d93ed176571e074a52d73360da93 | [
"MIT"
] | 9 | 2020-07-12T19:44:21.000Z | 2022-03-03T23:32:40.000Z | data/mapObjects/CeladonDiner.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 7 | 2020-07-16T10:48:52.000Z | 2021-01-28T18:32:02.000Z | data/mapObjects/CeladonDiner.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 2 | 2021-03-28T18:33:43.000Z | 2021-05-06T13:12:09.000Z | CeladonDiner_Object:
db $f ; border block
db 2 ; warps
warp 3, 7, 10, -1
warp 4, 7, 10, -1
db 0 ; signs
db 5 ; objects
object SPRITE_COOK, 8, 5, WALK, 2, 1 ; person
object SPRITE_MOM_GEISHA, 7, 2, STAY, NONE, 2 ; person
object SPRITE_FAT_BALD_GUY, 1, 4, STAY, DOWN, 3 ; person
object SPRITE_FISHER2, 5, 3, STAY, RIGHT, 4 ; person
object SPRITE_GYM_HELPER, 0, 1, STAY, DOWN, 5 ; person
; warp-to
warp_to 3, 7, CELADON_DINER_WIDTH
warp_to 4, 7, CELADON_DINER_WIDTH
| 24.05 | 57 | 0.686071 |
203f4d24ebf1d989a66bdd4c64604d3fbcfd6e14 | 7,201 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca_notsx.log_21829_1909.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_notsx.log_21829_1909.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_notsx.log_21829_1909.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 %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xf33c, %r15
nop
nop
nop
nop
sub %r11, %r11
movups (%r15), %xmm5
vpextrq $1, %xmm5, %rbp
nop
cmp $60187, %rbp
lea addresses_UC_ht+0x956c, %rax
and $13289, %rcx
mov $0x6162636465666768, %rdx
movq %rdx, %xmm7
vmovups %ymm7, (%rax)
nop
nop
and $37564, %rax
lea addresses_WC_ht+0x6992, %rsi
lea addresses_WT_ht+0x45ec, %rdi
clflush (%rsi)
nop
nop
inc %rbp
mov $50, %rcx
rep movsq
nop
nop
add %rax, %rax
lea addresses_WT_ht+0x184ec, %r11
nop
dec %rsi
movb (%r11), %al
nop
sub %r15, %r15
lea addresses_D_ht+0x2cb4, %rax
and %rsi, %rsi
movb $0x61, (%rax)
nop
nop
nop
nop
nop
inc %rdi
lea addresses_D_ht+0xa1ec, %rsi
lea addresses_WC_ht+0x151d2, %rdi
nop
nop
nop
nop
cmp $55577, %r15
mov $15, %rcx
rep movsq
nop
nop
nop
nop
add $54031, %rsi
lea addresses_WT_ht+0x1bc6c, %rdx
nop
nop
nop
nop
nop
sub %rax, %rax
mov (%rdx), %si
nop
nop
inc %rdi
lea addresses_UC_ht+0x4cfc, %rsi
lea addresses_A_ht+0x169c, %rdi
nop
nop
nop
add $4512, %r15
mov $23, %rcx
rep movsq
inc %rbp
lea addresses_normal_ht+0x4aec, %r15
nop
nop
nop
nop
nop
inc %rax
vmovups (%r15), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %rbp
nop
nop
nop
inc %rbp
lea addresses_normal_ht+0xbe6c, %rsi
lea addresses_normal_ht+0x13e6c, %rdi
nop
nop
nop
nop
nop
add %r15, %r15
mov $69, %rcx
rep movsb
nop
nop
nop
and $31545, %r15
lea addresses_normal_ht+0xdb98, %rax
nop
nop
nop
xor %rsi, %rsi
movb $0x61, (%rax)
nop
nop
nop
cmp $38571, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %rax
push %rbp
push %rdx
push %rsi
// Store
mov $0xfec, %rsi
add $61268, %rax
movw $0x5152, (%rsi)
nop
nop
add $5834, %rax
// Store
lea addresses_D+0x20ec, %rsi
nop
nop
nop
and $8179, %r13
movb $0x51, (%rsi)
nop
nop
nop
inc %r15
// Faulty Load
lea addresses_A+0x92ec, %r15
cmp %r10, %r10
mov (%r15), %rdx
lea oracles, %rax
and $0xff, %rdx
shlq $12, %rdx
mov (%rax,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rbp
pop %rax
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4, 'same': False, 'type': 'addresses_P'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 8, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_A'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'same': True, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 34.78744 | 2,999 | 0.656575 |
dd142f7147c9f6ed4c9be5842a83512e416be218 | 1,077 | asm | Assembly | programs/oeis/132/A132078.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/132/A132078.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/132/A132078.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A132078: Multiply previous term by 6 and reverse.
; 1,6,63,873,8325,5994,46953,817182,2903094,46581471,628884972,2389033773,83620243341,640064127105,362674830483,8982898406712,27204409379835,10972654622361,66143772953856,631327736268693,8512167146697873,83278108820037015,90222029256866994,469102145571233145,788937243782164182,2905892962643263374,44208595857775353471,628021256641575152562,2735190549489357218673,83021334163969234111461,667866404518389400821894,4631394046330117248917004,42020539430708977246388772,236233874368352485632321252,2157293973194110126423047141,64828283585706646193836734921,625904020361778932415107969883,8929187460944953760712214245573,83437458237246522796656742157535,12549254049977631974324947426005,3065548694954819756899242559257,24555355459314581982796129239381,682634577677698194788557231233741,6442047833431378619816606647085904,42451528893699881717288500078225683,890453964000137303092991263371907452
mov $1,6
lpb $0
sub $0,1
seq $1,4086 ; Read n backwards (referred to as R(n) in many sequences).
mul $1,6
lpe
div $1,6
mov $0,$1
| 89.75 | 888 | 0.895079 |
b403213900710d8cac914f88fead05106077a66f | 2,289 | asm | Assembly | programs/oeis/334/A334706.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/334/A334706.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/334/A334706.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A334706: Number of collinear triples in a 4 X n rectangular grid.
; 4,8,20,44,84,140,224,332,472,648,864,1120,1428,1784,2196,2668,3204,3804,4480,5228,6056,6968,7968,9056,10244,11528,12916,14412,16020,17740,19584,21548,23640,25864,28224,30720,33364,36152,39092,42188,45444,48860,52448,56204,60136,64248,68544,73024,77700,82568,87636,92908,98388,104076,109984,116108,122456,129032,135840,142880,150164,157688,165460,173484,181764,190300,199104,208172,217512,227128,237024,247200,257668,268424,279476,290828,302484,314444,326720,339308,352216,365448,379008,392896,407124,421688,436596,451852,467460,483420,499744,516428,533480,550904,568704,586880,605444,624392,643732,663468,683604,704140,725088,746444,768216,790408,813024,836064,859540,883448,907796,932588,957828,983516,1009664,1036268,1063336,1090872,1118880,1147360,1176324,1205768,1235700,1266124,1297044,1328460,1360384,1392812,1425752,1459208,1493184,1527680,1562708,1598264,1634356,1670988,1708164,1745884,1784160,1822988,1862376,1902328,1942848,1983936,2025604,2067848,2110676,2154092,2198100,2242700,2287904,2333708,2380120,2427144,2474784,2523040,2571924,2621432,2671572,2722348,2773764,2825820,2878528,2931884,2985896,3040568,3095904,3151904,3208580,3265928,3323956,3382668,3442068,3502156,3562944,3624428,3686616,3749512,3813120,3877440,3942484,4008248,4074740,4141964,4209924,4278620,4348064,4418252,4489192,4560888,4633344,4706560,4780548,4855304,4930836,5007148,5084244,5162124,5240800,5320268,5400536,5481608,5563488,5646176,5729684,5814008,5899156,5985132,6071940,6159580,6248064,6337388,6427560,6518584,6610464,6703200,6796804,6891272,6986612,7082828,7179924,7277900,7376768,7476524,7577176,7678728,7781184,7884544,7988820,8094008,8200116,8307148,8415108,8523996,8633824,8744588,8856296,8968952,9082560,9197120,9312644,9429128,9546580,9665004,9784404,9904780,10026144,10148492,10271832,10396168
mov $12,$0
mov $14,$0
add $14,1
lpb $14,1
clr $0,12
mov $0,$12
sub $14,1
sub $0,$14
mov $9,$0
mov $11,$0
add $11,1
lpb $11,1
mov $0,$9
sub $11,1
sub $0,$11
mov $8,$0
gcd $0,3
mov $1,$0
add $0,1
mod $6,2
add $6,1
add $8,$0
sub $8,$6
mul $8,2
mov $3,$8
sub $3,$1
mov $1,$3
div $1,2
mul $1,4
add $10,$1
lpe
add $13,$10
lpe
mov $1,$13
| 60.236842 | 1,796 | 0.777632 |
fb0162adea805574fe6940071936de6702a64aec | 232 | asm | Assembly | libsrc/stdio_new/file/fsetpos.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | 8 | 2017-01-18T12:02:17.000Z | 2021-06-12T09:40:28.000Z | libsrc/stdio_new/file/fsetpos.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | 1 | 2017-03-06T07:41:56.000Z | 2017-03-06T07:41:56.000Z | libsrc/stdio_new/file/fsetpos.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | 3 | 2017-03-07T03:19:40.000Z | 2021-09-15T17:59:19.000Z | ; CALLER linkage for function pointers
PUBLIC fsetpos
EXTERN fsetpos_callee
EXTERN ASMDISP_FSETPOS_CALLEE
.fsetpos
pop de
pop hl
pop ix
push hl
push hl
push de
jp fsetpos_callee + ASMDISP_FSETPOS_CALLEE
| 12.888889 | 45 | 0.737069 |
1275a3f43ca1983e427789deb804b6cd8faa8f11 | 749 | asm | Assembly | programs/oeis/070/A070362.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/070/A070362.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/070/A070362.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A070362: a(n) = 3^n mod 44.
; 1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15,1,3,9,27,37,23,25,31,5,15
mov $1,1
mov $2,$0
lpb $2,1
mul $1,3
mod $1,44
sub $2,1
lpe
| 68.090909 | 651 | 0.600801 |
b4aa87f823d0522fab79baa93862f000f69bfc61 | 624 | asm | Assembly | libsrc/_DEVELOPMENT/target/rc2014/device/acia/8080/acia_peekc.asm | UnivEngineer/z88dk | 9047beba62595b1d88991bc934da75c0e2030d07 | [
"ClArtistic"
] | 4 | 2021-12-23T15:34:05.000Z | 2021-12-23T15:36:16.000Z | libsrc/_DEVELOPMENT/target/rc2014/device/acia/8080/acia_peekc.asm | UnivEngineer/z88dk | 9047beba62595b1d88991bc934da75c0e2030d07 | [
"ClArtistic"
] | 2 | 2022-03-20T22:17:35.000Z | 2022-03-24T16:10:00.000Z | libsrc/_DEVELOPMENT/target/rc2014/device/acia/8080/acia_peekc.asm | jorgegv/z88dk | 127130cf11f9ff268ba53e308138b12d2b9be90a | [
"ClArtistic"
] | null | null | null |
SECTION code_driver
SECTION code_driver_character_input
PUBLIC _acia_peekc
EXTERN aciaRxCount, aciaRxOut
._acia_peekc
ld a,(aciaRxCount) ; get the number of bytes in the Rx buffer
ld l,a ; and put it in hl
or a ; see if there are zero bytes available
ret Z ; if the count is zero, then return
ld hl,(aciaRxOut) ; get the pointer to place where we pop the Rx byte
ld a,(hl) ; get the Rx byte
ld l,a ; and put it in hl
ret
EXTERN _acia_need
defc NEED = _acia_need
| 28.363636 | 83 | 0.567308 |
996cd610ae1b7d73ef9c871a86a02500e53f6d0b | 13,203 | asm | Assembly | zoom-plasma/zoom-plasma.asm | yupferris/makeshift | 609671c97ce82a2783fa0c8cf25f4b3140d7cabe | [
"MIT"
] | 29 | 2017-07-22T12:33:06.000Z | 2020-09-07T01:44:13.000Z | zoom-plasma/zoom-plasma.asm | logicomacorp/makeshift | 609671c97ce82a2783fa0c8cf25f4b3140d7cabe | [
"MIT"
] | 1 | 2017-07-22T12:45:49.000Z | 2017-07-22T12:57:49.000Z | zoom-plasma/zoom-plasma.asm | logicomacorp/makeshift | 609671c97ce82a2783fa0c8cf25f4b3140d7cabe | [
"MIT"
] | 2 | 2017-08-08T11:54:34.000Z | 2020-06-17T09:22:04.000Z | #import "../common.inc"
#import "zoom-plasma.inc"
#import "../sine-boxes/sine-boxes.inc"
.const stretching_loop_speedcode = $6600
.const zp_base = $02
.const scale_index = zp_base
.const x_move_index = zp_base + 1
.const y_move_index = zp_base + 2
.const y_flow_index = zp_base + 3
.const x_interval_low = zp_base + 4
.const x_interval_high = zp_base + 5
.const char_x_low = zp_base + 6
.const char_x_high = zp_base + 7
.const y_interval_low = zp_base + 8
.const y_interval_high = zp_base + 9
.const line_y = zp_base + 10
.const line_y_low = line_y
.const line_y_high = zp_base + 11
.const char_data_last_byte = zp_base + 12
.const x_flow_index = zp_base + 13
.const calc_line_temp = zp_base + 14
.const x_flow_index_temp = zp_base + 15
.pc = zoom_plasma_code_base "interface"
jmp init_bg
jmp init_int
.pc = * "init bg"
init_bg:
// Init variables
lda #74
sta scale_index
lda #$01
sta scale_index_inc_instr + 1
lda #20
sta x_move_index
lda #$01
sta x_move_index_inc_instr + 1
lda #80
sta y_move_index
lda #$01
sta y_move_index_inc_instr + 1
lda #0
sta y_flow_index
lda #$20
sta x_flow_index
// Unpack chars
// Bank out io regs
lda #$34
sta $01
// Set up read pointer
lda #<chars
sta block_read_addr_low
lda #>chars
sta block_read_addr_high
// Set up write pointer
lda #$00
sta block_write_addr_low
lda #$c0
sta block_write_addr_high
// Unpacks a single char and updates read/write pointer. Clobbers a & y
.macro UnpackChar() {
ldy #$00
// Read character line byte
lda (block_read_addr), y
// Write byte 8 times, expanding into a character
!: sta (block_write_addr), y
iny
cpy #$08
bne !-
// Adjust read pointer
lda #$01
jsr block_inc_read_addr
// Adjust write pointer by 8 bytes (move to next output char)
lda #$08
jsr block_inc_write_addr
}
// Loop through 7 256 byte blocks
ldy #$07
unpack_block_loop:
tya
pha
ldx #$00
unpack_chars_loop:
UnpackChar()
dex
bne unpack_chars_loop
pla
tay
dey
bne unpack_block_loop
// Unpack last block _except_ for the last char so we don't overwrite the irq vector
ldx #$ff
unpack_chars_last_block_loop:
UnpackChar()
dex
bne unpack_chars_last_block_loop
// Unpack first 6 bytes of last char and store the value into char_data_last_byte
// so we can fill in the last two bytes over the irq vector for rendering later,
// but not clobber it here
ldy #$00
lda (block_read_addr), y
!: sta (block_write_addr), y
iny
cpy #$06
bne !-
sta char_data_last_byte
// Bank in io regs
lda #$35
sta $01
// Generate stretching loop speedcode
lda #<stretching_loop_speedcode
sta block_write_addr_low
lda #>stretching_loop_speedcode
sta block_write_addr_high
ldx #$00
!: txa
pha
// Write d011 value in template
// $18 | ((i + 2) & $07)
clc
adc #$02
and #$07
ora #$18
sta stretching_loop_speedcode_template_update_instr + 1
// Copy template
lda #<stretching_loop_speedcode_template_start
sta block_read_addr_low
lda #>stretching_loop_speedcode_template_start
sta block_read_addr_high
lda #(stretching_loop_speedcode_template_end - stretching_loop_speedcode_template_start)
jsr block_copy_bytes
pla
tax
inx
cpx #198
bne !-
// Write rts at the end
lda #RTS
jsr block_write_byte
// Make charset at $3800 is empty
// Currently we have a placeholder there so we can skip this
// TODO: If we put this back in, do smc loops instead of unrolling
/*lda #$00
tax
!: .for(var i = 0; i < 8; i++) {
sta $3800 + i * $100
}
inx
bne !-*/
rts
.pc = * "init int"
init_int:
// Set up frame interrupt
lda #<frame
sta $fffe
lda #>frame
sta $ffff
lda #$ff
sta $d012
// Set multicolor text mode
lda $d016
ora #$10
sta $d016
// Reset cycle counter
lda #$00
sta cycle_counter
rts
.pc = * "frame"
frame:
pha
txa
pha
tya
pha
lda $01
pha
// Bank in io regs
lda #$35
sta $01
// Reset graphics mode etc
lda #$1b
sta $d011
// Reset screen mem and point char data at empty chars ($3800)
lda #$1e
sta $d018
// Reset VIC bank
lda #$c7
sta $dd00
// Update music
//inc $d020
jsr music + 3
//dec $d020
// Set up colors
lda #$03
sta background_color_instr + 1
lda #$0e
sta $d022
lda cycle_counter
lsr
and #$01
tax
lda screen_dark_colors, x
sta $d023
lda char_colors, x
ldx #$28
!: sta $d800 - 1, x
dex
bne !-
// Flow scripting
lda cycle_counter
lsr
tax
lda x_flow_index_inc_tab, x
sta x_flow_index_inc_instr + 1
lda y_flow_index_inc_tab, x
sta y_flow_index_inc_instr + 1
// Update effect indices
lda scale_index
clc
scale_index_inc_instr:
adc #$00
sta scale_index
lda x_move_index
clc
x_move_index_inc_instr:
adc #$00
sta x_move_index
lda y_move_index
clc
y_move_index_inc_instr:
adc #$00
sta y_move_index
lda y_flow_index
clc
y_flow_index_inc_instr:
adc #$00
sta y_flow_index
lda x_flow_index
clc
x_flow_index_inc_instr:
adc #$00
sta x_flow_index
// Update char map
//dec $d020
// Load x vars
scale_index_instr:
ldx scale_index
ldy x_move_index
// x_offset = char_x = x_offset_tab[scale_index] + x_move_tab[x_move_index];
lda zoom_plasma_x_offset_low_tab, x
clc
adc zoom_plasma_x_move_low_tab, y
sta char_x_low
lda zoom_plasma_x_offset_high_tab, x
adc zoom_plasma_x_move_high_tab, y
sta char_x_high
// x_interval = x_interval_tab[scale_index];
lda zoom_plasma_x_interval_low_tab, x
sta x_interval_low
lda zoom_plasma_x_interval_high_tab, x
sta x_interval_high
// X update
lda char_x_high
ldx #$00
!: stx x_flow_index_temp
pha
pha
clc
adc x_flow_index
tax
lda char_x_low
asl
pla
rol
clc
adc zoom_plasma_x_flow_tab, x
ldx x_flow_index_temp
sta $400, x
// Technically we don't need to do this on the last iteration, but it simplifies the code to leave it in
lda char_x_low
clc
adc x_interval_low
sta char_x_low
pla
adc x_interval_high
ldx x_flow_index_temp
inx
cpx #40
bne !-
//inc $d020
// Load y vars
ldx scale_index
// y_interval = y_interval_tab[scale_index];
lda zoom_plasma_y_interval_low_tab, x
sta y_interval_low
lda zoom_plasma_y_interval_high_tab, x
sta y_interval_high
// line_y = y_offset_tab[scale_index] + y_move_tab[y_move_index];
ldy y_move_index
lda zoom_plasma_y_offset_low_tab, x
clc
adc zoom_plasma_y_move_low_tab, y
sta line_y_low
lda zoom_plasma_y_offset_high_tab, x
adc zoom_plasma_y_move_high_tab, y
sta line_y_high
// Assumes high byte of line_y is in a and x, outputs shifted (NOT MASKED) line index in a (clobbering y)
.macro CalcLine() {
sta calc_line_temp
clc
adc y_flow_index
asl // Instead of doubling y_flow_tab's phase, we can just shift here
tay
lda zoom_plasma_y_flow_tab, y
clc
adc calc_line_temp
nop
nop
nop
nop
nop
nop
nop
}
// Inputs high byte of line_y in x, outputs updated high byte of line_y in a and x
.macro UpdateLine() {
lda line_y_low
clc
adc y_interval_low
sta line_y_low
txa
adc y_interval_high
tax
}
// Calc d018 value for first plasma line
lax line_y_high
CalcLine()
sta first_d018_value_instr + 1
UpdateLine()
stx line_y_high
// Set up stretching raster interrupt
lda #<stable_raster_a
sta $fffe
lda #>stable_raster_a
sta $ffff
lda #$2b
sta $d012
!: asl $d019
pla
sta $01
pla
tay
pla
tax
pla
rti
.align $100
.pc = * "stable raster a"
stable_raster_a:
pha
txa
pha
tya
pha
lda $01
pha
// Bank in io regs
lda #$35
sta $01
// Wait a bit for the next scanline
ldx #$0a
!: dex
bne !-
bit $00
// Set up next interrupt stage
lda #<stable_raster_b
sta $fffe
inc $d012
// ACK so next stage can fire
asl $d019
// Save sp into x (we'll restore in the next stage)
tsx
// Clear interrupt flag so next stage can fire
cli
// nop pads (next stage should fire in here somewhere)
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
jmp * // Safety net (if we see more than 1-cycle jitter for the next int, we got here)
// Technically this is only semi-stable with a 1-cycle jitter (close enough for this effect)
.pc = * "stable raster b"
stable_raster_b:
// Top border, thin white part
lda #$01
sta $d021
lda #$00
// Make sure there's no black crap on the border
sta $ffff
// Restore sp
txs
// Wait a bit...
ldx #$17
!: dex
bne !-
// Set up screen to read screen/color mem from current bank before stretching loop
lda #$19
sta $d011
// Wait a bit more..
ldx #$14
!: dex
bne !-
nop
// Write last byte of char data over interrupt vector (lol)
lda char_data_last_byte
sta $fffe
sta $ffff
// Set plasma background color
background_color_instr:
lda #$00
sta $d021
// Set first scanline d018 value
first_d018_value_instr:
lda #$00
sta $d018
// Switch VIC bank
// We want to do this pretty late so that the screen and color mem will have already been read for the current char row,
// but not so late that we show any wrong pixels at the beginning of the first line
lda #$c4
sta $dd00
// Preload line index for stretching loop
lax line_y + 1
// Stretching loop (should start at line 50 cycle 1/2)
jsr stretching_loop_speedcode
// Reset background color
// Need to wait until the last char row has been displayed so we don't mess up its background color
ldx #$07
!: dex
bne !-
lda #$00
sta $d021
// Make sure there's no black crap on the border
sta $ffff
// Reset VIC bank
lda #$c7
sta $dd00
// Set up frame interrupt
lda #<frame
sta $fffe
lda #>frame
sta $ffff
lda #$ff
sta $d012
// Update cycle
!: inc cycle_frame_counter
lda cycle_frame_counter
cmp #cycle_frames
bne cycle_update_done
// Bump cycle counter
inc cycle_counter
// Reset counter
lda #$00
sta cycle_frame_counter
// If we've gone 8 cycles, time to fire up the next effect
lda cycle_counter
cmp #$08
bne !+
jsr sine_boxes_init_int
// Script movement changes
!: lda cycle_counter
and #$01
bne cycle_update_done
lda x_move_index
clc
adc #$63
sta x_move_index
lda y_move_index
clc
adc #$b9
sta y_move_index
lda scale_index
clc
adc #$63
sta scale_index
dec scale_index_inc_instr + 1
cycle_update_done:
asl $d019
pla
sta $01
pla
tay
pla
tax
pla
rti
.pc = * "stretching loop speedcode template"
// This should be repeated 198 times (one for each scanline the effect runs, minus the first line)
stretching_loop_speedcode_template_start:
CalcLine()
// Stretch
stretching_loop_speedcode_template_update_instr:
ldy #00 // $18 | ((i + 2) & $07)
sty $d011 // This write should happen on cycle 55-57 each line
sta $d018 // Select charset
// Technically we don't need to do this on the last iteration, but it simplifies speedcode to leave it in
UpdateLine()
stretching_loop_speedcode_template_end:
.file [name="zoom-plasma-data.prg", segments="Data"]
.segmentdef Data [start=zoom_plasma_data_base]
.segment Data "data"
.pc = * "chars"
chars:
.import binary "chars.bin"
/*.pc = * "alt chars"
alt_chars:
.import binary "alt-chars.bin"*/
.pc = * "char colors"
char_colors:
.byte $0a, $08
.pc = * "screen dark colors"
screen_dark_colors:
.byte $04, $06
.pc = * "x flow index inc table"
x_flow_index_inc_tab:
.byte $ff, $04, $00, $fd
.pc = * "y flow index inc table"
y_flow_index_inc_tab:
.byte $01, $ff, $00, $02
| 20.597504 | 125 | 0.606908 |
ed2ff3b7f9f6383cf9f476dc5c0cb23175e86f25 | 501 | asm | Assembly | ee/hot/english.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ee/hot/english.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ee/hot/english.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ; English and Toolkit II Definitions 1985 T.Tebby QJUMP
xref hkc_english
section defs
xdef ynaq
xdef message
ynaq dc.b 'YNAQ'
message
dc.w yn_messg-*
dc.w ynaq_mes-*
dc.w to_messg-*
dc.w exist_ms-*
dc.w overw_ms-*
yn_messg dc.w 10,'..Y or N? '
ynaq_mes dc.w 11,'..Y/N/A/Q? '
to_messg dc.w 04,' TO '
exist_ms dc.w 09,' exists, '
overw_ms dc.w 15,'OK to overwrite'
end
| 20.875 | 63 | 0.518962 |
d19398b23ac718779899b4331f615287c835f668 | 553 | asm | Assembly | programs/oeis/289/A289356.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/289/A289356.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/289/A289356.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A289356: Least number k such that n^2 + n + k is prime.
; 2,1,1,1,3,1,1,3,1,7,3,5,1,9,1,1,5,1,5,3,1,1,3,5,1,3,7,1,9,7,7,5,5,1,3,17,29,3,1,7,17,1,5,9,7,11,17,11,5,9,1,5,11,17,1,3,11,1,11,1,11,11,1,17,17,7,1,5,11,1,3,1,5,5,7,1,5,1,1,3,1,11,17,5,11,11,5,13,9,1,1,5,7,5,3,7,7,5,17,1
mov $2,$0
add $2,1
mul $0,$2
add $2,1
mov $5,$0
lpb $2
mul $0,$6
sub $2,1
mov $3,$5
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,5
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
add $5,1
lpe
div $1,5
mov $0,$1
| 23.041667 | 222 | 0.553345 |
2cc93032fd859e50e4f4f826a188585b8d5df4df | 316 | asm | Assembly | libsrc/target/zx/display/zx_py2saddr.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 38 | 2021-06-18T12:56:15.000Z | 2022-03-12T20:38:40.000Z | libsrc/target/zx/display/zx_py2saddr.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 2 | 2021-06-20T16:28:12.000Z | 2021-11-17T21:33:56.000Z | libsrc/target/zx/display/zx_py2saddr.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 6 | 2021-06-18T18:18:36.000Z | 2021-12-22T08:01:32.000Z | ; uchar __FASTCALL__ *zx_py2saddr(uchar ycoord)
; aralbrec 06.2007
SECTION code_clib
PUBLIC zx_py2saddr
PUBLIC _zx_py2saddr
.zx_py2saddr
._zx_py2saddr
ld a,l
and $07
ld h,a
ld a,l
and $c0
rra
inc a
rrca
rrca
or h
ld h,a
ld a,l
rla
rla
and $e0
ld l,a
ret
| 10.533333 | 47 | 0.610759 |
e61591021fa444876efece6bf5efd1297634354c | 302 | asm | Assembly | programs/oeis/155/A155628.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/155/A155628.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/155/A155628.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A155628: 7^n-4^n+1^n
; 1,4,34,280,2146,15784,113554,807160,5699266,40091464,281426674,1973132440,13824509986,96821901544,677954637394,4746487768120,33228635602306,232613334118024,1628344878433714,11398620307466200
mov $2,7
pow $2,$0
mov $1,$2
mov $3,4
pow $3,$0
sub $1,$3
div $1,3
mul $1,3
add $1,1
| 23.230769 | 192 | 0.758278 |
7aec2650a5e8476abac3ccc645bb9c2a439abcca | 1,390 | asm | Assembly | programs/oeis/185/A185170.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/185/A185170.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/185/A185170.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A185170: a(n) = floor( (2*n^2 - 6*n + 9) / 5).
; 1,1,1,1,3,5,9,13,17,23,29,37,45,53,63,73,85,97,109,123,137,153,169,185,203,221,241,261,281,303,325,349,373,397,423,449,477,505,533,563,593,625,657,689,723,757,793,829,865,903,941,981,1021,1061,1103,1145,1189,1233,1277,1323,1369,1417,1465,1513,1563,1613,1665,1717,1769,1823,1877,1933,1989,2045,2103,2161,2221,2281,2341,2403,2465,2529,2593,2657,2723,2789,2857,2925,2993,3063,3133,3205,3277,3349,3423,3497,3573,3649,3725,3803,3881,3961,4041,4121,4203,4285,4369,4453,4537,4623,4709,4797,4885,4973,5063,5153,5245,5337,5429,5523,5617,5713,5809,5905,6003,6101,6201,6301,6401,6503,6605,6709,6813,6917,7023,7129,7237,7345,7453,7563,7673,7785,7897,8009,8123,8237,8353,8469,8585,8703,8821,8941,9061,9181,9303,9425,9549,9673,9797,9923,10049,10177,10305,10433,10563,10693,10825,10957,11089,11223,11357,11493,11629,11765,11903,12041,12181,12321,12461,12603,12745,12889,13033,13177,13323,13469,13617,13765,13913,14063,14213,14365,14517,14669,14823,14977,15133,15289,15445,15603,15761,15921,16081,16241,16403,16565,16729,16893,17057,17223,17389,17557,17725,17893,18063,18233,18405,18577,18749,18923,19097,19273,19449,19625,19803,19981,20161,20341,20521,20703,20885,21069,21253,21437,21623,21809,21997,22185,22373,22563,22753,22945,23137,23329,23523,23717,23913,24109,24305,24503
sub $0,1
mov $2,$0
sub $0,1
mul $0,$2
div $0,5
mov $1,$0
mul $1,2
add $1,1
| 115.833333 | 1,264 | 0.772662 |
5a50dd25713d1a9675bc002a3ce27630e1b4cd41 | 747 | asm | Assembly | data/pokemon/base_stats/sandslash.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | 1 | 2022-02-15T00:19:44.000Z | 2022-02-15T00:19:44.000Z | data/pokemon/base_stats/sandslash.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | data/pokemon/base_stats/sandslash.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | db DEX_SANDSLASH ; pokedex id
db 75, 100, 110, 65, 55
; hp atk def spd spc
db GROUND, GROUND ; type
db 90 ; catch rate
db 163 ; base exp
INCBIN "gfx/pokemon/front/sandslash.pic", 0, 1 ; sprite dimensions
dw SandslashPicFront, SandslashPicBack
db SCRATCH, SAND_ATTACK, NO_MOVE, NO_MOVE ; level 1 learnset
db GROWTH_MEDIUM_FAST ; growth rate
; tm/hm learnset
tmhm SWORDS_DANCE, TOXIC, BODY_SLAM, TAKE_DOWN, DOUBLE_EDGE, \
HYPER_BEAM, SUBMISSION, SEISMIC_TOSS, RAGE, EARTHQUAKE, \
FISSURE, DIG, MIMIC, DOUBLE_TEAM, BIDE, \
SWIFT, SKULL_BASH, REST, ROCK_SLIDE, SUBSTITUTE, \
CUT, STRENGTH
; end
db 0 ; padding
| 29.88 | 77 | 0.615797 |
66a12b73a78f37c33c285f1423bdd77edda9e5f7 | 2,098 | asm | Assembly | src/paging.asm | faibz/OperatingSystem | 5c516a6405063b7dea016bf32e23fb9d6d8b300e | [
"MIT"
] | null | null | null | src/paging.asm | faibz/OperatingSystem | 5c516a6405063b7dea016bf32e23fb9d6d8b300e | [
"MIT"
] | null | null | null | src/paging.asm | faibz/OperatingSystem | 5c516a6405063b7dea016bf32e23fb9d6d8b300e | [
"MIT"
] | null | null | null | ; Setup paging for bootloader
bits 32
; Address of page directory table
%define PAGE_DIR 9C000h
;Address of 0th page table. Address must be 4KB aligned
%define PAGE_TABLE_0 9D000h
; Address of 512th page table. Address must be 4KB aligned
%define PAGE_TABLE_512 9E000h
; Each page table has 1024 entries
%define PAGE_TABLE_ENTRIES 1024
; Attributes (page is present;page is writable; supervisor mode)
%define PRIV 3
; Enable Paging
EnablePaging:
pusha ; Save stack frame
; Set page table to reference first 4MB of memory
mov eax, PAGE_TABLE_0 ; Address of first page table
mov ebx, 0 | PRIV ; Starting physical address of page. First one is 0, next is 4K, etc
mov ecx, PAGE_TABLE_ENTRIES ; for every page in table...
EnablePaging_Loop1:
mov dword [eax], ebx ; Write the entry
add eax, 4 ; Go to next page entry in table (Each entry is 4 bytes)
add ebx, 4096 ; Add 4K to the physical entry
loop EnablePaging_Loop1 ; Go to next entry
; Map the 512th table to first 4MB. This iqill include the kernel which is loaded at 1MB
; The 512th table starts the 2gb virtual address
mov eax, PAGE_TABLE_512 ; Second page table
mov ebx, 0 | PRIV ; Starting physical address of page
mov ecx, PAGE_TABLE_ENTRIES ; For every page in table...
EnablePaging_Loop2:
mov dword [eax], ebx ; Write the entry
add eax, 4 ; Go to next page entry in table (Each entry is 4 bytes)
add ebx, 4096 ; Next page points to next 4K of physical memory
loop EnablePaging_Loop2 ; Go to next entry
; Set up the entries in the directory table. We are only interested in the 0th and 512th entry (i.e. the first
; 4MB of address space and the space at 2GB)
mov eax, PAGE_TABLE_0 | PRIV ; 1st table is directory entry 0
mov dword [PAGE_DIR], eax
mov eax, PAGE_TABLE_512 | PRIV ; 512th entry in directory table
mov dword [PAGE_DIR + (512 * 4)], eax
; Install directory table
mov eax, PAGE_DIR
mov cr3, eax
; Enable paging
mov eax, cr0
or eax, 80000000h
mov cr0, eax
popa
ret
| 28.739726 | 112 | 0.703527 |
802ada51f3d7bb9753084e2a893ad007ad6be064 | 3,326 | asm | Assembly | kernel/isr.asm | EmilNorden/tunaos | fccaeb90609b08066470fe8e4cde0e64f85c2f15 | [
"MIT"
] | null | null | null | kernel/isr.asm | EmilNorden/tunaos | fccaeb90609b08066470fe8e4cde0e64f85c2f15 | [
"MIT"
] | null | null | null | kernel/isr.asm | EmilNorden/tunaos | fccaeb90609b08066470fe8e4cde0e64f85c2f15 | [
"MIT"
] | null | null | null | global _isr0
global _isr1
global _isr2
global _isr3
global _isr4
global _isr5
global _isr6
global _isr7
global _isr8
global _isr9
global _isr10
global _isr11
global _isr12
global _isr13
global _isr14
global _isr15
global _isr16
global _isr17
global _isr18
global _isr19
global _isr20
global _isr21
global _isr22
global _isr23
global _isr24
global _isr25
global _isr26
global _isr27
global _isr28
global _isr29
global _isr30
global _isr31
; Divide by zero
_isr0:
cli
push byte 0
push byte 0
jmp isr_common
; Debug
_isr1:
cli
push byte 0
push byte 1
jmp isr_common
; Non-maskable Interrupt
_isr2:
cli
push byte 0
push byte 2
jmp isr_common
; Breakpoint
_isr3:
cli
push byte 0
push byte 3
jmp isr_common
; Overflow
_isr4:
cli
push byte 0
push byte 4
jmp isr_common
; Bound range exceeded
_isr5:
cli
push byte 0
push byte 5
jmp isr_common
; Invalid opcode
_isr6:
cli
push byte 0
push byte 6
jmp isr_common
; Device not available
_isr7:
cli
push byte 0
push byte 7
jmp isr_common
; Double fault
_isr8:
cli
jmp isr_common
; Coprocessor segment overrun
_isr9:
cli
push byte 0
push byte 9
jmp isr_common
; Invalid TSS
_isr10:
cli
jmp isr_common
; Segment not present
_isr11:
cli
jmp isr_common
; Stack-segment fault
_isr12:
cli
jmp isr_common
; General protection fault
_isr13:
cli
jmp isr_common
; Page fault
_isr14:
cli
jmp isr_common
; Unknown interrupt exception
_isr15:
cli
push byte 0
push byte 15
jmp isr_common
; x87 floating-point exception
_isr16:
cli
push byte 0
push byte 16
jmp isr_common
; Alignment check
_isr17:
cli
push byte 0
push byte 17
jmp isr_common
; Machine check
_isr18:
cli
push byte 0
push byte 18
jmp isr_common
; SIMD floating-point exception
_isr19:
cli
push byte 0
push byte 19
jmp isr_common
; Virtualization exception
_isr20:
cli
push byte 0
push byte 20
jmp isr_common
; Reserved
_isr21:
cli
push byte 0
push byte 21
jmp isr_common
; Reserved
_isr22:
cli
push byte 0
push byte 22
jmp isr_common
; Reserved
_isr23:
cli
push byte 0
push byte 23
jmp isr_common
; Reserved
_isr24:
cli
push byte 0
push byte 24
jmp isr_common
; Reserved
_isr25:
cli
push byte 0
push byte 25
jmp isr_common
; Reserved
_isr26:
cli
push byte 0
push byte 26
jmp isr_common
; Reserved
_isr27:
cli
push byte 0
push byte 27
jmp isr_common
; Reserved
_isr28:
cli
push byte 0
push byte 28
jmp isr_common
; Reserved
_isr29:
cli
push byte 0
push byte 29
jmp isr_common
; Security exception
_isr30:
cli
push byte 0
push byte 30
jmp isr_common
; Reserved
_isr31:
cli
push byte 0
push byte 31
jmp isr_common
extern interrupt_handler
isr_common:
pusha
push ds
push es
push fs
push gs
mov ax, 0x10 ; Load the Kernel Data Segment descriptor!
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov eax, esp ; Push us the stack
push eax
mov eax, interrupt_handler
call eax ; A special call, preserves the 'eip' register
pop eax
pop gs
pop fs
pop es
pop ds
popa
add esp, 8 ; Cleans up the pushed error code and pushed ISR number
iret ; pops 5 things at once: CS, EIP, EFLAGS, SS, and ESP! | 12.273063 | 74 | 0.703247 |
a71a17750873159b0e58768c212b89cf4daa167c | 837 | asm | Assembly | oeis/142/A142365.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/142/A142365.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/142/A142365.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A142365: Primes congruent to 14 mod 47.
; Submitted by Jon Maiga
; 61,719,907,1283,1471,1753,1847,2129,2411,2693,3163,3257,3539,3727,3821,5231,5419,5701,6359,6547,6829,7393,7487,8521,8803,9461,9649,9743,9931,10589,11059,11717,12281,13033,13127,13597,13691,13879,14537,15101,15289,15383,16229,16417,16699,16981,17827,17921,19237,19801,20177,20929,21023,21211,21493,21587,22433,22621,23279,23561,24407,24877,24971,25253,26099,27509,27697,27791,29201,29389,29483,29671,30047,30517,30893,31081,32303,32491,33149,33619,33713,34183,34747,34841,35311,35593,35969,36251
mov $1,30
mov $2,$0
add $2,2
pow $2,2
lpb $2
sub $2,1
mov $3,$1
add $1,13
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,34
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
lpe
mov $0,$1
mul $0,2
sub $0,93
| 33.48 | 496 | 0.726404 |
d8ffb7c11ccc902131e5496d59f10cc963e6830b | 1,599 | asm | Assembly | src/spread/help_english.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | src/spread/help_english.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | src/spread/help_english.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | section language
xdef tab_explanation
msg macro text
[.lab] dc.w [.len(text)]
dc.b '[text]'
endm
tab_explanation
dc.l 0
dc.l loose-*
dc.l 0
loose
dc.w 33
dc.w i0-*
dc.w i1-*
dc.w i2-*
dc.w i3-*
dc.w i4-*
dc.w i5-*
dc.w i6-*
dc.w i7-*
dc.w i8-*
dc.w i9-*
dc.w 0
dc.w i11-*
dc.w i12-*
dc.w i13-*
dc.w i13a-*
dc.w 0
dc.w i15-*
dc.w i16-*
dc.w i17-*
dc.w i18-*
dc.w i19-*
dc.w i20-*
dc.w i21-*
dc.w i22-*
dc.w i23-*
dc.w i24-*
dc.w i25-*
dc.w i26-*
dc.w i27-*
dc.w i28-*
dc.w i29-*
dc.w i30-*
dc.w i31-*
dc.w i32-*
i0 msg {Move window} ; 0
i1 msg {Resize window\Maximum/minimum window}
i2 msg {Sleep}
i3 msg {Files menu}
i4 msg {Grid menu}
i5 msg {Cell menu}
i6 msg {Status menu}
i7 msg {Functions & macros}
i8 msg {Goto cell}
i9 msg {Formulae/text entry}
i11 msg {Line}
i12 msg {Apply formulae/text to range}
i13 msg {Sum over range}
i13a msg {Current date}
i15 msg {Help menu\Info about QSpread}
i16 msg {Load sheet\Import from file}
i17 msg {Save sheet under current filename\Save with new filename}
i18 msg {Print block\Print page}
i19 msg {Search}
i20 msg {Repeat last search}
i21 msg {Echo cell over range}
i22 msg {Copy cell or range}
i23 msg {Move cell or range}
i24 msg {Delete cell or range}
i25 msg {Protect cell or range\Unprotect cell or range}
i26 msg {Overwrite scrap with current range}
i27 msg {Number representation}
i28 msg {Currency symbol}
i29 msg {Left-justify cell or range}
i30 msg {Right-justify cell or range}
i31 msg {Change column width\Perfect column width}
i32 msg {Recalculate sheet}
end
| 18.37931 | 66 | 0.662914 |
3d75d9142f7710c1ce830417dcdad4f396cd4342 | 542 | asm | Assembly | oeis/016/A016748.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/016/A016748.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/016/A016748.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A016748: a(n) = (2*n)^8.
; 0,256,65536,1679616,16777216,100000000,429981696,1475789056,4294967296,11019960576,25600000000,54875873536,110075314176,208827064576,377801998336,656100000000,1099511627776,1785793904896,2821109907456,4347792138496,6553600000000,9682651996416,14048223625216,20047612231936,28179280429056,39062500000000,53459728531456,72301961339136,96717311574016,128063081718016,167961600000000,218340105584896,281474976710656,360040606269696,457163239653376,576480100000000,722204136308736,899194740203776
pow $0,8
mul $0,256
| 90.333333 | 493 | 0.881919 |
4284214fc1a10d244325d3219bbfa79b37186b7a | 411 | asm | Assembly | engine/events/hidden_objects/town_map.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | 1 | 2022-02-15T00:19:44.000Z | 2022-02-15T00:19:44.000Z | engine/events/hidden_objects/town_map.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | engine/events/hidden_objects/town_map.asm | opiter09/ASM-Machina | 75d8e457b3e82cc7a99b8e70ada643ab02863ada | [
"CC0-1.0"
] | null | null | null | TownMapText::
text_far _TownMapText
text_promptbutton
text_asm
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld hl, wd730
set 6, [hl]
call GBPalWhiteOutWithDelay3
xor a
ldh [hWY], a
inc a
ldh [hAutoBGTransferEnabled], a
call LoadFontTilePatterns
farcall DisplayTownMap
ld hl, wd730
res 6, [hl]
ld de, TextScriptEnd
push de
ldh a, [hLoadedROMBank]
push af
jp CloseTextDisplay
| 17.869565 | 52 | 0.76399 |
5f2f2880de5e150ab2ce1221223bc8b3c16adf84 | 1,257 | asm | Assembly | programs/oeis/017/A017476.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/017/A017476.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/017/A017476.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A017476: a(n) = (11*n + 7)^4.
; 2401,104976,707281,2560000,6765201,14776336,28398241,49787136,81450625,126247696,187388721,268435456,373301041,506250000,671898241,875213056,1121513121,1416468496,1766100625,2176782336,2655237841,3208542736,3844124001,4569760000,5393580481,6324066576,7370050801,8540717056,9845600625,11294588176,12897917761,14666178816,16610312161,18741610000,21071715921,23612624896,26376683281,29376588816,32625390625,36136489216,39923636481,44000935696,48382841521,53084160000,58120048561,63506016016,69257922561,75391979776,81924750625,88873149456,96254442001,104086245376,112386528081,121173610000,130466162401,140283207936,150644120641,161568625936,173076800625,185189072896,197926222321,211309379856,225360027841,240100000000,255551481441,271737008656,288679469521,306402103296,324928500625,344282603536,364488705441,385571451136,407555836801,430467210000,454331269681,479174066176,505022001201,531901827856,559840650625,588865925376,619005459361,650287411216,682740290961,716392960000,751274631121,787414868496,824843587681,863591055616,903687890625,945165062416,988053892081,1032386052096,1078193566321,1125508810000,1174364509761,1224793743616,1276829940961,1330506882576,1385858700625,1442919878656
mul $0,11
add $0,7
pow $0,4
| 179.571429 | 1,195 | 0.894193 |
f15d31fb0fc9a4f60093e8e31362a176588cd1d2 | 580 | asm | Assembly | oeis/194/A194715.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/194/A194715.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/194/A194715.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A194715: 15 times triangular numbers.
; 0,15,45,90,150,225,315,420,540,675,825,990,1170,1365,1575,1800,2040,2295,2565,2850,3150,3465,3795,4140,4500,4875,5265,5670,6090,6525,6975,7440,7920,8415,8925,9450,9990,10545,11115,11700,12300,12915,13545,14190,14850,15525,16215,16920,17640,18375,19125,19890,20670,21465,22275,23100,23940,24795,25665,26550,27450,28365,29295,30240,31200,32175,33165,34170,35190,36225,37275,38340,39420,40515,41625,42750,43890,45045,46215,47400,48600,49815,51045,52290,53550,54825,56115,57420,58740,60075,61425,62790
sub $1,$0
bin $1,2
mul $1,15
mov $0,$1
| 72.5 | 499 | 0.789655 |
7118305cfaf918d71f02dd4e9bf1e4edc59d0d64 | 3,524 | asm | Assembly | books/nand2tetris/ch08/FunctionCalls/StaticsTest.asm | luksamuk/study | 7a4062cb894be52d786852b4729ac6a4e784b5a3 | [
"MIT"
] | 3 | 2019-03-13T02:16:44.000Z | 2020-03-05T21:14:18.000Z | books/nand2tetris/ch08/FunctionCalls/StaticsTest.asm | luksamuk/study | 7a4062cb894be52d786852b4729ac6a4e784b5a3 | [
"MIT"
] | 1 | 2019-03-15T00:52:59.000Z | 2019-03-15T00:53:54.000Z | books/nand2tetris/ch08/FunctionCalls/StaticsTest.asm | luksamuk/study | 7a4062cb894be52d786852b4729ac6a4e784b5a3 | [
"MIT"
] | 1 | 2020-03-05T21:14:29.000Z | 2020-03-05T21:14:29.000Z | @256
D=A
@SP
M=D
@-INTERNAL.HACKVM.FUNCALLRET.0
D=A
@SP
A=M
M=D
@SP
M=M+1
@LCL
D=M
@SP
A=M
M=D
@SP
M=M+1
@ARG
D=M
@SP
A=M
M=D
@SP
M=M+1
@THIS
D=M
@SP
A=M
M=D
@SP
M=M+1
@THAT
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
D=M
@0
D=D-A
@5
D=D-A
@ARG
M=D
@SP
D=M
@LCL
M=D
@Sys.init
0;JMP
(-INTERNAL.HACKVM.FUNCALLRET.0)
(Class1.set)
@ARG
A=M
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@Class1.0
D=A
@R14
M=D
@R13
D=M
@R14
A=M
M=D
@ARG
D=M
@1
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@Class1.1
D=A
@R14
M=D
@R13
D=M
@R14
A=M
M=D
@0
D=A
@SP
A=M
M=D
@SP
M=M+1
@LCL
D=M
@R13
M=D
@5
A=D-A
D=M
@R14
M=D
@SP
M=M-1
A=M
D=M
@ARG
A=M
M=D
@ARG
A=M
D=A+1
@SP
M=D
@R13
D=M
@1
A=D-A
D=M
@THAT
M=D
@R13
D=M
@2
A=D-A
D=M
@THIS
M=D
@R13
D=M
@3
A=D-A
D=M
@ARG
M=D
@R13
D=M
@4
A=D-A
D=M
@LCL
M=D
@R14
A=M
0;JMP
(Class1.get)
@Class1.0
D=M
@SP
A=M
M=D
@SP
M=M+1
@Class1.1
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
D=D-A
@SP
A=M
M=D
@SP
M=M+1
@LCL
D=M
@R13
M=D
@5
A=D-A
D=M
@R14
M=D
@SP
M=M-1
A=M
D=M
@ARG
A=M
M=D
@ARG
A=M
D=A+1
@SP
M=D
@R13
D=M
@1
A=D-A
D=M
@THAT
M=D
@R13
D=M
@2
A=D-A
D=M
@THIS
M=D
@R13
D=M
@3
A=D-A
D=M
@ARG
M=D
@R13
D=M
@4
A=D-A
D=M
@LCL
M=D
@R14
A=M
0;JMP
(Class2.set)
@ARG
A=M
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@Class2.0
D=A
@R14
M=D
@R13
D=M
@R14
A=M
M=D
@ARG
D=M
@1
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@Class2.1
D=A
@R14
M=D
@R13
D=M
@R14
A=M
M=D
@0
D=A
@SP
A=M
M=D
@SP
M=M+1
@LCL
D=M
@R13
M=D
@5
A=D-A
D=M
@R14
M=D
@SP
M=M-1
A=M
D=M
@ARG
A=M
M=D
@ARG
A=M
D=A+1
@SP
M=D
@R13
D=M
@1
A=D-A
D=M
@THAT
M=D
@R13
D=M
@2
A=D-A
D=M
@THIS
M=D
@R13
D=M
@3
A=D-A
D=M
@ARG
M=D
@R13
D=M
@4
A=D-A
D=M
@LCL
M=D
@R14
A=M
0;JMP
(Class2.get)
@Class2.0
D=M
@SP
A=M
M=D
@SP
M=M+1
@Class2.1
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
M=M-1
A=M
D=M
@R13
M=D
@SP
M=M-1
A=M
D=M
@R13
A=M
D=D-A
@SP
A=M
M=D
@SP
M=M+1
@LCL
D=M
@R13
M=D
@5
A=D-A
D=M
@R14
M=D
@SP
M=M-1
A=M
D=M
@ARG
A=M
M=D
@ARG
A=M
D=A+1
@SP
M=D
@R13
D=M
@1
A=D-A
D=M
@THAT
M=D
@R13
D=M
@2
A=D-A
D=M
@THIS
M=D
@R13
D=M
@3
A=D-A
D=M
@ARG
M=D
@R13
D=M
@4
A=D-A
D=M
@LCL
M=D
@R14
A=M
0;JMP
(Sys.init)
@6
D=A
@SP
A=M
M=D
@SP
M=M+1
@8
D=A
@SP
A=M
M=D
@SP
M=M+1
@-INTERNAL.HACKVM.FUNCALLRET.1
D=A
@SP
A=M
M=D
@SP
M=M+1
@LCL
D=M
@SP
A=M
M=D
@SP
M=M+1
@ARG
D=M
@SP
A=M
M=D
@SP
M=M+1
@THIS
D=M
@SP
A=M
M=D
@SP
M=M+1
@THAT
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
D=M
@2
D=D-A
@5
D=D-A
@ARG
M=D
@SP
D=M
@LCL
M=D
@Class1.set
0;JMP
(-INTERNAL.HACKVM.FUNCALLRET.1)
@SP
M=M-1
A=M
D=M
@R13
M=D
@5
D=A
@R14
M=D
@R13
D=M
@R14
A=M
M=D
@23
D=A
@SP
A=M
M=D
@SP
M=M+1
@15
D=A
@SP
A=M
M=D
@SP
M=M+1
@-INTERNAL.HACKVM.FUNCALLRET.2
D=A
@SP
A=M
M=D
@SP
M=M+1
@LCL
D=M
@SP
A=M
M=D
@SP
M=M+1
@ARG
D=M
@SP
A=M
M=D
@SP
M=M+1
@THIS
D=M
@SP
A=M
M=D
@SP
M=M+1
@THAT
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
D=M
@2
D=D-A
@5
D=D-A
@ARG
M=D
@SP
D=M
@LCL
M=D
@Class2.set
0;JMP
(-INTERNAL.HACKVM.FUNCALLRET.2)
@SP
M=M-1
A=M
D=M
@R13
M=D
@5
D=A
@R14
M=D
@R13
D=M
@R14
A=M
M=D
@-INTERNAL.HACKVM.FUNCALLRET.3
D=A
@SP
A=M
M=D
@SP
M=M+1
@LCL
D=M
@SP
A=M
M=D
@SP
M=M+1
@ARG
D=M
@SP
A=M
M=D
@SP
M=M+1
@THIS
D=M
@SP
A=M
M=D
@SP
M=M+1
@THAT
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
D=M
@0
D=D-A
@5
D=D-A
@ARG
M=D
@SP
D=M
@LCL
M=D
@Class1.get
0;JMP
(-INTERNAL.HACKVM.FUNCALLRET.3)
@-INTERNAL.HACKVM.FUNCALLRET.4
D=A
@SP
A=M
M=D
@SP
M=M+1
@LCL
D=M
@SP
A=M
M=D
@SP
M=M+1
@ARG
D=M
@SP
A=M
M=D
@SP
M=M+1
@THIS
D=M
@SP
A=M
M=D
@SP
M=M+1
@THAT
D=M
@SP
A=M
M=D
@SP
M=M+1
@SP
D=M
@0
D=D-A
@5
D=D-A
@ARG
M=D
@SP
D=M
@LCL
M=D
@Class2.get
0;JMP
(-INTERNAL.HACKVM.FUNCALLRET.4)
(WHILE)
@WHILE
0;JMP
| 5.012802 | 31 | 0.555619 |
c8138e06abe6121fc77eb6bc7ce70938e4d2f87b | 6,324 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_3071.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_3071.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_3071.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %rax
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0xaaf3, %rsi
lea addresses_WT_ht+0x1b8d9, %rdi
add %rdx, %rdx
mov $44, %rcx
rep movsl
nop
nop
nop
nop
nop
sub %rax, %rax
lea addresses_WC_ht+0x11d6c, %rbp
clflush (%rbp)
nop
nop
nop
and $31567, %r14
movw $0x6162, (%rbp)
nop
nop
nop
and %rcx, %rcx
lea addresses_WT_ht+0x9a01, %rbp
clflush (%rbp)
nop
nop
nop
sub %rdx, %rdx
movw $0x6162, (%rbp)
nop
nop
nop
nop
nop
and %rax, %rax
lea addresses_D_ht+0x9199, %rax
cmp %rbp, %rbp
movb (%rax), %r14b
dec %rbp
lea addresses_UC_ht+0x1aad9, %rdx
nop
nop
nop
xor %rcx, %rcx
movl $0x61626364, (%rdx)
and %rdi, %rdi
lea addresses_WC_ht+0xcd89, %rdi
nop
nop
add $53069, %rdx
mov (%rdi), %ebp
nop
nop
nop
nop
cmp %rax, %rax
lea addresses_A_ht+0x11319, %rbp
add $4302, %rcx
movb (%rbp), %dl
nop
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_WC_ht+0x10ed9, %rax
nop
nop
nop
xor $1307, %rsi
mov (%rax), %ebp
nop
nop
and $48985, %rdi
lea addresses_WT_ht+0x146d9, %rsi
lea addresses_WC_ht+0x15ad9, %rdi
nop
nop
nop
nop
nop
xor $11382, %r8
mov $60, %rcx
rep movsl
nop
nop
nop
nop
cmp $8238, %rax
lea addresses_WT_ht+0x196d9, %rsi
lea addresses_UC_ht+0x19f43, %rdi
nop
nop
nop
inc %rax
mov $76, %rcx
rep movsw
nop
nop
nop
sub %rax, %rax
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %rax
push %rbx
push %rdi
// Faulty Load
lea addresses_A+0x176d9, %r10
nop
inc %rdi
movb (%r10), %bl
lea oracles, %r13
and $0xff, %rbx
shlq $12, %rbx
mov (%r13,%rbx,1), %rbx
pop %rdi
pop %rbx
pop %rax
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_A', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
| 38.096386 | 2,999 | 0.657021 |
a97ef35dd29342f663043309af756c36498a3bc9 | 1,762 | asm | Assembly | programs/oeis/057/A057587.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/057/A057587.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/057/A057587.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A057587: Nonnegative numbers of form n*(n^2+-1)/2.
; 0,1,3,5,12,15,30,34,60,65,105,111,168,175,252,260,360,369,495,505,660,671,858,870,1092,1105,1365,1379,1680,1695,2040,2056,2448,2465,2907,2925,3420,3439,3990,4010,4620,4641,5313,5335,6072,6095,6900,6924,7800,7825,8775,8801,9828,9855,10962,10990,12180,12209,13485,13515,14880,14911,16368,16400,17952,17985,19635,19669,21420,21455,23310,23346,25308,25345,27417,27455,29640,29679,31980,32020,34440,34481,37023,37065,39732,39775,42570,42614,45540,45585,48645,48691,51888,51935,55272,55320,58800,58849,62475,62525,66300,66351,70278,70330,74412,74465,78705,78759,83160,83215,87780,87836,92568,92625,97527,97585,102660,102719,107970,108030,113460,113521,119133,119195,124992,125055,131040,131104,137280,137345,143715,143781,150348,150415,157182,157250,164220,164289,171465,171535,178920,178991,186588,186660,194472,194545,202575,202649,210900,210975,219450,219526,228228,228305,237237,237315,246480,246559,255960,256040,265680,265761,275643,275725,285852,285935,296310,296394,307020,307105,317985,318071,329208,329295,340692,340780,352440,352529,364455,364545,376740,376831,389298,389390,402132,402225,415245,415339,428640,428735,442320,442416,456288,456385,470547,470645,485100,485199,499950,500050,515100,515201,530553,530655,546312,546415,562380,562484,578760,578865,595455,595561,612468,612575,629802,629910,647460,647569,665445,665555,683760,683871,702408,702520,721392,721505,740715,740829,760380,760495,780390,780506,800748,800865,821457,821575,842520,842639,863940,864060,885720,885841,907863,907985,930372,930495,953250,953374,976500,976625
mov $3,1
mov $4,$0
add $0,1
lpb $0
sub $0,1
trn $2,2
add $1,$2
trn $2,$0
add $2,$0
trn $0,1
add $2,$3
add $3,3
lpe
lpb $4
add $1,1
sub $4,1
lpe
| 83.904762 | 1,543 | 0.798524 |
ca6c5a19b7b886aa5857db2b4732ab45a3611712 | 1,268 | asm | Assembly | projects/04/fill/Fill.asm | tanderegg/nand2tetris | 7c233e3558f4fe215842c64d43cbcc8dc2805b60 | [
"CC0-1.0"
] | null | null | null | projects/04/fill/Fill.asm | tanderegg/nand2tetris | 7c233e3558f4fe215842c64d43cbcc8dc2805b60 | [
"CC0-1.0"
] | null | null | null | projects/04/fill/Fill.asm | tanderegg/nand2tetris | 7c233e3558f4fe215842c64d43cbcc8dc2805b60 | [
"CC0-1.0"
] | null | null | null | // This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/04/Fill.asm
// Runs an infinite loop that listens to the keyboard input.
// When a key is pressed (any key), the program blackens the screen,
// i.e. writes "black" in every pixel. When no key is pressed, the
// program clears the screen, i.e. writes "white" in every pixel.
(LOOP)
// Get the current key
@24576
D=M
// Jump to WHITE if no key is pressed
@WHITE
D;JEQ
// Otherwise, set the screen to black
// Set D to the screen memory map address
@SCREEN
D=A
// Set pos to that value
@pos
M=D
(BLACKLOOP)
// Set D to 1
@1
D=A
// Set the value at pos to D
@pos
A=M
M=D
// Increment pos
@pos
M=M+1
D=M
// Keep looping until we've hit the end, 24576
@24576
D=D-A
@BLACKLOOP
D;JLT
@LOOP
0;JMP
(WHITE)
// Set D to the screen memory map address
@SCREEN
D=A
// Set pos to that value
@pos
M=D
(WHITELOOP)
// Set D to 0
@0
D=A
// Set the pixel at pos to 0 for white
@pos
A=M
M=D
// Increment pos
@pos
D=M
D=D+1
M=D
// Keep looping until we've hit the end, 8192
@24576
D=D-A
@WHITELOOP
D;JLT
@LOOP
0;JMP
| 13.489362 | 69 | 0.62776 |
92e9b5c286af94ccc2e34e712b34ab55b7881a2d | 886 | asm | Assembly | boot/04_stack.asm | musgravejw/OS | deaf471565ba6cea82cccd9e44bd14a017dab095 | [
"BSD-3-Clause"
] | 8 | 2019-11-09T19:14:04.000Z | 2021-11-24T15:02:38.000Z | boot/04_stack.asm | musgravejw/OS | deaf471565ba6cea82cccd9e44bd14a017dab095 | [
"BSD-3-Clause"
] | null | null | null | boot/04_stack.asm | musgravejw/OS | deaf471565ba6cea82cccd9e44bd14a017dab095 | [
"BSD-3-Clause"
] | 2 | 2019-11-10T06:26:57.000Z | 2021-06-25T17:24:51.000Z | ;
; A simple boot sector program that demonstrates the stack.
;
mov ah, 0x0e ; int 10/ah = 0eh -> scrolling teletype BIOS routine
mov bp, 0x8000 ; Set the base of the stack a little above where BIOS ; loads our boot sector - so it won’t overwrite us.
mov sp, bp
; Push some characters on the stack for later ; retreival. Note, these are pushed on as
; 16-bit values, so the most significant byte ; will be added by our assembler as 0x00.
push 'A'
push 'B'
push 'C'
; Note, we can only pop 16-bits, so pop to bx ; then copy bl (i.e. 8-bit char) to al
; print(al)
pop bx
mov al, bl
int 0x10
; Pop the next value
; print(al)
pop bx
mov al, bl
int 0x10
; To prove our stack grows downwards from bp,
; fetch the char at 0x8000 - 0x2 (i.e. 16-bits) ; print(al)
mov al, [0x7ffe]
int 0x10
; Jump forever.
jmp $
; Padding and magic BIOS number.
times 510-($-$$) db 0
dw 0xaa55
| 22.15 | 121 | 0.688488 |
837bdfa64060f73e805491b7940901bafe2c553b | 27 | asm | Assembly | tools/yasm/tests/nasm/global.asm | fasttr-org/ftr | ddba517fb53062d5dc919c94526607bb39bff4b9 | [
"BSD-3-Clause-Clear"
] | null | null | null | tools/yasm/tests/nasm/global.asm | fasttr-org/ftr | ddba517fb53062d5dc919c94526607bb39bff4b9 | [
"BSD-3-Clause-Clear"
] | null | null | null | tools/yasm/tests/nasm/global.asm | fasttr-org/ftr | ddba517fb53062d5dc919c94526607bb39bff4b9 | [
"BSD-3-Clause-Clear"
] | null | null | null | [common a 4]
[global a]
a:
| 6.75 | 12 | 0.592593 |
9f9a14c755f6f639149110c22fbc5a6d089b8d5b | 4,940 | asm | Assembly | mbr/bootloader.asm | anupcshan/internal | 5d31fd380528e9e6cecf99aa20055a413684bdbd | [
"BSD-3-Clause"
] | 6 | 2018-06-10T14:52:43.000Z | 2021-03-09T20:09:12.000Z | mbr/bootloader.asm | anupcshan/internal | 5d31fd380528e9e6cecf99aa20055a413684bdbd | [
"BSD-3-Clause"
] | 8 | 2017-07-22T08:26:04.000Z | 2021-06-19T18:35:51.000Z | mbr/bootloader.asm | anupcshan/internal | 5d31fd380528e9e6cecf99aa20055a413684bdbd | [
"BSD-3-Clause"
] | 5 | 2017-03-04T16:04:02.000Z | 2022-01-03T07:52:35.000Z | ; Minimal Linux Bootloader
; ========================
; @ author: Sebastian Plotz
; @ version: 1.0
; @ date: 24.07.2012
; Copyright (C) 2012 Sebastian Plotz
; Minimal Linux Bootloader is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
; Minimal Linux Bootloader 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 General Public License for more details.
; You should have received a copy of the GNU General Public License
; along with Minimal Linux Bootloader. If not, see <http://www.gnu.org/licenses/>.
; Memory layout
; =============
; 0x07c00 - 0x07dff Mininal Linux Bootloader
; + partition table
; + MBR signature
; 0x10000 - 0x17fff Real mode kernel
; 0x18000 - 0x1dfff Stack and heap
; 0x1e000 - 0x1ffff Kernel command line
; 0x20000 - 0x2fdff temporal space for
; protected-mode kernel
; base_ptr = 0x10000
; heap_end = 0xe000
; heap_end_ptr = heap_end - 0x200 = 0xde00
; cmd_line_ptr = base_ptr + heap_end = 0x1e000
org 0x7c00
cli
xor ax, ax
mov ds, ax
mov ss, ax
mov sp, 0x7c00 ; setup stack ...
mov ax, 0x1000
mov es, ax
sti
read_cmdline:
mov eax, 0x0001 ; load one sector
xor bx, bx ; no offset
mov cx, 0x1e00 ; load Kernel command line at 0x1e000
mov esi, cmd_lba
call read_from_hdd
read_kernel_bootsector:
mov eax, 0x0001 ; load one sector
xor bx, bx ; no offset
mov cx, 0x1000 ; load Kernel boot sector at 0x10000
mov esi, current_lba
call read_from_hdd
read_kernel_setup:
xor eax, eax
mov al, [es:0x1f1] ; no. of sectors to load
cmp ax, 0 ; 4 if setup_sects = 0
jne read_kernel_setup.next
mov ax, 4
.next:
mov bx, 512 ; 512 byte offset
mov cx, 0x1000
mov esi, current_lba
call read_from_hdd
check_version:
cmp word [es:0x206], 0x204 ; we need protocol version >= 2.04
jb error
test byte [es:0x211], 1
jz error
set_header_fields:
mov byte [es:0x210], 0xe1 ; set type_of_loader
or byte [es:0x211], 0x80 ; set CAN_USE_HEAP
mov word [es:0x224], 0xde00 ; set heap_end_ptr
;mov byte [es:0x226], 0x00 ; set ext_loader_ver
mov byte [es:0x227], 0x01 ; set ext_loader_type (bootloader id: 0x11)
mov dword [es:0x228], 0x1e000 ; set cmd_line_ptr
cld ; copy cmd_line
read_protected_mode_kernel:
mov edx, [es:0x1f4] ; edx stores the number of bytes to load
shl edx, 4
.loop:
cmp edx, 0
je run_kernel
cmp edx, 0xfe00 ; less than 127*512 bytes remaining?
jb read_protected_mode_kernel_2
mov eax, 0x7f ; load 127 sectors (maximum)
xor bx, bx ; no offset
mov cx, 0x2000 ; load temporary to 0x20000
mov esi, current_lba
call read_from_hdd
mov cx, 0x7f00 ; move 65024 bytes (127*512 byte)
call do_move
sub edx, 0xfe00 ; update the number of bytes to load
add word [gdt.dest], 0xfe00
adc byte [gdt.dest+2], 0
jmp short read_protected_mode_kernel.loop
read_protected_mode_kernel_2:
mov eax, edx
shr eax, 9
test edx, 511
jz read_protected_mode_kernel_2.next
inc eax
.next:
xor bx, bx
mov cx, 0x2000
mov esi, current_lba
call read_from_hdd
mov ecx, edx
shr ecx, 1
call do_move
run_kernel:
cli
mov ax, 0x1000
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov sp, 0xe000
jmp 0x1020:0
;; read_from_hdd:
;; ax: count in 512-byte sectors [1, 127]
;; bx: destination: offset
;; cx: destination: segment
;; esi: lba pointer (typically current_lba)
read_from_hdd:
push edx
mov [dap.count], ax
mov [dap.offset], bx
mov [dap.segment], cx
mov edx, [esi]
mov [dap.lba], edx
add [esi], eax ; update current_lba
mov ah, 0x42
mov si, dap
mov dl, 0x80 ; first hard disk
int 0x13
jc error
pop edx
ret
do_move:
push edx
push es
xor ax, ax
mov es, ax
mov ah, 0x87
mov si, gdt
int 0x15
jc error
pop es
pop edx
ret
error:
mov si, error_msg
msg_loop:
lodsb
and al, al
jz reboot
mov ah, 0xe
mov bx, 7
int 0x10
jmp short msg_loop
reboot:
xor ax, ax
int 0x16
int 0x19
jmp 0xf000:0xfff0 ; BIOS reset code
; Global Descriptor Table
gdt:
times 16 db 0
dw 0xffff ; segment limit
.src:
dw 0
db 2
db 0x93 ; data access rights
dw 0
dw 0xffff ; segment limit
.dest:
dw 0
db 0x10 ; load protected-mode kernel to 100000h
db 0x93 ; data access rights
dw 0
times 16 db 0
; Disk Address Packet
dap:
db 0x10 ; size of DAP
db 0 ; unused
.count:
dw 0 ; number of sectors
.offset:
dw 0 ; destination: offset
.segment:
dw 0 ; destination: segment
.lba:
dd 0 ; low bytes of LBA address
dd 0 ; high bytes of LBA address
error_msg db 'er', 0 ; /* FIXME: newline */
current_lba dd 8218 ; initialize to first LBA address
cmd_lba dd 8218 ; initialize to LBA address of cmdline.txt
| 20.497925 | 82 | 0.697166 |
c06a11fc72b157cf51ce4f18d7ac1b1e7fcbfcc0 | 1,102 | asm | Assembly | programs/oeis/022/A022841.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/022/A022841.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/022/A022841.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A022841: Beatty sequence for sqrt(7).
; 2,5,7,10,13,15,18,21,23,26,29,31,34,37,39,42,44,47,50,52,55,58,60,63,66,68,71,74,76,79,82,84,87,89,92,95,97,100,103,105,108,111,113,116,119,121,124,126,129,132,134,137,140,142,145,148,150,153,156,158,161,164,166,169,171,174,177,179,182,185,187,190,193,195,198,201,203,206,209,211,214,216,219,222,224,227,230,232,235,238,240,243,246,248,251,253,256,259,261,264,267,269,272,275,277,280,283,285,288,291,293,296,298,301,304,306,309,312,314,317,320,322,325,328,330,333,336,338,341,343,346,349,351,354,357,359,362,365,367,370,373,375,378,380,383,386,388,391,394,396,399,402,404,407,410,412,415,418,420,423,425,428,431,433,436,439,441,444,447,449,452,455,457,460,463,465,468,470,473,476,478,481,484,486,489,492,494,497,500,502,505,507,510,513,515,518,521,523,526,529,531,534,537,539,542,545,547,550,552,555,558,560,563,566,568,571,574,576,579,582,584,587,590,592,595,597,600,603,605,608,611,613,616,619,621,624,627,629,632,634,637,640,642,645,648,650,653,656,658,661
add $0,1
pow $0,2
mul $0,7
mov $1,3
lpb $0,1
trn $0,$1
add $1,2
lpe
sub $1,7
div $1,2
add $1,2
| 73.466667 | 961 | 0.718693 |
10b6386b747a3c704959f826f3120b94cfffaba6 | 1,890 | asm | Assembly | src/transition.asm | SlyryD/Beta-Quest | 97e0ff4214bf69e7993cc7ed87231592e2cebee9 | [
"MIT"
] | 1 | 2019-08-22T20:28:08.000Z | 2019-08-22T20:28:08.000Z | src/transition.asm | SlyryD/Beta-Quest | 97e0ff4214bf69e7993cc7ed87231592e2cebee9 | [
"MIT"
] | 2 | 2021-12-29T20:52:49.000Z | 2022-01-02T22:48:44.000Z | src/transition.asm | SlyryD/Beta-Quest | 97e0ff4214bf69e7993cc7ed87231592e2cebee9 | [
"MIT"
] | 2 | 2021-11-22T04:59:58.000Z | 2022-03-24T06:32:41.000Z | .org 0x8009A2B0
.area (0x8009A340 - 0x8009A2B0), 0
//a0 = Global Context
//a1 = screen transition effect
addiu sp, sp, 0xFFE0
sw ra, 0x0014(sp)
sw a0, 0x0020(sp)
andi t0, a1, -2 //drop least significant bit so that we can test for 0x0E and 0x0F
li at, 0x000E //sandstorm effect
bne t0, at, @skip_check
sw a1, 0x0024(sp)
b @check_if_object_loaded
nop
@return_check_if_object_loaded:
bgez v0, @skip_check
li at, 0x04 //replacement transition effect
sw at, 0x0024(sp)
@skip_check:
lw a2, 0x0020(sp)
li at, 0x121C8
addu a0, a2, at
sw a0, 0x0018(sp)
jal 0x80002E80
addiu a1, r0, 0x0250
//replacement
lw v0, 0x0024(sp)
lw a0, 0x0018(sp)
lw a2, 0x0020(sp)
addiu at, r0, 0x0001
sra t6, v0, 5
bne t6, at, @b_0x8009A368
sw v0, 0x0228(a0)
lui at, 0x800A
addiu t7, at, 0x8DEC
addiu t8, at, 0x8E18
addiu t9, at, 0x8C00
addiu t0, at, 0x9244
addiu t1, at, 0x8FA8
addiu t2, at, 0x8E24
addiu t3, at, 0x9250
addiu t4, at, 0x92A8
addiu t5, at, 0x92B4
.endarea
.org 0x8009A368
@b_0x8009A368:
.org 0x8009A390
.area (0x8009A3D0 - 0x8009A390), 0
@check_if_object_loaded:
li at, 0x117A4 //object table
addu a0, a0, at
jal 0x80081628 //check if object file is loaded
addiu a1, r0, 0x02 //gameplay_field_keep
b @return_check_if_object_loaded
nop
@transition_0_jump:
lui at, 0x800A
addiu t7, at, 0x8218
addiu t8, at, 0x82B8
addiu t9, at, 0x81E0
addiu t0, at, 0x8700
addiu t1, at, 0x83FC
addiu t2, at, 0x82C4
addiu t3, at, 0x83E4
addiu t4, at, 0x83D8
.endarea
.org 0x80108CEC
.word @transition_0_jump | 24.230769 | 89 | 0.579365 |
a78b91cb5bff4d4686db9f86ac6c1bb36babf394 | 597 | asm | Assembly | oeis/158/A158634.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/158/A158634.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/158/A158634.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A158634: a(n) = 46*n^2 - 1.
; Submitted by Christian Krause
; 45,183,413,735,1149,1655,2253,2943,3725,4599,5565,6623,7773,9015,10349,11775,13293,14903,16605,18399,20285,22263,24333,26495,28749,31095,33533,36063,38685,41399,44205,47103,50093,53175,56349,59615,62973,66423,69965,73599,77325,81143,85053,89055,93149,97335,101613,105983,110445,114999,119645,124383,129213,134135,139149,144255,149453,154743,160125,165599,171165,176823,182573,188415,194349,200375,206493,212703,219005,225399,231885,238463,245133,251895,258749,265695,272733,279863,287085,294399
add $0,1
pow $0,2
mul $0,46
sub $0,1
| 66.333333 | 496 | 0.79732 |
80f03ebb01cc5db0feeafd6e229b3c3182178242 | 548 | asm | Assembly | programs/oeis/112/A112929.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/112/A112929.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/112/A112929.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A112929: Number of squarefree integers less than the n-th prime.
; 1,2,3,5,7,8,11,12,15,17,19,23,26,28,30,32,36,37,41,44,45,49,51,55,60,61,63,66,67,70,77,80,83,85,91,92,95,99,102,104,108,109,116,117,120,121,129,138,140,141,144,148,149,153,157,161,165,166,169,171,173,179,187,190,191,193,203,206,211,212,213,218,222,225,228,231,234,240,243,248,255,256,262,263,268,270,274,279,281,283,286,293,298,300,305,308,311,319,320,329
seq $0,40 ; The prime numbers.
seq $0,107079 ; Minimal number of squared primes in a squarefree gap of length n.
sub $0,2
| 78.285714 | 357 | 0.724453 |
dc149b738812e33f3461217c06002fb8799fba9c | 2,447 | asm | Assembly | programs/oeis/193/A193248.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/193/A193248.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/193/A193248.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A193248: Truncated dodecahedron, and truncated icosahedron with faces of centered polygons.
; 1,93,455,1267,2709,4961,8203,12615,18377,25669,34671,45563,58525,73737,91379,111631,134673,160685,189847,222339,258341,298033,341595,389207,441049,497301,558143,623755,694317,770009,851011,937503,1029665,1127677,1231719,1341971,1458613,1581825,1711787,1848679,1992681,2143973,2302735,2469147,2643389,2825641,3016083,3214895,3422257,3638349,3863351,4097443,4340805,4593617,4856059,5128311,5410553,5702965,6005727,6319019,6643021,6977913,7323875,7681087,8049729,8429981,8822023,9226035,9642197,10070689,10511691,10965383,11431945,11911557,12404399,12910651,13430493,13964105,14511667,15073359,15649361,16239853,16845015,17465027,18100069,18750321,19415963,20097175,20794137,21507029,22236031,22981323,23743085,24521497,25316739,26128991,26958433,27805245,28669607,29551699,30451701,31369793,32306155,33260967,34234409,35226661,36237903,37268315,38318077,39387369,40476371,41585263,42714225,43863437,45033079,46223331,47434373,48666385,49919547,51194039,52490041,53807733,55147295,56508907,57892749,59299001,60727843,62179455,63654017,65151709,66672711,68217203,69785365,71377377,72993419,74633671,76298313,77987525,79701487,81440379,83204381,84993673,86808435,88648847,90515089,92407341,94325783,96270595,98241957,100240049,102265051,104317143,106396505,108503317,110637759,112800011,114990253,117208665,119455427,121730719,124034721,126367613,128729575,131120787,133541429,135991681,138471723,140981735,143521897,146092389,148693391,151325083,153987645,156681257,159406099,162162351,164950193,167769805,170621367,173505059,176421061,179369553,182350715,185364727,188411769,191492021,194605663,197752875,200933837,204148729,207397731,210681023,213998785,217351197,220738439,224160691,227618133,231110945,234639307,238203399,241803401,245439493,249111855,252820667,256566109,260348361,264167603,268024015,271917777,275849069,279818071,283824963,287869925,291953137,296074779,300235031,304434073,308672085,312949247,317265739,321621741,326017433,330452995,334928607,339444449,344000701,348597543,353235155,357913717,362633409,367394411,372196903,377041065,381927077,386855119,391825371,396838013,401893225,406991187,412132079,417316081,422543373,427814135,433128547,438486789,443889041,449335483,454826295,460361657,465941749
mov $4,$0
pow $0,3
mov $1,30
mul $1,$0
add $1,1
mov $2,$4
mul $2,17
add $1,$2
mov $3,$4
mul $3,$4
mov $2,$3
mul $2,45
add $1,$2
| 143.941176 | 2,223 | 0.86555 |
45312a9cd7cb46368caa2a87f4b02d414bd62389 | 432 | asm | Assembly | programs/oeis/025/A025765.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/025/A025765.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/025/A025765.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A025765: Expansion of 1/((1-x)(1-x^2)(1-x^9)).
; 1,1,2,2,3,3,4,4,5,6,7,8,9,10,11,12,13,14,16,17,19,20,22,23,25,26,28,30,32,34,36,38,40,42,44,46,49,51,54,56,59,61,64,66,69,72,75,78,81,84,87,90,93,96,100,103,107,110
add $0,7
lpb $0
sub $0,1
mov $1,$0
mov $0,1
pow $1,2
add $1,3
mov $2,1
mov $4,7
mov $5,7
lpe
add $1,6
mov $3,$0
div $5,$4
sub $4,$2
div $1,$4
div $1,6
mul $3,5
add $5,$3
add $1,$5
sub $1,6
mov $0,$1
| 16.615385 | 166 | 0.55787 |
6097f84e7056c2c4361fe05e0a4cebe5007de4e8 | 4,043 | asm | Assembly | src/asm/kernel/ServicesRoutines_Handlers.asm | EduardoCulau/MIPS_uC | 5ecc9d791dbbff16eed90268ecec1f61b76c344e | [
"MIT"
] | null | null | null | src/asm/kernel/ServicesRoutines_Handlers.asm | EduardoCulau/MIPS_uC | 5ecc9d791dbbff16eed90268ecec1f61b76c344e | [
"MIT"
] | null | null | null | src/asm/kernel/ServicesRoutines_Handlers.asm | EduardoCulau/MIPS_uC | 5ecc9d791dbbff16eed90268ecec1f61b76c344e | [
"MIT"
] | null | null | null | #Kernel com os handlers e rotinas de tratamento de interruptions (internas e externas)
#Tamanho da string de sistema
.eqv SYSTRING_SIZE 80
.text
InterruptionServiceRoutine:
#Salva contexto na pilha
Salvar_Contexto_ISR
#Verificar a origem da intr, informada pelo PIC.
la $t0, picAddrArray #Pega o end. do array de end. do PIC.
lw $t0, 0($t0) #Pega o end. do IRQ_ID.
la $t1, isrHandlersArray #Pega o array de end. dos handlers.
#Pegar vetor de interruption
lw $t0, 0($t0) #Pega o valor do IRQ_ID do PIC.
sw $t0, 116($sp) #Salvar na pilha para usos futuros.
#Indexa o vetor dos handlers e pega o end. do handler correspondente
sll $t0, $t0, 2 #Vetor x 4, para alinhar com a memoria
addu $t1, $t1, $t0 #Apontou para a position do handler correto.
lw $t1, 0($t1) #Pega o end. do handler.
#Saltar para handler correspondente.
jalr $t1
#Avisar o PIC que a intr foi tratada.
la $t0, picAddrArray #Pega o end. do array de end. do PIC.
lw $t0, 4($t0) #Pega o end. do INT_ACK.
lw $t1, 116($sp) #Pega o vetor de intr que foi salvo na pilha.
sw $t1, 0($t0) #Avisa PIC. Basta dar um store de qualqer valor no end. dele.
#Recupera contexto da pilha
Recuperar_Contexto_ISR
#Retorna da interruption
eret
#Incluir os handlers do rx
.include "../lib/kernel/rxHandler.asm"
#Incluir os handlers do timer
.include "../lib/kernel/timerHandler.asm"
#Incluir os handlers do btn
.include "../lib/kernel/btnHandler.asm"
#-------------------------------------------------------------------------------
.text
ExceptionServiceRoutine:
#Salva contexto na pilha
Salvar_Contexto_ESR
#Verificar a origem da exception para saltar.
#No caso tem de saltar para esrHandlersArray[CAUSE(6:2)]
la $t0, esrHandlersArray #Pega o array de end. dos handlers.
mfc0 $t1, $13 #Pegar vetor de excep do reg CAUSE.
#Extrai o campo ExcCode. CAUSE[6:2]
srl $t1, $t1, 2
andi $t1, $t1, 0xf
#Salvar o excCode no $k0 (kernel) para indexar o vetro de strings.
addu $k0, $zero, $t1
#Indexa o vetor dos handlers e pega o end. do handler correspondente
sll $t1, $t1, 2 #Vetor x 4, para alinhar com a memoria
addu $t1, $t1, $t0 #Apontou para a position do handler correto.
lw $t1, 0($t1) #Pega o end. do handler.
#Saltar para handler correspondente.
jalr $t1
#Recupera contexto da pilha
Recuperar_Contexto_ESR
#Retorna da exception
eret
#Incluir os handlers para as Exceptions
.include "../lib/kernel/exceptionsHandlers.asm"
.data
#Array de end. de handlers para a ISR.
isrHandlersArray: .word TIMER_Handler #Primeiro bit é nada.
RX_Handler #Handler do RX.
0 0 #Bit 2 e 3 nao tem nada.
PushButton_Handler #Handler do BTN.
0 0 0 #Bit 5 ate 7 nao tem nada.
#Array de end. de handlers para a ESR.
esrHandlersArray: .word 0
InvalidInstruction_Handler #[1]: Handler para InvalidInstruction
0 0 0 0 0 0
SYSCALL_Handler #[8]: Handler para Syscall
0 0 0
Overflow_Handler #[12]: Handler para Overflow
0 0
DivisionByZero_Handler #[15]: Handler para Division-by-zero
#Memoria compartilhada entre o hadler do RX e o syscal read. Assim eles podem se comunicar e trabalhar em conjunto.
pegouEnter: .word 0 #Saver se a read leu o que a RX escreveu na string.
systring: .space SYSTRING_SIZE #String para colocar o que chega no RX, e ser lida pela read.
#Memoria compartilhada entre o handler do timer e do BTN. Os contadores.
#E CE CD D
contadores: .word -1 -1 -1 -1
| 36.754545 | 119 | 0.596587 |
508795e91066d31998e68d7f722eba163643f6c9 | 7,656 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_21829_871.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.log_21829_871.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.log_21829_871.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r14
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x1eeb9, %rax
nop
nop
nop
nop
nop
sub %r12, %r12
movw $0x6162, (%rax)
nop
nop
dec %rdx
lea addresses_D_ht+0x2a39, %rax
nop
nop
nop
nop
add $12682, %r10
movups (%rax), %xmm7
vpextrq $1, %xmm7, %rcx
nop
nop
sub $3474, %rcx
lea addresses_WC_ht+0x1e839, %r10
nop
nop
xor $5944, %r12
mov (%r10), %ecx
nop
nop
nop
nop
nop
inc %rax
lea addresses_normal_ht+0x4eb9, %r12
and %r13, %r13
movw $0x6162, (%r12)
nop
nop
nop
nop
and $61850, %r14
lea addresses_D_ht+0x9c79, %rdx
nop
nop
nop
nop
cmp %rax, %rax
mov $0x6162636465666768, %r14
movq %r14, %xmm7
vmovups %ymm7, (%rdx)
nop
nop
cmp $11954, %r12
lea addresses_A_ht+0x1724d, %rsi
lea addresses_normal_ht+0x45b9, %rdi
nop
nop
nop
nop
nop
add %r14, %r14
mov $33, %rcx
rep movsw
nop
nop
nop
nop
inc %rdi
lea addresses_UC_ht+0x1aab9, %r14
nop
nop
nop
inc %rdi
mov (%r14), %r12w
nop
nop
nop
cmp %r13, %r13
lea addresses_WC_ht+0x7ad9, %rdi
nop
and %rax, %rax
and $0xffffffffffffffc0, %rdi
vmovaps (%rdi), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rcx
nop
nop
nop
nop
nop
add $32436, %r10
lea addresses_WT_ht+0x15bbd, %r12
nop
nop
nop
nop
inc %rsi
movl $0x61626364, (%r12)
nop
nop
dec %r12
lea addresses_normal_ht+0x140f9, %r10
nop
sub $30253, %r14
mov (%r10), %rcx
nop
nop
inc %rax
lea addresses_WT_ht+0xe71, %r13
dec %r14
movl $0x61626364, (%r13)
nop
nop
nop
cmp $61031, %r10
lea addresses_UC_ht+0x187a9, %r13
dec %r12
vmovups (%r13), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $1, %xmm5, %r10
nop
nop
nop
nop
nop
and $23169, %rsi
lea addresses_UC_ht+0x79b9, %r13
nop
nop
nop
nop
nop
add %r12, %r12
mov $0x6162636465666768, %rsi
movq %rsi, (%r13)
nop
nop
nop
xor $46192, %r13
lea addresses_D_ht+0x4bb9, %r10
nop
nop
cmp %r12, %r12
movb $0x61, (%r10)
and %rax, %rax
lea addresses_D_ht+0x1bbe1, %rsi
lea addresses_UC_ht+0x12de6, %rdi
clflush (%rsi)
nop
nop
and %r12, %r12
mov $40, %rcx
rep movsw
nop
nop
and %r12, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r14
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r8
push %r9
push %rdi
// Faulty Load
lea addresses_RW+0x186b9, %rdi
nop
add %r13, %r13
mov (%rdi), %r10w
lea oracles, %r8
and $0xff, %r10
shlq $12, %r10
mov (%r8,%r10,1), %r10
pop %rdi
pop %r9
pop %r8
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
| 33.578947 | 2,999 | 0.656348 |
6aa3eb827e320ee87a39fefef47d558b16ecabfc | 2,890 | asm | Assembly | c2000/C2000Ware_1_00_06_00/libraries/control/DCL/c28/source/DCL_DF13_C2C3.asm | ramok/Themis_ForHPSDR | d0f323a843ac0a488ef816ccb7c828032855a40a | [
"Unlicense"
] | null | null | null | c2000/C2000Ware_1_00_06_00/libraries/control/DCL/c28/source/DCL_DF13_C2C3.asm | ramok/Themis_ForHPSDR | d0f323a843ac0a488ef816ccb7c828032855a40a | [
"Unlicense"
] | null | null | null | c2000/C2000Ware_1_00_06_00/libraries/control/DCL/c28/source/DCL_DF13_C2C3.asm | ramok/Themis_ForHPSDR | d0f323a843ac0a488ef816ccb7c828032855a40a | [
"Unlicense"
] | 1 | 2021-07-21T08:10:37.000Z | 2021-07-21T08:10:37.000Z | ; DCL_DF13_C2C3.asm - Pre-computed Direct Form 1 implementation in third order
;
; Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
; ALL RIGHTS RESERVED
.if __TI_EABI__
.asg DCL_runDF13_C2, _DCL_runDF13_C2
.asg DCL_runDF13_C3, _DCL_runDF13_C3
.endif
.global _DCL_runDF13_C2
.global _DCL_runDF13_C3
.sect "dclfuncs"
; C prototype: float DCL_runDF13_C2(DCL_DF13 *p, float32_t ek, float32_t vk)
; argument 1 = *p : controller structure address [XAR4]
; argument 2 = ek : controller input [R0H]
; argument 3 = vk : partial product [R1H]
; return = uk : controller output [R0H]
_DCL_runDF13_C2:
.asmfunc
MOV32 R2H, *+XAR4[0] ; R2H = b0
MPYF32 R0H, R0H, R2H ; R0H = e(k) * b0
MOV AR0, #0x18 ; AR0 = 24
ADDF32 R0H, R0H, R1H ; R0H = u(k)
LRETR
.endasmfunc
; C prototype: float DCL_runDF13_C3(DF13 *p, float ek, float uk)
; argument 1 = *p : controller structure address [XAR4]
; argument 2 = ek : controller input [R0H]
; argument 3 = uk : controller output [R1H]
; return : v(k)
_DCL_runDF13_C3:
.asmfunc
; context save
PUSH XAR5
MOV32 *SP++, R4H
MOV32 *SP++, R5H
MOV32 *SP++, R6H
MOV32 *SP++, R7H
; initialise pointers
MOVL ACC, @XAR4 ; ACC = &p(0) = &b0
ADDB ACC, #0x10 ; ACC = &p(8) = &d0
MOVL XAR5, ACC ; XAR5 = &d0
MOV32 *XAR5++, R0H ; save d0, XAR5 = d1
; v1 = e(k) * b1
MOV32 R2H, *XAR4++ ; R2H = b0
MOV32 R2H, *XAR4++ ; R2H = b1
MPYF32 R3H, R2H, R0H ; R3H = v1
|| MOV32 R4H, *XAR5 ; R4H = d1
MOV32 *XAR5++, R0H ; save e(k-1)
; v2 = e(k-1) * b2
MOV32 R5H, *XAR4++ ; R5H = b2
MPYF32 R2H, R5H, R4H ; R2H = v2
|| MOV32 R6H, *XAR5 ; R6H = d2
MOV32 *XAR5++, R4H ; save e(k-2)
; v3 = e(k-3) * b3
MOV32 R5H, *XAR4++ ; R5H = b3
MPYF32 R7H, R5H, R6H ; R7H = v2
|| MOV32 *XAR5++, R6H ; save e(k-3)
; save v123
ADDF32 R0H, R3H, R2H ; R0H = v1 + v2
MOV32 R5H, *XAR4++ ; R5H = a0
ADDF32 R0H, R0H, R7H ; R0H = v1 + v2 + v3
|| MOV32 R5H, *XAR4++ ; R5H = a1
; v4 = u(k) * a1
MPYF32 R2H, R1H, R5H ; R2H = v4
|| MOV32 *XAR5++, R1H ; XAR5 = &d5
MOV32 R3H, *XAR5 ; R3H = d5
SUBF32 R0H, R0H, R2H ; R0H = v1 + v2 + v3 - v4
MOV32 *XAR5++, R1H ; save u(k-1)
; v5 = u(k-1) * a2
MOV32 R4H, *XAR4++ ; R4H = a2
MPYF32 R5H, R4H, R3H ; R5H = v5
|| MOV32 R1H, *XAR5 ; R2H = d6
MOV32 *XAR5++, R3H ; save u(k-2)
; v6 = u(k-2) * a3
SUBF32 R0H, R0H, R5H ; R0H = v1 + v2 + v3 - v4 - v5
|| MOV32 R6H, *XAR4 ; R6H = a3
MPYF32 R7H, R6H, R1H ; R7H = v7
MOV32 *XAR5, R1H ; save u(k-3)
SUBF32 R0H, R0H, R7H ; save v(k+1)
; context restore
MOV32 R7H, *--SP, UNCF ; do not parallel with previous SUBF32
MOV32 R6H, *--SP, UNCF
MOV32 R5H, *--SP, UNCF
MOV32 R4H, *--SP, UNCF
POP XAR5
LRETR
.endasmfunc
.end
; end of file
| 26.759259 | 78 | 0.574048 |
a824e141a2c937ad7cd4f6babe01587ade66395e | 6,532 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_1025.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_21829_1025.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_21829_1025.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r14
push %r15
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x126f3, %r11
nop
nop
nop
nop
nop
inc %r12
mov (%r11), %di
and $132, %r14
lea addresses_UC_ht+0xf7f3, %rsi
lea addresses_D_ht+0x1c3e3, %rdi
nop
add %r11, %r11
mov $126, %rcx
rep movsq
nop
nop
nop
xor $62005, %r12
lea addresses_normal_ht+0xe73f, %rsi
lea addresses_WT_ht+0x1100c, %rdi
nop
nop
nop
and %r12, %r12
mov $9, %rcx
rep movsb
nop
nop
xor %r14, %r14
lea addresses_WT_ht+0x14bb3, %rsi
lea addresses_normal_ht+0x9d73, %rdi
clflush (%rsi)
nop
and $25912, %r11
mov $70, %rcx
rep movsq
nop
nop
nop
nop
nop
and $29471, %rcx
lea addresses_UC_ht+0x8ab3, %rsi
lea addresses_D_ht+0xd73, %rdi
nop
nop
sub %r15, %r15
mov $80, %rcx
rep movsb
nop
sub $2201, %r12
lea addresses_WC_ht+0x6ead, %rsi
lea addresses_D_ht+0x8f53, %rdi
nop
nop
sub $3701, %r10
mov $39, %rcx
rep movsq
nop
nop
nop
sub $34386, %rcx
lea addresses_normal_ht+0x48d3, %rcx
nop
nop
nop
nop
add %rsi, %rsi
movb (%rcx), %r11b
nop
xor $44722, %r10
lea addresses_UC_ht+0x10c1b, %rsi
nop
cmp %r12, %r12
mov (%rsi), %r15d
nop
nop
nop
nop
dec %rsi
lea addresses_UC_ht+0xb2b3, %r15
nop
nop
sub %r11, %r11
movl $0x61626364, (%r15)
nop
nop
cmp %rdi, %rdi
lea addresses_WC_ht+0x19edb, %rcx
nop
nop
nop
nop
nop
cmp %r11, %r11
vmovups (%rcx), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %rsi
nop
nop
sub $45801, %r12
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r9
push %rbx
push %rdx
// Faulty Load
lea addresses_WC+0x1ad73, %rdx
nop
nop
nop
nop
nop
inc %r13
movups (%rdx), %xmm4
vpextrq $0, %xmm4, %r12
lea oracles, %rbx
and $0xff, %r12
shlq $12, %r12
mov (%rbx,%r12,1), %r12
pop %rdx
pop %rbx
pop %r9
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': True}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'38': 21829}
38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38
*/
| 37.976744 | 2,999 | 0.660288 |
432f020dd6ad61fe08c25e94c1e604e4240dc866 | 1,086 | asm | Assembly | _maps/Prison Capsule.asm | kodishmediacenter/msu-md-sonic | 3aa7c5e8add9660df2cd0eceaa214e7d59f2415c | [
"CC0-1.0"
] | 9 | 2021-01-15T13:47:53.000Z | 2022-01-17T15:33:55.000Z | _maps/Prison Capsule.asm | kodishmediacenter/msu-md-sonic | 3aa7c5e8add9660df2cd0eceaa214e7d59f2415c | [
"CC0-1.0"
] | 7 | 2021-01-14T02:18:48.000Z | 2021-03-24T15:44:30.000Z | _maps/Prison Capsule.asm | kodishmediacenter/msu-md-sonic | 3aa7c5e8add9660df2cd0eceaa214e7d59f2415c | [
"CC0-1.0"
] | 2 | 2021-01-14T13:14:26.000Z | 2021-01-29T17:46:04.000Z | ; ---------------------------------------------------------------------------
; Sprite mappings - prison capsule
; ---------------------------------------------------------------------------
Map_Pri_internal:
dc.w @capsule-Map_Pri_internal
dc.w @switch1-Map_Pri_internal
dc.w @broken-Map_Pri_internal
dc.w @switch2-Map_Pri_internal
dc.w @unusedthing1-Map_Pri_internal
dc.w @unusedthing2-Map_Pri_internal
dc.w @blank-Map_Pri_internal
@capsule: dc.b 7
dc.b $E0, $C, $20, 0, $F0
dc.b $E8, $D, $20, 4, $E0
dc.b $E8, $D, $20, $C, 0
dc.b $F8, $E, $20, $14, $E0
dc.b $F8, $E, $20, $20, 0
dc.b $10, $D, $20, $2C, $E0
dc.b $10, $D, $20, $34, 0
@switch1: dc.b 1
dc.b $F8, 9, 0, $3C, $F4
@broken: dc.b 6
dc.b 0, 8, $20, $42, $E0
dc.b 8, $C, $20, $45, $E0
dc.b 0, 4, $20, $49, $10
dc.b 8, $C, $20, $4B, 0
dc.b $10, $D, $20, $2C, $E0
dc.b $10, $D, $20, $34, 0
@switch2: dc.b 1
dc.b $F8, 9, 0, $4F, $F4
@unusedthing1: dc.b 2
dc.b $E8, $E, $20, $55, $F0
dc.b 0, $E, $20, $61, $F0
@unusedthing2: dc.b 1
dc.b $F0, 7, $20, $6D, $F8
@blank: dc.b 0
even | 29.351351 | 77 | 0.479742 |
3c94ff675864413909c0e86fedf80009d9120d3c | 80,948 | asm | Assembly | MH6502-4/ASM/monitor.asm | FredericSegard/Micro-Hobbyist | 4074e5d91154db92efedda5952a58f48531b4cf3 | [
"MIT"
] | null | null | null | MH6502-4/ASM/monitor.asm | FredericSegard/Micro-Hobbyist | 4074e5d91154db92efedda5952a58f48531b4cf3 | [
"MIT"
] | null | null | null | MH6502-4/ASM/monitor.asm | FredericSegard/Micro-Hobbyist | 4074e5d91154db92efedda5952a58f48531b4cf3 | [
"MIT"
] | null | null | null | ; _ _
; __ _ __| | __| | _ __ ___ ___ ___
; / _` | / _` | / _` | | '__| / _ \ / __| / __|
; | (_| | | (_| | | (_| | | | | __/ \__ \ \__ \
; \__,_| \__,_| \__,_| |_| \___| |___/ |___/
;
; Set current address
; ----------------------------------------------------------------------------------------------------------------------------------
cur_address:
lda IN_BUFFER,y ; Read a character from the input buffer
beq cur_addr_default ; End of buffer (0)? Then get default address
cmp #" " ; Is it the space delimiter?
beq cur_addr_help ; Yes it is. Then check if its a help request, or an address
jmp syntax_error ; If anything else, print a syntax error, and end routine
cur_addr_help:
jsr skip_spaces ; Skip any leading spaces
lda IN_BUFFER, y ; Read a character from the input buffer
beq cur_addr_default ; End of buffer? Then get default address
cmp #"?" ; Is help requested?
bne cur_addr_get ; No, then get address
printString help_address ; *MACRO*
rts
cur_addr_default: ; IF NO ADDRESS PROVIDED, SET IT TO $0000
stz CUR_ADDR+1 ; Set MSB address as 00
stz CUR_ADDR ; Set LSB address as 00
rts ;
cur_addr_get: ; GET START ADDRESS
;jsr skip_spaces ; skip leading spaces if any
jsr get_word ; Get address from the input buffer
bcs cur_addr_get2
jmp invalid_address ; Print error message and exit
cur_addr_get2:
lda WORD+1 ; Store word as address
sta CUR_ADDR+1 ;
lda WORD ;
sta CUR_ADDR ;
rts
; _ _
; __ _ ___ ___ ___ _ __ ___ | |__ | | ___
; / _` | / __| / __| / _ \ | '_ ` _ \ | '_ \ | | / _ \
; | (_| | \__ \ \__ \ | __/ | | | | | | | |_) | | | | __/
; \__,_| |___/ |___/ \___| |_| |_| |_| |_.__/ |_| \___|
; Assemble code to memory
; ----------------------------------------------------------------------------------------------------------------------------------
assemble:
rts
; _ _
; | |__ _ __ ___ __ _ | | __
; | '_ \ | '__| / _ \ / _` | | |/ /
; | |_) | | | | __/ | (_| | | <
; |_.__/ |_| \___| \__,_| |_|\_\
; Set or restore break-point
; ----------------------------------------------------------------------------------------------------------------------------------
break:
rts
; _ _
; ___ | | ___ ___ | | __
; / __| | | / _ \ / __| | |/ /
; | (__ | | | (_) | | (__ | <
; \___| |_| \___/ \___| |_|\_\
;
; ----------------------------------------------------------------------------------------------------------------------------------
; Reads or sets the time (RTC chip)
; T
; T YY-MM-DD D HH:MM:SS
clock:
; CHECK FOR EOF AND " " DELIMITER
lda IN_BUFFER,y ; Read a character from the input buffer
beq read_time ; End of buffer (0)? Then get default address
cmp #" " ; Is it the space delimiter?
beq clock_help ; Yes it is. Then check if its a help request
jmp syntax_error ; If anything else, print a syntax error, and end routine
clock_help:
jsr skip_spaces ; Skip any leading spaces
lda IN_BUFFER, y ; Read a character from the input buffer
beq read_time ; End of buffer? Then read clock
cmp #"?" ; Is help requested?
bne set_time ; No, then set
printString help_clock ; *MACRO*
rts
read_time:
lda #SHORT
jsr print_date
lda #" "
jsr print_char
jsr print_char
jsr print_char
lda #24 ; 24 hour time format
jsr print_time
lda #CR
jsr print_char
jsr print_char
rts
; GET THE DATE AND TIME - DELIMITER FORMATING IS STRICT AND IN BCD
set_time:
lda #$80 ; b7 = Write bit
sta RTC_CTRL ; Set the RTC control register to write mode
set_time_year:
; GET AND STORE YEAR (0-99)
jsr skip_spaces
jsr get_byte ; Get the year
bcs st_yr ; If it's valid dataProceed to store value
jmp set_time_help ; If there's an error, then print help
st_yr: sta RTC_YEAR ; Store result in RTCs year register
set_time_month:
; GET AND STORE MONTH (1-12)
lda IN_BUFFER,y ; Get next character
iny
inc ERROR_PTR
cmp #"-" ; Expect a dash delimiter character
beq st_mo1 ; If present, go fetch month
jmp set_time_help ; If error, then print help
st_mo1: jsr get_byte ; Get the BCD characters
bcs st_mo2 ; It's 0, then proceed to store the value
jmp set_time_help ; It's 1, an error, then print help
st_mo2: sta RTC_MONTH ; Store result in RTCs month register
set_time_date:
; GET AND STORE DATE (1-31)
lda IN_BUFFER,y ; Get next character
iny
inc ERROR_PTR
cmp #"-" ; Expect a dash delimiter character
beq st_dt1 ; If present, go fetch date
jmp set_time_help ; Print help
st_dt1: jsr get_byte ; Get the characters
bcs st_dt2 ; It's 0, then proceed to store the value
jmp set_time_help ; It's 1, an error, then print help
st_dt2: sta RTC_DATE ; Store result in RTCs date register
set_time_day:
; GET AND STORE DAY (1-7) (Sunday-Saturday)
lda IN_BUFFER,y ; Get next character
iny ; Increment buffer index
inc ERROR_PTR
cmp #" " ; Expect a space delimiter character
beq st_day ; If present, go fetch date
jmp set_time_help ; If error, then print help
st_day: jsr get_nibble ; get a single digit
sta RTC_DAY ; Store result on RTCs day register
set_time_hours:
; GET AND STORE HOUR (0-23)
lda IN_BUFFER,y ; Get next character
iny
inc ERROR_PTR
cmp #" " ; Expect a space delimiter character
beq st_hr1 ; If present, go fetch date
jmp set_time_help ; It's 1, an error, then print help
st_hr1: jsr get_byte ; Get the BCD characters
bcs st_hr2 ; It's 0, then proceed to store the value
jmp set_time_help ; It's 1, an error, then print help
st_hr2: sta RTC_HOURS ; Store result in RTCs date register
set_time_minutes:
; GET AND STORE MINUTE (0-59)
lda IN_BUFFER,y ; Get next character
iny
inc ERROR_PTR
cmp #":" ; Expect a colon delimiter character
beq st_mi1 ; If present, go fetch date
jmp set_time_help ; It's 1, an error, then print help
st_mi1: jsr get_byte ; Get the BCD characters
bcs st_mi2 ; It's 0, then proceed to store the value
jmp set_time_help ; It's 1, an error, then print help
st_mi2: sta RTC_MINUTES ; Store result in RTCs date register
set_time_seconds:
; GET AND STORE SECONDS (0-59)
lda IN_BUFFER,y ; Get next character
iny
inc ERROR_PTR
cmp #":" ; Expect a colon delimiter character
beq st_se1 ; If present, go fetch date
jmp set_time_help ; It's 1, an error, then print help
st_se1: jsr get_byte ; Get the BCD characters
bcs st_se2 ; It's 0, then proceed to store the value
jmp set_time_help ; It's 1, an error, then print help
st_se2: sta RTC_SECONDS ; Store result in RTCs date register
bra set_time_end
set_time_help:
jsr error_pointer
printString time_error ; *MACRO*
set_time_end:
stz RTC_CTRL ; Clear the RTC control register
rts
; ___ ___ _ __ ___ _ __ __ _ _ __ ___
; / __| / _ \ | '_ ` _ \ | '_ \ / _` | | '__| / _ \
; | (__ | (_) | | | | | | | | |_) | | (_| | | | | __/
; \___| \___/ |_| |_| |_| | .__/ \__,_| |_| \___|
; |_|
; ----------------------------------------------------------------------------------------------------------------------
compare:
rts
; ___ ___ _ __ _ _
; / __| / _ \ | '_ \ | | | |
; | (__ | (_) | | |_) | | |_| |
; \___| \___/ | .__/ \__, |
; |_| |___/
; Copy / Move a portion of memory to another location
; ----------------------------------------------------------------------------------------------------------------------
copy:
rts
; _ _ _ _
; __| | (_) __ _ __ _ _ __ ___ ___ | |_ (_) ___ ___
; / _` | | | / _` | / _` | | '_ \ / _ \ / __| | __| | | / __| / __|
; | (_| | | | | (_| | | (_| | | | | | | (_) | \__ \ | |_ | | | (__ \__ \
; \__,_| |_| \__,_| \__, | |_| |_| \___/ |___/ \__| |_| \___| |___/
; |___/
;
; Diagnose RAM and peripherals
; ----------------------------------------------------------------------------------------------------------------------
; DESTROYS: A, X, Y, MON_TEMP
diagnostics:
; CHECK FOR EOF AND " " DELIMITER
lda IN_BUFFER,y ; Read a character from the input buffer
beq diag_start ; End of buffer (0)? Then start diagnostics
cmp #" " ; Is it the space delimiter?
beq diag_help ; Yes it is. Then check if its a help request
jmp syntax_error ; If anything else, print a syntax error, and end routine
diag_help:
jsr skip_spaces ; Skip any leading spaces
lda IN_BUFFER, y ; Read a character from the input buffer
beq diag_start ; End of buffer? Then start diagnostics
cmp #"?" ; Is help requested?
bne diag_start ; No, then set
printString help_diag ; *MACRO*
rts
diag_start:
sei ; Deactivate interrupts
stz DIAG_TEMP+1 ; Used to detect skip test
; ZERO-PAGE RAM TEST
; ------------------
diag_zeropage:
; PRINT MESSAGE
printString diag_zeropage_msg ; *MACRO*
ldx #$00 ; Set start address pointer
diag_zeropage55:
; TEST WITH 55
lda $00,x ; Load value stored at memory location pointed by x
sta DIAG_TEMP ; Save it
lda #$55 ; Load value 55 test pattern
sta $00,x ; Store test pattern in memory location
lda $00,x ; Reload test pattern from memory
cmp #$55 ; Compare it to the original test pattern
beq diag_zeropageAA ; If equal, test next pattern
jmp diag_error ; If not, print error, and end routine
diag_zeropageAA:
; TEST WITH AA
lda #$AA ; Load value AA test pattern
sta $00,x ; Store test pattern in memory location
lda $00,x ; Reload test pattern from memory
cmp #$AA ; Compare it to the original test pattern
beq diag_zeropage_restore ; If equal, restore data back to ram
jmp diag_error ; If not, print error, and end routine
diag_zeropage_restore:
; RESTORE DATA AND LOOP
lda DIAG_TEMP ; Restore data
sta $00,x ; Save value back to zeropage
inx ; Increment address pointer
bne diag_zeropage55 ; If rolled back to 0, then test stack RAM, else test next location
jsr diag_ok
; STACK PAGE RAM TEST
; -------------------
diag_stack:
printString diag_stack_msg ; *MACRO*
ldx #$00 ; Set start address pointer
diag_stack55:
lda $0100,x ; Load value storet at memory location pointed by x
sta DIAG_TEMP ; Store it
lda #$55 ; Load value 55 test pattern
sta $0100,x ; Store test pattern in memory location
lda $0100,x ; Reload test pattern from memory
cmp #$55 ; Compare it to the original test pattern
beq diag_stackAA ; If equal, test next pattern
jmp diag_error ; If not, print error, and end routine
diag_stackAA:
lda #$AA ; Load value AA test pattern
sta $0100,x ; Store test pattern in memory location
lda $0100,x ; Reload test pattern from memory
cmp #$AA ; Compare it to the original test pattern
beq diag_stack_restore ; If equal, restore data back to ram
jmp diag_error ; If not, print error, and end routine
diag_stack_restore:
lda DIAG_TEMP ; Restore data from stack
sta $0100,x ; Save value back to stack
inx ; Increment address pointer
bne diag_stack55 ; If rolled back to 0, then test stack RAM, else test next location
jsr diag_ok
; SYSTEM RAM TEST
; ---------------
diag_ramtest: ; SYTEM RAM TEST
printString diag_ramtest_msg ; *MACRO*
lda #>START_RAM ; Load start address (MSB)
sta CUR_ADDR+1 ; Save start address accessed (MSB)
jsr print_byte ; Print MSB of start address
lda #<START_RAM ; Load start address (LSB)
sta CUR_ADDR ; Save start address accessed (LSB)
jsr print_byte ; Print LSB of start address
lda #"-" ;
jsr print_char ; Print dash
lda #>END_RAM ; Load end address (MSB)
sta DES_ADDR+1 ; Save end address (MSB)
jsr print_byte ; Print MSB of end address
lda #<END_RAM ; Load end address (LSB)
sta DES_ADDR ; Save end address (LSB)
jsr print_byte ; Print LSB of end address
lda #":" ;
jsr print_char ; Print colon
jsr diag_memtest ; Execute RAM diagnostics
; bcc diag_bankramtest
bcc diag_nvramtest
jsr diag_ok
; BANK RAM TEST
; -------------
;diag_bankramtest: ; BANK RAM TEST
; lda DIAG_TEMP+1
; beq diag_bankramtest2
; jmp diag_end
;diag_bankramtest2:
; printString diag_bankramtest_msg; *MACRO*
; lda #>START_BANKRAM ; Load start address (MSB)
; sta CUR_ADDR+1 ; Save start address accessed (MSB)
; jsr print_byte ; Print MSB of start address
; lda #<START_BANKRAM ; Load start address (LSB)
; sta CUR_ADDR ; Save start address accessed (LSB)
; jsr print_byte ; Print LSB of start address
; lda #"-" ;
; jsr print_char ; Print dash
; lda #>END_BANKRAM ; Load end address (MSB)
; sta DES_ADDR+1 ; Save end address (MSB)
; jsr print_byte ; Print MSB of end address
; lda #<END_BANKRAM ; Load end address (LSB)
; sta DES_ADDR ; Save end address (LSB)
; jsr print_byte ; Print LSB of end address
; lda #":" ;
; jsr print_char ; Print colon
; lda #" " ;
; jsr print_char ; Print space
; ldx #NUMBER_OF_BANKS ; Setup bank counter to point to first bank
;diag_banktest: ;
; lda #>START_BANKRAM ; Reload start address (MSB)
; sta CUR_ADDR+1 ; Save start address accessed (MSB)
; lda #<START_BANKRAM ; Reload start address (LSB)
; sta CUR_ADDR ; Save start address accessed (LSB)
; txa ; Transfer bank counter to A
; sta BANK_SEL ; Change bank
; sta BIN
; jsr bin2bcd8
; lda BCD
; jsr print_byte ; Print space
; jsr diag_memtest ; Execute current bank RAM diagnostics
; bcc diag_end ; There was an error, exit
; ldy #2 ; Set backspace counter to 2
; jsr delete_char ; Delete 2 characters from terminal
; dex ; Decrement bank numbers
; bne diag_banktest ; If not finished, then continue testing more banks
; ldy #1 ; Set backspace counter to 1
; jsr delete_char ; Delete a characters from terminal
; jsr diag_ok
; NVRAM TEST
; ----------
diag_nvramtest:
lda DIAG_TEMP+1
bne diag_end
printString diag_nvramtest_msg ; *MACRO*
lda #>START_NVRAM ; Load start address (MSB)
sta CUR_ADDR+1 ; Save start address accessed (MSB)
jsr print_byte ; Print MSB of start address
lda #<START_NVRAM ; Load start address (LSB)
sta CUR_ADDR ; Save start address accessed (LSB)
jsr print_byte ; Print LSB of start address
lda #"-" ;
jsr print_char ; Print dash
lda #>END_NVRAM ; Load end address (MSB)
sta DES_ADDR+1 ; Save end address (MSB)
jsr print_byte ; Print MSB of end address
lda #<END_NVRAM ; Load end address (LSB)
sta DES_ADDR ; Save end address (LSB)
jsr print_byte ; Print LSB of end address
lda #":" ;
jsr print_char ; Print colon
jsr diag_memtest ; Execute RAM diagnostics
bcc diag_end
jsr diag_ok
diag_end:
stz CUR_ADDR ; Reset default address to $0000
stz CUR_ADDR+1 ;
cli ; Restore interrupt
rts
; Diagnostics subroutines
diag_memtest:
; TEST MEMORY LOCATIONS
lda (CUR_ADDR) ; Read a byte from memory
sta MON_TEMP ; Store byte to retrieve it back later
lda #$55 ; Load 55
sta DIAG_TEMP ; Save for diag_error
sta (CUR_ADDR) ; Store value
lda (CUR_ADDR) ; Read value
cmp #$55 ; Is the result the same as the loaded value?
beq diag_memtest2 ; Yes, go to next test
jmp diag_error ; No, print error
diag_memtest2:
lda #$AA ; Load AA
sta DIAG_TEMP ; Save for diag_error
sta (CUR_ADDR) ; Store value
lda (CUR_ADDR) ; Read value
cmp #$AA ; Is the result the same as the loaded value?
beq diag_memtest_ok ; Yes, go and print OK
jmp diag_error ; No, print error
diag_memtest_ok:
lda MON_TEMP ; Restore original byte
sta (CUR_ADDR) ; And write it back to memory
; ; HAS THE ESCAPE KEY BEEN PRESSED
; jsr read_char ; Get a character from the terminal, if available
; bcs diag_key_read ; If one is present, interpret keystroke
; jsr read_keyboard ; Get a character from the PS/2 keyboard buffer, if available
; bcs diag_key_read ; Loop until one is present
; bra diag_mem_test_continue
;diag_key_read:
; cmp #ESC
; bne diag_mem_test_continue
; ldy 2
; jsr delete_char
; jsr diag_skip_test
; inc DIAG_TEMP+1
; ldx #0
; sec
; rts
;diag_mem_test_continue:
lda DES_ADDR+1
cmp CUR_ADDR+1
bne diag_memtest_next ;
lda DES_ADDR
cmp CUR_ADDR
bne diag_memtest_next ;
sec
rts
diag_memtest_next:
jsr inc_cur_addr ; Increment current address to next
bra diag_memtest
diag_skip_test:
printString diag_skip_test_msg ; *MACRO*
diag_error:
; PRINT ERROR MESAGE
lda #CR
jsr print_char ; Change line
printString diag_ram_error_msg ; *MACRO*
lda CUR_ADDR+1 ; Load the MSB address where the error is
jsr print_byte ; Print MSB
lda CUR_ADDR ; Load the LSB address where the error is
jsr print_byte ; Print LSB
lda #":"
jsr print_char ; Print colon
lda (CUR_ADDR) ; Get content located at address where error is
jsr print_byte ; Print the content
printString diag_ram_error2_msg ; *MACRO*
lda DIAG_TEMP ; Restore exected value from stack (was in X)
jsr print_byte ; Print expected result
lda #CR ;
jsr print_char ; Print carriage return
clc ; Clear carry to declare error
jmp diag_end
diag_ok:
; PRINT OK MESSAGE
lda #" "
jsr print_char
lda #"O"
jsr print_char
lda #"K"
jsr print_char
lda #CR
jsr print_char
rts
; ____ _ _ _
; | _ \ (_) ___ __ _ ___ ___ ___ _ __ ___ | |__ | | ___
; | | | | | | / __| / _` | / __| / __| / _ \ | '_ ` _ \ | '_ \ | | / _ \
; | |_| | | | \__ \ | (_| | \__ \ \__ \ | __/ | | | | | | | |_) | | | | __/
; |____/ |_| |___/ \__,_| |___/ |___/ \___| |_| |_| |_| |_.__/ |_| \___|
;
; Disassembles code in memory
; ----------------------------------------------------------------------------------------------------------------------
disassemble:
; GET COMMAND LINE START ADDRESS IF ANY
; -------------------------------------
dis_read_cmd_line: ; CHECK FOR EOL AND " " DELIMITER
lda IN_BUFFER,y ; Read a character from the input buffer
beq dis_default_addr ; Is it end of buffer (0)? Yes, so use default address (CUR_ADDR)
cmp #" " ; Is it the space delimiter?
beq dis_start_addr ; Yes it is. Then go read an address
jsr syntax_error ; If anything else, print a syntax error
jmp disassemble_end ; Go to end of routine
dis_default_addr: ; IF NO ADDRESS PROVIDED, GET CUR ADDRESS USED
lda CUR_ADDR+1 ; Read the MSB's last address used
sta SRC_ADDR+1 ; Store it as the start address
lda CUR_ADDR ; Read the LSB's last address used
sta SRC_ADDR ; Store it as the start address
bra dis_start ; Go grab the end address, if there is one
dis_start_addr: ; GET START ADDRESS
jsr skip_spaces ; skip leading spaces if any
jsr get_word ; Get address from the input buffer
bcs dis_store_start ; Valid word is present, store address
jsr invalid_address ; Display invalid address message
jmp disassemble_end ; No valid word is present, then send end parsing
dis_store_start: ; STORE START ADDRESS
lda WORD ; Load LSB from get_word
sta SRC_ADDR ; Store LSB to start address register
sta CUR_ADDR ; Store it in the current address (LSB)
lda WORD+1 ; Load MSB from get_word
sta SRC_ADDR+1 ; Store MSB to start address register
sta CUR_ADDR+1 ; Store it in the current address (MSB)
dis_start:
stz MON_TEMP+1 ; Set line counter to 0
; PRINT ADDRESS, OPCODE AND OPERAND VALUES
dis_print_line:
; PRINT ADDRESS
lda CUR_ADDR+1 ; Load address MSB
jsr print_byte ; Prints MSB
lda CUR_ADDR ; Load address LSB
jsr print_byte ; Prints LSB
lda #":" ; Fetch colon ":" delimiter for byte display
jsr print_char ; Print it
lda #" " ; Fetch the space character
jsr print_char ; Print it
; PRINT NUMERICAL OPCODE
lda (CUR_ADDR) ; Get opcode
sta OPCODE ; Save opcode for later use
tax ; Keep x to get addressing mode later
jsr print_byte ; Print opcode byte
lda #" " ; Print a space...
jsr print_char ; ... to separate opcode from operand
jsr inc_cur_addr ; Go to next address
; DETERMINE NUMBER OF BYTES FOR THAT INSTRUCTION
lda dis_addressing,x ; Get the addressing mode
sta ADDR_MODE ; Store addressing mode for later use
cmp #2 ; Is it a 1-byte instruction?
bcc dis_print_7_spaces ; Yes, then print some spaces to align to mnemonic print
cmp #10 ; Does instruction have a single byte operand?
bcc dis_print_1_operand ; Yes, print single-byte operand
bra dis_print_2_operands ; No, print a 2-byte operand
dis_print_1_operand:
; READ OPERAND
lda (CUR_ADDR) ; Load operand
sta OPERAND1 ; Store it in a variable for later use
jsr print_byte ; Output it to screen
jsr inc_cur_addr ; Go to next address
bra dis_print_5_spaces ; Print some spaces to align to mnemonic print
dis_print_2_operands:
; READ TWO OPERANDS
lda (CUR_ADDR) ; Load first operand
sta OPERAND1 ; Store it in a variable for later use
jsr print_byte ; Output it to screen
lda #" " ; Print a space
jsr print_char ;
jsr inc_cur_addr ; Go to next address
lda (CUR_ADDR) ; Load second operand
sta OPERAND2 ; Store it in a variable for later use
jsr print_byte ; Output it to screen
lda #" " ; Print two spaces
jsr print_char ;
jsr print_char ;
jsr inc_cur_addr ; Go to next address
bra dis_print_mnemonic
dis_print_7_spaces:
lda #" "
jsr print_char
jsr print_char
dis_print_5_spaces:
lda #" "
jsr print_char
jsr print_char
jsr print_char
jsr print_char
jsr print_char
; PRINT OPCODE'S MNEMONIC (OpCode mnemonics are divided into 4 tables of 64 opcodes, equaling 256 bytes per table)
dis_print_mnemonic:
lda OPCODE
cmp #$40 ; Read first block of mnemonic
bcc dis_print_block1
cmp #$80 ; Read second block of mnemonic
bcc dis_print_block2
cmp #$C0 ; Read third block of mnemonic
bcc dis_print_block3
bra dis_print_block4 ; Read fourth block of mnemonic
dis_print_block1:
asl ; Multiply by 2, two times...
asl ; ... to create a 4 byte offset
tax ; Accumulator becomes the index
lda dis_mnemonic_blk1,x ; Load first character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk1,x ; Load second character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk1,x ; Load third character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk1,x ; Load fourth character of mnemonic
jsr print_char ; Print it
jmp dis_addr_mode
dis_print_block2:
sec ; Set carry bit
sbc #$40 ; Offset to second table
asl ; Multiply by 2, two times...
asl ; ... to create a 4 byte offset
tax ; Accumulator becomes the index
lda dis_mnemonic_blk2,x ; Load first character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk2,x ; Load second character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk2,x ; Load third character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk2,x ; Load fourth character of mnemonic
jsr print_char ; Print it
jmp dis_addr_mode
dis_print_block3:
sec ; Set carry bit
sbc #$80 ; Offset to third table
asl ; Multiply by 2, two times...
asl ; ... to create a 4 byte offset
tax ; Accumulator becomes the index
lda dis_mnemonic_blk3,x ; Load first character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk3,x ; Load second character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk3,x ; Load third character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk3,x ; Load fourth character of mnemonic
jsr print_char ; Print it
jmp dis_addr_mode
dis_print_block4:
sec ; Set carry bit
sbc #$C0 ; Offset to fourth table
asl ; Multiply by 2, two times...
asl ; ... to create a 4 byte offset
tax ; Accumulator becomes the index
lda dis_mnemonic_blk4,x ; Load first character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk4,x ; Load second character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk4,x ; Load third character of mnemonic
jsr print_char ; Print it
inx ; Point to next character
lda dis_mnemonic_blk4,x ; Load fourth character of mnemonic
jsr print_char ; Print it
; PRINT OPERAND(S) IN CORRESPONDING ADDRESSING MODE FORMAT
dis_addr_mode:
lda #" " ; Print a space
jsr print_char
lda ADDR_MODE ; Get addressing mode and branch to appropriate addressing routine
dis_inv cmp #0 ; Invalid opcode
bne dis_imp
jmp dis_invalid ;
dis_imp cmp #IMP ;
bne dis_imm ;
jmp dis_implied ;
dis_imm cmp #IMM ;
bne dis_rel
jmp dis_immediate ;
dis_rel cmp #REL ;
bne dis_zp
jmp dis_relative ;
dis_zp cmp #ZP ;
bne dis_zpx
jmp dis_zeropage ;
dis_zpx cmp #ZPX
bne dis_zpy ;
jmp dis_zeropage_x ;
dis_zpy cmp #ZPY ;
bne dis_izp
jmp dis_zeropage_y ;
dis_izp cmp #IZP ;
bne dis_izx
jmp dis_indirect_zp ;
dis_izx cmp #IZX ;
bne dis_izy
jmp dis_indirect_zpx ;
dis_izy cmp #IZY ;
bne dis_zpr
jmp dis_indirect_zpy ;
dis_zpr cmp #ZPR ;
bne dis_abs
jmp dis_zeropage_relative ;
dis_abs cmp #ABS ;
bne dis_abx
jmp dis_absolute ;
dis_abx cmp #ABX ;
bne dis_aby
jmp dis_absolute_x ;
dis_aby cmp #ABY ;
bne dis_ind
jmp dis_absolute_y ;
dis_ind cmp #IND ;
bne dis_iax
jmp dis_indirect ;
dis_iax cmp #IAX ;
bne dis_iay
jmp dis_indirect_x ;
dis_iay cmp #IAY ;
bne dis_lop
jmp dis_indirect_y ;
dis_lop jmp dis_lines_loop
; INVALID
dis_invalid
ldx #9
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
jmp dis_lines_loop
; IMPLIED
dis_implied:
ldx #9
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
jmp dis_lines_loop
; IMMEDIATE: #$00 (ALSO PRINT ASCII VALUE IF IT'S IN A VALID RANGE)
dis_immediate:
lda #"#"
jsr print_char
lda #"$"
jsr print_char
lda OPERAND1
jsr print_byte
ldx #5
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; RELATIVE: $00 (ALSO PRINTS DESTINATION ADDRESS)
dis_relative:
lda #"$"
jsr print_char
lda OPERAND1
jsr print_byte
ldx #6
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; ZEROPAGE: $00
dis_zeropage:
lda #"$"
jsr print_char
lda OPERAND1
jsr print_byte
ldx #6
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; ZEROPAGE X INDEXED: $00,X
dis_zeropage_x:
lda #"$"
jsr print_char
lda OPERAND1
jsr print_byte
lda #","
jsr print_char
lda #"x"
jsr print_char
ldx #4
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; ZEROPAGE Y INDEXED: $00,Y
dis_zeropage_y:
lda #"$"
jsr print_char
lda OPERAND1
jsr print_byte
lda #","
jsr print_char
lda #"y"
jsr print_char
ldx #4
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; INDIRECT ZEROPAGE: ($00)
dis_indirect_zp:
lda #"("
jsr print_char
lda #"$"
jsr print_char
lda OPERAND1
jsr print_byte
lda #")"
jsr print_char
ldx #4
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; INDIRECT ZEROPAGE X INDEXED: ($00,X)
dis_indirect_zpx:
lda #"("
jsr print_char
lda #"$"
jsr print_char
lda OPERAND1
jsr print_byte
lda #","
jsr print_char
lda #"x"
jsr print_char
lda #")"
jsr print_char
ldx #2
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; INDIRECT ZEROPAGE Y INDEXED: ($00),Y
dis_indirect_zpy:
lda #"("
jsr print_char
lda #"$"
jsr print_char
lda OPERAND1
jsr print_byte
lda #")"
jsr print_char
lda #","
jsr print_char
lda #"y"
jsr print_char
ldx #2
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; ZEROPAGE RELATIVE: $00,$00 (ALSO PRINTS DESTINATION ADDRESS)
dis_zeropage_relative:
lda #"$"
jsr print_char
lda OPERAND1
jsr print_byte
lda #","
jsr print_char
lda #"$"
jsr print_char
lda OPERAND2
jsr print_byte
ldx #2
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
lda OPERAND2
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; ABSOLUTE: $0000
dis_absolute:
lda #"$"
jsr print_char
lda OPERAND2
jsr print_byte
lda OPERAND1
jsr print_byte
ldx #4
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
lda OPERAND2
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; ABSOLUTE X INDEXED: $0000,X
dis_absolute_x:
lda #"$"
jsr print_char
lda OPERAND2
jsr print_byte
lda OPERAND1
jsr print_byte
lda #","
jsr print_char
lda #"x"
jsr print_char
ldx #2
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
lda OPERAND2
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; ABSOLUTE Y INDEXED: $0000,Y
dis_absolute_y:
lda #"$"
jsr print_char
lda OPERAND2
jsr print_byte
lda OPERAND1
jsr print_byte
lda #","
jsr print_char
lda #"y"
jsr print_char
ldx #2
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
lda OPERAND2
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; INDIRECT: ($0000)
dis_indirect:
lda #"("
jsr print_char
lda #"$"
jsr print_char
lda OPERAND2
jsr print_byte
lda OPERAND1
jsr print_byte
lda #")"
jsr print_char
ldx #2
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
lda OPERAND2
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; INDIRECT X INDEXED: ($0000,X)
dis_indirect_x:
lda #"("
jsr print_char
lda #"$"
jsr print_char
lda OPERAND2
jsr print_byte
lda OPERAND1
jsr print_byte
lda #","
jsr print_char
lda #"x"
jsr print_char
lda #")"
jsr print_char
ldx #0
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
lda OPERAND2
jsr dis_print_ascii7
jmp dis_lines_loop ; Print next line or end routine
; INDIRECT Y INDEXED: ($0000),Y
dis_indirect_y:
lda #"("
jsr print_char
lda #"$"
jsr print_char
lda OPERAND2
jsr print_byte
lda OPERAND1
jsr print_byte
jsr print_char
lda #")"
lda #","
jsr print_char
lda #"y"
jsr print_char
lda #")"
ldx #0
jsr dis_spaces
lda OPCODE
jsr dis_print_ascii7
lda OPERAND1
jsr dis_print_ascii7
lda OPERAND2
jsr dis_print_ascii7
dis_lines_loop:
lda #CR ; Change line
jsr print_char ;
inc MON_TEMP+1 ; Increment line number counter
lda MON_TEMP+1 ; Has the line number counter...
cmp #ROWS-2 ; ...reached the display size limit?
beq disassemble_end ; Yes, then end routine
jmp dis_print_line ; Else, print another line
disassemble_end:
rts
; Disassemble subroutines
; TAB ALIGN AND PRINT SEPARATOR
dis_spaces:
lda #" " ; Load space character
cpx #0 ; Is X = 0? (Space counter)
beq dis_spaces3 ; Yes, then print separator
dis_spaces2:
jsr print_char ; Print space
dex ; Decrement X
bne dis_spaces2 ; If X is not 0, then loop to print another space
dis_spaces3:
lda #"|" ; Print separator character
jsr print_char ;
lda #" " ; Print a space
jsr print_char ;
rts
; PRINT ASCII REPRESENTATION OF OPCODE/OPERAND(S) - (Useful for identifying text vs. code)
dis_print_ascii7:
cmp #" " ; ASCII decimal 32 (Space)
bcc d_lc1 ; Is A < 20? Yes? Then print a dot
cmp #$7F ; ASCII decimal 127? (DEL)
bcs d_lc1 ; Is A >= 127? Yes? Then print a dot
bra d_lc2 ; Otherwise, returns ASCII value, or Accumulator as is
d_lc1: lda #"." ; It's an invalid character, replace it with a dot
d_lc2: jsr print_char ; Print valid character
rts
; __ _ _ _
; / _| (_) | | | | _ __ ___ ___ _ __ ___
; | |_ | | | | | | | '_ ` _ \ / _ \ | '_ ` _ \
; | _| | | | | | | | | | | | | | __/ | | | | | |
; |_| |_| |_| |_| _____ |_| |_| |_| \___| |_| |_| |_|
; |_____|
;
; Fills a region of memory with a byte value
; ----------------------------------------------------------------------------------------------------------------------
fill_mem:
; CHECK FOR EOL AND " " DELIMITER
lda IN_BUFFER,y ; Read a character from the input buffer
bne f_delim ; Not end of string...
jmp no_parameter ; Yes it is. Since nothing is specified, go print error
f_delim cmp #" " ; Is it the space delimiter?
beq fill_mem_start_addr ; Yes it is. Then go read an address
jmp syntax_error ; If anything else, print a syntax error, then end routine
fill_mem_start_addr: ; GET START ADDRESS
jsr skip_spaces ; skip leading spaces
jsr get_word ; Get word from the input buffer
bcs fill_mem_store_start ; If valid, then save addresses
jmp invalid_address ; Display invalid address message, then end routine
fill_mem_store_start: ; STORE START ADDRESS
lda WORD+1 ; Load MSB from get_word
sta CUR_ADDR+1 ; Store MSB to start address register
sta SRC_ADDR+1 ; Store MSB to start address register
lda WORD ; Load LSB from get_word
sta CUR_ADDR ; Store LSB to start address register
sta SRC_ADDR ; Store LSB to start address register
fill_mem_is_end_addr: ; IS THERE AN END ADDRESS?
lda IN_BUFFER,y ; Read a character from the input buffer
bne pf2 ; It's not the end of string
jmp no_parameter ; It's the end f the string, print error
pf2 cmp #" " ; Is the it a space delimiter?
beq fill_mem_end_addr ; It is, then get the byte
jmp no_parameter ; Print an error if no delimiter was detected, then end routine
fill_mem_end_addr: ; GET END ADDRESSE
jsr skip_spaces ; skip leading spaces
jsr get_word ; Get address from the input buffer
bcs fill_mem_store_end ; Address is valid, so save addresses
jmp invalid_address ; It's not, then print error and end routine
fill_mem_store_end: ; STORE END ADDRESS
lda WORD+1 ; Load MSB from get_address
sta DES_ADDR+1 ; Store MSB to start address register
lda WORD ; Load LSB from get_address
sta DES_ADDR ; Store LSB to start address register
fill_mem_is_byte: ; IS THERE A BYTE COMMING UP?
lda IN_BUFFER,y ; Read a character from the input buffer
cmp #0 ; Is it the end of the string?
beq f_nopar ; Yes it is, Since no byte has been entered, print error
cmp #" " ; Is the it a space delimiter?
beq fill_mem_byte ; It is, then get the byte
f_nopar jmp no_parameter ; Print an error if no delimiter was detected, then end routine
fill_mem_byte: ; GET BYTE
jsr skip_spaces ; skip leading spaces
jsr get_byte ; Get address from the input buffer
bcs fill_mem_memory ; Byte is valid, save byte
jmp invalid_byte ; It's not, then send end parsing
fill_mem_memory:
sta TEMP ; Save byte
fill_mem_write_byte:
lda CUR_ADDR+1
cmp DES_ADDR+1
bne fill_mem_next
lda CUR_ADDR
cmp DES_ADDR
beq fill_mem_store_last
fill_mem_next:
lda TEMP
sta (CUR_ADDR) ; Store it in specified memory location
lda (CUR_ADDR) ; Read the byte just written
cmp TEMP ; Compare it to the actual byte
bne fill_mem_failed ; It they don't match, print an error
jsr inc_cur_addr ; Increment last address position for next byte
bra fill_mem_write_byte
fill_mem_store_last: ; STORE CUR BYTE ADDRESS, AND SET CUR ADDRESS TO START ADDRESS
; --------------------------------------------------------------
lda TEMP
sta (CUR_ADDR) ; Store it in specified memory location
lda (CUR_ADDR) ; Read the byte just written
cmp TEMP ; Compare it to the actual byte
bne fill_mem_failed ; It they don't match, print an error
lda SRC_ADDR+1 ; Load MSB from get_address
sta CUR_ADDR+1 ; Store MSB to start address register
lda SRC_ADDR ; Load LSB from get_address
sta CUR_ADDR ; Store LSB to start address register
rts
fill_mem_failed:
printString cant_write_address ; *MACRO*
lda CUR_ADDR+1
jsr print_byte
lda CUR_ADDR
jsr print_byte
lda #CR
jsr print_char
rts ; End subroutine
; __ _ _
; / _| (_) _ __ __| |
; | |_ | | | '_ \ / _` |
; | _| | | | | | | | (_| |
; |_| |_| |_| |_| \__,_|
;
; Find a byte or a series of bytes (up to 8) in memory
; ---------------------------------------------------------------------------------------------------------------------------------
find:
stz CUR_ADDR ; Start search at address $0000
stz CUR_ADDR+1 ;
ldx #0 ; Set argument count to 0
stz NO_OF_BYTES ; Clear number of bytes
stz FIND_EOT ; Used to avoid trailing space error at the end of the buffer
lda IN_BUFFER,y ; Read a character from the input buffer
bne find_delimiter ; If not end of buffer, proceed
jmp no_parameter ; End of buffer, then print error and end routine
; READ ARGUMENTS FROM COMMAND LINE
find_delimiter:
cmp #" " ; Is it the space delimiter?
beq find_get_byte ; It is, then get a byte
jmp syntax_error ; Else print syntax error, and exit
find_get_byte:
jsr skip_spaces ; Remove leading spaces
lda FIND_EOT
cmp #0 ; If the first byte has not been read
beq find_get_byte2 ; Then read a byte
lda IN_BUFFER,y ; Read buffer to see if it's end of line
bne find_get_byte2
jmp find_end ; It it's an end of line character, end routine
find_get_byte2:
inc FIND_EOT ; Increment byte count
jsr get_byte ; Get byte from input buffer
bcs find_store_byte ; If byte is valid, save byte
jmp invalid_byte ; If it's not valid, print an error and exit
find_store_byte:
sta BYTE1,x ; Store byte
inx ; Increment byte counter
stx NO_OF_BYTES ; Count number of arguments
find_get_next_char:
lda IN_BUFFER,y ; Read a character from the input buffer
beq find_validate ; If it's the end of the line, then compare the byte sequence
bra find_delimiter ; Get next byte
; PRINT DATA TO SEARCH
find_validate:
printString find_validate_msg ; *MACRO*
ldx #0 ; Set match index to 0
find_validate_bytes:
lda BYTE1,x ; Print byte x
jsr print_byte
lda #" " ; Print space
jsr print_char
inx ; Increase index
cpx NO_OF_BYTES ; Is index it equal to number of arguments?
beq find_validate_CR
bra find_validate_bytes
find_validate_CR:
lda #CR ; Print carriage return
jsr print_char
; FIND MATCH
find_compare:
ldx #0 ; Set search pointer to first byte to compare
lda CUR_ADDR+1
sta SRC_ADDR+1
lda CUR_ADDR
sta SRC_ADDR
find_compare2:
lda BYTE1,x ; Get a byte
cmp (CUR_ADDR) ; Compare it to memory location
beq find_compare_next ; If there's a match, check next byte
jsr inc_cur_addr ; It's no match, then increment address
bcc find_end_search ; If address is $FFFF
bra find_compare ; Restart comparison
find_compare_next:
jsr inc_cur_addr
bcc find_end_search ; If address is $FFFF
inx
cpx NO_OF_BYTES
beq find_print
;inx
bra find_compare2
find_end_search:
cpx NO_OF_BYTES
beq find_print
bra find_end
; PRINT MATCHE
find_print:
lda SRC_ADDR+1
jsr print_byte
lda SRC_ADDR
jsr print_byte
lda #":"
jsr print_char
ldx #0
find_print2:
lda #" "
jsr print_char
lda BYTE1,x
jsr print_byte
inx
cpx NO_OF_BYTES
beq find_print3
;inx
bra find_print2
find_print3:
lda #CR
jsr print_char
bra find_compare
find_end:
rts
; _ _ _
; __ _ ___ | |_ | |__ _ _ | |_ ___
; / _` | / _ \ | __| | '_ \ | | | | | __| / _ \
; | (_| | | __/ | |_ | |_) | | |_| | | |_ | __/
; \__, | \___| \__| _____ |_.__/ \__, | \__| \___|
; |___/ |_____| |___/
; Read from INPUT_BUFFER at Y, and converts 2 ASCII characters to a hex byte
; ----------------------------------------------------------------------------------------------------------------------
; INPUT: IN_BUFFER @ Y containing 2 characters
; DESTROYS: GET_TEMP
; RETURNS: Byte in A
; Carry bit clear = hex digit is not valid
; Carry bit set = hex digit is valid
get_byte:
jsr get_nibble ; convert ASCII to hex nibble
bcc get_byte_end ; End routine if nibble is invalid
asl ; push nibble to MSB
asl ;
asl ;
asl ;
sta GET_TEMP ; Store A in GET_TEMP
jsr get_nibble ; convert ASCII to hex nibble
bcc get_byte_end ; End routine if nibble is invalid
ora GET_TEMP ; Join MSB and LSB into A
get_byte_end:
rts
; _ _ _ _ _
; __ _ ___ | |_ _ __ (_) | |__ | |__ | | ___
; / _` | / _ \ | __| | '_ \ | | | '_ \ | '_ \ | | / _ \
; | (_| | | __/ | |_ | | | | | | | |_) | | |_) | | | | __/
; \__, | \___| \__| _____ |_| |_| |_| |_.__/ |_.__/ |_| \___|
; |___/ |_____|
; Read from IN_BUFFER at Y, and converts the ASCII character to a hex value
; ----------------------------------------------------------------------------------------------------------------------
; INPUT: IN_BUFFER @ Y containing 1 character
; RETURNS: Carry bit clear = hex digit is not valid
; Carry bit set = hex digit is valid in A
get_nibble:
lda IN_BUFFER,y ; Get character
beq get_nibble_error
jsr uppercase ; Convert A-F to uppercase
; IS IT A VALID HEX CHARACTER?
cmp #"0" ; Filter anything bellow the ASCII 0
bcc get_nibble_error ; Is A less than "0"? Yes, then error
cmp #"F"+1 ; Filter anything above the ASCII F
bcs get_nibble_error ; Is A greater than "F"? Yes, then error
cmp #"9"+1 ; Filter anything above ASCII 9
bcc get_nibble_ok ; Is A is less or equal to "9"? Yes, then ok
cmp #"A" ; Filter anything below ASCII A
bcs get_nibble_ok ; Is A greater then or equal to "A"? Yes, then ok
get_nibble_error:
clc ; Clear carry to indicate error
rts ; End subroutine
get_nibble_ok:
; OFFSET RESULT FROM ASCII VALUE to HEX VALUE
sec ; Prepare for substraction
sbc #$30 ;
cmp #$0A ; Is it a decimal (0-9) digit?
bcc get_nibble_clear ; Yes
sec
sbc #$07 ; Alphabet offset to get A-F
get_nibble_clear:
and #$0F ; Clear upper nibble
iny ; Increment command line buffer pointer
inc ERROR_PTR ; Increment pointer to next potential error location
sec ; Set carry to indicate valid nibble
rts ; End subroutine
; _ _
; __ _ ___ | |_ __ __ ___ _ __ __| |
; / _` | / _ \ | __| \ \ /\ / / / _ \ | '__| / _` |
; | (_| | | __/ | |_ \ V V / | (_) | | | | (_| |
; \__, | \___| \__| _____ \_/\_/ \___/ |_| \__,_|
; |___/ |_____|
;
; Get a character word (16-bit) from the command line, and produce a valid hex word
; ----------------------------------------------------------------------------------------------------------------------
; INPUT: IN_BUFFER @ Y
; OUTPUT: Carry bit clear = invalid word
; Carry bit set = valid word in WORD & WORD+1
get_word:
pha
phx
sty GET_TEMP ; Save for later usage
ldx #0 ; Set counter to 0
get_word_count: ; IS THE WORD COMPOSED OF 1 to 4 CHARACTERS?
lda IN_BUFFER,y ; Load character
cmp #0 ; Is it the end of the string?
beq get_word_endcount ; Yes, then stop counting
cmp #" " ; Is it the seperator delimiter?
beq get_word_endcount ; Yes, then stop counting
iny ; Increment IN_BUFFER pointer
inx ; Increment character count
bra get_word_count ; Get next character until end of string or separator delimiter
get_word_endcount:
ldy GET_TEMP ; Restore index pointer to start of word
get_word_count0;
cpx #0 ; Is there an word specified?
bne get_word_count1 ; Yes, then go to 1
lda CUR_ADDR ; Default word to current address (CUR_ADDR) if nothing is specified
sta WORD
lda CUR_ADDR+1
sta WORD+1
sec
bra get_word_end ; End subroutine
get_word_count1:
cpx #1 ; Is there just one digit?
bne get_word_count2 ; No, then go to 2, else...
jsr get_nibble ; Get single character (nibble)
bcc get_word_error ; If nibble contains an illegal character, go to error
sta WORD ; Store it in the little endian part of the word
stz WORD+1 ; Clear big endian part of the word
sec
bra get_word_end ; End subroutine
get_word_count2:
cpx #2 ; Is it just a 2 digit word?
bne get_word_count3 ; No, then go to 3, else...
jsr get_byte ; Get a byte
bcc get_word_error ; If byte contains an illegal character, go to error
sta WORD ; Store it in the little endian part of the word
stz WORD+1 ; Clear big endian part of the word
sec
bra get_word_end ; End subroutine
get_word_count3:
cpx #3 ; Is it a 3 digit word?
bne get_word_count4 ; No, then go to 4, else...
jsr get_nibble ; Get the first character of a 3 digit word
bcc get_word_error ; If nibble contains an illegal character, go to error
sta WORD+1 ; Store the nibble in the big endian portion of the word
jsr get_byte ; Get the little endian byte
bcc get_word_error ; If byte contains an illegal character, go to error
sta WORD ; Store the little endian portion of the word
sec
bra get_word_end ; End subroutine
get_word_count4:
cpx #4 ; Is it a 4 digit word?
bne get_word_error ; No, then flag an error, else...
jsr get_byte ; Get the big endian byte
bcc get_word_error ; If byte contains an illegal character, go to error
sta WORD+1 ; Store the nibble in the big endian portion of the word
jsr get_byte ; Get the little endian byte
bcc get_word_error ; If byte contains an illegal character, go to error
sta WORD ; Store the little endian portion of the word
sec ; Indicate that word is valid
bra get_word_end ; End subroutine
get_word_error:
clc ; Clear Carry to indicate an error
get_word_end:
plx
pla
rts
; _ _
; | |__ ___ | | _ __
; | '_ \ / _ \ | | | '_ \
; | | | | | __/ | | | |_) |
; |_| |_| \___| |_| | .__/
; |_|
;
; Prints help for various commands
; ----------------------------------------------------------------------------------------------------------------------
help:
printString help_msg ; *MACRO*
rts
; _ _ _
; (_) _ __ ___ ___ _ _ _ __ __ _ __| | __| | _ __
; | | | '_ \ / __| / __| | | | | | '__| / _` | / _` | / _` | | '__|
; | | | | | | | (__ | (__ | |_| | | | | (_| | | (_| | | (_| | | |
; |_| |_| |_| \___| _____ \___| \__,_| |_| _____ \__,_| \__,_| \__,_| |_|
; |_____| |_____|
;
; Increment CUR_ADDR (16-bit address) - Does not roll-over
; ----------------------------------------------------------------------------------------------------------------------
; INPUT: CUR_ADDR and CUR_ADDR+1
; RETURNS: Carry bit clear = Did not increment. Already at $FFFF
; Carry bit set = Incremented
inc_cur_addr:
pha
lda CUR_ADDR+1
cmp #$FF ; Is MSB = $FF?
bne inc_cur_addr_add ; No, then proceed to increment
lda CUR_ADDR
cmp #$FF ; Is LSB = $FF
bne inc_cur_addr_add ; No, then proceed to increment
clc ; Carry clear indicate reached $FFFF
pla
rts
inc_cur_addr_add:
clc ; Clear carry bit
lda CUR_ADDR ; Load LSB into A
adc #1 ; Add 1
sta CUR_ADDR ; Store the result in LSB
bcc inc_cur_addr_end ; If result does not roll over(FF -> 00), then end subroutine
inc CUR_ADDR+1 ; IF it does, then add 1 to MSB
inc_cur_addr_end:
sec ; Carry set indicates incrementation done
pla
rts
; _ _ _ _ _ _
; (_) _ __ | |_ ___ | | | |__ ___ __ __ | | ___ __ _ __| |
; | | | '_ \ | __| / _ \ | | | '_ \ / _ \ \ \/ / | | / _ \ / _` | / _` |
; | | | | | | | |_ | __/ | | | | | | | __/ > < | | | (_) | | (_| | | (_| |
; |_| |_| |_| \__| \___| |_| _____ |_| |_| \___| /_/\_\ _____ |_| \___/ \__,_| \__,_|
; |_____| |_____|
;
; Download Intel hex. Start .org at $1000
; (From the 6502.org code repository with a little modification)
; ----------------------------------------------------------------------------------------------------------------------
intel_hex_load:
stz DOWNLOAD_FAIL ; Start by assuming no download failure
printString starthex ; *MACRO*
hex_get_record:
jsr read_char
bcc hex_get_record
cmp #ESC ; Has ESCAPE key been pressed?
bne hex_get_start ; Go check for record marker
printString transferaborted ; *MACRO*
rts ; Exit
hex_get_start:
cmp #":" ; Start of record marker
bne hex_get_record ; not found yet
; START OF RECORD MARKER HAS BEEN FOUND
; READ RECORD LENGTH
jsr read_hex ; Get the record length
sta RECORD_LENGTH ; Save it the record length
sta CHECKSUM ; and save first byte of checksum
; READ THE ADDRESS
jsr read_hex ; Get the high part of start address
sta START+1 ;
clc ;
adc CHECKSUM ; Add in the checksum
sta CHECKSUM ;
jsr read_hex ; Get the low part of the start address
sta START ;
clc ;
adc CHECKSUM ; Add in the checksum
sta CHECKSUM ;
; READ RECORD TYPE
jsr read_hex ; Get the record type
sta RECORD_TYPE ; and save it
clc ;
adc CHECKSUM ; Add in the checksum
sta CHECKSUM ;
lda RECORD_TYPE ;
beq hex_get_data ; Get data
cmp #1
beq hex_end_of_file ; Get End of file record
cmp #2
beq hex_get_record ; Bypass remaining data of record, and get for next record
; UNKNOWN RECORD TYPE
printString unknownrecordtype ; *MACRO*
lda RECORD_TYPE ; Get record type
jsr print_byte ; Print it
lda #CR ; But we'll let it finish so as not to falsely start a new d/l from existing
rts ; Exit if any other record type
; GET RECORD TYPE 00 (DATA)
hex_get_data:
ldx RECORD_LENGTH ; Number of data bytes to write to memory
ldy #0 ; Start offset at 0
hex_get_data_loop:
jsr read_hex ; Get the first/next/last data byte
sta (START),y ; Save it to RAM
clc
adc CHECKSUM ; Add in the checksum
sta CHECKSUM ;
iny ; Update data pointer
dex ; Decrement count
bne hex_get_data_loop ; Continue transfering data until count is 0
jsr read_hex ; Get the checksum
clc
adc CHECKSUM
bne hex_failure ; If failed, report it
lda #"." ; Character indicating record OK = '.'
jsr print_char ; Write it out
jmp hex_get_record ; Get next record
; FAILED CHECKSUM, INDICATE RECORD THAT FAILED
hex_failure:
lda #'x' ; Character indicating record failure = 'F'
sta DOWNLOAD_FAIL ; Download failed if non-zero
jsr print_char ; write it out
jmp hex_get_record ; Wait for next record start
; EOF RECORD (01)
hex_end_of_file: ; We've reached the end-of-record record
jsr read_hex ; Get the checksum
clc
adc CHECKSUM ; Add previous checksum accumulator value
beq hex_download_check ; Checksum = 0 means we're OK!
printString badrecordchecksum ; *MACRO*
rts
; PRINTS STATUS OF DOWNLOAD (SUCCESS OR FAILED)
hex_download_check:
lda DOWNLOAD_FAIL ;
beq hex_download_success ; Check D/L fail flag
printString downloadfailed ; *MACRO*
rts
hex_download_success:
printString downloadsuccessful ; *MACRO*
lda #$10 ; Set CUR_ADDR to $1000
sta CUR_ADDR+1 ;
stz CUR_ADDR ;
rts
; _
; (_) ___ _ __ ___ __ _ _ __
; | | / _ \ | '_ ` _ \ / _` | | '_ \
; | | | (_) | | | | | | | | (_| | | |_) |
; |_| \___/ _____ |_| |_| |_| \__,_| | .__/
; |_____| |_|
; I/O map display
; ----------------------------------------------------------------------------------------------------------------------------------
io_map:
printString io_map_msg ; *MACRO*
rts
; _ __ ___ ___ _ __ ___ ___ _ __ _ _
; | '_ ` _ \ / _ \ | '_ ` _ \ / _ \ | '__| | | | |
; | | | | | | | __/ | | | | | | | (_) | | | | |_| |
; |_| |_| |_| \___| |_| |_| |_| \___/ |_| \__, |
; |___/
;
; Reads and displays a portion of memory (memory dump)
; ----------------------------------------------------------------------------------------------------------------------
; GET COMMAND LINE START ADDRESS IF ANY
; -------------------------------------
memory: ; CHECK FOR EOL AND " " DELIMITER
lda IN_BUFFER,y ; Read a character from the input buffer
beq memory_default_addr ; Is it end of buffer (0)? Yes, so use default address (CUR_ADDR)
cmp #" " ; Is it the space delimiter?
beq memory_start_addr ; Yes it is. Then go read an address
jsr syntax_error ; If anything else, print a syntax error
jmp memory_end ; Go to end of routine
memory_default_addr: ; IF NO ADDRESS PROVIDED, GET CUR ADDRESS USED +1
lda CUR_ADDR+1 ; Read the MSB's last address used
sta SRC_ADDR+1 ; Store it as the start address
lda CUR_ADDR ; Read the LSB's last address used
sta SRC_ADDR ; Store it as the start address
bra memory_hex_dump ;
memory_start_addr: ; GET START ADDRESS
jsr skip_spaces ; skip leading spaces if any
jsr get_word ; Get address from the input buffer
bcs memory_store_start ; Valid word is present, store address
jsr invalid_address ; Display invalid address message
jmp memory_end ; No valid word is present, then send end parsing
memory_store_start: ; STORE START ADDRESS
lda WORD ; Load LSB from get_word
sta SRC_ADDR ; Store LSB to start address register
sta CUR_ADDR ; Store it in the current address (LSB)
lda WORD+1 ; Load MSB from get_word
sta SRC_ADDR+1 ; Store MSB to start address register
sta CUR_ADDR+1 ; Store it in the current address (MSB)
memory_hex_dump: ; PRINT HEX DUMP
stz MON_TEMP+1 ; Set line counter to 0
; PRINT ADDRESS, OPCODE AND OPERAND VALUES
memory_looplines: ; PRINT 16-BIT ADDRESS AT THE BEGINNING OF EACH LINE
lda CUR_ADDR+1 ; Load address MSB
jsr print_byte ; Prints MSB
lda CUR_ADDR ; Load address LSB
jsr print_byte ; Prints LSB
lda #":" ; Fetch colon ":" delimiter for byte display
jsr print_char ; Print it
lda #" " ; Fetch the space character
jsr print_char ; Print it
ldx #$00 ; Set byte counter to 0
memory_loopbytes: ; PRINT X BYTES PER LINE
stz MON_TEMP
r_lb0: jsr memory_ffff ; Is address $FFFF?
bcc r_lb1 ; No, then proceed to display the byte normally
lda #1 ; Yes, is it the first time FFFF appears?
cmp MON_TEMP ;
beq r_lb1 ;
lda #" " ; Else, print spaces
jsr print_char ; One for the MSB
jsr print_char ; Another for the LSB
jsr print_char ; And lastly, the separator
bra r_lb2 ; Proceed with the byte loop
r_lb1: lda (CUR_ADDR) ; Load byte from referenced address
jsr print_byte ; Print the byte
lda #" " ; Separate bytes with a space
jsr print_char ; Print the space separator
r_lb2: jsr inc_cur_addr ; Increment last address by one
inx ; Increment byte counter
cpx #BYTES_PER_LINE ; Is it the predefined amount of bytes?
bne r_lb0 ; No? Then contine printing bytes
memory_print_characters: ; PRINT CHARACTER REPRESENTATION OF BYTES
lda #"|" ; Fetch the pipe "|" separator character
jsr print_char ; Print it
lda #" " ; Fetch the space character
jsr print_char ; Print it
lda SRC_ADDR ; Reload start address
sta CUR_ADDR ; Into the temporary location
lda SRC_ADDR+1 ; Reload start address
sta CUR_ADDR+1 ; Into the temporary location
ldx #$00 ; Reset counter to 0 to be the character counter
memory_loopchars: ; PRINT 8 CHARACTERS, OR 16 CHARACTERS PER LINE
stz MON_TEMP
r_lc: jsr memory_ffff ; Is address $FFFF?
bcc r_lc0 ; No, then proceed to display the character normally
lda #1
cmp MON_TEMP
beq r_lc0
lda #" " ; Else,
jsr print_char ; print a space
bra r_lc3 ; Proceed with character loop
r_lc0: lda (CUR_ADDR) ; Load character from referenced address
cmp #" " ; ASCII decimal 32 (Space)
bcc r_lc1 ; Is A < 20? Yes? Then output error 0.
cmp #$7F ; ASCII decimal 127? (DEL)
bcs r_lc1 ; Is A >= 127? Yes? Then output error 0.
bra r_lc2 ; Otherwise, returns A as is.
r_lc1: lda #"." ; It's an invalid character, replace it with a dot
r_lc2: jsr print_char ; Print valid character
r_lc3: jsr inc_cur_addr ; Increment temp address by one
inx ; Increment character counter
cpx #BYTES_PER_LINE ; Is it the predefined amount of characters?
bne r_lc ; No, then proceed to the next character
lda #CR ; Fetch the new line character
jsr print_char ; Print it
inc MON_TEMP+1 ; Increment line counter
; UPDATE ADDRESSES
lda CUR_ADDR ; Load last address LSB
sta SRC_ADDR ; Store it as the new start address LSB
lda CUR_ADDR+1 ; Load last address LSB
sta SRC_ADDR+1 ; Store it as the new start address LSB
; IF $FFFF REACHED, THEN STOP DISPLAYING MORE LINES
lda MON_TEMP+1
jsr memory_ffff ; Is current address $FFFF?
bcc r_nxt ; No
lda #ROWS-2 ; Else end printing lines
r_nxt: cmp #ROWS-2
beq memory_end
jmp memory_looplines ; Finished displaying lines
memory_end: ; IF CUR ADDRESS WAS $FFFF THEN ROLL OVER TO $0000
jsr memory_ffff ; Is current address $FFFF?
bcc r_e2
stz CUR_ADDR ; Set address to 0000
stz CUR_ADDR+1 ;
r_e2: rts
; Check if end of address reached ($FFFF)
; Carry set if $FFFF
memory_ffff:
pha
lda CUR_ADDR+1 ; Load last address MSB
cmp #$FF ; Is it $FF?
bne rm_ffff_no ; No, then end routine
lda CUR_ADDR ; Load last address LSB
cmp #$FF ; Is it $FF?
bne rm_ffff_no ; No, then end routine
rm_ffff_yes:
inc MON_TEMP
sec
pla
rts
rm_ffff_no:
clc
pla
rts
; _ __ __ _ _ __ ___ ___
; | '_ \ / _` | | '__| / __| / _ \
; | |_) | | (_| | | | \__ \ | __/
; | .__/ \__,_| |_| |___/ \___|
; |_|
; Parse monitor command line
; ----------------------------------------------------------------------------------------------------------------------
parse:
ldy #$00 ; Input buffer pointer
ldx #$00 ; Command pointer
jsr skip_spaces ; Skip leading spaces (alters input buffer pointer y)
sty PARSE_IN_BUFF_POS ; Store the real position of first character in buffer
lda ERROR_PTR ; Load current error pointer location
sta PARSE_ERROR_PTR ; Save it
lda IN_BUFFER,y ; Load first byte of data from input buffer
beq parse_end ; Is it the end of the string? Yes, then end parsing.
parse_next_char:
lda commands,x ; Load a command character
beq parse_no_cmd ; If no command is recognized or valid, end parsing
bmi parse_is_cmd ; If it's a command code delimiter, go to command
cmp IN_BUFFER,y ; Compare it with input buffer
bne parse_skip_cmd ; if not equal, go to next command by skipping the rest of the command letters
iny ; Increment input buffer pointer
inx ; Increment command pointer
inc ERROR_PTR ; Increment Error pointer
bra parse_next_char ; Grab the next character
parse_skip_cmd:
; BACKUP TO ORIGINAL POSITION FOR NEXT COMMAND VERIFICATION
ldy PARSE_IN_BUFF_POS ; Load position of first character in buffer (Leading whitespaces were removed)
lda PARSE_ERROR_PTR ; Load original error pointer
sta ERROR_PTR ; Store it
; SKIP CURRENT COMMAND CHARACTERS UNTIL COMMAND CODE IS DETECTED
parse_skip_until_code:
inx ; Point to next character
lda commands,x ; Dummy load it
bpl parse_skip_until_code ; If it's an alphanumeric character, get next one
inx ; If it's a command code...
inx ; ... bypass jump address
inx ;
bra parse_next_char ; Read next command character
parse_is_cmd:
inx
jmp (commands,x)
parse_no_cmd:
jsr invalid_command ; Print invalid command
parse_end:
rts ; End of routine
; _
; _ __ ___ ___ | | __
; | '_ \ / _ \ / _ \ | |/ /
; | |_) | | __/ | __/ | <
; | .__/ \___| \___| |_|\_\
; |_|
; Read a byte from a specific or current address
; POKE AAAA
; ----------------------------------------------------------------------------------------------------------------------
; DESTROYS: A, TEMP, SRC_ADDR
; RETURNS: CUR_ADDR, current address position
peek: ; IS THERE A PARAMETER?
lda IN_BUFFER,y ; Read a character from the input buffer
bne peek_delimeter ; If not empty, check for parameters
bra peek_print ; Print peeked data
peek_delimeter:
cmp #" " ; Is the it a space delimiter?
beq peek_start_addr ; If it is, then get the start address
jsr syntax_error
bra peek_end ; End routine
peek_start_addr: ; GET START ADDRESS
jsr skip_spaces ; skip leading spaces if any
jsr get_word ; Get address from the input buffer
bcs peek_store_start ; Valid word is present, store address
jsr invalid_address ; Print invalid address
bra peek_end ; End routine
peek_store_start: ; STORE START ADDRESS
lda WORD ; Load LSB from get_word
sta CUR_ADDR ; Store it in the current address (LSB)
lda WORD+1 ; Load MSB from get_word
sta CUR_ADDR+1 ; Store it in the current address (MSB)
peek_print:
lda CUR_ADDR+1 ; Print MSB of address
jsr print_byte
lda CUR_ADDR ; Print LSB of address
jsr print_byte
lda #":" ; Print colon
jsr print_char
lda (CUR_ADDR) ; Print byte
jsr print_byte
lda #CR ; Carriage return
jsr print_char
peek_end:
rts
; _
; _ __ ___ | | __ ___
; | '_ \ / _ \ | |/ / / _ \
; | |_) | | (_) | | < | __/
; | .__/ \___/ |_|\_\ \___|
; |_|
;
; Writes a byte at a specific address
; POKE AAAA BB
; ----------------------------------------------------------------------------------------------------------------------
; DESTROYS: A, TEMP, SRC_ADDR
; RETURNS: CUR_ADDR, current address position
poke: ; IS THERE A PARAMETER?
lda IN_BUFFER,y ; Read a character from the input buffer
bne poke_delimeter ; If not empty, check for parameters
jsr no_parameter ; If empty, print no parameters message
bra poke_end ; End routine
poke_delimeter:
cmp #" " ; Is the it a space delimiter?
beq poke_start_addr ; If it is, then get the start address
jsr syntax_error
bra poke_end ; End routine
poke_start_addr: ; GET START ADDRESS
jsr skip_spaces ; skip leading spaces if any
jsr get_word ; Get address from the input buffer
bcs poke_store_start ; Valid word is present, store address
jsr invalid_address ; Print invalid address
bra poke_end ; End routine
poke_store_start: ; STORE START ADDRESS
lda WORD ; Load LSB from get_word
sta CUR_ADDR ; Store it in the current address (LSB)
lda WORD+1 ; Load MSB from get_word
sta CUR_ADDR+1 ; Store it in the current address (MSB)
poke_get_byte: ; GET BYTE
jsr skip_spaces ; Skip leading spaces
jsr get_byte ; Get address from input buffer, result in A
bcs poke_store_byte ; It's valid, write the byte
jsr invalid_parameter ; It's not valid, so write error message
bra poke_end ; End routine
poke_store_byte: ; WRITE THE BYTE, AND VERIFY IT
sta TEMP ; Save byte to compare it later
sta (CUR_ADDR) ; Store it in specified memory location
lda (CUR_ADDR) ; Read the byte just written
cmp TEMP ; Compare it to the original byte
beq poke_print ; If it matches, then print address and byte
jsr write_error ; Since it doesn't match, print write error
bra poke_end ; End routine
poke_print:
lda CUR_ADDR+1 ; Print MSB of address
jsr print_byte
lda CUR_ADDR ; Print LSB of address
jsr print_byte
lda #":" ; Print colon
jsr print_char
lda TEMP ; Print byte
jsr print_byte
lda #CR ; Carriage return
jsr print_char
poke_end:
rts
; _ _
; _ __ ___ __ _ __| | | |__ ___ __ __
; | '__| / _ \ / _` | / _` | | '_ \ / _ \ \ \/ /
; | | | __/ | (_| | | (_| | | | | | | __/ > <
; |_| \___| \__,_| \__,_| _____ |_| |_| \___| /_/\_\
; |_____|
;
; Convert two ASCII hexadecimal characters from serial terminal to 8-bit binary
; ----------------------------------------------------------------------------------------------------------------------
; Result in A
; Destroys TEMP
read_hex:
jsr read_char ; Read first character from ACIA
bcc read_hex ; If character not present, then read from ACIA again
jsr nibble2numeric ; Convert to 0..F numeric
asl a ; Shift value to MSB
asl a ;
asl a ;
asl a ; This is the upper nibble
and #$F0 ; Clear LSB
sta TEMP ; Store MSB in TEMP for merging after processing LSB
read_hex2:
jsr read_char ; Read second character from ACIA
bcc read_hex2 ; If character not present, then read from ACIA again
jsr nibble2numeric ; Convert to 0..F numeric
ora TEMP ; Merge MSB (TEMP) and LSB (A)
rts ; return byte in A
; _ _
; _ __ ___ __ _ (_) ___ | |_ ___ _ __ ___
; | '__| / _ \ / _` | | | / __| | __| / _ \ | '__| / __|
; | | | __/ | (_| | | | \__ \ | |_ | __/ | | \__ \
; |_| \___| \__, | |_| |___/ \__| \___| |_| |___/
; |___/
; Prints the registers and processor status
; ----------------------------------------------------------------------------------------------------------------------
registers:
; PRINT THE PROGRAM COUNTER
lda #"P" ; P for the program counter
jsr print_char ; Print it
lda #"C" ; C for the program counter
jsr print_char ; Print it
lda #":" ; Colon for the separator
jsr print_char ; Print it
lda PROC_PC+1 ; Load MSB
jsr print_byte ;
lda PROC_PC ; Load LSB
jsr print_byte
lda #" " ; Space for the separator
jsr print_char ; Print it
; PRINT THE ACCUMULATOR
lda #"A" ; A for the accumulator
jsr print_char ; Print it
lda #":" ; Colon for the separator
jsr print_char ; Print it
lda PROC_A ; Load the A register
jsr print_byte ; Print it
lda #" " ; Space for the separator
jsr print_char ; Print it
; PRINT THE X REGISTER
lda #"X" ; X for the X register
jsr print_char ; Print it
lda #":" ; Colon for the separator
jsr print_char ; Print it
lda PROC_X ; Load the X register
jsr print_byte ; Print it
lda #" " ; Space for the separator
jsr print_char ; Print it
; PRINT THE Y REGISTER
lda #"Y" ; Y for the Y register
jsr print_char ; Print it
lda #":" ; Colon for the separator
jsr print_char ; Print it
lda PROC_Y ; Load the Y register
jsr print_byte ; Print it
lda #" " ; Space for the separator
jsr print_char ; Print it
; PRINT THE STATUS FLAGS
lda #"F" ; F for FLAGS
jsr print_char ; Print it
lda #":" ; Colon for the separator
jsr print_char ; Print it
lda PROC_FLAGS ; Load status register
and #$80 ; Filter bit 7 (negative)
beq p_neg1
lda #"n"
bra p_neg2
p_neg1: lda #"N"
p_neg2: jsr print_char ; Print N/n"
lda PROC_FLAGS ; Load status register
and #$40 ; Filter bit 6 (overflow)
beq p_ovr1
lda #"v"
bra p_ovr2
p_ovr1: lda #"V"
p_ovr2: jsr print_char ; Print V/v
lda PROC_FLAGS ; Load status register
and #$20 ; Filter bit 5
beq p_b1
lda #"b"
bra p_b2
p_b1: lda #"B"
p_b2: jsr print_char ; Print B/b
lda PROC_FLAGS ; Load status register
and #$10 ; Filter bit 4
beq p_b3
lda #"b"
bra p_b4
p_b3: lda #"B"
p_b4: jsr print_char ; Print B/b
lda PROC_FLAGS ; Load status register
and #$08 ; Filter bit 3 (Decimal)
beq p_dec1
lda #"d"
bra p_dec2
p_dec1: lda #"D"
p_dec2: jsr print_char ; Print D/d
lda PROC_FLAGS ; Load status register
and #$04 ; Filter bit 2 (Interrupt)
beq p_int1
lda #"i"
bra p_int2
p_int1: lda #"I"
p_int2: jsr print_char ; Print I/i
lda PROC_FLAGS ; Load status register
and #$02 ; Filter bit 1 (Zero)
beq p_zer1
lda #"z"
bra p_zer2
p_zer1: lda #"Z"
p_zer2: jsr print_char ; Print Z/z
lda PROC_FLAGS ; Load status register
and #$01 ; Filter bit 0 (Carry)
beq p_car1
lda #"c"
bra p_car2
p_car1: lda #"C"
p_car2: jsr print_char ; Print C/c
lda #CR
jsr print_char ; Print carriage return
rts
; _ __ _ _ _ __
; | '__| | | | | | '_ \
; | | | |_| | | | | |
; |_| \__,_| |_| |_|
; Execute code at address specified, or at CUR_ADDR
; ----------------------------------------------------------------------------------------------------------------------
run:
lda IN_BUFFER,y ; Read a character from the input buffer
bne run_get_addr ; It's not the end of string, get address
jmp (CUR_ADDR) ; Execute code at CUR_ADDR
run_get_addr:
cmp #" " ; Is it the space delimiter?
beq run_at_addr ; Yes it is. Then go read an address
jsr syntax_error ; If anything else, print a syntax error
rts ; End of routine
run_at_addr: ; GET START ADDRESS
jsr skip_spaces ; skip leading spaces
jsr get_word ; Get address from the input buffer
bcs run_addr ; Valid address
jsr invalid_address ; If there's an error in the address, print it
bra run_end
run_addr:
jmp (WORD) ; Execute code at specified address
run_end:
rts
; ___ __ _ __ __ ___
; / __| / _` | \ \ / / / _ \
; \__ \ | (_| | \ V / | __/
; |___/ \__,_| \_/ \___|
; Save a portion of memory to the computer
; ---------------------------------------------------------------------------------------------------------------------------------
save:
rts
; _
; ___ | |_ _ __ ___ __ _ _ __ ___
; / __| | __| | '__| / _ \ / _` | | '_ ` _ \
; \__ \ | |_ | | | __/ | (_| | | | | | | |
; |___/ \__| |_| \___| \__,_| |_| |_| |_|
; Send a stream of bytes to a specific address, with a 1 millisecond delay between bytes
; ---------------------------------------------------------------------------------------------------------------------------------
stream: ; IS THERE A PARAMETER?
ldx #0 ; Set byte counter to 0
lda IN_BUFFER,y ; Read a character from the input buffer
bne stream_delimeter ; If not empty, check for parameters
jmp no_parameter ; If empty, print no parameters message, and end routine
stream_delimeter:
cmp #" " ; Is the it a space delimiter?
beq stream_start_addr ; If it is, then get the start address
jmp syntax_error ; Print syntax error, and end routine
stream_start_addr: ; GET START ADDRESS
jsr skip_spaces ; skip leading spaces if any
jsr get_word ; Get address from the input buffer
bcs stream_store_start ; Valid word is present, store address
jmp invalid_address ; Print invalid address, and end routine
stream_store_start: ; STORE START ADDRESS
lda WORD ; Load LSB from get_word
sta CUR_ADDR ; Store it in the current address (LSB)
lda WORD+1 ; Load MSB from get_word
sta CUR_ADDR+1 ; Store it in the current address (MSB)
stream_get_byte: ; GET BYTE
jsr skip_spaces ; Skip leading spaces
cpx #0 ; If the first byte has not been read
beq stream_get_byte2 ; Then read a byte
lda IN_BUFFER,y ; Read buffer to see if it's end of line
beq stream_end ; It it's an end of line character, end routine
stream_get_byte2:
inx ; Increment byte count
jsr get_byte ; Get address from input buffer, result in A
bcs stream_store_byte ; It's valid, write the byte
jmp invalid_parameter ; It's not valid, so write error message, and end routine
stream_store_byte: ; WRITE THE BYTE, AND VERIFY IT
sta (CUR_ADDR) ; Store it in specified memory location
lda #1 ; set 1ms delay
jsr millis ;
stream_loop_bytes: ; IF THERE ARE MORE BYTES, WRITE THEM
lda IN_BUFFER,y ; Read a character from the input buffer
beq stream_end ; Yes it is, then end routine
cmp #" " ; Is the it a space delimiter?
beq stream_get_byte ; It is, then get the byte
jmp invalid_parameter ; Print an error if parameter is invalid, and end routine
stream_end:
rts
; _ _
; ___ | | __ (_) _ __ ___ _ __ __ _ ___ ___ ___
; / __| | |/ / | | | '_ \ / __| | '_ \ / _` | / __| / _ \ / __|
; \__ \ | < | | | |_) | \__ \ | |_) | | (_| | | (__ | __/ \__ \
; |___/ |_|\_\ |_| | .__/ _____ |___/ | .__/ \__,_| \___| \___| |___/
; |_| |_____| |_|
;
; Skip spaces from INPUT_BUFFER at current index IN_BUFFER_PTR
; ----------------------------------------------------------------------------------------------------------------------
; INPUT: Y (current position)
; OUTPUT: Y (new position)
skip_spaces:
pha
skip_spaces_loop:
lda IN_BUFFER,y ; Load character
cmp #" " ; Is it a space?
bne skip_spaces_end ; Not a space? Then end subroutine
iny ; Increment index for next character
inc ERROR_PTR ; Increment pointer to next potential error location
bra skip_spaces_loop ; Go and read another character
skip_spaces_end:
pla
rts
; _ _
; __ __ _ __ (_) | |_ ___ _ __ ___ ___ _ __ ___
; \ \ /\ / / | '__| | | | __| / _ \ | '_ ` _ \ / _ \ | '_ ` _ \
; \ V V / | | | | | |_ | __/ | | | | | | | __/ | | | | | |
; \_/\_/ |_| |_| \__| \___| _____ |_| |_| |_| \___| |_| |_| |_|
; |_____|
;
; Writes a byte or a series of consecutive bytes at current address
; ----------------------------------------------------------------------------------------------------------------------
; RETURNS: CUR_ADDR, current address position
write_mem: ; IS THERE A PARAMETER?
ldx #0 ; Number of byte counter to 0
lda IN_BUFFER,y ; Read a character from the input buffer
bne write_mem_delimeter ; If not empty, check for parameters
jmp no_parameter ; If empty, print no parameters message, and end routine
write_mem_delimeter:
cmp #" " ; Is the it a space delimiter?
beq write_mem_start_addr ; If it is, then get the start address
jmp syntax_error ; Print syntax error, and end routine
write_mem_start_addr: ; GET START ADDRESS
jsr skip_spaces ; skip leading spaces if any
jsr get_word ; Get address from the input buffer
bcs write_mem_store_start ; Valid word is present, store address
jmp invalid_address ; Print invalid address, and end routine
write_mem_store_start: ; STORE START ADDRESS
lda WORD ; Load LSB from get_word
sta CUR_ADDR ; Store it in the current address (LSB)
lda WORD+1 ; Load MSB from get_word
sta CUR_ADDR+1 ; Store it in the current address (MSB)
write_mem_get_byte: ; GET BYTE
jsr skip_spaces ; Skip leading spaces
cpx #0 ; If the first byte has not been read
beq write_mem_get_byte2 ; Then read a byte
lda IN_BUFFER,y ; Read buffer to see if it's end of line
beq write_mem_end ; It it's an end of line character, end routine
write_mem_get_byte2:
inx ; Increment byte count
jsr get_byte ; Get address from input buffer, result in A
bcs write_mem_store_byte ; It's valid, write the byte
jmp invalid_parameter ; It's not valid, so write error message, and end routine
write_mem_store_byte: ; WRITE THE BYTE, AND VERIFY IT
sta TEMP ; Save byte to compare it later
sta (CUR_ADDR) ; Store it in specified memory location
lda (CUR_ADDR) ; Read the byte just written
cmp TEMP ; Compare it to the original byte
beq write_mem_loop_bytes ; If it matches, read next byte if there are any
jmp write_error ; Since it doesn't match, print write error, and end routine
write_mem_loop_bytes: ; IF THERE ARE MORE BYTES, WRITE THEM
jsr inc_cur_addr ; Increment current address position for next byte
lda IN_BUFFER,y ; Read a character from the input buffer
beq write_mem_end ; Is it the end of buffer? Yes it is, then end routine
cmp #" " ; Is the it a space delimiter?
beq write_mem_get_byte ; It is, then get the byte
jmp invalid_parameter ; Print an error if parameter is invalid, and end routine
write_mem_end:
rts
; ____ ___ _ __ ___ _ __ ___ ___ _ __ ___
; |_ / / _ \ | '__| / _ \ | '_ ` _ \ / _ \ | '_ ` _ \
; / / | __/ | | | (_) | | | | | | | | __/ | | | | | |
; /___| \___| |_| \___/ _____ |_| |_| |_| \___| |_| |_| |_|
; |_____|
;
; Writes zeros in all memory locations and resets
; ----------------------------------------------------------------------------------------------------------------------
zero_mem:
; ZERO PAGE
;----------
; sei
printString zero_clearing_zp_msg; *MACRO*
; ldx #$00 ; Reset pointer
zero_zeropage:
; stz $00,x ; Zero out address $0000 + X
; inx ; Point to next memory location
; bne zero_zeropage ; Loop until X reaches zero
; STACK PAGE
; ----------
printString zero_clearing_stack_msg ; *MACRO*
; tsx ; Load current stack pointer (not $FF)
zero_stackpage:
; stz $0100,x ; Zero out address $0100 + X
; dex ; Point to the next memory location
; bne zero_stackpage ; Loop until X reaches zero
; stz $0100 ; Make sure $0100 is cleared
; cli ;
; SYSTEM RAM
; ----------
printString zero_clearing_ram_msg; *MACRO*
lda #$02 ; Start at page 2
sta CUR_ADDR+1 ; Store page 2 value at MSB current address
stz CUR_ADDR ; LSB is at 0
zero_sysram_loop:
lda #0
sta (CUR_ADDR) ; Clear byte pointed by current address
lda #>END_RAM ; Has it reached end of RAM (MSB)?
cmp CUR_ADDR+1 ;
bne zero_sysram_continue ; No, then continue on to the next address
lda #<END_RAM ; Has it reached end of RAM (LSB)?
cmp CUR_ADDR ;
; beq zero_bankram
beq zero_nvram
zero_sysram_continue:
jsr inc_cur_addr
bra zero_sysram_loop
; BANK RAM
; --------
;zero_bankram:
; printString zero_clearing_bank_msg ; *MACRO*
; ldx #NUMBER_OF_BANKS ; Set x to the total number of banks
;zero_bankram_nextbank:
; stx BANK_SEL ; Set bank selector
; stx BIN
; jsr bin2bcd8
; lda BCD
; jsr print_byte ; Print space
; SET START ADDRESS
; lda #>START_BANKRAM ; Load start address (MSB)
; sta CUR_ADDR+1 ; Save start address accessed (MSB)
; lda #<START_BANKRAM ; Load start address (LSB)
; sta CUR_ADDR ; Save start address accessed (LSB)
;zero_bankram_loop:
; lda #0
; sta (CUR_ADDR) ; Clear byte pointed by current address
; CHECK FOR END ADDRESS
; lda #>END_BANKRAM ; Has it reached end of RAM (MSB)?
; cmp CUR_ADDR+1 ;
; bne zero_bankram_continue ; No, then continue on to the next address
; lda #<END_BANKRAM ; Has it reached end of RAM (LSB)?
; cmp CUR_ADDR ;
; beq zero_bankram_bankchange ; go to next bank
;zero_bankram_continue:
; jsr inc_cur_addr
; bra zero_bankram_loop
;zero_bankram_bankchange:
; ldy #2 ; Set backspace counter to 3
; jsr delete_char ; Delete 2 characters from terminal
; dex
; bne zero_bankram_nextbank ; bank 0 is tested when first iteration is done (i.e. 64 = %01000000)
; ldy #7 ; Set backspace counter to 3
; jsr delete_char ; Delete 7 characters from terminal
; lda #CR
; jsr print_char
; NVRAM (Is not zeroed out, as it's used for semi-permanenet storage. Use "fill_mem" to zero it out manually)
; -----
zero_nvram:
printString zero_clearing_nvram_msg ; *MACRO*
zero_end:
rts
; ----------------------------------------------------------------------------------------------------------------------
; COMMON MESSAGES
; ----------------------------------------------------------------------------------------------------------------------
command_prompt:
lda CUR_ADDR+1 ; Display current address MSB
jsr print_byte ;
lda CUR_ADDR ; Display current address LSB
jsr print_byte ;
lda #">" ; Display prompt symbol
jsr print_char ;
lda #" " ; Display prompt symbol
jsr print_char ;
lda #6 ; Number of characters taken by the prompt
sta ERROR_PTR ; Store it as default value for error pointer
rts
error_pointer:
ldx ERROR_PTR
error_pointer_loop:
lda #" "
jsr print_char
dex
bne error_pointer_loop
lda #"^"
jsr print_char
lda #CR
jsr print_char
rts
no_parameter:
jsr error_pointer ; Print error pointer underneath the command-line culprit
printString no_parameter_msg ; *MACRO*
rts ; End subroutine
invalid_address:
jsr error_pointer ; Print error pointer underneath the command-line culprit
printString invalid_addr_msg ; *MACRO*
rts
invalid_byte:
jsr error_pointer ; Print error pointer underneath the command-line culprit
printString invalid_byte_msg ; *MACRO*
rts
invalid_parameter:
jsr error_pointer ; Print error pointer underneath the command-line culprit
printString invalid_param_msg ; *MACRO*
rts
invalid_command:
jsr error_pointer ; Print error pointer underneath the command-line culprit
printString invalid_command_msg ; *MACRO*
rts
syntax_error:
jsr error_pointer ; Print error pointer underneath the command-line culprit
printString syntax_error_msg ; *MACRO*
rts
write_error:
printString write_error_msg ; *MACRO*
rts ; End subroutine
| 31.145825 | 132 | 0.636421 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.