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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ebd83ee2ba7892d3f1db89a82214d85878854cb1 | 6,306 | asm | Assembly | c2000/C2000Ware_1_00_06_00/libraries/dsp/FixedPoint/c28/source/fir32.asm | ramok/Themis_ForHPSDR | d0f323a843ac0a488ef816ccb7c828032855a40a | [
"Unlicense"
] | null | null | null | c2000/C2000Ware_1_00_06_00/libraries/dsp/FixedPoint/c28/source/fir32.asm | ramok/Themis_ForHPSDR | d0f323a843ac0a488ef816ccb7c828032855a40a | [
"Unlicense"
] | null | null | null | c2000/C2000Ware_1_00_06_00/libraries/dsp/FixedPoint/c28/source/fir32.asm | ramok/Themis_ForHPSDR | d0f323a843ac0a488ef816ccb7c828032855a40a | [
"Unlicense"
] | 1 | 2021-07-21T08:10:37.000Z | 2021-07-21T08:10:37.000Z | ;;#############################################################################
;;! \file source/fir32.asm
;;!
;;! \brief 32-bit FIR filter
;;!
;;! \date Jan 11, 2011
;;!
;;
;; Group: C2000
;; Target Family: C28x
;;
;;#############################################################################
;;$TI Release: C28x Fixed Point DSP Library v1.20.00.00 $
;;$Release Date: Thu Oct 18 15:57:22 CDT 2018 $
;;$Copyright: Copyright (C) 2014-2018 Texas Instruments Incorporated -
;; http://www.ti.com/ ALL RIGHTS RESERVED $
;;#############################################################################
;;
;;*****************************************************************************
;; includes
;;*****************************************************************************
;;
;;*****************************************************************************
;; globals
;;*****************************************************************************
; Module definition for external reference
.def _FIR32_init
.def _FIR32_calc
;;
;;=============================================================================
;; Routine Type : C Callable
;; Description :
;; void FIR16_calc(FIR16_handle)
;;
;; This routine implements the non-recursive difference equation of an
;; all-zero filter(FIR), of order N. All the coefficients of all-zero
;; filter are assumed to be less than 1 in magnitude.
;;=============================================================================
;;
;; Difference Equation :
;;
;; y(n)=H(0)*x(n)+H(1)*x(n-1)+H(2)*x(n-2)+....+H(N)*x(n-N)
;;
;; where
;; y(n)=output sample of the filter at index n
;; x(n)=input sample of the filter at index n
;;
;; Transfer Function :
;;
;; Y(z) -1 -2 -N+1 -N
;; ----- = h(0) + h(1) z + h(2) z + ... +h(N-1) z + h(N) z
;; X(z)
;;
;; Network Diagram :
;
;; dbuffer[0] dbuffer[1] dbuffer[2] dbuffer[N}
;; Input -1 x(n-1) -1 x(n-2) x(n-N)
;; x(n) >------o----z---->-o----z---->-o--- - ->- - o
;; | | | |
;; | | | |
;; | | | |
;; v H(0) v H(1) v H(2) v H(N)
;; | | | |
;; | | | | output
;; |---->-----(+)---->----(+)-- - -> - (+)-----> y(n)
;;
;; Symbols Used :
;; H(0),H(1),H(2),...,H(N) : filter coefficients
;; x(n-1),x(n-2),...,x(n-N) : filter states
;; x(n) : filter input
;; y(n) : filter output
;;=============================================================================
;; Function Input: This function accepts the handle of the below structure
;;
;; typedef struct { <------------ XAR4
;; int32_t *coeff_ptr; /* +0 Pointer to Filter coefficient */
;; int32_t * dbuffer_ptr; /* +2 Delay buffer ptr */
;; int16_t cbindex; /* +4 Circular Buffer Index */
;; int16_t order; /* +5 Order of the Filter */
;; int16_t input; /* +6 Latest Input sample */
;; int16_t output; /* +7 Filter Output */
;; void (*init)(void *); /* +8 Ptr to Init funtion */
;; void (*calc)(void *); /* +10 Ptr to calc fn */
;; }FIR32;
;;
_FIR32_init:
ADDB XAR4,#2
MOV *+XAR4[4],#0 ; XAR4->ouput, input=0
MOV *+XAR4[6],#0 ; output=0
MOVL XAR6,*XAR4 ; XAR6=dbuffer_ptr
MOV ACC,*+XAR4[3] << 1 ; AL=2*order
MOV AH,AL ; AH=2*order
ADDB AL,#1 ; AL=2*order+1
MOV *+XAR4[2],AH ; cbindex = 2*order (will wrap around if offset > 2*order)
RPT AL
|| MOV *XAR6++,#0
LRETR
ConstTable:
PosSatVal: .long 0x00FFFFFF ; Corresponds to >> 6
NegSatVal: .long 0xFF000000 ; Corresponds to >> 6
FILTER_SIZE .set 44
_FIR32_calc:
PUSH XAR1 ; Context Save
SETC SXM,OVM ; AR4=FIR16_handle->coeff_ptr
SPM 0 ; Create guard band of >> 6
MOVL XAR7,*XAR4 ; XAR4->coeff_ptr, XAR7=coeff_ptr
MOVZ AR1,*+XAR4[4] ; XAR4->coeff_ptr, AR1=cbindex
MOVL XAR6,*+XAR4[2] ; XAR4->coeff_ptr, XAR6=dbuffer_ptr
MOVL ACC,*+XAR4[6] ; ACC = X:Input
MOVL *XAR6%++,ACC ; Store in data array and inc circ address
MOVL *+XAR4[2],XAR6 ; XAR4->coeff_ptr, update the dbuffer pointer
MOV ACC,*+XAR4[5] ; AR0=order
MOVZ AR0,AL ; AR0=order
ZAPA ; Zero the ACC, P registers and OVC counter
;; <<VC140828 - debug only
;;.asg 0, N
;;.loop
;;QMACL P,*+XAR6[AR1%++],*XAR7++ ; ACC = ACC + P << PM = ACC + P << 0
;; ; P = (signed[*+XAR6[AR1%++]] * signed[*XAR7++]) >> 32
;;.eval N + 1, N ; increment N
;;.break N = FILTER_SIZE
;;.endloop
;; VC140828>>
RPT AR0
|| QMACL P,*XAR6%++,*XAR7++
ADDL ACC,P ; Add the two sums with shift
ADDB XAR4,#1
MOVL *+XAR4[7],ACC ; Store saturated result (Q30)
SPM 0
POP XAR1
CLRC OVM
LRETR
;;#############################################################################
;; End of File
;;#############################################################################
| 40.948052 | 105 | 0.336981 |
27be6ccf375e206447fddb6cc844c6e72d1d80bf | 5,206 | asm | Assembly | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_1289.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_1289.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_1289.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r15
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_UC_ht+0x1e7df, %r11
clflush (%r11)
nop
nop
sub $43678, %rsi
movb $0x61, (%r11)
cmp %r15, %r15
lea addresses_A_ht+0x520f, %r11
nop
nop
nop
nop
sub %rcx, %rcx
movups (%r11), %xmm3
vpextrq $0, %xmm3, %r12
and $25583, %rcx
lea addresses_normal_ht+0x1e62d, %rsi
lea addresses_WC_ht+0x137df, %rdi
cmp $22491, %r11
mov $13, %rcx
rep movsw
nop
xor $50196, %r12
lea addresses_WC_ht+0x129df, %rsi
lea addresses_D_ht+0x191df, %rdi
clflush (%rdi)
nop
nop
nop
add $2702, %r13
mov $46, %rcx
rep movsb
nop
nop
cmp $49180, %rcx
lea addresses_WT_ht+0x810f, %rsi
lea addresses_UC_ht+0x18adf, %rdi
nop
nop
sub %r15, %r15
mov $108, %rcx
rep movsw
nop
nop
and $41907, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r15
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r9
push %rbx
push %rdi
push %rdx
// Faulty Load
lea addresses_UC+0xd7df, %r10
nop
nop
cmp %rbx, %rbx
mov (%r10), %edi
lea oracles, %r9
and $0xff, %rdi
shlq $12, %rdi
mov (%r9,%rdi,1), %rdi
pop %rdx
pop %rdi
pop %rbx
pop %r9
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_UC', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}}
{'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_D_ht'}}
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 48.203704 | 2,999 | 0.661544 |
9f864c97d93d695a1ae6a1fb9a6f570d16787e09 | 141 | asm | Assembly | libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/___fs2uchar_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/___fs2uchar_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/___fs2uchar_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null |
SECTION code_fp_math32
PUBLIC ___fs2uchar_callee
EXTERN cm32_sdcc___fs2uchar_callee
defc ___fs2uchar_callee = cm32_sdcc___fs2uchar_callee
| 17.625 | 53 | 0.900709 |
b056bfbd55a873429bbbc1b03c9ec015abe956f9 | 479 | asm | Assembly | programs/oeis/103/A103566.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/103/A103566.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/103/A103566.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A103566: Sum of the primes > 5 modulo 3.
; 1,3,4,6,7,9,11,12,13,15,16,18,20,22,23,24,26,27,28,30,32,33,35,36,38,39,41,42,44,46,47,49,50,51,52,54,56,58,59,61,62,64,65,66,67,69,70,72,74,75,77,79,81,83,84,85,87,88,90,91,93,94,96,97,98,100,101,103,105,106
mov $2,$0
add $2,1
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
add $0,3
seq $0,132194 ; a(n) = 1 if n-th prime is 0 or 2 mod 3, otherwise 0.
mov $3,$0
add $3,1
div $3,2
add $3,1
add $1,$3
lpe
mov $0,$1
| 23.95 | 210 | 0.590814 |
ca4488e2966d61521daa1786f83f184392539cb2 | 2,564 | nasm | Assembly | sem 4 Programs/Microprocessor/mp_me/nasm/bsort.nasm | Sameer411/Second_Year_Lab_Assignment | 4481803f463464ae53066feb76028761944af200 | [
"MIT"
] | 5 | 2019-12-09T18:15:09.000Z | 2021-12-27T13:47:37.000Z | sem 4 Programs/Microprocessor/mp_me/nasm/bsort.nasm | Sameer411/Second_Year_Lab_Assignment | 4481803f463464ae53066feb76028761944af200 | [
"MIT"
] | null | null | null | sem 4 Programs/Microprocessor/mp_me/nasm/bsort.nasm | Sameer411/Second_Year_Lab_Assignment | 4481803f463464ae53066feb76028761944af200 | [
"MIT"
] | 4 | 2020-04-18T13:07:33.000Z | 2022-02-14T04:09:33.000Z | global _start
_start:
%include "macro.nasm"
;====================================================================
section .text
%macro disp 2
mov rax,1
mov rdi,1
mov rsi,%1
mov rdx,%2
syscall
%endmacro
pop rcx ;no. of arguments
pop rcx ;program name
pop rcx ;file name
mov [filename],rcx
open [filename]
cmp rax,-1h
je error
mov [filehandle],rax
read [filehandle],buffer,bufflen
dec rax
mov [abufflen],rax
disp msg2,len2
disp buffer,[abufflen]
call procedure1 ;Find the length of buffer
call buffer_array ;Create array of integers remove enter
disp msg3,len3
call b_sort ;For sorting the elements
write [filehandle],buffer1,[num1]
disp buffer1,[num1]
close [filehandle]
exit1:
mov rax,60
mov rdi,0
syscall
;..................................................................
error:
disp msg1,len1
jmp exit1
;..................................................................
procedure1:
mov rsi,buffer
mov cl,00h
mov al,50h
c1:
mov al,[rsi]
cmp al,0Ah
jne c2
inc cl
inc cl
c2:
inc rsi
dec dl
jnz c1
mov byte[abufflen],cl
ret
;..................................................................
buffer_array:
mov rdi,buffer1
mov rsi,buffer
mov cl,00h
mov dl,byte[abufflen]
a1:
mov al,[rsi]
mov [rdi],al
inc rsi
inc rsi
inc rdi
inc cl
dec dl
dec dl
jnz a1
mov byte[num1],cl
ret
;..................................................................
b_sort:
mov cl,[num1]
mov [cnt1],cl
z3:
mov rsi,buffer1
mov rdi,buffer1
inc rdi
mov cl,[num1]
dec cl
mov [cnt2],cl
z2:
mov cl,[rsi]
mov dl,[rdi]
cmp cl,dl
jbe z1
call swap
z1:
mov [rsi],cl
mov [rdi],dl
inc rsi
inc rdi
dec byte[cnt2]
jnz z2
dec byte[cnt1]
jnz z3
ret
swap:
mov al,cl
mov cl,dl
mov dl, al
ret
;========================================================
section .data
msg1 : db "Error in opening file",10
len1: equ $-msg1
msg2 : db "Numbers are : ",10
len2: equ $-msg2
msg3 : db "Sorted Numbers are : ",10
len3: equ $-msg3
;=========================================================
section .bss
filename resb 200
filehandle resb 200
buffer resb 200
bufflen resb 200
buffer1 resb 200
abufflen resb 200
cnt1 resb 100
cnt2 resb 100
num1 resb 100
;===========================================================
| 17.682759 | 101 | 0.473479 |
781e5427dba8eba885b4da96f717414b9804b72a | 350 | asm | Assembly | programs/oeis/002/A002011.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/002/A002011.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/002/A002011.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A002011: a(n) = 4*(2n+1)!/n!^2.
; 4,24,120,560,2520,11088,48048,205920,875160,3695120,15519504,64899744,270415600,1123264800,4653525600,19234572480,79342611480,326704870800,1343120024400,5513861152800,22606830726480,92580354403680,378737813469600,1547884976788800,6320530321887600
add $0,1
mov $1,$0
mul $1,2
bin $1,$0
mul $1,$0
div $1,2
mul $1,4
| 31.818182 | 248 | 0.777143 |
138dadef67964cefce67e65e97aa9e9d84ece0e2 | 2,068 | asm | Assembly | src/z80asm/dev/z80asm_lib/daa.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null | src/z80asm/dev/z80asm_lib/daa.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null | src/z80asm/dev/z80asm_lib/daa.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null | ;------------------------------------------------------------------------------
; Z88DK Z80 Macro Assembler
;
; DAA emulation for Rabbit - based on the Fuse implementation
;
; Copyright (C) Paulo Custodio, 2011-2017
; License: The Artistic License 2.0, http://www.perlfoundation.org/artistic_license_2_0
; Repository: https://github.com/z88dk/z88dk
;------------------------------------------------------------------------------
IF !__CPU_8080__ && !__CPU_8085__
SECTION code_crt0_sccz80
PUBLIC __z80asm__daa
__z80asm__daa:
push bc
push af
ex (sp), hl ; H is A, L is F
; libspectrum_byte add = 0, carry = ( F & FLAG_C );
ld bc, 0 ; B = add
rl c ; C = 1 if carry, 0 otherwise
; if( ( F & FLAG_H ) || ( ( A & 0x0f ) > 9 ) ) add = 6;
bit 4, l ; check H
jr nz, t1_true
ld a, h
and $0F
cp 9+1 ; A >= 10 -> no carry
jr c, t1_cont
t1_true:
ld b, 6 ; add = 6
t1_cont:
; if( carry || ( A > 0x99 ) ) add |= 0x60;
bit 0, c ; check carry
jr nz, t2_true
ld a, h
cp 0x99+1
jr c, t2_cont
t2_true:
ld a, 0x60
or b
ld b, a
t2_cont:
; if( A > 0x99 ) carry = FLAG_C;
ld a, h
cp 0x99+1
jr c, t3_cont
t3_true:
set 0, c ; store carry=1 in C
t3_cont:
; if( F & FLAG_N ) { SUB(add); } else { ADD(add); }
bit 1, l ; check N
ld a, h ; prepare to add/subtract
jr z, t4_zero
t4_one:
sub b
jr t4_cont
t4_zero:
add a, b
t4_cont:
ld h, a
; F = ( F & ~( FLAG_C | FLAG_P ) ) | carry | parity_table[A];
ld a, l
and ~$01 ; clear C
or $04 ; set P/V (even = 1, odd = 0)
or c ; | carry
ld l, a
ld b, $80
parity_loop:
ld a, h
and b ; check each bit
jr z, bit0
ld a, l
xor $04 ; invert parity bit
ld l, a
bit0:
rr b
jr nc, parity_loop
; set zero flag
ld a, h
and a
jr nz, not_z
set 6, l ; set Z flag
not_z:
; set sign flag
bit 7, h
jr z, positive
set 7, l ; set S flag
positive:
; return
ex (sp), hl
pop af
pop bc
ret
ENDIF
| 16.95082 | 87 | 0.505319 |
83399fe50bff64c945588a6e22c302582d422777 | 8,041 | asm | Assembly | x86/BasicMacros.asm | lucabrivio/asmFish-fasmg | e1d082dcc493bfa18baee0933c113c7a92cd70d8 | [
"BSD-3-Clause"
] | 1 | 2021-07-08T10:54:07.000Z | 2021-07-08T10:54:07.000Z | x86/BasicMacros.asm | lucabrivio/asmFish-fasmg | e1d082dcc493bfa18baee0933c113c7a92cd70d8 | [
"BSD-3-Clause"
] | null | null | null | x86/BasicMacros.asm | lucabrivio/asmFish-fasmg | e1d082dcc493bfa18baee0933c113c7a92cd70d8 | [
"BSD-3-Clause"
] | 1 | 2020-04-19T16:49:48.000Z | 2020-04-19T16:49:48.000Z |
; convert 64 bit register reg to its 32 bit version
; for >= r8, r8d is the 32 bit version
raxd equ eax
rbxd equ ebx
rcxd equ ecx
rdxd equ edx
rbpd equ ebp
rsid equ esi
rdid equ edi
; lazy way to put an address of a string into a register
macro lstring reg, target, Mes
local m
lea reg, [m]
jmp target
m:
db Mes
db 0
end macro
macro PrintNL
if VERSION_OS = 'W'
mov al, 13
stosb
end if
mov al, 10
stosb
end macro
macro PrintNewLine
if VERSION_OS = 'W'
mov al, 13
stosb
end if
mov al, 10
stosb
end macro
macro NewLineData
if VERSION_OS = 'W'
db 13
end if
db 10
end macro
macro IntegerStringData number
local value, pos, digit, disp
value = number
if value < 0
db '-'
value = -value
end if
pos = 10000000
disp = 0
repeat 8
digit = value/pos
value = value - (digit*pos)
pos = pos/10
disp = disp or digit
if disp <> 0 | pos = 1
db '0' + digit
end if
end repeat
end macro
macro BuildTimeData
local time, day, year, month, febdays
time = %t
day = time/(24*3600)
day = day - (day + 365)/(3*365+366)
year = 1970 + day/365
day = day mod 365 + 1
month = 1
if year mod 4 = 0
febdays = 29
else
febdays = 28
end if
iterate dayscount, 31,febdays,31,30,31,30,31,31,30,31,30,31
if day > dayscount
day = day - dayscount
month = month + 1
end if
end iterate
db '0' + (year / 1000)
db '0' + (year mod 1000) / 100
db '0' + (year mod 100) / 10
db '0' + (year mod 10)
db '-'
db '0' + (month / 10)
db '0' + (month mod 10)
db '-'
db '0' + (day / 10)
db '0' + (day mod 10)
end macro
; macro for string functions
; the string m is put in the code
; and the function fxn is called on it
macro szcall fxn, m
local message, over
lea rcx, [message]
jmp over
message: db m
db 0
over: call fxn
end macro
; should work for registers or immediates
macro ClampUnsigned x, min, max
local Lower, Done
cmp x, min
jb Lower
cmp x, max
jb Done
mov x, max
jmp Done
Lower:
mov x, min
Done:
end macro
; should work for registers or immediates
macro ClampSigned x, min, max
local Lower, Done
cmp x, min
jl Lower
cmp x, max
jl Done
mov x, max
jmp Done
Lower:
mov x, min
Done:
end macro
; convert from uppercase to lowercase
macro ToLower x
local Lower
sub x, 'A'
cmp x, 'Z'-'A' + 1
jae Lower
add x, ('a'-'A')
Lower:
add x, 'A'
end macro
;macro print description,number
;{
; display description
; value=number
; pos=100000
; repeat 6
; digit=value/pos
; value=value-(digit*pos)
; pos=pos/10
; display ('0'+digit)
; end repeat
; display $d,$a
;}
; use this macro if you are too lazy to touch beforehand the required amount of stack
; for functions that need more than 4K of stack space
; here we assume that the current stack pointer is in the commited range
; if size > 4096, [rsp-size] might be past the gaurd page
; so touch the pages up to it
STACK_PAGE_SIZE = 4096
macro _chkstk_ms stackptr, size
; print 'local size = ', size
repeat (size+8) / STACK_PAGE_SIZE
cmp al, byte[stackptr - % * STACK_PAGE_SIZE]
end repeat
end macro
; a = PopCnt(b)
macro _popcnt a, x, t
if CPU_HAS_POPCNT <> 0
popcnt a, x
else
if a eq t
err 'arguments of _popcnt15 are strange'
end if
match size[addr], x ; x is memory
mov a, x
mov t, x
shr a, 1
and a, qword[Mask55]
sub t, a
mov a, t
shr t, 2
and a, qword[Mask33]
and t, qword[Mask33]
add a, t
mov t, a
shr a, 4
add a, t
and a, qword[Mask0F]
imul a, qword[Mask01]
shr a, 56
else
if a eq x ; only have two registers to work with
mov t, a
shr t, 1
and t, qword[Mask55]
sub a, t
mov t, a
shr t, 2
and a, qword[Mask33]
and t, qword[Mask33]
add a, t
mov t, a
shr t, 4
add a, t
and a, qword[Mask0F]
imul a, qword[Mask01]
shr a, 56
else ; can't write to x
mov a, x
mov t, x
shr a, 1
and a, qword[Mask55]
sub t, a
mov a, t
shr t, 2
and a, qword[Mask33]
and t, qword[Mask33]
add a, t
mov t, a
shr a, 4
add a, t
and a, qword[Mask0F]
imul a, qword[Mask01]
shr a, 56
end if
end match
end if
end macro
; a = PopCnt(x) assuming PopCnt(b)<16
; a and t are expected to be registers
;macro _popcnt15 a, x, t
;
;display 'touching pop15'
;
; if CPU_HAS_POPCNT <> 0
; popcnt a, x
; else
; if a eq t
; err 'arguments of _popcnt15 are strange'
; end if
; match size[addr], x ; x is memory
; mov a, x
; mov t, x
; shr a, 1
; and a, qword[Mask55]
; sub t, a
; mov a, t
; shr t, 2
; and a, qword[Mask33]
; and t, qword[Mask33]
; add a, t
; imul a, qword[Mask11]
; shr a, 56
; else
; if a eq x ; only have two registers to work with
; mov t, x
; shr t, 1
; and t, qword[Mask55]
; sub x, t
; mov t, x
; shr t, 2
; and x, qword[Mask33]
; and t, qword[Mask33]
; add x, t
; imul x, qword[Mask01]
; shr x, 56
; else ; can't write to x
; mov a, x
; mov t, x
; shr a, 1
; and a, qword[Mask55]
; sub t, a
; mov a, t
; shr t, 2
; and a, qword[Mask33]
; and t, qword[Mask33]
; add a, t
; imul a, qword[Mask11]
; shr a, 56
; end if
; end match
; end if
;end macro
; a = ClearLowestBit(b)
; carry flag is not handled consistently
; none of a, b, t can be memory
macro _blsr a, b, t
if CPU_HAS_BMI1
blsr a, b
else
if a eq b
lea t, [a-1]
and a, t
else
lea a, [b-1]
and a, b
end if
end if
end macro
; a = IsolateLowestBit(b)
; carry flag is not handled consistently
; none of a, b, t can be memory
macro _blsi a, b, t
if CPU_HAS_BMI1
blsi a, b
else
if a eq b
mov t, a
neg a
and a, t
else
mov a, b
neg a
and a, b
end if
end if
end macro
; a = And(Not(b),c)
; sign and zero flags are handled consistently
macro _andn a, b, c
if CPU_HAS_BMI1
andn a, b, c
else
match size[addr], c
if a eq b
not a
and a, c
else
mov a, b
not a
and a, c
end if
else
if b eq c
err 'arguments of andn are strange'
else if a eq c
not b
and a, b
not b
else if a eq b
not a
and a, c
else
mov a, b
not a
and a, c
end if
end match
end if
end macro
; y = BitDeposit(x,m)
macro _pdep y, x, m, b, t, tm
local start, skip, done
if CPU_HASH_BMI2 <> 0
pdep y, x, m
else
mov tm, m
xor y, y
lea b, [y+1]
test tm, tm
jz done
start: mov t, tm
neg t
and t, tm
test x, b
jz skip
or y, t
skip: lea t, [tm-1]
add b, b
and tm, t
jnz start
done:
end if
end macro
; y = BitExtract(x,m)
macro _pext y, x, m, b, t, tm
local start, skip, done
if CPU_HASH_BMI2 <> 0
pext y, x, m
else
mov tm, m
xor y, y
lea b, [y+1]
test tm, tm
jz done
start: mov t, tm
neg t
and t, tm
test t, x
lea t, [tm-1]
jz skip
or y, b
skip: add b, b
and tm, t
jnz start
done:
end if
end macro
| 18.442661 | 85 | 0.516229 |
3c72103bd9baaf261a39147ae6c7592c0cfd3e53 | 402 | asm | Assembly | programs/oeis/251/A251610.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/251/A251610.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/251/A251610.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A251610: Determinants of the spiral knots S(4,k,(1,1,1)).
; 1,4,3,0,5,12,7,0,9,20,11,0,13,28,15,0,17,36,19,0,21,44,23,0,25,52,27,0,29,60,31,0,33,68,35,0,37,76,39,0,41,84,43,0,45,92,47,0,49,100,51,0,53,108,55,0,57,116,59,0,61,124,63,0,65,132,67,0,69,140,71,0,73,148,75,0,77,156,79,0,81,164,83,0,85,172,87,0,89,180,91,0,93,188,95,0,97,196,99,0
add $0,1
mov $1,4
gcd $1,$0
mod $1,4
mul $1,$0
mov $0,$1
| 40.2 | 283 | 0.629353 |
f33bbc5b3f7d3864e45a077c3e759d9e733bfae4 | 7,670 | asm | Assembly | Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_1176.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_1176.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_1176.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 %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x39f, %rcx
nop
dec %r9
movw $0x6162, (%rcx)
nop
nop
nop
nop
add $48207, %r12
lea addresses_A_ht+0x1dd5f, %rsi
lea addresses_D_ht+0xaecb, %rdi
xor $61453, %r10
mov $85, %rcx
rep movsl
nop
nop
nop
and $49657, %r10
lea addresses_D_ht+0x915f, %rsi
lea addresses_WT_ht+0x11d5f, %rdi
nop
nop
nop
nop
nop
inc %r9
mov $15, %rcx
rep movsl
nop
nop
nop
nop
sub %r10, %r10
lea addresses_A_ht+0xf45f, %r13
nop
cmp $4239, %r10
movw $0x6162, (%r13)
nop
nop
add %r9, %r9
lea addresses_D_ht+0x1dd5f, %r13
xor %rcx, %rcx
movups (%r13), %xmm0
vpextrq $1, %xmm0, %rdi
xor %rsi, %rsi
lea addresses_WC_ht+0xa48f, %rsi
lea addresses_UC_ht+0x10627, %rdi
clflush (%rsi)
clflush (%rdi)
and $30955, %rdx
mov $44, %rcx
rep movsq
nop
nop
nop
nop
nop
xor %rdx, %rdx
lea addresses_normal_ht+0x1129f, %rsi
lea addresses_WC_ht+0x18a43, %rdi
nop
add $11781, %r10
mov $77, %rcx
rep movsq
nop
nop
nop
nop
xor $18293, %r12
lea addresses_normal_ht+0xbc5f, %r9
nop
nop
nop
nop
and %rdi, %rdi
movups (%r9), %xmm4
vpextrq $1, %xmm4, %rdx
nop
and %rsi, %rsi
lea addresses_D_ht+0x1635f, %rsi
lea addresses_normal_ht+0x1395f, %rdi
nop
nop
nop
nop
nop
sub $63025, %rdx
mov $55, %rcx
rep movsw
nop
nop
nop
and $39967, %rdx
lea addresses_WC_ht+0x11987, %r10
nop
inc %rdi
mov (%r10), %cx
nop
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_D_ht+0x1905f, %rsi
lea addresses_D_ht+0x1a2b7, %rdi
clflush (%rsi)
clflush (%rdi)
nop
nop
nop
xor %rdx, %rdx
mov $87, %rcx
rep movsq
nop
nop
nop
add %rdx, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r15
push %r8
push %rax
push %rbp
// Store
mov $0x533f2f0000000fff, %rax
nop
sub %rbp, %rbp
mov $0x5152535455565758, %r15
movq %r15, %xmm7
vmovups %ymm7, (%rax)
nop
nop
nop
nop
nop
inc %r12
// Store
lea addresses_RW+0x1285f, %r13
clflush (%r13)
xor $60710, %r10
mov $0x5152535455565758, %r8
movq %r8, %xmm1
vmovups %ymm1, (%r13)
nop
cmp %r12, %r12
// Load
lea addresses_RW+0x761f, %r13
clflush (%r13)
nop
inc %r8
movups (%r13), %xmm5
vpextrq $1, %xmm5, %rax
nop
nop
nop
add $62829, %r12
// Faulty Load
lea addresses_US+0x1d75f, %rbp
nop
xor %r15, %r15
mov (%rbp), %r10
lea oracles, %r8
and $0xff, %r10
shlq $12, %r10
mov (%r8,%r10,1), %r10
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_A_ht', 'congruent': 7}, 'dst': {'same': True, 'type': 'addresses_D_ht', 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 8}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 3}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 2}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': True, 'AVXalign': False, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 8}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 8}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': True, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 0}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 33.938053 | 2,999 | 0.656845 |
10cca2e5ca3c5aade4587a1343d099d6e8e31574 | 225,125 | asm | Assembly | VsIntegration/Spect.Net.VsPackage/Docs/Spectrum+3_V4-0_ROM0.asm | Toysoft/spectnetide | 7fe01fe772215e3405adc4eba8b1d1bb815e4534 | [
"MIT"
] | 219 | 2017-09-09T08:18:19.000Z | 2022-03-24T03:35:28.000Z | VsIntegration/Spect.Net.VsPackage/Docs/Spectrum+3_V4-0_ROM0.asm | Toysoft/spectnetide | 7fe01fe772215e3405adc4eba8b1d1bb815e4534 | [
"MIT"
] | 211 | 2017-10-25T07:54:43.000Z | 2021-12-30T08:59:05.000Z | VsIntegration/Spect.Net.VsPackage/Docs/Spectrum+3_V4-0_ROM0.asm | Toysoft/spectnetide | 7fe01fe772215e3405adc4eba8b1d1bb815e4534 | [
"MIT"
] | 29 | 2017-09-09T10:19:25.000Z | 2022-02-09T12:17:14.000Z | ; **************************************************
; *** SPECTRUM +3 ROM 0 DISASSEMBLY (EDITOR ROM) ***
; **************************************************
; The Spectrum ROMs are copyright Amstrad, who have kindly given permission
; to reverse engineer and publish Spectrum ROM disassemblies.
; =====
; NOTES
; =====
; ------------
; Release Date
; ------------
; 17th May 2010
; ------------------------
; Disassembly Contributors
; ------------------------
; Garry Lancaster
;
; The ROM disassembly was created with the aid of dZ80 V1.10, and incorporates work from
; "The canonical list of +3 oddities" by Ian Collier.
; -----------------
; Assembler Details
; -----------------
; This file can be assembled to produce a binary image of the ROM
; with Interlogic's Z80ASM assembler (available for Z88, QL, DOS and Linux).
; Note that the defs directive is used and this causes a block of $00 bytes to be created.
module rom0
;**************************************************
; include "sysvar48.def"
; System variable definitions for 48K Spectrum
defc KSTATE=$5c00
defc LAST_K=$5c08
defc REPDEL=$5c09
defc REPPER=$5c0a
defc DEFADD=$5c0b
defc K_DATA=$5c0d
defc TVDATA=$5c0e
defc STRMS=$5c10
defc CHARS=$5c36
defc RASP=$5c38
defc PIP=$5c39
defc ERR_NR=$5c3a
defc FLAGS=$5c3b
defc TV_FLAG=$5c3c
defc ERR_SP=$5c3d
defc LIST_SP=$5c3f
defc MODE=$5c41
defc NEWPPC=$5c42
defc NSPPC=$5c44
defc PPC=$5c45
defc SUBPPC=$5c47
defc BORDCR=$5c48
defc E_PPC=$5c49
defc VARS=$5c4b
defc DEST=$5c4d
defc CHANS=$5c4f
defc CURCHL=$5c51
defc PROG=$5c53
defc NXTLIN=$5c55
defc DATADD=$5c57
defc E_LINE=$5c59
defc K_CUR=$5c5b
defc CH_ADD=$5c5d
defc X_PTR=$5c5f
defc WORKSP=$5c61
defc STKBOT=$5c63
defc STKEND=$5c65
defc BREG=$5c67
defc MEM=$5c68
defc FLAGS2=$5c6a
defc DF_SZ=$5c6b
defc S_TOP=$5c6c
defc OLDPPC=$5c6e
defc OSPCC=$5c70
defc FLAGX=$5c71
defc STRLEN=$5c72
defc T_ADDR=$5c74
defc SEED=$5c76
defc FRAMES=$5c78
defc UDG=$5c7b
defc COORDS=$5c7d
defc P_POSN=$5c7f
defc PR_CC=$5c80
defc ECHO_E=$5c82
defc DF_CC=$5c84
defc DF_CCL=$5c86
defc S_POSN=$5c88
defc SPOSNL=$5c8a
defc SCR_CT=$5c8c
defc ATTR_P=$5c8d
defc MASK_P=$5c8e
defc ATTR_T=$5c8f
defc MASK_T=$5c90
defc P_FLAG=$5c91
defc MEMBOT=$5c92
defc NMIADD=$5cb0 ; only used in +3
defc RAMTOP=$5cb2
defc P_RAMT=$5cb4
;**************************************************
; include "sysvarp3.def"
; Additional system variables used in the +3
defc SWAP=$5b00
defc STOO=$5b10
defc YOUNGER=$5b21
defc REGNUOY=$5b2a
defc ONERR=$5b3a
defc OLDHL=$5b52
defc OLDBC=$5b54
defc OLDAF=$5b56
defc TARGET=$5b58
defc RETADDR=$5b5a
defc BANKM=$5b5c
defc RAMRST=$5b5d
defc RAMERR=$5b5e
defc BAUD=$5b5f
defc SERFL=$5b61
defc COL=$5b63
defc WIDTH=$5b64
defc TVPARS=$5b65
defc FLAGS3=$5b66
defc BANK678=$5b67
defc XLOC=$5b68
defc YLOC=$5b69
defc OLDSP=$5b6a
defc SYNRET=$5b6c
defc LASTV=$5b6e
defc RC_LINE=$5b73
defc RC_START=$5b75
defc RC_STEP=$5b77
defc LODDRV=$5b79
defc SAVDRV=$5b7a
defc DUMPLF=$5b7b
defc STRIP1=$5b7c
defc STRIP2=$5b84
defc TSTACK=$5bff
;**************************************************
; include "sysvarp7.def"
; System variables and data structures in DOS workspace (page 7)
; Alternate screen $c000-$daff
; Also used by +3 BASIC commands for temporary storage
defc src_add=$c000 ; (2) address of source filespec
defc dst_add=$c002 ; (2) address of dest filespec
defc src_drv=$c004 ; (1) source drive
defc dst_drv=$c005 ; (1) dest drive
defc eof=$c006 ; (1) EOF flag
defc free_m=$c007 ; (2) space free on M: for copying
defc copy_ram=$c009 ; (1) flag: true if copy via RAM, not M:
defc dst_open=$c00a ; (1) flag: true if dst_file is open
defc wild=$c00b ; (1) flag: true for wildcards in filespec
defc dst_dev=$c00c ; (1) dest dev:$00=file,$e0=printer,$aa=screen
defc tmp_bytes=$c00d ; (2) #bytes copied to temporary file
defc copied=$c00f ; (1) #files copied
defc dst_file=$c010 ; (18) dest filespec ($ff-term)
defc src_file=$c022 ; (18) source filespec ($ff-term)
defc cat_spec=$c034 ; (13) filespec to search catalog from
defc wld_next=$c041 ; (13) next filename formed from wild spec
defc tmp_file=$c04e ; (18) temp filespec ($ff-term)
; +3DOS permanent structures & variables
defc pg_buffer=$db00 ; ($20) buffer for copying between pages
defc rt_alert=$db20 ; (2) ALERT routine address
defc al_resp=$db22 ; (7) ALERT response string
defc al_mess=$db29 ; ($77) message for ALERT routine
defc fcbs=$dba0 ; ($380) FCBs ($38 bytes each for $10 files)
defc sysfcb0=$df20 ; ($38) system FCB 0
defc sysfcb1=$df58 ; ($38) system FCB 1
defc filerecs=$df90 ; (3) #recs in file (during open)
defc def_user=$df93 ; (1) default user area
defc def_drv=$df94 ; (1) default drive
defc extchg=$df95 ; (1) extents changed in operation flag
defc att_clr=$df96 ; (1) attributes to clear
defc att_set=$df97 ; (1) attributes to set
defc cat_buff=$df98 ; (2) address of catalog buffer
defc cat_filt=$df9a ; (1) catalog filter
defc cat_size=$df9b ; (1) catalog buffer size (in entries)
defc cat_ents=$df9c ; (1) number of completed catalog entries
; $df9d-$df9f unused (3 bytes)
defc rt_dirent=$dfa0 ; (2) routine to call for every dir entry
defc direntry=$dfa2 ; ($20) directory entry buffer
; $dfc2-$dfcf unused (14 bytes)
; Not advisable to use, due to bug in datestamp checking routine
defc rw_page=$dfd0 ; (1) page to read/write to
defc rw_add=$dfd1 ; (2) address to read/write to
; $dfd3-$dfdf unused (13 bytes)
defc bcbs=$dfe0 ; ($b0) BCBs ($0b bytes each for $10 buffers)
defc cache7=$e090 ; ($200) Page 7 cache buffer (always exists)
defc cachenum=$e290 ; (1) number of cache buffers
defc cachefst=$e291 ; (1) first cache buffer number
defc bcb_inuse=$e292 ; (2) inuse BCB chain
defc bcb_free=$e294 ; (2) free BCB chain
; $e296-$e29f unused (10 bytes)
defc xdpb_ptrs=$e2a0 ; ($20) pointers to XDPBs (or 0) for A: to P:
defc xdpb_a=$e2c0 ; ($30) XDPB for drive A:
defc chksm_a=$e2f0 ; ($10) checksum vector for drive A:
defc alloc_a=$e300 ; ($2d) allocation bitmap for drive A:
defc xdpb_b=$e32d ; ($30) XDPB for drive B:
defc chksm_b=$e35d ; ($10) checksum vector for drive B:
defc alloc_b=$e36d ; ($2d) allocation bitmap for drive B:
defc xdpb_m=$e39a ; ($30) XDPB for drive M:
defc alloc_m=$e3ca ; ($20) allocation bitmap for drive M:
defc unit0=$e3ea ; (1) drive mapped to unit 0
defc rt_chgdsk=$e3eb ; (2) CHANGE_DISK routine address
defc rt_temp=$e3ed ; (2) address of subroutine (temporary)
defc spec_m=$e3ef ; (8) disk spec for drive M:
; $e3f7-$e3ff unused (9 bytes)
defc ddl_parms=$e400 ; ($19) parameters in calls to DD_L_READ etc
defc rt_encode=$e419 ; (2) ENCODE routine address
; $e41a-$e41f unused (6 bytes)
defc equipment=$e420 ; (8) equipment info for FD units 0 to 3
; Byte 0: bits 0..1=side info (0=unknown,1/2=#sides)
; Byte 0: bits 2..3=track info (0=unknown,1/2=single/double)
; Byte 0: bit 6 set if head position known
; Byte 1: track under head
defc tm_mtron=$e428 ; (1) motor on time
defc tm_mtroff=$e429 ; (1) motor off time
defc tm_wroff=$e42a ; (1) write off time
defc tm_hdset=$e42b ; (1) head settle time
defc tm_step=$e42c ; (1) step rate
defc retry_cnt=$e42d ; (1) retry count
; $e42e-$e42f unused (2 bytes)
defc fdc_res=$e430 ; (8) FDC results buffer
; $e438-$e5ff unused (456 bytes)
defc timeout=$e600 ; (1) current disk motor timeout
; $e601 unused (1 byte)
; From this point, "unused" status is not 100% certain, due to limited
; knowledge of the Editor ROM
; Temporary storage used when switching ROMs etc
defc tmp_sp=$e602 ; (2) temporary SP store
defc tmp_ret=$e604 ; (2) temporary return address store
defc tmp_af=$e606 ; (2) temporary AF store
defc tmp_hl=$e608 ; (2) temporary HL store
defc tmp_de=$e60a ; (2) temporary DE store
defc tmp_bc=$e60c ; (2) temporary BC store
; $e60e-$e77b unused (366 bytes)
defc tmp_stack=$e7ff ; ($84) temporary TSTACK store
; from $e77c-$e7ff
; $e800-$ebff unused (1024 bytes)
; Editor variables
defc men_high=$ec0c ; (1) highlighted menu line
defc ed_flags=$ec0d ; (1) - bit 1 set when processing menu
defc process=$ec0e ; (1) process: $07 Loader, $04 Calculator
defc ed_ATTR_P=$ec0f ; (1) editor/saved ATTR_P
defc ed_MASK_P=$ec10 ; (1) editor/saved MASK_P
defc ed_ATTR_T=$ec11 ; (1) editor/saved ATTR_T
defc ed_MASK_T=$ec12 ; (1) editor/saved MASK_T
defc ed_P_FLAG=$ec13 ; (1) editor/saved P_FLAG
; $ec20-$ecff unused (224 bytes)
; Temporary buffers/storage
defc tmp_fspec=$ed01 ; (??) temporary filespec workspace
defc tmp_buff=$ed11 ; (2048) temporary buffer for FORMAT/COPY
; *BUG* means COPY uses page 0 instead of 7
; $f511-$f6e9 unused (473 bytes)
defc men_rout=$f6ea ; (2) address of menu routines table
defc men_text=$f6ec ; (2) address of menu text
; $f700-$f8ff unused (512 bytes)
; $fa00-$fbff unused (512 bytes)
defc ign_space=$fc9e ; (1) flag: if set, ignore leading space
defc line_add=$fc9f ; (2) 0 or add of line data
defc ascii_add=$fca1 ; (2) 0 or add of ASCII expanded token/number
defc ascii_txt=$fca3 ; (??) bit-7 terminated ASCII text
; IX normally set to $fd98, so this area unknown exactly
defc edit_top=$fd99 ; (1) top screen line of editing area
defc curs_cols=$fd9e ; (1) cursor colours
defc curs_attr=$fd9f ; (1) saved attribute under cursor
defc chkword=$fda0 ; (??) word to check if token
; $fe00-$ffff used to load bootsector by +3DOS ROM
;**************************************************
org $0000
.l0000 di ; +3 Startup address
ld bc,$6c03
.l0004 dec bc ; Delay for approx 0.2s
ld a,b
or c
jr nz,l0004
jp l010f ; go to test memory
defm "ED" ; Editor ROM ID
defs 2
; RST 10: call the RST 10 routine in ROM 3 to print a character
.l0010 rst $28
defw $0010 ; call RST 10 in ROM 3
ret
defs 4
; RST 18: call the RST 18 routine in ROM 3 to collect a character
.l0018 rst $28
defw $0018 ; call RST 18 in ROM 3
ret
defs 4
; RST 20: call the RST 20 routine in ROM 3 to collect next character
.l0020 rst $28
defw $0020 ; call RST 20 in ROM 3
ret
defs 4
; RST 28 : Call a routine in ROM 3, then return to ROM 0
; The address following the RST 28 instruction is called, then control
; is returned to the instruction following the address
.l0028 ex (sp),hl ; save HL, get return address
push af ; save AF
ld a,(hl) ; A=low byte of address to call
inc hl
inc hl ; HL=address of instruction to return to
ld (RETADDR),hl ; save
.l0030 dec hl
ld h,(hl)
ld l,a ; HL=address to call in ROM 3
pop af ; restore AF
jp l00ae ; jump on
defs 1
; The maskable interrupt routine, called every 50ms while in IM1
.l0038 push hl ; save HL
ld hl,$0048
push hl
ld hl,SWAP
push hl
ld hl,$0038
push hl
jp SWAP ; call MASK-INT and KEY-INT in ROM 3
pop hl ; restore HL
di ; disable interrupts again
call l0074
ei ; re-enable interrupts
ret
defs $17
; NMI routine
.l0066 push af ; save AF & HL
push hl
ld hl,(NMIADD)
ld a,h
or l
jr z,l0070 ; skip if no routine (NMIADD=0)
jp (hl) ; else execute
.l0070 pop hl ; restore registers
pop af
retn
; Disk motor timeout subroutine
; Called by maskable interrupt to turn off disk motor when timeout occurs
.l0074 push af ; save AF & BC
push bc
ld bc,$7ffd
ld a,(BANKM)
or $07
out (c),a ; get page 7 (+3DOS workspace)
ld a,($e600) ; check motor off timeout
or a
jr z,l00a3 ; move on if already off
ld a,(FRAMES)
bit 0,a
jr nz,l00a3 ; only decrement every other time
ld a,($e600)
dec a
ld ($e600),a ; decrement motor off timeout
jr nz,l00a3 ; move on if still should be on
ld bc,$1ffd
ld a,(BANK678)
and $f7
ld (BANK678),a
out (c),a ; turn motor off
.l00a3 ld bc,$7ffd
ld a,(BANKM)
out (c),a ; page previous memory back in
pop bc ; restore registers
pop af
ret
; Continuation of RST 28: call a routine in ROM 3
.l00ae ld (TARGET),hl ; save ROM 3 address in TARGET
ld hl,YOUNGER
ex (sp),hl ; stack YOUNGER address beneath TOS
push hl
ld hl,(TARGET) ; get HL=target address in ROM 3
ex (sp),hl ; restore HL & save target address on stack
jp SWAP ; jump to SWAP - pages in ROM 3, returns to
; target routine which returns to YOUNGER
; where ROM 0 is paged back and jump made
; back to RETADDR
; Here follows the five paging subroutines which are copied into
; the system variables on startup
; Enter at SWAP to change ROM 0<->3 or ROM 1<->2
.l00bd push af ; save AF & BC
push bc
ld bc,$7ffd
ld a,(BANKM) ; get copy of last OUT to $7ffd
xor $10 ; change ROM 0<->1 or ROM 2<->3
di ; disable interrupts
ld (BANKM),a
out (c),a ; page new ROM
; Enter at STOO with interrupts disabled and AF/BC stacked
; to change ROM 0<->2 or ROM 1<->3
.l00cd ld bc,$1ffd
ld a,(BANK678) ; get copy of last OUT to $1ffd
xor $04 ; change ROM 0<->2 or ROM 1<->3
ld (BANK678),a
out (c),a ; page new ROM
ei ; re-enable interrupts
pop bc ; restore registers
pop af
ret
; Enter at YOUNGER with return address in RETADDR to swap
; ROM 0<->3 or ROM 1<->2 and return there
.l00de call SWAP ; swap ROM 0<->3 or ROM 1<->2
push hl ; save HL
ld hl,(RETADDR) ; get return address from system vars
ex (sp),hl ; restore return address & HL
ret
; Enter at REGNUOY with return address in RETADDR to swap
; ROM 0<->2 or ROM 1<->3 and return there
.l00e7 push hl ; save HL
ld hl,$5b34
ex (sp),hl ; place $5b34 as return address
push af ; save AF & BC
push bc
jp STOO ; swap ROM 0<->2 or ROM 1<->3 and return here
.l5b34 push hl ; save HL
ld hl,(RETADDR) ; get return address from system vars
ex (sp),hl ; restore return address & HL
ret
; Enter at ONERR to page in Syntax ROM (ROM 1) and jump to error handler
.l00f7 di ; disable interrupts
xor a
ld bc,$1ffd
out (c),a ; ensure ROM 0 or 1 is paged
ld (BANK678),a
set 4,a
ld bc,$7ffd
out (c),a ; ensure ROM 1 is paged
ld (BANKM),a
ei ; enable interrupts
jp $253a ; jump to error handler in ROM 1
; Test memory at startup & initialise
.l010f ld b,$08 ; 8 pages to clear
.l0111 ld a,b
exx
dec a
ld bc,$7ffd
out (c),a ; page next RAM page to $c000
ld hl,$c000
ld de,$c001
ld bc,$3fff
ld (hl),$00
ldir ; clear it
exx
djnz l0111 ; back for more pages
xor a
ld hl,$dcba ; an address in top 16K of ROM
ld bc,$7ffd ; memory paging address
.l0130 ld de,$0108 ; E=8 bits to test, D=bit 0
out (c),a ; get next page to segment 3
ex af,af' ; save A'=page
.l0136 ld a,d ; test to see if bit can be set
ld (hl),a
ld a,(hl)
and d
jp z,l0367 ; jump if memory not re-read correctly
cpl ; test to see if bit can be reset
ld (hl),a
ld a,(hl)
and d
jp nz,l0367 ; jump if memory not re-read correctly
rlc d
dec e
jr nz,l0136 ; loop back to test other bits
ex af,af'
inc a
cp $08
jr nz,l0130 ; loop back to test other pages
ld c,$fd
ld d,$ff
ld e,$bf
ld b,d
ld a,$0e
out (c),a ; select AY register 14 (RS232/AUX)
ld b,e
ld a,$ff
out (c),a ; set all RS232/AUX lines high
jr l0167 ; move on, with page 7 at $c000
; Apparently unused section, possibly originally intended to
; flag a memory error
exx
ld a,b
out ($fe),a
.l0165 jr l0165
; More initialisation (with page 7 at $c000)
.l0167 xor a
ex af,af' ; A' clear to show reset, not NEW
ld sp,$6000 ; set stack within page 5
.l016c ld b,d
ld a,$07
out (c),a ; select AY register $07
ld b,e
ld a,$ff
out (c),a ; initialise AY chip (?)
ld de,SWAP
ld hl,l00bd
ld bc,$0052
ldir ; copy paging subroutines to system vars
ld a,$cf
ld (RAMRST),a ; place RST 8 instruction at RAMRST
ld hl,$ffff
ld (P_RAMT),hl ; set P RAMT to 64K
ld de,$3eaf ; prepare to copy chars A-U from ROM 3
ld bc,$00a8 ; to UDG area
ex de,hl
rst $28 ; execute a LDDR from ROM 3 to copy them
defw $1661
ex de,hl
inc hl
ld (UDG),hl ; store address of first UDG
dec hl
ld bc,$0040
ld (RASP),bc ; set RASP and PIP
ld (RAMTOP),hl ; set RAMTOP below UDGs
ld hl,FLAGS3
res 7,(hl) ; reset bit 7 of FLAGS3 (??)
ld hl,DUMPLF
ld (hl),$09 ; set DUMPLF
; The NEW command enters here
.l01b0 ld hl,$3c00
ld (CHARS),hl ; set CHARS
im 1 ; set interrupt mode 1
ld iy,ERR_NR ; IY points to ERR NR
set 4,(iy+$01) ; set "+3 BASIC mode"
ld hl,FLAGS3
res 3,(hl) ; set "print to Centronics"
set 2,(hl) ; set "print expanded tokens"
ld hl,$000b
ld (BAUD),hl ; set BAUD
xor a
ld (SERFL),a ; clear SERFL
ld (COL),a ; clear COL
ld (TVPARS),a ; clear TVPARS
ld hl,$ec00
ld ($ff24),hl ; ???
ld a,$50
ld (WIDTH),a ; set WIDTH
ld hl,$000a
ld (RC_START),hl ; set RCSTART
ld (RC_STEP),hl ; set RCSTEP
ld a,$54
ld (LODDRV),a ; set LODDRV to "T"
ld (SAVDRV),a ; set SAVDRV to "T"
ld hl,$5cb6
ld (CHANS),hl ; set CHANS immediately after system vars
ld de,l03b8
ld bc,$0015
ex de,hl
ldir ; copy initial channel information
ex de,hl
dec hl
ld (DATADD),hl ; set DATADD after CHANS
inc hl
ld (PROG),hl ; set PROG after DATADD
ld (VARS),hl ; set VARS
ld (hl),$80 ; store end of variables marker
inc hl
ld (E_LINE),hl ; set ELINE after VARS
ld (hl),$0d ; store end of line marker
inc hl
ld (hl),$80 ; store end of ELINE marker
inc hl
ld (WORKSP),hl ; set WORKSP after ELINE
ld (STKBOT),hl ; set STKBOT
ld (STKEND),hl ; set STKEND
ld a,$38
ld (ATTR_P),a ; set ATTR P
ld (ATTR_T),a ; set ATTR T
ld (BORDCR),a ; set BORDCR
xor a
ld (ed_P_FLAG),a ; set editor's P_FLAG
ld a,$07
out ($fe),a ; white border
ld hl,$0523
ld (REPDEL),hl ; set REPDEL and REPPER
dec (iy-$3a) ; set two bytes of KSTATE to $ff
dec (iy-$36)
ld hl,l03cd
ld de,STRMS
ld bc,$000e
ldir ; copy initial stream addresses to STRMS
res 1,(iy+$01) ; reset bit 1 of FLAGS
ld (iy+$00),$ff ; set ERR NR to no error
ld (iy+$31),$02 ; set DF SZ
ex af,af'
cp $52
jp z,l2675 ; move on if in self-test program
ld hl,(RAMTOP)
inc hl
ld sp,hl ; set SP to RAMTOP+1
ei ; enable interrupts
rst $28
defw $0d6b ; CLS using ROM 3
call l02aa ; display test image if BREAK held down
ld de,l03db
call l029e ; display copyright message
ld hl,TSTACK
ld (OLDSP),hl ; set OLDSP to TSTACK area
call l05cc ; switch in page 7 with stack in TSTACK
ld a,$38
ld (ed_ATTR_T),a ; set editor's ATTR_T
ld (ed_ATTR_P),a ; set editor's ATTR_P
call l05a7 ; switch back page 0
call l3e80
defw $2410 ; initialise DOS & display drive info
call l05cc ; switch in page 7 with stack in TSTACK
ld (iy+$31),$02 ; set DFSZ
set 5,(iy+$02) ; set bit 5 of TVFLAG
call l0633 ; ???
call l05a7 ; switch back page 0
jp l064e ; move on
; Print string subroutine
; Displays a string terminated by a byte with bit 7 set
; Entry: DE=address of string
; Exit: DE=address after string, A corrupted
.l029e ld a,(de) ; get next character
and $7f ; mask high bit
push de
rst $10 ; print it
pop de
ld a,(de)
inc de ; increment address
add a,a
jr nc,l029e ; loop back if bit 7 wasn't set
ret
; Check to see if BREAK is held down, entering the test image if so
.l02aa ld a,$7f
in a,($fe)
.l02ae rra
ret c ; exit if SPACE not held down
ld a,$fe
in a,($fe)
rra
ret c ; exit if CAPS SHIFT not held down
ld a,$07
out ($fe),a ; white border
ld a,$02
rst $28
defw $1601 ; open stream 2 for output
xor a
ld (TV_FLAG),a ; clear TV FLAG
ld a,$16
rst $10
xor a
rst $10
xor a
rst $10 ; AT 0,0
ld e,$08 ; E=8, used many times in routine
ld b,e ; B=8 messages per line
ld d,b ; D=8 lines
.l02ce ld a,b
dec a
rl a
rl a
rl a ; A=paper colour from position along line
add a,d
dec a ; add in ink colour from line number
ld (ATTR_T),a ; set ATTR T
ld hl,l03b0 ; address of '1987' test message
ld c,e ; C=8=length of message
.l02df ld a,(hl)
rst $10 ; display next character
inc hl
dec c
jr nz,l02df ; loop back for more characters
djnz l02ce ; loop back for more messages
ld b,e ; B=8 messages per line
dec d
jr nz,l02ce ; loop back for more lines
ld hl,$4800 ; start of middle third of screen
ld d,h
ld e,l
inc de
xor a
ld (hl),a
ld bc,$0fff
ldir ; clear bottom two thirds of screen
ex de,hl
ld de,$5900
ld bc,$0200
ldir ; copy attribs of top third to rest of screen
di ; disable interrupts
.l0302 ld de,$0370
ld l,$07
.l0307 ld bc,$0099
.l030a dec bc
ld a,b
or c
jr nz,l030a ; delay
ld a,l
xor $10
ld l,a
out ($fe),a ; generate tone
dec de
ld a,d
or e
jr nz,l0307 ; loop back for tone
; Here we test for sets of keys pressed at the test image, and jump
; to routines to handle them if necessary
ld de,$2000 ; DE=number of times to check for keysets
ld ix,l03a8 ; IX=start of keyset table
.l0321 ld l,(ix+$00) ; HL=next keyset start address-1
ld h,(ix+$01)
inc ix
inc ix ; IX points to next entry in keyset table
ld a,h
or l
jr nz,l0335 ; test keyset unless at end of table
ld ix,l03a8 ; if so, start again at the beginning
jr l0321
.l0335 inc hl ; HL points to next keyboard scan address
ld c,(hl)
inc hl
ld b,(hl) ; BC=next keyboard scan address
inc hl
ld a,b
or c
jr z,l034c ; move on if scanned all for this keyset
in a,(c)
and $1f ; mask keyboard (bits 0-4)
cp (hl) ; check against required value
jr z,l0335 ; continue checking if OK
dec de ; decrement number of checks counter
ld a,d
or e
jr nz,l0321 ; loop back to scan again
jr l0302 ; sound tone again
.l034c ld c,(hl) ; get address of routine to execute
inc hl
ld b,(hl)
push bc ; stack address
ret ; and "return" to it
; Self-test keyset table
; Program accessed with "QAZPLM" held down on test screen
.l0351 defw $fbfe
defb $1e ; "Q"
defw $fdfe
defb $1e ; "A"
defw $fefe
defb $1d ; "Z"
defw $dffe
defb $1e ; "P"
defw $bffe
defb $1d ; "L"
defw $7ffe
defb $1b ; "M"
defw 0 ; end of keys to scan
defw l21df ; routine address
; Jump here if there is a memory test error:
; if the bit couldn't be set, a border is set to the bit number,
; if it couldn't be reset, an alternating bit number/bit number XOR 7
; border is set.
.l0367 ld a,8
sub e
ex af,af' ; A'=bit number failed on
and a
jr nz,l0373 ; jump on if bit could be set
ex af,af'
out ($fe),a ; else halt with border set to bit number
.l0371 jr l0371
.l0373 ex af,af'
ld c,a
ld b,$07
xor b
ld b,a ; B=bit number XOR 7
.l0379 ld a,c
out ($fe),a ; set bit number border
ld de,$0000
.l037f dec de
ld a,d
or e
jr nz,l037f ; pause for approx 0.5s
ld a,b
out ($fe),a ; set bit number XOR 7 border
ld de,$2aaa
.l038a dec de
ld a,d
or e
jr nz,l038a ; pause for approx 0.1s
jr l0379 ; loop back
; Pretty EAR monitor keyset table
; Program accessed with "EUA" held down on test screen
.l0391 defw $fbfe
defb $1b ; "E"
defw $dffe
defb $17 ; "U"
defw $fdfe
defb $1e ; "A"
defw 0 ; end of keys to scan
defw l22d0 ; routine address
; Reboot keyset table
; Spectrum rebooted with "BV" held down on test screen
.l039e defw $7ffe
defb $0f ; "B"
defw $fefe
defb $0f ; "V"
defw 0 ; end of keys to scan
defw $0000 ; routine address
; The table of keyset addresses-1 scanned at startup
.l03a8 defw l0351-1 ; self-test keyset table-1
defw l0391-1 ; pretty EAR monitor keyset table-1
defw l039e-1 ; reboot keyset table-1
defw 0 ; end of table marker
; Text used for the test display
.l03b0 defm $13&$0&"19"&$13&$1&"87"
; Here is the initial channel information, copied to CHANS
.l03b8 defw $09f4
defw $10a8
defb 'K' ; keyboard/lower screen channel
defw $09f4
defw $15c4
defb 'S' ; main screen channel
defw $0f81
defw $15c4
defb 'X' ; workspace channel
defw $3a05
defw $3a00
defb 'P' ; printer channel
defb $80 ; end of channel information
; Here is the initial stream addresses, copied to STRMS
.l03cd defw $0001 ; stream -3, 'K'
defw $0006 ; stream -2, 'S'
defw $000b ; stream -1, 'X'
defw $0001 ; stream 0, 'K'
defw $0001 ; stream 1, 'K'
defw $0006 ; stream 2, 'S'
defw $0010 ; stream 3, 'P'
; Copyright message
.l03db defm $7f&"1982, 1986, 1987 Amstrad Plc."&$8d
; Subroutine to ???
.l03fa ld hl,$eef5
res 0,(hl) ; ???
set 1,(hl) ; ???
.l0401 ld hl,(E_PPC) ; get current line
ld a,h
or l
jr nz,l040b ; move on unless 0
.l0408 ld ($ec06),hl ; ???
.l040b ld a,($f9db) ; ???
push af
ld hl,($fc9a) ; ???
call l1418 ; get number of line before (or 0)
ld ($f9d7),hl ; ???
call l12f0 ; ???
call l11a4 ; ???
pop af
.l041f or a
jr z,l042e ; move on if ???
push af
.l0423 call l11ad ; ???
ex de,hl
call $1338
pop af
dec a
defb $18
defb -15
.l042e ld c,$00
call $1182
ld b,c
ld a,($ec15)
ld c,a
push bc
push de
.l043a call $11ad
ld a,($eef5)
bit 1,a
defb $28
defb 29
push de
push hl
.l0446 ld de,$0020
add hl,de
bit 0,(hl)
defb $28
defb 17
inc hl
ld d,(hl)
inc hl
ld e,(hl)
or a
ld hl,(E_PPC)
sbc hl,de
defb $20
defb 5
ld hl,$eef5
set 0,(hl)
.l045f pop hl
pop de
.l0461 push bc
push hl
ld bc,$0023
ldir
pop hl
pop bc
push de
push bc
ex de,hl
ld hl,$eef5
bit 0,(hl)
defb $28
defb 42
ld b,$00
.l0476 ld hl,($ec06)
ld a,h
or l
defb $28
defb 14
push hl
call $0f0f
pop hl
defb $30
defb 18
dec hl
inc b
ld ($ec06),hl
defb $18
ex de,hl
call $0f0f
call nc,$0f31
ld hl,$eef5
ld (hl),$00
.l0496 ld a,b
pop bc
push bc
ld c,b
ld b,a
call $0adc
.l049e pop bc
pop de
ld a,c
inc b
cp b
defb $30
defb -107
ld a,($eef5)
bit 1,a
defb $28
defb 33
bit 0,a
defb $20
defb 29
ld hl,(E_PPC)
ld a,h
or l
defb $28
defb 8
ld ($fc9a),hl
call $12f0
defb $18
defb 9
.l04bf ld ($fc9a),hl
call $1420
ld (E_PPC),hl
.l04c8 pop de
pop bc
jp $0401
.l04cd pop de
pop bc
cp a
.l04d0 push af
ld a,c
ld c,b
call $1182
ex de,hl
.l04d7 push af
call $16fe
pop af
ld de,$0023
add hl,de
inc c
cp c
jr nc,l04d7 ; (-13)
pop af
ret z
call $0ad2
.l04e9 call $0c43
ld hl,($ec06)
dec hl
ld a,h
or l
ld ($ec06),hl
jr nz,l04e9 ; (-14)
jp $0adc
ret
.l04fb ld b,$00
ld a,($ec15)
ld d,a
jp l1d6b
.l0504 ld b,$00
push hl
ld c,b
call $1182
call $1338
pop hl
ret nc
call $11ad
.l0513 push bc
push hl
ld hl,$0023
add hl,de
ld a,($ec15)
ld c,a
cp b
jr z,l052e ; (14)
push bc
.l0521 push bc
ld bc,$0023
ldir
pop bc
ld a,c
inc b
cp b
jr nz,l0521 ; (-12)
pop bc
.l052e pop hl
call $1712
ld bc,$0023
ldir
scf
pop bc
ret
.l053a ld b,$00
call $12f9
ret nc
.l0540 push bc
push hl
ld a,($ec15)
ld c,a
call $1182
call $11ec
jr nc,l0574 ; (38)
dec de
ld hl,$0023
add hl,de
ex de,hl
push bc
ld a,b
cp c
jr z,l0565 ; (12)
.l0559 push bc
ld bc,$0023
lddr
pop bc
ld a,b
dec c
cp c
jr c,l0559 ; (-12)
.l0565 ex de,hl
inc de
pop bc
pop hl
call $1726
ld bc,$0023
ldir
scf
pop bc
ret
.l0574 pop hl
pop bc
ret
.l0577 push de
ld h,$00
ld l,b
add hl,de
ld d,a
ld a,b
.l057e ld e,(hl)
ld (hl),d
ld d,e
inc hl
inc a
cp $20
jr c,l057e ; (-9)
ld a,e
cp $00
pop de
ret
.l058c push de
ld hl,$0020
add hl,de
push hl
ld d,a
ld a,$1f
jr l059e ; (7)
.l0597 ld e,(hl)
ld (hl),d
ld d,e
cp b
jr z,l05a1 ; (4)
dec a
.l059e dec hl
jr l0597 ; (-10)
.l05a1 ld a,e
cp $00
pop hl
pop de
ret
; Subroutine to page in normal memory (page 0) and swap SP with OLDSP
.l05a7 ex af,af' ; save AF
ld a,$00
di
call l05c1 ; page in page 0
pop af ; AF holds return address
ld (TARGET),hl ; save HL in TARGET
ld hl,(OLDSP) ; get OLDSP
ld (OLDSP),sp ; save SP in OLDSP
ld sp,hl ; SP now holds what was in OLDSP
ei
ld hl,(TARGET) ; restore HL
push af ; push back return address
ex af,af' ; restore AF
ret
; Subroutine to page in page A
.l05c1 push bc ; save BC
ld bc,$7ffd
out (c),a ; change page
ld (BANKM),a ; save copy of OUT
pop bc ; restore BC
ret
; Subroutine to page in DOS workspace (page 7) and swap SP with OLDSP
.l05cc ex af,af' ; save AF
di
pop af ; AF holds return address
ld (TARGET),hl ; save HL in TARGET
ld hl,(OLDSP) ; get OLDSP
ld (OLDSP),sp ; save SP in OLDSP
ld sp,hl ; SP now holds what was in OLDSP
ld hl,(TARGET) ; restore HL
push af ; push back return address
ld a,$07
call l05c1 ; page in page 7
ei
ex af,af' ; restore AF
ret
; The editing keys table
; Most of these keys are produced by the external keypad, which was not
; made available in the UK.
.l05e6 defb $15
defb $0b ; cursor up
defw l0b5f
defb $0a ; cursor down
defw l0b80
defb $08 ; cursor left
defw l0ba2
defb $09 ; cursor right
defw l0bae
defb $ad ; TAB (up 10)
defw l0b1a
defb $ac ; AT (down 10)
defw l0af0
defb $af ; CODE (left word)
defw l0a9f
defb $ae ; VAL$ (right word)
defw l0aac
defb $a6 ; INKEY$ (top)
defw l0a4e
defb $a5 ; RND (bottom)
defw l0a76
defb $a8 ; FN (start of line)
defw l0b52
defb $a7 ; PI (end of line)
defw l0b45
defb $aa ; SCREEN$ (delete char right)
defw l09e6
defb $0c ; delete
defw l09f6
defb $b3 ; COS (delete word right)
defw l10e5
defb $b4 ; TAN (delete word left)
defw l108a
defb $b0 ; VAL (delete line right)
defw l1140
defb $b1 ; LEN (delete line left)
defw l110c
defb $0d ; enter
defw l0a0f
defb $a9 ; POINT (screen)
defw l0748
defb $07 ; edit
defw $07b1
; The menu keys table
.l0626 defb $04
defb $0b ; cursor up
defw l07dc
defb $0a ; cursor down
defw l07df
defb $07 ; edit
defw l07c5
defb $0d ; enter
defw l07c5
; Subroutine to ????
.l0633 call l0989
ld hl,$0000
ld ($fc9a),hl
ld a,$82
ld (ed_flags),a
ld hl,$0000
ld (E_PPC),hl
call l16b6
call l1758
ret
; Routine to display main menu & go to process it
.l064e ld hl,TSTACK
ld (OLDSP),hl ; set "OLDSP" to temporary stack area
call l05cc ; page in DOS workspace
ld a,$02
rst $28
defw $1601 ; open channel to stream 2
ld hl,l07f2
ld (men_rout),hl ; store main menu routine table address
ld hl,l07ff
ld (men_text),hl ; store main menu text address
push hl ; save menu address
ld hl,ed_flags
set 1,(hl) ; signal "processing menu"
res 4,(hl) ; ???
dec hl
ld (hl),$00 ; set men_high=0
pop hl ; restore menu address
xor a
call l189a ; display main menu
jp l0703 ; move to process menu
.l067b ld ix,$fd98
ld hl,TSTACK
ld (OLDSP),hl
call $05cc
ld a,$02
rst $28
defw $1601
defb $cd
ld e,d
defb $18
defb 33
dec sp
ld e,h
.l0693 bit 5,(hl)
jr z,l0693 ; (-4)
ld hl,ed_flags
res 3,(hl)
bit 6,(hl)
jr nz,l06b4 ; (20)
ld a,($ec0e)
cp $04
jr z,l06b1 ; (10)
cp $00
jp nz,$0992
call $1a5a
jr l06b4 ; (3)
.l06b1 call l1a5f ; display "Calculator" bar
.l06b4 call $11a4
call $12f0
ld a,($ec0e) ; get current process
cp $04
jr z,l0703 ; move on if its the calculator
ld hl,(E_PPC) ; get number of current line
ld a,h
or l
jr nz,l06dd ; move on if not zero
ld hl,(PROG)
ld bc,(VARS)
and a
sbc hl,bc ; get length of BASIC program
jr nz,l06da ; move on if not zero
ld hl,$0000
ld ($ec08),hl ; ??? last line
.l06da ld hl,($ec08) ; ??? last line
.l06dd call l05a7 ; page in normal memory
rst $28
defw $196e ; ???
rst $28
defw $1695
call l05cc ; page in DOS workspace
ld (E_PPC),de
ld hl,ed_flags
bit 5,(hl)
jr nz,l0703 ; (15)
ld hl,$0000
ld ($ec06),hl
call l03fa
call $0abd
call $0a0f
; Main routine to process menus & editing functions
.l0703 ld sp,TSTACK ; set SP in temporary stack
.l0706 call l1871 ; get a key
push af
ld a,(PIP)
call l0799 ; sound a 'PIP'
pop af
call l0716 ; "do" the key
jr l0706 ; loop back
.l0716 ld hl,ed_flags
bit 1,(hl) ; check editing/menu flag
push af
ld hl,l0626 ; use menu keys table
jr nz,l0724
ld hl,l05e6 ; or editing keys table
.l0724 call l2166 ; perform pressed key action
jr nz,l072e
call nc,l0794 ; sound a RASP if action failed
pop af ; restore editing/menu flag status
ret
.l072e pop af ; restore editing/menu flag status
jr z,l0736 ; move on if editing
xor a
ld (MODE),a ; else in menu, so set MODE=0
ret
.l0736 ld hl,ed_flags
bit 0,(hl)
jr z,l0741 ; move on if ???
call l0794 ; sound a RASP
ret
.l0741 cp $a3
jr nc,l0706 ; loop back if ???
jp l09bc
; Editing keys: SCREEN
.l0748 ld a,($ec0e)
cp $04
ret z ; exit if in Calculator
call $04fb
ld hl,ed_flags
res 3,(hl)
ld a,(hl)
xor $40
ld (hl),a
and $40
jr z,l0763 ; (5)
call $0768
jr l0766 ; (3)
.l0763 call $077b
.l0766 scf
ret
.l0768 call $1a8e
ld hl,ed_flags
set 6,(hl)
call $0efb
call $1c95
call $09aa
jr l0786 ; (11)
.l077b ld hl,ed_flags
res 6,(hl)
call $0989
call $1a5a
.l0786 ld hl,($fc9a)
ld a,h
or l
call nz,$1418
call $03fa
jp $0abd
; Subroutine to sound a PIP or RASP
; Enter at l0799 with A=PIP, or at l0794 for RASP
.l0794 ld a,(RASP)
srl a ; A=RASP/2
.l0799 push ix ; save IX
ld d,$00
ld e,a ; DE=f*t
ld hl,$0c80 ; HL=timing constant
.l07a1 rst $28
defw $03b5 ; call BEEPER
pop ix ; restore IX
ret
; Another sound
.l07a7 push ix
ld de,$0030
ld hl,$0300
jr l07a1
; Editing keys: EDIT
.l07b1 call l0ab7 ; remove cursor
ld hl,ed_flags
set 1,(hl) ; set "processing menu"
dec hl
ld (hl),$00 ; highlight on line 0
ld hl,(men_text)
xor a
call l189a ; display menu
scf
ret
; The menu ENTER/EDIT routine
.l07c5 ld hl,ed_flags
res 1,(hl) ; signal editing mode
dec hl
ld a,(hl) ; A=currently highlighted line
ld hl,(men_rout) ; HL=menu routines table
push hl
push af
call l1950 ; copy saved area back to screen
pop af
pop hl
call l2166 ; execute required routine
jp l0abd ; move on
; The menu cursor up/down routines
; Enter at l07dc for up, l07df for down
.l07dc scf ; set carry for cursor up
jr l07e0
.l07df and a ; clear carry for cursor down
.l07e0 ld hl,men_high
ld a,(hl) ; get currently highlighted line number
push hl
ld hl,(men_text) ; point to menu
call c,l19b9 ; move highlight up
call nc,l19c8 ; or down
pop hl
ld (hl),a ; replace highlighted line number
.l07f0 scf ; signal "action succeeded"
ret
; The main menu routine address table
.l07f2 defb $04
defb $00
defw l08e8 ; Loader
defb $01
defw l0937 ; +3 BASIC
defb $02
defw l0950 ; Calculator
defb $03
defw l08df ; 48K BASIC
; The main menu
.l07ff defb $05 ; 5 lines total
defm "128 +3 "&$ff
.l0809 defm "Loade"&('r'+$80)
.l080f defm "+3 BASI"&('C'+$80)
.l0817 defm "Calculato"&('r'+$80)
defm "48 BASI"&('C'+$80)
defb ' '+$80
; The editor menu routine address table
.l082a defb $05
defb $00
defw l07f0 ; +3 BASIC
defb $01
defw l0917 ; Renumber
defb $02
defw l08c5 ; Screen
defb $03
defw l0928 ; Print
defb $04
defw l08ca ; Exit
; The editor menu
.l083a defb $06
defm "Options "&$ff
defm "+3 BASI"&('C'+$80)
defm "Renumbe"&('r'+$80)
defm "Scree"&('n'+$80)
defm "Prin"&('t'+$80)
defm "Exi"&('t'+$80)
defb ' '+$80
; The calculator menu routines table
.l0864 defb $02
defb $00
defw l07f0 ; Calculator
defb $01
defw l08ca ; Exit
; The calculator menu
.l086b defb $03
defm "Options "&$ff
defm "Calculato"&('r'+$80)
defm "Exi"&('t'+$80)
defb ' '+$80
; Cassette loader message
.l0884 defm $16&$00&$00
defm $10&$00&$11&$07
defm $13&$00
defm "Insert tape and press PLAY"&$0d
defm "To cancel - press BREAK twic"&('e'+$80)
; The Screen menu option
.l08c5 call l0748 ; call SCREEN editing key routine
jr l093f ; ???
; The "Exit" from submenu option
.l08ca ld hl,ed_flags
res 6,(hl) ; ???
call l0989 ; ???
ld b,$00
ld d,$17
call l1d6b ; clear whole screen to editor colours
call l05a7 ; page in normal memory
jp l064e ; display main menu & process it
; The 48K BASIC menu option
.l08df call l05a7 ; page in normal memory
call l3e80
defw $1488 ; enter 48K BASIC via ROM 1
ret
; The Loader menu option
.l08e8 call l1a64 ; display "Loader" bar
ld hl,TV_FLAG
set 0,(hl) ; signal "using lower screen"
ld de,$0884
push hl
.l08f4 ld hl,FLAGS3
bit 4,(hl)
pop hl
jr nz,l08ff ; move on if disk interface present
call l029e ; display cassette loader message
.l08ff res 0,(hl) ; ???
set 6,(hl) ; ???
ld a,$07
ld ($ec0e),a ; signal "current process is Loader"
ld bc,$0000
call l191d ; output "AT 0,0"
.l090e call l05a7 ; page in normal memory
call l3e80
defw $12e8 ; execute Loader via ROM 1
ret
.l0917 call $1a95
call nc,$0794
ld hl,$0000
ld (E_PPC),hl
ld ($ec08),hl
jr l0930 ; (8)
; The Print menu option
.l0928 call l05a7 ; page in normal memory
call l3e80
defw $1451 ; execute Print via ROM 1
.l0930 ld hl,ed_flags
bit 6,(hl) ; ???
.l0935 jr nz,l093f
; The +3 BASIC routine - called from the main menu
.l0937 ld hl,TV_FLAG
res 0,(hl) ; signal "main screen"
call l1a5a ; display "+3 BASIC" bar
.l093f ld hl,ed_flags
res 5,(hl) ; ???
res 4,(hl) ; ???
ld a,$00 ; ???
ld hl,l082a ; +3 BASIC menu addresses
ld de,l083a ; +3 BASIC menu
jr l097c ; go to set menu
; The Calculator routine - called from the main menu
.l0950 ld hl,ed_flags
set 5,(hl) ; ???
set 4,(hl) ; ???
res 6,(hl) ; ???
call l0989
call l1a5f ; display "Calculator" bar
ld a,$04
ld ($ec0e),a
ld hl,$0000
ld (E_PPC),hl
call $03fa
ld bc,$0000
ld a,b
call $0ac3
ld a,$04
ld hl,l0864
ld de,l086b
; Routine to set new menu and ???
.l097c ld ($ec0e),a ; ???
ld (men_rout),hl ; store routine address table
ld (men_text),de ; store menu address
jp l06b4 ; ???
; Subroutine to ???
.l0989 call l0eed
call l1c8c
jp l09b3
.l0992 ld b,$00
ld d,$17
call l1d6b ; clear screen to editor colours
jp $065c
.l099c defb $06
defb 0
defb 0
defb 0
defb $04
defb $10
defb $14
.l09a3 defb $06
defb 0
defb 0
defb 0
defb 0
defb $01
defb $01
.l09aa ld hl,l09a3
ld de,$f6ee
jp l2152
.l09b3 ld hl,l099c
ld de,$f6ee
jp l2152
; Subroutine to ???
.l09bc ld hl,ed_flags
or a
or a
bit 0,(hl)
jp nz,$0abd
res 7,(hl)
set 3,(hl)
push hl
push af
call $0ab7
pop af
push af
call $0f4f
pop af
ld a,b
call $0c43
pop hl
set 7,(hl)
jp nc,$0abd
ld a,b
jp c,$0ac3
jp $0abd
; Editing keys: DELETE RIGHT
.l09e6 ld hl,ed_flags
set 3,(hl)
call $0ab7
call $0fe0
scf
ld a,b
jp $0ac3
; Editing keys: DELETE
.l09f6 ld hl,ed_flags
res 0,(hl)
set 3,(hl)
call $0ab7
call $0c26
ccf
jp c,$0abd
.l0a07 call $0fe0
scf
ld a,b
jp $0ac3
; Editing keys: ENTER
.l0a0f call $0ab7
push af
call $1182
push bc
ld b,$00
call $0f0f
pop bc
jr c,l0a29 ; (10)
ld hl,$0020
add hl,de
ld a,(hl)
cpl
and $09
jr z,l0a45 ; (28)
.l0a29 ld a,(ed_flags)
bit 3,a
jr z,l0a35 ; (5)
call $0d59
jr nc,l0a4a ; (21)
.l0a35 call $0d17
call $0c43
call $0f9c
ld b,$00
pop af
scf
jp $0ac3
.l0a45 pop af
scf
jp $0abd
.l0a4a pop af
jp $0abd
; Editing keys: TOP
.l0a4e ld a,($ec0e)
cp $04
ret z ; exit if in Calculator
call l0ab7 ; remove cursor
ld hl,$0000 ; line 0
call l05a7 ; page in normal memory
rst $28
defw $196e ; get address of first line in HL
rst $28
defw $1695 ; get line number in DE
call l05cc ; page in DOS workspace
ld (E_PPC),de ; set as current line
ld a,$0f
call l1ca3 ; set colours to blue ink, white paper
call l03fa ; ???
scf ; success
jp l0abd ; place cursor & exit
; Editing keys: BOTTOM
.l0a76 ld a,($ec0e)
cp $04
ret z ; exit if in Calculator
call l0ab7 ; remove cursor
ld hl,9999 ; last possible line
call l05a7 ; page in normal memory
rst $28
defw $196e ; get last line address in DE
ex de,hl
rst $28
defw $1695 ; get last line number in DE
call l05cc ; page in DOS workspace
ld (E_PPC),de ; set as current line
ld a,$0f
call l1ca3 ; set colours to blue ink, white paper
call $03fa ; ???
scf ; success
jp l0abd ; place cursor & exit
; Editing keys: LEFT WORD
.l0a9f call $0ab7
call $0cb5
jp nc,$0abd
ld a,b
jp $0ac3
; Editing keys: RIGHT WORD
.l0aac call $0ab7
call $0cd4
jr nc,l0abd ; (9)
ld a,b
jr l0ac3 ; (12)
; Subroutine to remove cursor
.l0ab7 call l0ad2 ; get cursor position
jp l1749 ; remove it
; Subroutine to place cursor
.l0abd call l0ad2 ; get cursor position
jp l173a ; place it
; Subroutine to set cursor to line C, column B, ??? A
; and set colours & place it
.l0ac3 call l0adc ; set cursor details
push af
push bc
ld a,$0f
call l1ca3 ; set colours to blue INK, white PAPER
pop bc
pop af
jp l173a ; place cursor
; Subroutine to get cursor line (C), column (B), and ??? (A)
.l0ad2 ld hl,$f6ee
ld c,(hl) ; get line (within editing area)
inc hl
ld b,(hl) ; get column
inc hl
ld a,(hl) ; get ???
inc hl
ret
; Subroutine to set cursor line (C), column (B), and ??? (A)
.l0adc ld hl,$f6ee
ld (hl),c ; set line
inc hl
ld (hl),b ; set column
inc hl
ld (hl),a ; set ???
ret
.l0ae5 push hl
call $1182
ld h,$00
ld l,b
add hl,de
ld a,(hl)
pop hl
ret
; Editing keys: DOWN 10 LINES
.l0af0 call $0ab7
ld e,a
ld d,$0a
.l0af6 push de
call $0bfb
pop de
jr nc,l0abd ; (-64)
ld a,e
call $0adc
ld b,e
call $0bc4
jr nc,l0b0d ; (6)
dec d
jr nz,l0af6 ; (-20)
ld a,e
jr c,l0ac3 ; (-74)
.l0b0d push de
call $0bd6
pop de
ld b,e
call $0bc4
ld a,e
or a
jr l0ac3 ; (-87)
; Editing keys: UP 10 LINES
.l0b1a call $0ab7
ld e,a
ld d,$0a
.l0b20 push de
call $0bd6
pop de
jr nc,l0abd ; (-106)
ld a,e
call $0adc
ld b,e
call $0bcd
jr nc,l0b38 ; (7)
dec d
jr nz,l0b20 ; (-20)
ld a,e
jp c,$0ac3
.l0b38 push af
call $0bfb
ld b,$00
call $0c9f
pop af
jp $0ac3
; Editing keys: END OF LINE
.l0b45 call $0ab7
call $0d17
jp nc,$0abd
ld a,b
jp $0ac3
; Editing keys: START OF LINE
.l0b52 call $0ab7
call $0cfc
jp nc,$0abd
ld a,b
jp $0ac3
; Editing keys: CURSOR UP
.l0b5f call l0ab7 ; remove cursor
ld e,a
push de
call $0bd6
pop de
jp nc,$0abd
ld b,e
call $0bcd
ld a,e
jp c,$0ac3
push af
call $0bfb
ld b,$00
call $0bc4
pop af
jp $0ac3
; Editing keys: CURSOR DOWN
.l0b80 call l0ab7 ; remove cursor
ld e,a
push de
call $0bfb
pop de
jp nc,$0abd
ld b,e
call $0bcd
ld a,e
jp c,$0ac3
push de
call $0bd6
pop de
ld b,e
call $0bc4
ld a,e
or a
jp $0ac3
; Editing keys: CURSOR LEFT
.l0ba2 call l0ab7 ; remove cursor
call $0c26
jp c,$0ac3
jp $0abd
; Editing keys: CURSOR RIGHT
.l0bae call l0ab7 ; remove cursor
call $0c43
jp c,$0ac3
push af
call $0bd6
ld b,$1f
call $0caa
pop af
jp $0ac3
.l0bc4 push de
call $0c9f
call nc,$0caa
pop de
ret
.l0bcd push de
call $0caa
call nc,$0c9f
pop de
ret
.l0bd6 call $0d47
jr nc,l0bfa ; (31)
push bc
call $1182
ld b,$00
call $0f0f
call nc,$104e
pop bc
ld hl,$f6f1
ld a,(hl)
cp c
jr c,l0bf8 ; (9)
push bc
call $053a
pop bc
ret c
ld a,c
or a
ret z
.l0bf8 dec c
scf
.l0bfa ret
.l0bfb push bc
call $1182
ld b,$00
call $0f0f
pop bc
jr c,l0c0a ; (3)
jp $104e
.l0c0a call $0d33
jr nc,l0c25 ; (22)
ld hl,$f6f1
inc hl
ld a,c
cp (hl)
jr c,l0c23 ; (12)
push bc
push hl
call $0504
pop hl
pop bc
ret c
inc hl
ld a,(hl)
cp c
ret z
.l0c23 inc c
scf
.l0c25 ret
.l0c26 ld d,a
dec b
jp m,$0c31
ld e,b
call $0caa
ld a,e
ret c
.l0c31 push de
call $0bd6
pop de
ld a,e
ret nc
ld b,$1f
call $0caa
ld a,b
ret c
ld a,d
ld b,$00
ret
.l0c43 ld d,a
inc b
ld a,$1f
cp b
jr c,l0c50 ; (6)
ld e,b
call $0c9f
ld a,e
ret c
.l0c50 dec b
push bc
push hl
ld hl,ed_flags
bit 7,(hl)
jr nz,l0c8b ; (49)
call $1182
ld hl,$0020
add hl,de
ld a,(hl)
bit 1,a
jr nz,l0c8b ; (37)
set 1,(hl)
res 3,(hl)
ld hl,$0023
add hl,de
ex de,hl
pop hl
pop bc
push af
call $0bfb
pop af
call $1182
ld hl,$0023
add hl,de
ex de,hl
res 0,a
set 3,a
call $0fa1
call $16ee
ld a,b
scf
ret
.l0c8b pop hl
pop bc
push de
call $0bfb
pop de
ld a,b
ret nc
ld b,$00
call $0c9f
ld a,b
ret c
ld a,e
ld b,$00
ret
.l0c9f push de
push hl
call $1182
call $0f0f
jp $0d30
.l0caa push de
push hl
call $1182
call $0f31
jp $0d30
.l0cb5 push de
push hl
.l0cb7 call $0c26
jr nc,l0cd2 ; (22)
call $0ae5
cp $20
jr z,l0cb7 ; (-12)
.l0cc3 call $0c26
jr nc,l0cd2 ; (10)
call $0ae5
cp $20
jr nz,l0cc3 ; (-12)
call $0c43
.l0cd2 jr l0d30 ; (92)
.l0cd4 push de
push hl
.l0cd6 call $0c43
jr nc,l0cf6 ; (27)
call $0ae5
cp $20
jr nz,l0cd6 ; (-12)
.l0ce2 call $0c43
jr nc,l0cf6 ; (15)
call $0f0f
jr nc,l0cf6 ; (10)
call $0ae5
cp $20
jr z,l0ce2 ; (-17)
scf
jr l0d30 ; (58)
.l0cf6 call nc,$0c26
or a
jr l0d30 ; (52)
.l0cfc push de
push hl
.l0cfe call $1182
ld hl,$0020
add hl,de
bit 0,(hl)
jr nz,l0d10 ; (7)
call $0bd6
jr c,l0cfe ; (-16)
jr l0d30 ; (32)
.l0d10 ld b,$00
call $0c9f
jr l0d30 ; (25)
.l0d17 push de
push hl
.l0d19 call $1182
ld hl,$0020
add hl,de
bit 3,(hl)
jr nz,l0d2b ; (7)
call $0bfb
jr c,l0d19 ; (-16)
jr l0d30 ; (5)
.l0d2b ld b,$1f
call $0caa
.l0d30 pop hl
pop de
ret
.l0d33 ld a,(ed_flags)
bit 3,a
scf
ret z
call $1182
ld hl,$0020
add hl,de
bit 3,(hl)
scf
ret z
jr l0d59 ; (18)
.l0d47 ld a,(ed_flags)
bit 3,a
scf
ret z
call $1182
ld hl,$0020
add hl,de
bit 0,(hl)
scf
ret z
.l0d59 ld a,$02
.l0d5b call $1182
ld hl,$0020
add hl,de
bit 0,(hl)
jr nz,l0d6e ; (8)
dec c
jp p,$0d5b
ld c,$00
ld a,$01
.l0d6e ld hl,$ec00
ld de,$ec03
or $80
ld (hl),a
ld (de),a
inc hl
inc de
ld a,$00
ld (hl),a
ld (de),a
inc hl
inc de
ld a,c
ld (hl),a
ld (de),a
ld hl,$0000
ld ($ec06),hl
call $142d
call $1dfa
push ix
call $05a7
call l3e80
defw $24f0
call $05cc
ei
pop ix
ld a,(ERR_NR)
inc a
jr nz,l0dbd ; (24)
ld hl,ed_flags
res 3,(hl)
call $1758
ld a,($ec0e)
cp $04
call nz,$03fa
call $07a7
call $0ad2
scf
ret
.l0dbd ld hl,$ec00
ld de,$ec03
ld a,(de)
res 7,a
ld (hl),a
inc hl
inc de
ld a,(de)
ld (hl),a
inc hl
inc de
ld a,(de)
ld (hl),a
call $1df6
jr c,l0dd8 ; (4)
ld bc,($ec06)
.l0dd8 ld hl,($ec06)
or a
sbc hl,bc
push af
push hl
call $0ad2
pop hl
pop af
jr c,l0df8 ; (17)
jr z,l0e13 ; (42)
.l0de9 push hl
ld a,b
call $0c26
pop hl
jr nc,l0e13 ; (34)
dec hl
ld a,h
or l
jr nz,l0de9 ; (-13)
jr l0e13 ; (27)
.l0df8 push hl
ld hl,ed_flags
res 7,(hl)
pop hl
ex de,hl
ld hl,$0000
or a
sbc hl,de
.l0e06 push hl
ld a,b
call $0c43
pop hl
jr nc,l0e13 ; (5)
dec hl
ld a,h
or l
jr nz,l0e06 ; (-13)
.l0e13 ld hl,ed_flags
set 7,(hl)
call $0adc
ld a,$17
call $1ca3
or a
ret
.l0e22 ld hl,$ec00
bit 7,(hl)
jr z,l0e30 ; (7)
ld hl,($ec06)
inc hl
ld ($ec06),hl
.l0e30 ld hl,$ec00
ld a,(hl)
inc hl
ld b,(hl)
inc hl
ld c,(hl)
push hl
and $0f
ld hl,$0e53
call l2166
ld e,l
pop hl
jr z,l0e47 ; (2)
ld a,$0d
.l0e47 ld (hl),c
dec hl
ld (hl),b
dec hl
push af
ld a,(hl)
and $f0
or e
ld (hl),a
pop af
ret
inc bc
ld (bc),a
ld a,d
ld c,$04
or a
ld c,$01
ld e,l
ld c,$cd
add a,l
inc de
.l0e60 call $0edc
jr nc,l0e6c ; (7)
cp $00
jr z,l0e60 ; (-9)
ld l,$01
ret
.l0e6c inc c
ld b,$00
ld hl,($f9db)
ld a,c
cp (hl)
defb $38
defb -25
ld b,$00
ld c,$00
.l0e7a push hl
ld hl,$f6ee
ld a,(hl)
cp c
jr nz,l0e8c ; (10)
inc hl
ld a,(hl)
cp b
jr nz,l0e8c ; (5)
ld hl,$ec00
res 7,(hl)
.l0e8c pop hl
.l0e8d call $1182
call $0edc
jr nc,l0e9c ; (7)
cp $00
jr z,l0e7a ; (-31)
ld l,$02
ret
.l0e9c ld hl,$0020
add hl,de
bit 3,(hl)
jr z,l0ea9 ; (5)
ld l,$08
ld a,$0d
ret
.l0ea9 ld hl,$f6f3
inc c
ld a,(hl)
cp c
ld b,$00
jr nc,l0e8d ; (-38)
ld b,$00
ld c,$01
.l0eb7 call $1291
.l0eba call $0edc
jr nc,l0ec6 ; (7)
cp $00
jr z,l0eba ; (-9)
ld l,$04
ret
.l0ec6 ld hl,$0020
add hl,de
bit 3,(hl)
jr nz,l0ed7 ; (9)
inc c
ld b,$00
ld a,($f6f5)
cp c
jr nc,l0eb7 ; (-32)
.l0ed7 ld l,$08
ld a,$0d
ret
.l0edc ld a,$1f
cp b
ccf
ret nc
ld l,b
ld h,$00
add hl,de
ld a,(hl)
inc b
scf
ret
.l0ee9 defb $01
defb $14
.l0eeb defb $01
defb $01
; Subroutine to ???
.l0eed ld hl,TV_FLAG
res 0,(hl) ; signal "not using lower screen"
ld hl,l0ee9
ld de,$ec15
jp l2152 ; copy $14 into $ec15 and exit
.l0efb ld hl,TV_FLAG
set 0,(hl) ; signal "using lower screen"
ld bc,$0000
call l191d ; output "AT 0,0"
ld hl,l0eeb
ld de,$ec15
jp l2152 ; copy $01 into $ec15 and exit
.l0f0f ld h,$00
ld l,b
add hl,de
ld a,(hl)
cp $00
scf
ret nz
ld a,b
or a
jr z,l0f29 ; (13)
push hl
dec hl
ld a,(hl)
cp $00
scf
pop hl
ret nz
.l0f24 ld a,(hl)
cp $00
scf
ret nz
.l0f29 inc hl
inc b
ld a,b
cp $1f
jr c,l0f24 ; (-12)
ret
.l0f31 ld h,$00
ld l,b
add hl,de
ld a,(hl)
cp $00
scf
ret nz
.l0f3a ld a,(hl)
cp $00
jr nz,l0f46 ; (7)
ld a,b
or a
ret z
dec hl
dec b
jr l0f3a ; (-12)
.l0f46 inc b
scf
ret
ld h,$00
ld l,b
add hl,de
ld a,(hl)
ret
.l0f4f ld hl,ed_flags
or a
bit 0,(hl)
ret nz
push bc
push af
call $1182
pop af
.l0f5c call $0577
push af
ex de,hl
call $16fe
ex de,hl
pop af
ccf
jr z,l0f9a ; (49)
push af
ld b,$00
inc c
ld a,($ec15)
cp c
jr c,l0f96 ; (35)
ld a,(hl)
ld e,a
and $d7
cp (hl)
ld (hl),a
ld a,e
set 1,(hl)
push af
call $1182
pop af
jr z,l0f90 ; (13)
res 0,a
call $0fa1
jr nc,l0f9a ; (16)
call $16ee
pop af
jr l0f5c ; (-52)
.l0f90 call $0f0f
pop af
jr l0f5c ; (-58)
.l0f96 pop af
call $123c
.l0f9a pop bc
ret
.l0f9c call $1182
ld a,$09
.l0fa1 push bc
push de
ld b,c
ld hl,$0fbd
ld c,a
push bc
call $0540
pop bc
ld a,c
jr nc,l0fba ; (10)
ld c,b
call $1182
ld hl,$0020
add hl,de
ld (hl),a
scf
.l0fba pop de
pop bc
ret
defs $20
add hl,bc
defs 2
.l0fe0 push bc
call $1182
push bc
.l0fe5 ld hl,$0020
add hl,de
bit 1,(hl)
ld a,$00
jr z,l0fff ; (16)
inc c
ld hl,$0023
add hl,de
ex de,hl
ld a,($ec15)
cp c
jr nc,l0fe5 ; (-22)
dec c
call $1297
.l0fff pop hl
.l1000 push hl
call $1182
pop hl
ld b,a
ld a,c
cp l
ld a,b
push af
jr nz,l100f ; (3)
ld b,h
jr l1018 ; (9)
.l100f push af
push hl
ld b,$00
call $0f0f
pop hl
pop af
.l1018 push hl
ld hl,$f6f4
set 0,(hl)
jr z,l1022 ; (2)
res 0,(hl)
.l1022 call $058c
push af
push bc
push de
ld hl,$f6f4
bit 0,(hl)
jr nz,l103d ; (14)
ld b,$00
call $0c9f
jr c,l103d ; (7)
call $104e
pop de
pop bc
jr l1042 ; (5)
.l103d pop hl
pop bc
call $16fe
.l1042 pop af
dec c
.l1044 ld b,a
pop hl
pop af
ld a,b
jp nz,$1000
scf
pop bc
ret
.l104e ld hl,$0020
add hl,de
ld a,(hl)
bit 0,(hl)
jr nz,l1080 ; (41)
push af
push bc
ld a,c
or a
jr nz,l1072 ; (21)
push bc
ld hl,($fc9a)
call $1418
ld ($fc9a),hl
ld a,($f9db)
ld c,a
dec c
call $1385
pop bc
jr l1076 ; (4)
.l1072 dec c
call $1182
.l1076 pop bc
pop af
ld hl,$0020
add hl,de
res 1,(hl)
or (hl)
ld (hl),a
.l1080 ld b,c
call $1182
call $11ad
jp $0513
; Editing keys: DELETE WORD LEFT
.l108a call $1152
.l108d push hl
call $1163
jr z,l10c5 ; (50)
call $0c26
pop hl
jr nc,l10c6 ; (45)
call $0ae5
push af
push hl
call $0fe0
pop hl
pop af
cp $20
jr z,l108d ; (-26)
.l10a7 push hl
call $1163
jr z,l10c5 ; (24)
call $0c26
pop hl
jr nc,l10c6 ; (19)
call $0ae5
cp $20
jr z,l10c1 ; (7)
push hl
call $0fe0
pop hl
jr l10a7 ; (-26)
.l10c1 push hl
call $0c43
.l10c5 pop hl
.l10c6 ld a,b
push af
push hl
ld hl,$eef5
res 2,(hl)
ld a,($ec15)
push bc
ld b,$00
ld c,a
cp a
call $04d0
pop bc
ld hl,ed_flags
set 3,(hl)
pop hl
call $0ac3
pop af
ret
; Editing keys: DELETE WORD RIGHT
.l10e5 call $1152
.l10e8 push hl
call $0ae5
pop hl
cp $00
scf
jr z,l10c6 ; (-44)
push af
push hl
call $0fe0
pop hl
pop af
cp $20
jr nz,l10e8 ; (-21)
.l10fd call $0ae5
cp $20
scf
jr nz,l10c6 ; (-63)
push hl
call $0fe0
pop hl
jr l10fd ; (-15)
; Editing keys: DELETE LINE LEFT
.l110c call $1152
.l110f push hl
call $1182
ld hl,$0020
add hl,de
bit 0,(hl)
jr nz,l1127 ; (12)
call $0c26
jr nc,l113b ; (27)
call $0fe0
pop hl
jr l110f ; (-23)
push hl
.l1127 ld a,b
cp $00
jr z,l113b ; (15)
dec b
call $0ae5
inc b
cp $00
jr z,l113b ; (6)
dec b
call $0fe0
jr l1127 ; (-20)
.l113b pop hl
.l113c scf
jp $10c6
; Editing keys: DELETE LINE RIGHT
.l1140 call $1152
.l1143 call $0ae5
cp $00
scf
jr z,l113c ; (-15)
push hl
call $0fe0
pop hl
jr l1143 ; (-15)
.l1152 ld hl,ed_flags
res 0,(hl)
call $0ab7
ld hl,$eef5
set 2,(hl)
ld hl,$f6f1
ret
.l1163 call $1182
ld hl,$0020
add hl,de
bit 0,(hl)
jr z,l117c ; (14)
ld a,b
cp $00
jr z,l1180 ; (13)
dec b
call $0ae5
inc b
cp $00
jr z,l1180 ; (4)
.l117c ld a,$01
or a
ret
.l1180 xor a
ret
.l1182 ld hl,$ec16
.l1185 push af
ld a,c
ld de,$0023
.l118a or a
jr z,l1191 ; (4)
add hl,de
dec a
jr l118a ; (-7)
.l1191 ex de,hl
pop af
ret
push de
call $1182
ld h,$00
ld l,b
add hl,de
pop de
ret
.l119e defb $05
defb $00,$00,$00,$f8,$f6
; Subroutine to ???
.l11a4 ld hl,l119e
ld de,$f6f5
jp l2152
; Subroutine to ???
.l11ad push bc
push de
ld hl,$f6f5 ; ???
push hl
ld a,(hl)
or a
jr nz,l11cf ; move on if ???
push hl
call l142d ; setup token routines in RAM
ld hl,($f9d7)
call l1420 ; get line number after ???
jr nc,l11c6 ; move on if none
ld ($f9d7),hl ; store it
.l11c6 ld b,h
ld c,l
pop hl
call l13a4 ; ???
dec a
jr l11e4
.l11cf ld hl,ed_flags
res 0,(hl)
ld hl,$f6f8
ld d,h
ld e,l
ld bc,$0023
add hl,bc
ld bc,$02bc
ldir
dec a
scf
.l11e4 pop de
ld (de),a
ld hl,$f6f8
pop de
pop bc
ret
.l11ec push bc
push de
ld hl,$0020
add hl,de
ld a,(hl)
cpl
and $11
jr nz,l120d ; (21)
push hl
push de
inc hl
ld d,(hl)
inc hl
ld e,(hl)
push de
call $142d
pop hl
call $1418
jr nc,l120b ; (3)
ld ($f9d7),hl
.l120b pop de
pop hl
.l120d bit 0,(hl)
ld hl,$f6f5
push hl
jr z,l121a ; (5)
ld a,$00
scf
jr l11e4 ; (-54)
.l121a ld a,(hl)
cp $14
jr z,l11e4 ; (-59)
ld bc,$0023
ld hl,$f6f8
ex de,hl
ldir
ld hl,$f9d6
ld d,h
ld e,l
ld bc,$0023
or a
sbc hl,bc
ld bc,$02bc
lddr
inc a
scf
jr l11e4 ; (-88)
.l123c push bc
push de
push af
ld b,$00
ld c,$01
push hl
call $1291
pop hl
bit 3,(hl)
res 3,(hl)
jr nz,l126e ; (32)
.l124e call $0f0f
pop af
.l1252 call $0577
jr z,l1288 ; (49)
push af
ld b,$00
inc c
ld a,c
cp $15
jr c,l126e ; (14)
dec hl
ld a,(hl)
inc hl
cp $00
jr z,l126e ; (7)
push hl
ld hl,ed_flags
set 0,(hl)
pop hl
.l126e bit 1,(hl)
set 1,(hl)
res 3,(hl)
call $1291
jr nz,l124e ; (-43)
push bc
push de
call l16e0 ; pad line at DE with nulls to length 32
ld (hl),$08
pop de
pop bc
call $16ee
pop af
jr l1252 ; (-54)
.l1288 ld a,c
ld ($f6f5),a
set 3,(hl)
pop de
pop bc
ret
.l1291 ld hl,$f6f8
jp $1185
.l1297 push bc
push de
ld hl,ed_flags
res 0,(hl)
ld a,($f6f5)
ld c,a
or a
ld a,$00
jr z,l12e9 ; (66)
.l12a7 call $1291
push af
ld b,$00
call $0f0f
jr nc,l12c0 ; (14)
pop af
call $058c
push af
push bc
ld b,$00
call $0f0f
pop bc
jr c,l12e4 ; (36)
.l12c0 inc hl
ld a,(hl)
push af
push bc
ld a,c
cp $01
jr nz,l12d2 ; (9)
ld a,($ec15)
ld c,a
call $1182
jr l12d6 ; (4)
.l12d2 dec c
call $1291
.l12d6 pop bc
pop af
ld hl,$0020
add hl,de
res 1,(hl)
or (hl)
ld (hl),a
ld hl,$f6f5
dec (hl)
.l12e4 pop af
dec c
jr nz,l12a7 ; (-65)
scf
.l12e9 pop de
pop bc
ret
; ???
.l12ec defb $03
defb $00,$de,$f9
; Subroutine to ???
.l12f0 ld hl,l12ec
ld de,$f9db
jp l2152
.l12f9 push bc
push de
ld hl,$f9db
push hl
ld a,(hl)
or a
jr nz,l1321 ; (30)
push hl
call $142d
ld hl,($fc9a)
call $1418
jr nc,l1312 ; (3)
ld ($fc9a),hl
.l1312 ld b,h
ld c,l
pop hl
inc hl
inc hl
inc hl
jr nc,l132b ; (17)
call $13a4
dec a
ex de,hl
jr l132b ; (10)
.l1321 ld hl,($f9dc)
ld bc,$0023
sbc hl,bc
scf
dec a
.l132b ex de,hl
pop hl
jr nc,l1330 ; (1)
ld (hl),a
.l1330 inc hl
ld (hl),e
inc hl
ld (hl),d
ex de,hl
pop de
pop bc
ret
.l1338 push bc
push de
ld hl,$0020
add hl,de
ld a,(hl)
cpl
and $11
jr nz,l1350 ; (12)
push de
push hl
inc hl
ld d,(hl)
inc hl
ld e,(hl)
ld ($fc9a),de
pop hl
pop de
.l1350 bit 3,(hl)
ld hl,$f9db
push hl
jr z,l136e ; (22)
push hl
call $142d
ld hl,($fc9a)
call $1420
ld ($fc9a),hl
pop hl
inc hl
inc hl
inc hl
ld a,$00
scf
jr l132b ; (-67)
.l136e ld a,(hl)
cp $14
jr z,l1381 ; (14)
inc a
ld hl,($f9dc)
ld bc,$0023
ex de,hl
ldir
ex de,hl
scf
jr l132b ; (-86)
.l1381 pop hl
pop de
pop bc
ret
.l1385 ld hl,$f9de
jp $1185
; Table of routine addresses for printing chars in EDITOR
.l138b defb $08
defb $0d
defw $16c6 ; ???
defb $01
defw $16d4 ; ???
defb $12
defw l1428 ; for colour codes, skip embedded code
defb $13
defw l1428
defb $14
defw l1428
defb $15
defw l1428
defb $10
defw l1428
defb $11
defw l1428
; Subroutine to ???
.l13a4 ld d,h
ld e,l
inc de
inc de
inc de
.l13a9 push de
ld hl,$0020
add hl,de
ld (hl),$01 ; store ???
inc hl
ld (hl),b
.l13b2 inc hl
ld (hl),c ; store line number
ld c,$01 ; coloumn 1 ???
ld b,$00 ; character position on screen line
.l13b8 push bc
push de
ld a,($ec0e)
cp $04
call nz,l1611 ; unless in calculator, get next line char
pop de
pop bc
jr c,l13d5 ; move on if found character
ld a,c
cp $01
ld a,$0d
jr nz,l13d5 ; do CR unless no chars output
ld a,b
or a
ld a,$01
jr z,l13d5 ; ???
ld a,$0d ; CR
.l13d5 ld hl,l138b
call l2166 ; perform actions for special chars
jr c,l13fa ; if successful action, move on
jr z,l13b8 ; loop back if need new char
push af
ld a,$1f
cp b
jr nc,l13f4 ; move on unless need to start new line
ld a,$12
call l13ff ; ???
jr c,l13f1 ; ???
pop af
ld a,$0d
jr l13d5
.l13f1 call $16ee ; ???
.l13f4 pop af
call l16bf ; ???
jr l13b8
.l13fa pop hl
ld a,c ; ???
ret z
scf
ret
; Subroutine to ???
.l13ff push af
call l16e0 ; pad line at DE to length 32 with nulls
pop af
xor (hl) ; ??
ld (hl),a
ld a,c
cp $14
ret nc
inc c
ld hl,$0023
add hl,de
ex de,hl
ld hl,$0020
add hl,de
ld (hl),$00
scf
ret
; Subroutine to get number (HL) of line before HL (or 0 if none)
.l1418 call l15b0 ; find line number before HL
ret c ; exit if found
ld hl,$0000 ; else use 0
ret
; Subroutine to get number (HL) of line after HL (or 0 if none)
.l1420 call l152a ; get line number after HL
ret c ; exit if found
ld hl,$0000 ; else use 0
ret
; Subroutine to skip an embedded colour code in a line
.l1428 call l1611 ; get next char (skip colour code)
ccf
ret nc ; exit if success, else set no data left
; Subroutine to setup token scanning/expanding routines
.l142d ld hl,$0000
ld ($fc9f),hl ; set "no line data"
ld ($fca1),hl ; set "no expanded token"
ld hl,l1442
ld de,$fcae
ld bc,$00e8
ldir ; copy token routines into RAM
ret
; Routine executed in RAM at $fcae
; On entry, A=zero-based token number (code-$a5), and on exit $fca1
; contains address of expanded token
.l1442 di
push af
ld bc,$7ffd
ld a,$17
out (c),a ; page in ROM 1 & RAM 7
ld bc,$1ffd
ld a,(BANK678)
set 2,a
out (c),a ; page in ROM 3
pop af
cp $50
jr nc,l148b ; these parts start off search at every
cp $40 ; 16th token for speed
jr nc,l1484
cp $30
jr nc,l147d
cp $20
jr nc,l1476
cp $10
jr nc,l146f
ld hl,$0096 ; RND in token table
jr l1490
.l146f sub $10
ld hl,$00cf ; ASN in token table
jr l1490
.l1476 sub $20
ld hl,$0100 ; OR in token table
jr l1490
.l147d sub $30
ld hl,$013e ; MERGE in token table
jr l1490
.l1484 sub $40
ld hl,$018b ; RESTORE in token table
jr l1490
.l148b sub $50
ld hl,$01d4 ; PRINT in token table
.l1490 ld b,a ; B=offset of token from current
or a
.l1492 jr z,l149d
.l1494 ld a,(hl) ; get next character
inc hl
and $80
jr z,l1494 ; loop back until end of token found
dec b ; decrement token offset
jr l1492 ; loop back
.l149d ld de,$fca3
ld ($fca1),de ; set expanded token address
ld a,($fc9e)
or a ; test "leading space" flag
ld a,$00
ld ($fc9e),a ; and set to zero
jr nz,l14b3
ld a,' '
ld (de),a ; insert space if necessary
inc de
.l14b3 ld a,(hl)
ld b,a
inc hl
ld (de),a ; copy token byte
inc de
and $80
jr z,l14b3 ; back until end of token
ld a,b
and $7f
dec de
ld (de),a ; mask off high bit in last char
inc de
ld a,' '+$80 ; and add terminating space
ld (de),a
ld bc,$7ffd
ld a,(BANKM)
out (c),a ; restore original ROM/RAM configuration
ld bc,$1ffd
ld a,(BANK678)
out (c),a
ei
ret
; Routine executed in RAM at $fd43
; On entry, bit-7 terminated word to check for is at $fda0
; On exit, if carry set, A=token code, else A=0
.l14d7 di
push af
ld bc,$7ffd
ld a,$17
out (c),a ; page in ROM 1 & RAM 7
ld bc,$1ffd
ld a,(BANK678)
set 2,a
out (c),a ; page in ROM 3
pop af
ld hl,$0096 ; token table start
ld b,$a5 ; first token number
.l14f0 ld de,$fda0 ; start of word to test
.l14f3 ld a,(de) ; get next letter of word to test
and $7f
cp $61
ld a,(de)
jr c,l14fd
and $df ; mask lowercase letters to uppercase
.l14fd cp (hl) ; test against current token letter
jr nz,l1509 ; move on if no match
inc hl
inc de
and $80
jr z,l14f3 ; loop back unless last token character
scf ; success
jr l1515
.l1509 inc b ; increment token number
jr z,l1514 ; exit if all checked
.l150c ld a,(hl)
and $80
inc hl
jr z,l150c ; loop back until current token finished
jr l14f0 ; back to check more tokens
.l1514 or a ; failure
.l1515 ld a,b
ld d,a
ld bc,$7ffd
ld a,(BANKM)
out (c),a ; page back original ROM/RAM configuration
ld bc,$1ffd
ld a,(BANK678)
out (c),a
ld a,d ; A=token number
ei
ret
; Subroutine to form ASCII line number for next line after HL. Exits
; with DE=address of line data & HL=line number
.l152a call l15e4 ; set "no line" addresses
or a
ld ($fc9e),a ; set "leading spaces"
call l05a7 ; page in normal memory
call l15f0 ; get address of line HL
jr nc,l158b ; exit if not found
jr nz,l1547
ld a,b
or c
jr z,l1547 ; move on if first line was required
call l15c9 ; get address of next line
call l15d3
jr nc,l158b ; exit if end of program
; Subroutine to form ASCII line number for line at HL.
; Exits with HL=line number, DE=address of line data
.l1547 ld d,(hl)
inc hl
ld e,(hl) ; get line number
call l05cc ; page in DOS workspace
push de
push hl
push ix
ld ix,$fca3
ld ($fca1),ix ; set ASCII line number address
ex de,hl
ld b,$00 ; don't form leading zeros
ld de,$fc18
call l158f ; form 1000s
ld de,$ff9c
call l158f ; form 100s
ld de,$fff6
call l158f ; form 10s
ld de,$ffff
call l158f ; form units
dec ix
ld a,(ix+$00)
or $80 ; set bit 7 of last digit
ld (ix+$00),a
pop ix
pop hl
pop de
inc hl
inc hl
inc hl ; HL=address of line data
ld ($fc9f),hl ; save it
ex de,hl
scf ; success
ret
.l158b call l05cc ; page in DOS workspace
ret ; exit
; Subroutine to form next digit of line number at IX
; Line number in HL, unit size in DE, and print zero flag in B
.l158f xor a ; count 0
.l1590 add hl,de ; reduce line number by unit size
inc a ; increment count
jr c,l1590 ; loop until overflow
sbc hl,de ; add back last try
dec a
add a,'0' ; form ASCII digit
ld (ix+$00),a ; store it
cp '0'
jr nz,l15ab ; set flag if not zero
ld a,b
or a
jr nz,l15ad ; if flag set, leave 0 digits
ld a,$00
ld (ix+$00),a ; else replace with $00
jr l15ad
.l15ab ld b,$01 ; set "print 0 digits" flag
.l15ad inc ix ; increment pointer
ret
; Subroutine to get number (HL) and address (DE) of line before line HL
; forming ASCII line number in page 7. Carry reset if no prior line.
.l15b0 call l15e4 ; initialise "no line" addresses
or a
ld ($fc9e),a ; ???
call l05a7 ; page in normal memory
call l15f0 ; find address of line HL
jr nc,l158b ; if not found, exit with error
ex de,hl
ld a,l
or h ; was there a previous line?
scf
jp nz,l1547 ; form line number & address of data if so
ccf
jr l158b ; else exit with error
; Subroutine to get address of next program line in HL (current is
; saved in DE)
.l15c9 push hl
inc hl
inc hl
ld e,(hl)
inc hl
ld d,(hl) ; DE=line length
inc hl
add hl,de ; HL=next line
pop de ; DE=previous line
ret
; Subroutine to check for end of program (carry reset if so)
.l15d3 ld a,(hl) ; check next program byte
and $c0
scf
ret z ; exit with carry set if not end-of-program
ccf ; clear carry if end-of-program
ret
; Subroutine to check if line number at HL is equal to BC (carry set if so)
.l15da ld a,b
cp (hl)
ret nz
ld a,c
inc hl
cp (hl)
dec hl
ret nz
scf
ret
; Subroutine to set "no line" addresses
.l15e4 push hl
ld hl,$0000
ld ($fca1),hl ; set "no ASCII line number"
ld ($fc9f),hl ; set "no line data"
pop hl
ret
; Subroutine to search for address of line HL, returning in HL with
; carry set. If HL=0 first line address is returned. Carry reset if
; line not found. DE=address of previous line (or 0)
.l15f0 push hl
pop bc ; BC=line to find
ld de,$0000 ; no previous line
ld hl,(PROG) ; get start of program
call l15d3 ; check if end
ret nc ; exit if so with failure
call l15da ; is it line BC
ret c ; exit if so with success
ld a,b
or c
scf
ret z ; exit with first line if line 0 specified
.l1604 call l15c9 ; get to next line
call l15d3
ret nc ; exit if program end
call l15da
jr nc,l1604 ; loop back if not line BC yet
ret
; Subroutine to get next character (A) from line. Carry reset if none left
.l1611 ld hl,($fca1) ; get address of ASCII text
ld a,l
or h
jr z,l1636 ; move on if none
ld a,(hl)
inc hl
cp $a0 ; test for terminating space
ld b,a
ld a,$00 ; set "print leading space" if none
jr nz,l1623
ld a,$ff ; else suppress
.l1623 ld ($fc9e),a ; set flag
ld a,b
bit 7,a
jr z,l162e
ld hl,$0000 ; if last character, set "no text left"
.l162e ld ($fca1),hl ; update address
and $7f ; mask high bit
jp l1689 ; exit with success
.l1636 ld hl,($fc9f) ; get address of line data
ld a,l
or h
jp z,l168b ; exit with fail if none
call l05a7 ; page in normal memory
.l1641 ld a,(hl)
cp $0e ; check for embedded number
jr nz,l164e
inc hl ; if found, skip & loop back
inc hl
inc hl
inc hl
inc hl
inc hl
jr l1641
.l164e call l05cc ; page in DOS workspace
inc hl
ld ($fc9f),hl ; update address
cp $a5
jr c,l1661 ; move on unless 48K BASIC token
sub $a5 ; get token number (0+)
call $fcae ; expand to ASCII text
jp l1611 ; go to get first char
.l1661 cp $a3
jr c,l1675 ; move on unless +3 BASIC token
jr nz,l166c
ld hl,l168e ; SPECTRUM token
jr l166f
.l166c ld hl,l1696 ; PLAY token
.l166f call $fd09 ; expand to ASCII text
jp l1611 ; go to get first char
.l1675 push af
ld a,$00
ld ($fc9e),a ; flag "print leading space"
pop af
cp $0d
jr nz,l1689 ; exit with success unless end of line
ld hl,$0000
ld ($fca1),hl ; set no ASCII text
ld ($fc9f),hl ; and no line data
.l1689 scf ; success
ret
.l168b scf
ccf ; fail
ret
.l168e defm "SPECTRU"&('M'+$80)
.l1696 defm "PLA"&('Y'+$80)
defm "GOT"&('O'+$80)
defm "GOSU"&('B'+$80)
defm "DEFF"&('N'+$80)
defm "OPEN"&('#'+$80)
defm "CLOSE"&('#'+$80)
.l16b3 defb $02
defb $01
defb $05
.l16b6 ld hl,l16b3
ld de,$fd96
jp l2152
; Subroutine to ???
.l16bf ld l,b
ld h,$00
add hl,de
ld (hl),a
inc b
ret
call l16e0 ; pad line at DE to length 32 with nulls
ld a,(hl)
or $18
ld (hl),a
ld hl,$fd96
set 0,(hl)
scf
ret
call l16e0 ; pad line at DE to length 32 with nulls
set 3,(hl)
ld hl,$fd96
set 0,(hl)
scf
ret
; Subroutine to pad line at DE (length B) with nulls to length B=32
; On exit, HL=end of line+1
.l16e0 ld l,b
ld h,0
add hl,de ; get past last char on line
ld a,$20
.l16e6 cp b
ret z ; exit if 32 chars already
ld (hl),0 ; pad with zeros
inc hl
inc b
jr l16e6
.l16ee ld a,($fd97)
ld b,$00
.l16f3 ld h,$00
ld l,b
add hl,de
ld (hl),$00
inc b
dec a
jr nz,l16f3 ; (-10)
ret
.l16fe push bc
push de
push hl
push hl
ld hl,$eef5
bit 2,(hl)
pop hl
jr nz,l170e ; (4)
ld b,c
call $1d2b
.l170e pop hl
pop de
pop bc
ret
.l1712 push bc
push de
push hl
push hl
ld hl,$eef5
bit 2,(hl)
pop hl
jr nz,l1722 ; (4)
ld e,c
call $1ccc
.l1722 pop hl
pop de
pop bc
ret
.l1726 push bc
push de
push hl
push hl
ld hl,$eef5
bit 2,(hl)
pop hl
jr nz,l1736 ; (4)
ld e,c
call $1cd3
.l1736 pop hl
pop de
pop bc
ret
; Subroutine to place cursor at column B, line C (of editing area)
.l173a push af
push bc
push de
push hl
ld a,b
ld b,c ; B=line of editing area
ld c,a ; C=column
call l1caa
pop hl
pop de
pop bc
pop af
ret
; Subroutine to remove cursor from column B, line C (of editing area)
.l1749 push af
push bc
push de
push hl
ld a,b
ld b,c
ld c,a
call $1cbf
pop hl
pop de
pop bc
pop af
ret
.l1758 ld a,$00
ld (MODE),a
ld a,$02
ld (REPPER),a
call l185a
ret
ld (hl),h
rst $18
sbc a,$55
djnz $17be ; (82)
ret
sbc a,(hl)
sbc a,(hl)
cp l
ld h,d
push bc
ret nz
ld d,l
jp nz,$1044
rla
cp $5f
sub b
cp $d1
defb $dd
push de
rla
sub b
rst $30
rst $18
rst $18
call nc,$d9c7
sbc a,$c3
cp l
di
call c,$d659
ld d,(hl)
djnz $17a8 ; (23)
ld h,h
ld b,a
ld e,a
sub b
ld h,b
rst $18
ld b,b
.l1798 ld b,e
sub a
djnz $1798 ; (-4)
ld d,c
rst $0
ld b,e
ld e,a
sbc a,$bd
ld h,(hl)
exx
.l17a4 ld e,e
sub b
rla
jp po,$54d5
djnz $17a4 ; (-8)
ld d,l
ld b,d
ld b,d
ld e,c
sbc a,$57
rla
sub b
ld a,a
ld e,h
ld e,h
exx
add a,$55
jp nz,$5190
sbc a,$bd
call po,$d5d8
sub b
ld (hl),h
ld e,a
jp nz,$595b
ld e,(hl)
rst $10
sub b
ld a,l
ld e,a
jp nc,$64bd
ld e,b
pop de
.l17d2 ld e,(hl)
in a,($c3)
djnz $179b ; (-60)
ld e,a
ld e,$1e
cp l
ld h,h
ret c
push de
djnz $17d2 ; (-14)
ld b,d
push de
ld b,a
push de
ld b,d
ret
sub b
call po,$c0d1
sub b
defb $18
defb 88
exx
out ($19),a
cp l
jp po,$dc5f
.l17f4 ld d,c
sbc a,$54
inc e
sub b
ld h,d
exx
out ($58),a
ld d,c
jp nz,$9054
ld d,l
ld b,h
sub b
pop de
ld e,h
cp l
ld d,c
ld e,(hl)
ld d,h
sub b
ld sp,hl
add a,$df
ld b,d
djnz $17a9 ; (-104)
rst $0
ret c
ld c,c
djnz $17f4 ; (-34)
ld e,a
.l1817 call nz,$bd19
ld h,a
ld b,d
exx
ld b,h
call nz,$5ed5
sub b
rst $18
ld e,(hl)
sub b
ld h,b
di
ld h,a
sub b
adc a,b
dec b
add a,c
ld (bc),a
ld b,e
inc e
djnz $1876 ; (69)
ld b,e
exx
ld e,(hl)
cp l
defb $fd
ex af,af'
nop
sub b
ld d,c
.l183a sbc a,$d4
djnz $183a ; (-4)
ex af,af'
nop
djnz $1887 ; (69)
ld e,(hl)
call nc,$c255
djnz $183b ; (-13)
ld h,b
sbc a,a
defb $fd
sbc a,e
cp l
cp l
jp $c490
rst $18
ld e,$9e
cp l
ld h,h
ret c
ld d,l
djnz $1817 ; (-67)
.l185a ld hl,FLAGS
ld a,(hl)
or $0c
ld (hl),a
ld hl,ed_flags
bit 4,(hl)
ld hl,FLAGS3
jr nz,l186e
res 0,(hl)
ret
.l186e set 0,(hl)
ret
; Subroutine to get a key - this may include keypad keys which
; send extended mode before a keycode to give a token
.l1871 push hl ; save HL
.l1872 ld hl,FLAGS
.l1875 bit 5,(hl)
jr z,l1875 ; loop until a key is available
res 5,(hl) ; signal no key available
ld a,(LAST_K) ; get key
ld hl,MODE
res 0,(hl) ; set "L" mode (?)
cp $20
jr nc,l1894 ; move on if not a control code
.l1887 cp $10
jr nc,l1872 ; loop back to ignore control codes>=$10
cp $06
jr c,l1872 ; ignore control codes<$06
call l1896 ; change mode if required
jr nc,l1872
.l1894 pop hl ; restore HL
ret
.l1896 rst $28
defw $10db ; call key mode change routine
ret
; Subroutine to display a menu
; On entry HL=address of menu
.l189a push hl
call l194d ; save menu window area of screen
ld hl,TV_FLAG
res 0,(hl) ; signal "using main screen"
pop hl
ld e,(hl) ; E=number of menu lines
inc hl
push hl
ld hl,l19fe
call l1925 ; output control codes for top menu line
pop hl
call l1925 ; output menu title
push hl
call l1a34 ; output rainbow
ld hl,l1a0c
call l1925 ; output end of top menu line
pop hl
push de
ld bc,$0807
call l191d ; output 'AT 8,7'
.l18c3 push bc ; save screen position
ld b,$0c ; B=menu width 12 (+2 border)
ld a,' '
rst $10 ; output border space
.l18c9 ld a,(hl) ; get next char
inc hl
cp $80
jr nc,l18d2 ; move on if last char on menu line
rst $10 ; else output
djnz l18c9 ; & loop back for more
.l18d2 and $7f ; mask off end marker bit
rst $10 ; output last character
.l18d5 ld a,$20
rst $10 ; output spaces for rest of menu width
djnz l18d5
pop bc
inc b ; get to next line
call l191d ; output AT command
dec e
jr nz,l18c3 ; loop back for more lines
ld hl,$6f38 ; HL=pixel coords for top left of menu
pop de ; E=total number of menu lines
sla e
sla e
sla e
ld d,e
dec d ; D=menu height in pixel lines-1
ld e,$6f ; E=menu width in pixel lines-1
ld bc,$ff00
ld a,d
call l190b ; draw line top to bottom
ld bc,$0001
ld a,e
call l190b ; draw line left to right
ld bc,$0100
ld a,d
inc a
call l190b ; draw line bottom to top
xor a
call l19dc ; put highlight on top line
ret
; Subroutine to draw a line, used in menu display
; On entry, H=Y coord, L=X coord, A=line length, BC=amount to
; add to HL to get to next pixel
.l190b push af ; save registers
push hl
push de
push bc
ld b,h
ld c,l
rst $28
defw $22e9 ; plot a pixel
pop bc ; restore registers
pop de
pop hl
pop af
add hl,bc ; get coords of next pixel
dec a
jr nz,l190b ; back for rest of line
ret
; Subroutine to output 'AT b,c'
.l191d ld a,$16
rst $10
ld a,b
rst $10
ld a,c
rst $10
ret
; Subroutine to output a $ff-terminated message (used in menus)
; If '+3' is encountered and a disk interface is not present, '+2e'
; is substituted
.l1925 ld a,(hl) ; get next character
inc hl
cp $ff
ret z ; exit if end-of-message marker
cp '+'
jr z,l1931 ; move on to check '+'
.l192e rst $10 ; else output and loop back for more
jr l1925
.l1931 ld a,(hl)
cp '3' ; check for '+3' string
ld a,$2b ; reload with '+'
jr nz,l192e ; go back to output if not '+3'
push hl
ld hl,FLAGS3
bit 4,(hl)
pop hl
jr nz,l192e ; go back to output if disk interface present
inc hl
inc hl ; skip '+3 '
ld a,'+' ; and output '+2A' instead
rst $10
ld a,'2'
rst $10
ld a,'A'
jr l192e ; back
; This routine has a dual purpose: to either copy a "window" area to the
; screen, or to save a "window" area in high memory (of page 7)
; The window area is of fixed size 12 lines x 14 chars, located at
; 7,7
; Enter at l194d to copy the area FROM the screen, or at l1950 to copy
; the area TO the screen
; A total of: 21 (system variables)
; + 12x14x8 (bitmap)
; + 12x14 (attributes)
; = 1533 bytes are saved, at $eef6 to $f4f2
.l194d scf ; set carry (copying FROM screen)
jr l1951
.l1950 and a ; reset carry (copying TO screen)
.l1951 ld de,$eef6 ; DE contains window save area in page 7
ld hl,TV_FLAG
jr c,l195a
ex de,hl ; swap source & dest if necessary
.l195a ldi ; copy TV_FLAG system variable
jr c,l195f
ex de,hl ; swap back
.l195f ld hl,COORDS
jr c,l1965 ; swap source & dest
ex de,hl
.l1965 ld bc,$0014
ldir ; copy COORDS to ATTR_T system variables
jr c,l196d
ex de,hl ; swap back
.l196d ex af,af' ; save carry flag
ld bc,$0707 ; Top left of window is 7,7
call l1da1 ; get C=33-C and B=24-B-(IX+1)
ld a,(ix+$01)
add a,b
ld b,a ; correct B to 24-B
ld a,$0c ; for 12 character lines
.l197b push bc ; save registers
push af
push de
rst $28
defw $0e9b ; get HL=address of line B in display file
ld bc,$0007
add hl,bc ; HL=address of left of window line
pop de ; restore save area in page 7
call l1990 ; copy a character line (width 14)
pop af ; restore registers
pop bc
dec b ; move to next character line
dec a
jr nz,l197b ; loop back for more lines
ret
; Subroutine used by menu window transfer routine, to transfer a single
; character line (width 14)
; On entry, HL=screen address of top pixel line
; DE=address of save area
; Carry'=save/restore flag
.l1990 ld bc,$080e ; B=8 pixel lines,C=14 bytes window width
.l1993 push bc ; save counters
ld b,$00 ; BC=bytes to copy
push hl ; save screen address
ex af,af' ; get carry flag
jr c,l199b
ex de,hl ; swap source & dest if necessary
.l199b ldir ; copy pixel line
jr c,l19a0
ex de,hl ; swap back
.l19a0 ex af,af' ; save carry flag
pop hl ; restore screen address
inc h ; get to next pixel line
pop bc ; restore counts
djnz l1993 ; back for more pixel lines
push bc
push de
rst $28
defw $0e88
ex de,hl ; HL=attributes address
pop de
pop bc
ex af,af' ; get carry flag
jr c,l19b2
ex de,hl ; swap source & dest if necessary
.l19b2 ldir ; copy attributes
jr c,l19b7
ex de,hl ; swap back
.l19b7 ex af,af' ; save carry flag
ret
; Move menu highlight up a line
; On entry, A=current highlight line number, HL=address of menu size
.l19b9 call l19dc ; remove current highlight
dec a ; decrement line number
jp p,l19c3 ; move on if still positive
ld a,(hl) ; else set to bottom line
dec a
dec a
.l19c3 call l19dc ; replace highlight on new line
scf ; set carry, so calling routine doesn't
ret ; immediately call "move highlight down"
; Move menu highlight down a line
; On entry, A=current highlight line number, HL=address of menu size
.l19c8 push de ; save DE
call l19dc ; remove current highlight
inc a ; increment line number
ld d,a
ld a,(hl)
dec a
dec a
cp d ; check against max line number
ld a,d
jp p,l19d7
xor a ; set to 0 if too large
.l19d7 call l19dc ; replace highlight on new line
pop de ; restore DE
ret
; Subroutine to switch menu line A (0=top) between highlighted and
; non-highlighted
.l19dc push af ; save registers
push hl
push de
ld hl,$5907 ; attribute address of top menu line
ld de,$0020
and a
jr z,l19ec
.l19e8 add hl,de ; get to attribute address of required line
dec a
jr nz,l19e8
.l19ec ld a,$78
cp (hl) ; is it BRIGHT 1, PAPER 7, INK 0?
jr nz,l19f3 ; if not, change to this
ld a,$68 ; if so, change to BRIGHT 1, PAPER 5, INK 0
.l19f3 ld d,$0e ; 14 characters to do
.l19f5 ld (hl),a ; change attributes
inc hl
dec d
jr nz,l19f5
pop de ; restore registers
pop hl
pop af
ret
; Control codes for top line of menus
.l19fe defb $16,$07,$07 ; AT 7,7
defb $15,$00,$14,$00 ; OVER 0,INVERSE 0
defb $10,$07,$11,$00 ; INK 7,PAPER 0
defb $13,$01 ; BRIGHT 1
defb $ff
; Control codes for end of top line of menus
.l1a0c defb $11,$00 ; PAPER 0
defb ' '
defb $11,$07 ; PAPER 7
defb $10,$00 ; INK 0
defb $ff
; A two-character "character set" used for displaying the
; rainbow on menus and bars
.l1a14 defb $01,$03,$07,$0f
defb $1f,$3f,$7f,$ff
defb $fe,$fc,$f8,$f0
defb $e0,$c0,$80,$00
; The rainbow string
.l1a24 defb $10,$02,' '
defb $11,$06,'!'
defb $10,$04,' '
defb $11,$05,'!'
defb $10,$00,' '
defb $ff
; Subroutine to output the "rainbow" on menus and bars
.l1a34 push bc ; save registers
push de
push hl
ld hl,l1a14
ld de,STRIP1
ld bc,$0010
ldir ; copy rainbow charset into RAM
ld hl,(CHARS)
push hl ; save CHARS
ld hl,STRIP1-$0100
ld (CHARS),hl ; set to rainbow set
ld hl,l1a24
call l1925 ; output rainbow
pop hl
ld (CHARS),hl ; restore CHARS
pop hl ; restore registers
pop de
pop bc
ret
; Subroutines to display the bars for various functions
.l1a5a ld hl,l080f ; +3 BASIC
jr l1a67
.l1a5f ld hl,l0817 ; Calculator
jr l1a67
.l1a64 ld hl,l0809 ; Loader
; Subroutine to clear the bottom 3 lines to editor colours, and display
; a bar with a rainbow and the text at HL (bit 7-terminated) on line 21
.l1a67 push hl
call l1a8e ; clear bottom 3 lines to editor colours
ld hl,$5aa0 ; attribute address of line 21
ld b,$20
ld a,$40
.l1a72 ld (hl),a ; fill line 21 to BRIGHT 1, PAPER 0, INK 0
inc hl
djnz l1a72
ld hl,l19fe
call l1925 ; output control codes for top menu lines
ld bc,$1500
call l191d ; output AT 21,0
pop de
call l029e ; ouput the bar text
ld c,$1a ; output AT 21,26
call l191d
jp l1a34 ; output the rainbow
; Subroutine to clear bottom 3 lines to editor colours
.l1a8e ld b,$15
ld d,$17
.l1a92 jp l1d6b ; clear bottom 3 lines to editor colours
; The renumber routine
.l1a95 call l05a7 ; page in normal memory
call l1c12 ; get number of lines in BASIC program
ld a,d
or e
jp z,l1bcd ; if none, signal "command failed" & exit
ld hl,(RC_STEP)
rst $28
defw $30a9 ; HL=STEP*number of lines
ex de,hl ; DE=STEP*number of lines
ld hl,(RC_START)
add hl,de ; HL=projected last line number
ld de,$2710
or a
sbc hl,de
jp nc,l1bcd ; if >9999, signal "command failed" & exit
ld hl,(PROG) ; get start of program
.l1ab7 rst $28
defw $19b8 ; get address of next line
inc hl
inc hl
ld (RC_LINE),hl ; store address of current line (after number)
inc hl
inc hl ; point after line length
ld (STRIP2+$11),de ; store address of next line
.l1ac5 ld a,(hl) ; get next character
rst $28
defw $18b6 ; skip past embedded number if necessary
cp $0d
jr z,l1ad2 ; move on if end of line
call l1b1b ; replace any line number in this command
jr l1ac5 ; loop back
.l1ad2 ld de,(STRIP2+$11) ; get address of next line
ld hl,(VARS)
and a
sbc hl,de
ex de,hl
jr nz,l1ab7 ; loop back if not end of program
call l1c12
ld b,d
ld c,e ; BC=number of lines in program
ld de,$0000
ld hl,(PROG) ; HL=address of first line
.l1aea push bc ; save registers
push de
push hl
ld hl,(RC_STEP)
rst $28
defw $30a9 ; HL=(line-1)*STEP
ld de,(RC_START)
add hl,de
ex de,hl ; DE=new line number
pop hl
ld (hl),d
inc hl
ld (hl),e ; store new number at start of line
inc hl
ld c,(hl)
inc hl
ld b,(hl)
inc hl
add hl,bc ; get to start of next line
pop de
inc de ; increment line count
pop bc
dec bc ; decrement lines to do
ld a,b
or c
jr nz,l1aea ; loop back for more
call l05cc ; page back DOS workspace
ld (RC_LINE),bc ; reset "current line being renumbered"
scf ; signal "command succeeded"
ret
; Table of commands containing line numbers
.l1b14 defb $ca ; LINE
defb $f0 ; LIST
defb $e1 ; LLIST
defb $ec ; GOTO
defb $ed ; GOSUB
defb $e5 ; RESTORE
defb $f7 ; RUN
; Subroutine to replace any line number in the current statement.
; On entry, HL=address of code, A=code
; On exit HL=address of next code to check
.l1b1b inc hl
ld (STRIP2+$0f),hl ; save pointer after command
ex de,hl
ld bc,$0007
ld hl,l1b14
.l1b26 cpir ; check if one of line number commands
ex de,hl
ret nz ; exit if not
ld c,$00 ; set BC=0
.l1b2c ld a,(hl) ; get next character
cp $20
jr z,l1b4c ; go to skip spaces
rst $28
defw $2d1b ; is it a digit?
jr nc,l1b4c ; go to skip if so
cp '.'
jr z,l1b4c ; go to skip decimal point
cp $0e
jr z,l1b50 ; move on if found embedded number
or $20
cp $65
jr nz,l1b48 ; if it's not an "e", exit
ld a,b
or c
jr nz,l1b4c ; found any characters suggesting a number?
.l1b48 ld hl,(STRIP2+$0f) ; if not, exit with pointer after command
ret
.l1b4c inc bc ; increment characters found
inc hl
jr l1b2c ; loop back for more
.l1b50 ld (STRIP2+$07),bc ; save no of characters before embedded #
push hl ; save pointer to embedded number
rst $28
defw $18b6 ; skip past embedded number
call l1c43 ; skip past spaces
ld a,(hl) ; get following character
pop hl ; restore pointer to embedded number
cp ':'
jr z,l1b64
cp $0d
ret nz ; exit if following character not : or ENTER
.l1b64 inc hl ; HL points to next statement/line
rst $28
defw $33b4 ; stack the embedded number
rst $28
defw $2da2 ; get embedded number to BC
ld h,b
ld l,c ; HL=embedded line number
rst $28
defw $196e ; get HL=address of target line
jr z,l1b7c ; move on if the actual line was found
ld a,(hl)
cp $80
jr nz,l1b7c ; or if there is a line afterwards (not end)
ld hl,$270f ; use 9999 and move on
jr l1b8d
.l1b7c ld (STRIP2+$0d),hl ; save target line address
call l1c18 ; get DE=number of lines before it
ld hl,(RC_STEP)
rst $28
defw $30a9
ld de,(RC_START)
add hl,de ; HL=target line's new number
.l1b8d ld de,STRIP2+$09
push hl ; save number
call l1c49 ; form ASCII representation of it
ld e,b
inc e
ld d,$00 ; DE=length of ASCII string
push de ; save length
push hl ; and address of string
ld l,e
ld h,$00
ld bc,(STRIP2+$07) ; get number of characters available
or a
sbc hl,bc
ld (STRIP2+$07),hl ; save number of extra chars required
jr z,l1bdc ; move on if right size
jr c,l1bd2 ; move on if more chars available than needed
ld b,h
ld c,l ; BC=chars to insert
ld hl,(STRIP2+$0f) ; HL=address to insert at
push hl ; save registers
push de
ld hl,(STKEND)
add hl,bc
jr c,l1bcb ; move on to signal error if no room
ex de,hl
ld hl,$0082
add hl,de
jr c,l1bcb ; error if can't leave $82 bytes free
sbc hl,sp
ccf
jr c,l1bcb ; or if would encroach on stack
pop de ; restore registers
pop hl
rst $28
defw $1655 ; make room
jr l1bdc ; move on
.l1bcb pop de
pop hl
.l1bcd call l05cc ; page in DOS workspace
and a ; signal "command failed"
ret ; exit
.l1bd2 dec bc
dec e
jr nz,l1bd2 ; BC=number of bytes to reclaim
ld hl,(STRIP2+$0f)
rst $28
defw $19e8 ; reclaim room
.l1bdc ld de,(STRIP2+$0f)
pop hl
pop bc
ldir ; copy ASCII text of line number
ex de,hl
ld (hl),$0e ; store embedded number marker
pop bc ; BC=new line number
inc hl
push hl ; save address to place FP number
rst $28
defw $2d2b ; stack BC on FP stack (HL=address)
pop de
ld bc,$0005
ldir ; copy FP representation
ex de,hl
push hl ; save address of next byte to check
ld hl,(RC_LINE)
push hl ; save address of current line
ld e,(hl)
inc hl
ld d,(hl) ; DE=length of current line
ld hl,(STRIP2+$07)
add hl,de
ex de,hl ; DE=new length of current line
pop hl
ld (hl),e
inc hl
ld (hl),d ; store new length
ld hl,(STRIP2+$11)
ld de,(STRIP2+$07)
add hl,de
ld (STRIP2+$11),hl ; store new next line address
pop hl ; restore address of next byte to check
ret
; Subroutine to count the number of lines in a BASIC program,
; either to the end (enter at l1c12), or to a certain address (enter
; at l1c18 with address in STRIP2+$0d).
; Number of lines is returned in DE
.l1c12 ld hl,(VARS)
ld (STRIP2+$0d),hl ; save VARS
.l1c18 ld hl,(PROG)
ld de,(STRIP2+$0d)
or a
sbc hl,de
jr z,l1c3e ; move on if no BASIC program in memory
ld hl,(PROG) ; start at PROG
ld bc,$0000 ; with 0 lines
.l1c2a push bc
rst $28
defw $19b8 ; find DE=address of next line
ld hl,(STRIP2+$0d)
and a
sbc hl,de
jr z,l1c3b ; move on if no more lines
ex de,hl ; else swap to HL
pop bc
inc bc ; increment line count
jr l1c2a ; loop back
.l1c3b pop de ; restore number of lines
inc de ; increment for last line
ret
.l1c3e ld de,$0000 ; BASIC program length=0
ret
; Subroutine to skip spaces
.l1c42 inc hl
.l1c43 ld a,(hl) ; get next char
cp ' '
jr z,l1c42 ; skip if space
ret ; exit with HL pointing to non-space
; Subroutine to form a text representation of a binary number up to 9999
; On entry, DE=address to form number, HL=number
; On exit, HL=start address of text number, DE=end address+1, B=#digits-1
.l1c49 push de ; save start address of text number
ld bc,-1000
call l1c6d ; form 1000s digit
ld bc,-100
call l1c6d ; form 100s digit
ld c,-10
call l1c6d ; form 10s digit
ld a,l
add a,'0'
ld (de),a ; form units digit
inc de
ld b,$03 ; check first 3 digits
pop hl ; restore start address of text number
.l1c63 ld a,(hl)
cp '0'
ret nz ; exit if non-zero digit
ld (hl),' ' ; replace leading 0s with spaces
inc hl
djnz l1c63 ; loop back
ret
; Subroutine to form a decimal digit from a binary number
; On entry, HL=number, DE=address to store digit, BC=-unit size
; On exit, HL is reduced and DE is incremented
.l1c6d xor a ; zero counter
.l1c6e add hl,bc ; subtract unit size
inc a ; and increment digit counter
jr c,l1c6e ; loop back for more until failed
sbc hl,bc ; add back last unit
dec a ; and decrement counter
add a,'0'
ld (de),a ; place ASCII digit
inc de ; increment address
ret
.l1c7a defb $08
defb 0
defb 0
defb $14
defb 0
defb 0
defb 0
defb $0f
defb 0
.l1c83 defb $08
defb 0
defb $16
defb $01
defb 0
defb 0
defb 0
defb $0f
defb 0
; Subroutine to ???
.l1c8c ld ix,$fd98
ld hl,l1c7a
jr l1c98 ; (3)
.l1c95 ld hl,l1c83
.l1c98 ld de,$fd98
jp l2152
.l1c9e rst $10
ld a,d
rst $10
scf
ret
; Subroutine to set cursor colours to A
.l1ca3 and $3f ; mask off FLASH/BRIGHT bits
ld (ix+$06),a ; set colours
scf
ret
; Subroutine to place cursor at column C, line B (of editing area)
.l1caa ld a,(ix+$01) ; get line for top of editing area
add a,b
ld b,a ; B=line
call l1dad ; get attribute address
ld a,(hl)
ld (ix+$07),a ; save attribute
cpl
and $c0 ; get inverse of current FLASH/BRIGHT bits
or (ix+$06) ; combine with cursor colour
ld (hl),a ; set new attribute
scf
ret
; Subroutine to remove cursor from column C, line B (of editing area)
.l1cbf ld a,(ix+$01) ; get line for top of editing area
add a,b
ld b,a ; B=line
call l1dad ; get attribute address
ld a,(ix+$07)
ld (hl),a ; restore attribute
ret
.l1ccc push hl
ld h,$00
ld a,e
sub b
jr l1cda ; (7)
.l1cd3 push hl
ld a,e
ld e,b
ld b,a
sub e
ld h,$ff
.l1cda ld c,a
ld a,b
cp e
jr z,l1d2a ; (75)
push de
call $1da5
.l1ce3 push bc
ld c,h
rst $28
defw $0e9b
defb $eb
xor a
or c
jr z,l1cf0 ; (3)
inc b
jr l1cf1 ; (1)
.l1cf0 dec b
.l1cf1 push de
rst $28
defw $0e9b
defb $d1
ld a,c
ld c,$20
ld b,$08
.l1cfb push bc
push hl
push de
ld b,$00
ldir
pop de
pop hl
pop bc
inc h
inc d
djnz $1cfb ; (-14)
push af
push de
rst $28
defw $0e88
defb $eb
ex (sp),hl
rst $28
defw $0e88
defb $eb
ex (sp),hl
pop de
ld bc,$0020
ldir
pop af
pop bc
and a
jr z,l1d23 ; (3)
inc b
jr l1d24 ; (1)
.l1d23 dec b
.l1d24 dec c
ld h,a
jr nz,l1ce3 ; (-69)
pop de
ld b,e
.l1d2a pop hl
.l1d2b call l1dc5 ; swap editor/BASIC colours & P_FLAG
ex de,hl
ld a,(TV_FLAG)
push af
ld hl,ed_flags
bit 6,(hl)
res 0,a
jr z,l1d3e ; (2)
set 0,a
.l1d3e ld (TV_FLAG),a
ld c,$00
call $191d
ex de,hl
ld b,$20
.l1d49 ld a,(hl)
and a
jr nz,l1d4f ; (2)
ld a,$20
.l1d4f cp $90
jr nc,l1d62 ; (15)
rst $28
defw $0010
.l1d56 inc hl
djnz $1d49 ; (-16)
pop af
ld (TV_FLAG),a
call l1dc5 ; swap editor/BASIC colours & P_FLAG
scf
ret
.l1d62 call $05a7
rst $10
call $05cc
jr l1d56 ; (-21)
; Subroutine to clear an area of screen to the editor's colours
; On entry, B=first line number and D=last line number (0...23)
.l1d6b call l1dc5 ; swap editor/BASIC colours & P_FLAG
ld a,d
sub b
inc a
ld c,a ; C=number of lines to clear
call l1da5 ; convert line number as required by ROM 3
.l1d75 push bc
rst $28
defw $0e9b ; get HL=address of line B in display file
ld c,$08 ; 8 pixel lines per character
.l1d7b push hl
ld b,$20 ; 32 characters per line
xor a
.l1d7f ld (hl),a ; clear a pixel line of a character
inc hl
djnz l1d7f ; back for rest of line
pop hl
inc h
dec c
jr nz,l1d7b ; back for rest of pixel lines
ld b,$20
push bc
rst $28
defw $0e88 ; get attribute address
ex de,hl
pop bc
ld a,(ATTR_P)
.l1d93 ld (hl),a ; clear attributes to editor's ATTR_P
inc hl
djnz l1d93 ; for rest of line
pop bc
dec b ; next line
dec c ; decrement counter
jr nz,l1d75 ; back for more
call l1dc5 ; swap editor/BASIC colours & P_FLAG
scf
ret
; Subroutine to convert line numbers and column numbers as required
; by certain ROM 3 routines
.l1da1 ld a,$21
sub c
ld c,a ; C=33-oldC
.l1da5 ld a,$18
sub b
sub (ix+$01)
ld b,a ; B=24-oldB-??
ret
; Subroutine to get attribute address for line B, column C into HL
.l1dad push bc
xor a
ld d,b
ld e,a
rr d
rr e
rr d
rr e
rr d
rr e ; DE=B*32
ld hl,$5800 ; start of attribs
ld b,a
add hl,bc
add hl,de ; form address
pop bc
ret
; Subroutine to swap some system variables with copies in page 7, allowing
; BASIC & the editor to use different values for colours etc
.l1dc5 push af ; save registers
push hl
push de
ld hl,(ATTR_P) ; swap permanent & temporary colours with
ld de,(ATTR_T) ; editor ones
exx
ld hl,(ed_ATTR_P)
ld de,(ed_ATTR_T)
ld (ATTR_P),hl
ld (ATTR_T),de
exx
ld (ed_ATTR_P),hl
ld (ed_ATTR_T),de
ld hl,ed_P_FLAG ; swap P_FLAG with editor one
ld a,(P_FLAG)
ld d,(hl)
ld (hl),a
ld a,d
ld (P_FLAG),a
pop de ; restore registers
pop hl
pop af
ret
.l1df6 ld a,$01
jr l1dfc ; (2)
.l1dfa ld a,$00
.l1dfc ld ($fdb6),a
ld hl,$0000
ld ($fdb1),hl
ld ($fdb3),hl
add hl,sp
ld ($fdb7),hl
call $15e4
ld a,$00
ld ($fdb0),a
ld hl,$fda0
ld ($fda9),hl
call $05a7
rst $28
defw $16b0
defb $cd
call z,$3e05
nop
ld ($fdad),a
ld hl,(E_LINE)
ld ($fdae),hl
ld hl,$0000
ld ($fdab),hl
.l1e34 ld hl,($fdb1)
inc hl
ld ($fdb1),hl
call $1f30
ld c,a
ld a,($fdad)
cp $00
jr nz,l1e87 ; (65)
.l1e46 ld a,c
and $04
jr z,l1e80 ; (53)
.l1e4b call $1f7c
jr nc,l1e57 ; (7)
ld a,$01
ld ($fdad),a
jr l1e34 ; (-35)
.l1e57 ld hl,($fdab)
ld a,l
or h
jp nz,$1eb1
.l1e5f push bc
call $1f60
pop bc
ld a,$00
ld ($fdad),a
.l1e69 ld a,c
and $01
jr nz,l1e46 ; (-40)
ld a,b
call $1fa9
ret nc
ld hl,($fdb1)
inc hl
ld ($fdb1),hl
call $1f30
ld c,a
jr l1e69 ; (-23)
.l1e80 ld a,b
call $1fa9
ret nc
jr l1e34 ; (-83)
.l1e87 cp $01
jr nz,l1e80 ; (-11)
ld a,c
and $01
jr z,l1e4b ; (-69)
push bc
.l1e91 call $2113
pop bc
jr c,l1f10 ; (121)
ld hl,($fdab)
ld a,h
or l
jr nz,l1eb1 ; (19)
ld a,c
and $02
jr z,l1e5f ; (-68)
call $1f7c
jr nc,l1e57 ; (-81)
ld hl,($fda9)
dec hl
ld ($fdab),hl
jr l1e34 ; (-125)
.l1eb1 push bc
ld hl,$fda0
ld de,($fdab)
ld a,d
cp h
jr nz,l1ec2 ; (5)
ld a,e
cp l
jr nz,l1ec2 ; (1)
inc de
.l1ec2 dec de
jr l1ec6 ; (1)
.l1ec5 inc hl
.l1ec6 ld a,(hl)
and $7f
push hl
push de
call $1fa9
pop de
pop hl
ld a,h
cp d
jr nz,l1ec5 ; (-15)
ld a,l
cp e
jr nz,l1ec5 ; (-19)
ld de,($fdab)
ld hl,$fda0
ld ($fdab),hl
ld bc,($fda9)
dec bc
ld a,d
cp h
jr nz,l1f03 ; (24)
ld a,e
cp l
jr nz,l1f03 ; (20)
inc de
push hl
ld hl,$0000
ld ($fdab),hl
pop hl
ld a,b
cp h
jr nz,l1f03 ; (7)
ld a,c
cp l
jr nz,l1f03 ; (3)
pop bc
jr l1f22 ; (31)
.l1f03 ld a,(de)
ld (hl),a
inc hl
inc de
and $80
jr z,l1f03 ; (-8)
ld ($fda9),hl
jr l1e91 ; (-127)
.l1f10 push bc
call $1fa9
pop bc
ld hl,$0000
ld ($fdab),hl
ld a,($fdad)
cp $04
jr z,l1f27 ; (5)
.l1f22 ld a,$00
ld ($fdad),a
.l1f27 ld hl,$fda0
ld ($fda9),hl
jp $1e46
.l1f30 call $0e22
ld b,a
cp $3f
jr c,l1f42 ; (10)
or $20
call $1f59
jr c,l1f56 ; (23)
.l1f3f ld a,$01
ret
.l1f42 cp $20
jr z,l1f53 ; (13)
cp $23
jr z,l1f50 ; (6)
jr c,l1f3f ; (-13)
cp $24
jr nz,l1f3f ; (-17)
.l1f50 ld a,$02
ret
.l1f53 ld a,$03
ret
.l1f56 ld a,$06
ret
.l1f59 cp $7b
ret nc
cp $61
ccf
ret
.l1f60 ld hl,$fda0
ld ($fda9),hl
sub a
ld ($fdab),a
ld ($fdac),a
.l1f6d ld a,(hl)
and $7f
push hl
call $202f
pop hl
ld a,(hl)
and $80
ret nz
inc hl
jr l1f6d ; (-15)
.l1f7c ld hl,($fda9)
ld de,$fda9
ld a,d
cp h
jr nz,l1f8b ; (5)
ld a,e
cp l
jp z,$1fa6
.l1f8b ld de,$fda0
ld a,d
cp h
jr nz,l1f96 ; (4)
ld a,e
cp l
jr z,l1f9c ; (6)
.l1f96 dec hl
ld a,(hl)
and $7f
ld (hl),a
inc hl
.l1f9c ld a,b
or $80
ld (hl),a
inc hl
ld ($fda9),hl
scf
ret
.l1fa6 scf
ccf
ret
.l1fa9 push af
ld a,($fdb5)
or a
jr nz,l1fc2 ; (18)
pop af
cp $3e
jr z,l1fbd ; (8)
cp $3c
jr z,l1fbd ; (4)
.l1fb9 call $1ff7
ret
.l1fbd ld ($fdb5),a
scf
ret
.l1fc2 cp $3c
ld a,$00
ld ($fdb5),a
jr nz,l1fe5 ; (26)
pop af
cp $3e
jr nz,l1fd4 ; (4)
ld a,$c9
jr l1fb9 ; (-27)
.l1fd4 cp $3d
jr nz,l1fdc ; (4)
ld a,$c7
jr l1fb9 ; (-35)
.l1fdc push af
ld a,$3c
call $1ff7
pop af
jr l1fb9 ; (-44)
.l1fe5 pop af
cp $3d
jr nz,l1fee ; (4)
ld a,$c8
jr l1fb9 ; (-53)
.l1fee push af
ld a,$3e
call $1ff7
pop af
jr l1fb9 ; (-62)
.l1ff7 cp $0d
jr z,l201b ; (32)
cp $ea
ld b,a
jr nz,l2007 ; (7)
ld a,$04
ld ($fdad),a
jr l2015 ; (14)
.l2007 cp $22
jr nz,l2015 ; (10)
ld a,($fdad)
and $fe
xor $02
ld ($fdad),a
.l2015 ld a,b
call $202f
scf
ret
.l201b ld a,($fdb6)
cp $00
jr z,l202c ; (10)
ld bc,($fdb1)
ld hl,($fdb7)
ld sp,hl
scf
ret
.l202c scf
ccf
ret
.l202f ld e,a
ld a,($fdb0)
ld d,a
ld a,e
cp $20
jr nz,l2059 ; (32)
ld a,d
and $01
jr nz,l2052 ; (20)
ld a,d
and $02
jr nz,l204a ; (7)
ld a,d
or $02
ld ($fdb0),a
ret
.l204a ld a,e
call $208e
ld a,($fdb0)
ret
.l2052 ld a,d
and $fe
ld ($fdb0),a
ret
.l2059 cp $a3
jr nc,l2081 ; (36)
ld a,d
and $02
jr nz,l206d ; (11)
ld a,d
and $fe
ld ($fdb0),a
ld a,e
call $208e
ret
.l206d push de
ld a,$20
call $208e
pop de
ld a,d
and $fe
and $fd
ld ($fdb0),a
ld a,e
call $208e
ret
.l2081 ld a,d
and $fd
or $01
ld ($fdb0),a
ld a,e
call $208e
ret
.l208e ld hl,($fdb3)
inc hl
ld ($fdb3),hl
ld hl,($fdae)
ld b,a
ld a,($fdb6)
cp $00
ld a,b
jr z,l20c6 ; (37)
ld de,(X_PTR)
ld a,h
cp d
jr nz,l20c3 ; (26)
ld a,l
cp e
jr nz,l20c3 ; (22)
ld bc,($fdb1)
ld hl,($fdb3)
and a
sbc hl,bc
jr nc,l20bd ; (4)
ld bc,($fdb3)
.l20bd ld hl,($fdb7)
ld sp,hl
scf
ret
.l20c3 scf
jr l20c8 ; (2)
.l20c6 scf
ccf
.l20c8 call $05a7
jr nc,l20da ; (13)
ld a,(hl)
ex de,hl
cp $0e
jr nz,l20f0 ; (29)
inc de
inc de
inc de
inc de
inc de
jr l20f0 ; (22)
.l20da push af
ld bc,$0001
push hl
push de
call $20f9
pop de
pop hl
rst $28
defw $1664
defb $2a
ld h,l
ld e,h
ex de,hl
lddr
pop af
ld (de),a
.l20f0 inc de
call $05cc
ld ($fdae),de
ret
.l20f9 ld hl,(STKEND)
add hl,bc
jr c,l2109 ; (10)
ex de,hl
ld hl,$0082
add hl,de
jr c,l2109 ; (3)
sbc hl,sp
ret c
.l2109 ld a,$03
ld (ERR_NR),a
call l3e80
defw $25cb
.l2113 call $142d
call $fd43
ret c
ld b,$f9
ld de,$fda0
ld hl,$168e
call $fd5c
ret nc
cp $ff
jr nz,l212e ; (4)
ld a,$d4
jr l2150 ; (34)
.l212e cp $fe
jr nz,l2136 ; (4)
ld a,$d3
jr l2150 ; (26)
.l2136 cp $fd
jr nz,l213e ; (4)
ld a,$ce
jr l2150 ; (18)
.l213e cp $fc
jr nz,l2146 ; (4)
ld a,$ed
jr l2150 ; (10)
.l2146 cp $fb
jr nz,l214e ; (4)
ld a,$ec
jr l2150 ; (2)
.l214e sub $56
.l2150 scf
ret
; Subroutine to transfer a counted string (minus count) from (HL) to (DE)
.l2152 ld b,(hl) ; get count
inc hl
.l2154 ld a,(hl)
ld (de),a ; transfer a byte
inc de
inc hl
djnz l2154 ; back for more
ret
; Subroutine to check if char in A is a digit. If so, carry set & A=value
.l215b cp '0'
ccf
ret nc ; exit if less than "0"
cp ':'
ret nc ; or if > "9"
sub '0' ; convert to value
scf ; success
ret
; Subroutine to perform a routine found with a table lookup
; The value to look for is in A, and the table address is in HL
; The table consists of:
; a number of entries byte
; for each entry: a value byte followed by a routine address
; When a match is found, the routine is called. A is tested for
; zero before returning, carry status is preserved and should be
; set by the routine if action succeeded.
; If no match is found, carry is reset.
.l2166 push bc ; save registers
push de
ld b,(hl) ; B=# entries in table
inc hl
.l216a cp (hl) ; check next entry
inc hl
ld e,(hl)
inc hl
ld d,(hl) ; DE=address associated with current entry
jr z,l2179 ; if match, move on
inc hl
djnz l216a ; loop back for more
scf
ccf ; clear carry to signal "no match"
pop de ; restore registers
pop bc
ret
.l2179 ex de,hl ; HL=address
pop de ; restore registers
pop bc
call l2186 ; call routine address in HL
jr c,l2183 ; if carry set, go to test A & set carry
cp a ; test A (& clear carry)
ret
.l2183 cp a ; test A
scf ; set carry
ret
.l2186 jp (hl)
; Routine called from ROM 2 to display an error message in HL
; On entry Z is set if DE contains a response key list to use
.l2187 jr z,l218c
ld de,$0000 ; no response list
.l218c push de
push hl
ld a,$fd
rst $28
defw $1601 ; open channel to stream -3
pop hl
push hl
.l2195 ld b,$20 ; 32 chars per line
.l2197 ld a,(hl) ; get next char
cp ' '
jr nz,l219e
ld d,h ; if space, set DE to current position
ld e,l
.l219e cp $ff
jr z,l21ab ; move on if end of message
inc hl
djnz l2197 ; loop back for more
ex de,hl
ld a,$0d
ld (hl),a ; insert a CR at last space
jr l2195 ; back for more lines
.l21ab ld a,$16 ; start at 0,0 in stream -3
rst $10
ld a,$00
rst $10
ld a,$00
rst $10
pop hl ; restore message start
.l21b5 ld a,(hl) ; get next char
cp $ff
jr z,l21be ; move on if end
rst $10 ; output char
inc hl
jr l21b5 ; back for more
.l21be call l1871 ; get a key
ld b,a ; B=key
pop hl ; restore response key list
ld a,h
or l
push hl
jr z,l21d3 ; move on if none required
.l21c8 ld a,(hl)
cp b
jr z,l21d3 ; move on if response key found
inc hl
cp $ff
jr nz,l21c8 ; loop back if more possibilities to check
jr l21be ; else get another key
.l21d3 push af
rst $28
defw $0d6e ; clear lower screen
ld a,$fe
rst $28
defw $1601 ; open channel to stream -2
pop af
pop hl
ret
; *************** START OF SELF-TEST PROGRAM SECTION ****************
; The self-test program, entered by pressing "QAZPLM" at the test screen
.l21df di ; disable interrupts
ld ix,$ffff ; IX=top of RAM
ld a,$07
out ($fe),a ; white border
ld sp,$7fff ; set stack to top of page 5
call l28f7 ; initialise & show title page
di ; disable interrupts
ld a,$07
out ($fe),a ; white border
call l271a ; clear screen
.l21f6 ld bc,$0700
call l270b ; set INK 7, PAPER 0
ld hl,l3261
call l2703 ; display RAM test message
call l269a ; pause for 0.8s
ld a,$04
.l2207 out ($fe),a ; green border
ld de,$0002 ; D=test pattern,E=pass counter
.l220c ld a,$00 ; start with page 0
ld bc,$7ffd
.l2211 out (c),a ; page in next page
ex af,af' ; save page number
ld hl,$c000
.l2217 ld (hl),d ; fill page with D
inc hl
ld a,l
or h
jr nz,l2217 ; until page filled
ex af,af'
inc a
cp $08
jr nz,l2211 ; back for more pages
ld a,$00 ; start at page 0 again
.l2225 out (c),a ; page in next page
ex af,af' ; save page number
ld hl,$c000
.l222b ld a,(hl)
cp d ; check pattern
jr nz,l2262 ; move on if error
cpl
ld (hl),a ; store inverse pattern
inc hl
ld a,l
or h
jr nz,l222b ; until page done
ex af,af'
inc a
cp $08
jr nz,l2225 ; back for more pages
dec a ; back to page 7
.l223d ex af,af'
ld hl,$0000 ; start at end of memory
.l2241 dec hl
ld a,h
cp $bf
jr z,l224f ; move on if at start of page
ld a,d
cpl
cp (hl) ; check inverse pattern
jr nz,l2262 ; move on if error
ld (hl),d ; store normal pattern
jr l2241 ; loop back
.l224f ex af,af'
cp $00
jr z,l2259
dec a
out (c),a
jr l223d ; back for more pages
.l2259 dec e ; decrement pass counter
jp z,l2329 ; move on if successful
ld d,$ff
jp l220c ; back for second pass with new pattern
.l2262 ex af,af'
push af ; save page and address of failure
push hl
call l266f ; re-initialise
xor a
ld bc,$7ffd
ld (BANKM),a
out (c),a ; page in page 0
ld bc,$0700
call l270b ; set INK 7, PAPER 0
call l271a ; clear screen
ld hl,l22ba
call l2703 ; display RAM test fail message
pop hl
ld a,h
call l2299 ; output high byte of address
ld a,l
call l2299 ; output low byte of address
exx
ld hl,l22fe
call l2703 ; output page message
pop af
and $07
exx
call l2299 ; output page number
di
halt ; halt!
; Subroutine to output A as two hexadecimal digits
.l2299 push hl ; save registers
push af
push af
srl a
srl a
srl a
srl a ; A=A/16
ld b,$02 ; two digits
.l22a6 exx
ld d,$00
ld e,a ; DE=0...F
ld hl,l2306
add hl,de
ld a,(hl) ; A=ASCII hex digit
call l2716 ; output it
pop af ; restore value
and $0f ; get low nibble
exx
djnz l22a6 ; loop back for second digit
pop hl
ret
.l22ba defm $16&$0a&$0
defm "RAM fail: address "&$ff
; The "EUA" routine from the testcard, which changes attributes based
; on input at EAR
.l22d0 ld a,$00
out ($fe),a ; set black border
ld hl,$4000
ld de,$4001
ld bc,$1800
ld (hl),$00
ldir ; clear screen to black
.l22e1 ld hl,$5800 ; start of attributes
.l22e4 ld bc,$0300 ; B=loop counter,C=black paper
.l22e7 in a,($fe)
and $40 ; get EAR bit
or c
ld c,a
rr c ; combine into C
inc ix ; delay
dec ix
djnz l22e7 ; loop 3 times to form a paper colour
ld (hl),c ; store in attributes
inc hl ; move to next
ld a,h
cp $5b
jr nz,l22e4 ; loop back for whole screen
jr l22e1 ; start again
.l22fe defm ", page "&$ff
.l2306 defm "0123456789ABCDEF"
.l2316 defm $16&$0a&$0
defm "RAM test passed"&$ff
; Continuation of self-test program
.l2329 ld a,$00 ; start with page 0
ld hl,$cafe ; location to use
ld bc,$7ffd
.l2331 out (c),a ; page in page
ld (hl),a ; and store page number
inc a
cp $08
jr nz,l2331 ; back for more
.l2339 dec a
out (c),a ; page in page
cp (hl) ; check correct number
jp nz,l2457 ; if not, go to signal ULA error
and a
jr nz,l2339 ; back for more
di
ld bc,$7ffd
ld a,$00 ; start at page 0
.l2349 out (c),a ; page in page
ld ($e000),a ; store number at midpoint of page
inc a
cp $08
jr nz,l2349 ; back for more
dec a
call l235f ; copy routine to page 7
ld a,$03
call l235f ; and to page 3
jp $d000 ; jump into it in page 3
; Subroutine to copy the following routine into page A at $d000
.l235f ld bc,$7ffd
out (c),a ; page in required page
ld hl,l2370
ld de,$d000
ld bc,$00b9
ldir ; copy routine
ret
; Routine to be executed in pages 3 & 7 ($2370-$2328 at $d000-$d0b8)
; to test the RAM configurations (all of which have one of these pages
; at the top)
.l2370 ld a,$01 ; start with RAM configuration 0,1,2,3
ld de,$d0a9 ; start of table of configs
ld hl,$2000 ; location of page number within lowest page
.l2378 ld bc,$1ffd
out (c),a ; page in next configuration
ex af,af'
ld bc,$4000
.l2381 ld a,(de)
inc de
cp (hl) ; check correct page in place
jr nz,l2394 ; if not, move on
add hl,bc ; add offset to next segment
jr nc,l2381 ; loop back for more
ex af,af'
add a,$02 ; increment configuration
bit 3,a
jr z,l2378 ; loop back if more to test
ld d,$01 ; flag "RAM configurations passed"
.l2392 jr l2397
.l2394 ex af,af'
ld d,$00 ; flag "RAM configurations failed"
.l2397 exx
ld bc,$7ffd
ld a,$03
out (c),a ; make sure page 3 is selected
ld b,$1f
xor a
out (c),a ; and ROM 0
call $d09b ; get checksum of ROM 0
jr nz,l23f2 ; if not zero, go to error
ld bc,$7ffd
ld a,$13
out (c),a ; get ROM 1
call $d09b ; and its checksum
jr nz,l23f2 ; if not zero, go to error
scf
call $d08e ; rotate ROM0/1 success into flags
.l23b9 ld bc,$1ffd
ld a,$04
out (c),a
ld bc,$7ffd
ld a,$03
out (c),a ; get ROM 2
call $d09b ; and its checksum
jr nz,l23f8 ; if not zero, go to error
ld a,$0b
ld bc,$7ffd
out (c),a ; get ROM 3
call $d09b ; and its checksum
jr nz,l23f8 ; if not zero, go to error
scf
call $d08e ; rotate ROM2/3 success into flags
.l23dc ld a,$03
ld bc,$7ffd
out (c),a ; make sure page 3 is paged in
ld a,$00
ld b,$1f
out (c),a ; with ROM 0
ld (BANKM),a
ld (BANK678),a
jp l2436 ; jump back into routine in ROM
.l23f2 xor a
call $d08e ; rotate ROM0/1 fail into flags
jr l23b9
.l23f8 xor a
call $d08e ; rotate ROM2/3 fail into flags
jr l23dc
; Subroutine to rotate a test flag bit (1=success) into IX
.ld08e push de
push ix
pop de
rl e
rl d
push de
pop ix
pop de
ret
; Subroutine to form an 8-bit addition checksum of the current ROM
; All ROMs should checksum to zero
.ld09b xor a ; zero checksum
ld h,a
ld l,a ; and address
.l240e add a,(hl) ; add next byte
inc hl
ld d,a
ld a,h
cp $40
ld a,d
jr nz,l240e ; back for rest of page
and a ; check if zero
ret
; Table of +3 special RAM configurations to test
.ld0a9 defb $00,$01,$02,$03
defb $04,$05,$06,$07
defb $04,$05,$06,$03
defb $04,$07,$06,$03
; Subroutine to rotate carry flag (1=pass,0=fail) into IX
.l2429 push de ; save DE
push ix
pop de ; DE=test results
rl e ; rotate carry into test results
rl d
push de
pop ix ; IX=test results
pop de ; restore DE
ret
; Re-entry into self-test routine from RAM here
.l2436 ld bc,$7ffd
ld a,$00
out (c),a ; page in page 0
ld sp,$7fff ; set stack in page 5
exx
xor a
cp d ; set carry if RAM configs test passed
call l2429 ; rotate RAM configs test result into flags
call l266f ; re-initialise
call l271a ; clear screen
ld hl,l2316
call l2703 ; display RAM test passed message
call l269a ; pause for 0.8s
jr l2461 ; move on
; routine comes here if ULA error with normal RAM paging
.l2457 call l266f ; reinitialise
ex af,af' ; get page
ld hl,$0000 ; specify address 0000 for page error
jp l2262 ; display error and halt
; More self-test program
.l2461 call l2c99 ; GI sound test
call l28b6 ; Symshift-A test
call l295d ; ULA test
call l274d ; keyboard test
call l2c1f ; ULA sound test part 1
call l2c6e ; ULA sound test part 2
call l29d0 ; joystick test
call l2b24 ; cassette output test
call l2a4b ; screen switching test
call l2488 ; printer BUSY test & data test
call l3558 ; integral disk test
call l35a3 ; tape test
jp l2b91 ; move on to display results
; Printer BUSY test & data test
.l2488 call l271a ; cls
ld hl,l25d5
call l2703 ; display test message
ld hl,l25f3 ; ask for printer OFFLINE then any key
call l2703
ld hl,l2613
call l2703
ld hl,l261e
call l2703
call l253d ; wait for a key
ld bc,$0ffd
in a,(c)
bit 0,a ; check BUSY signal
jr z,l24c4 ; move on if not set
ld hl,l2608
call l2703 ; ask for ONLINE then any key
call l253d ; wait for a key
ld bc,$0ffd
in a,(c)
bit 0,a ; check BUSY signal
jr nz,l24c4 ; move on if set
scf ; signal success
jr l24c6
.l24c4 scf
ccf ; signal fail
.l24c6 call l2429 ; set success/fail flag
call l271a ; cls
ld hl,BANK678
set 4,(hl)
ld hl,l2549
call l2703 ; display test messages
ld hl,l255e
call l2703
ld e,$00 ; chars per line count
.l24df ld a,' ' ; start with space
.l24e1 push af
call l24f4 ; output character
pop af
inc a ; get next ASCII code
cp $80
jr z,l24f0 ; go to skip $80-$9f
or a
jr z,l24df ; restart after $ff at space
jr l24e1
.l24f0 ld a,$a0
jr l24e1
; Subroutine to output a character to the printer
.l24f4 call l2507 ; output it
push af
inc e ; increment chars printed this line
ld a,e
cp $48
jr nz,l2505
ld e,$00 ; if $48, reset and start new line
ld a,$0d
call l2507
.l2505 pop af
ret
; Subroutine to output a character to the printer,
; checking for Quit from user, exiting to higher calling
; routine
.l2507 push af
.l2508 ld a,$fb
in a,($fe)
rra ; get Q status in carry
jr nc,l252c ; move on if pressed
ld bc,$0ffd
in a,(c)
bit 0,a ; check BUSY status
jr nz,l2508 ; loop back if busy
pop af
out (c),a ; place character at port
di
ld a,(BANK678)
.l251f ld bc,$1ffd
xor $10
out (c),a ; STROBE parallel port
bit 4,a
jr z,l251f ; loop back to change state if necessary
ei
ret
.l252c pop af ; discard AF
pop af ; discard return address
pop af ; and two stacked values from calling routine
pop af
ld hl,l2597
call l2703 ; ask if printed OK
call l26af ; get SPACE/ENTER
call l2429 ; set success/fail
ret ; exit to earlier routine
; Subroutine to wait until a new key is available
.l253d ld hl,FLAGS
res 5,(hl)
.l2542 bit 5,(hl)
jr z,l2542
res 5,(hl)
ret
; Printer test messages
.l2549 defm $16&$4&$4
defm "Printer data test"&$ff
.l255e defm $16&$8&$1
defm "Make sure printer is ready"
defm $16&$0a&$1
defm "Press Q to quit printing"&$ff
.l2597 defm $16&$0c&$01
defm "If characters printed OK,"&$0d
defm "Press [ENTER], otherwise [SPACE]"&$ff
.l25d5 defm $15&$0&$16&$4&$4
defm "Printer BUSY signal test"&$ff
.l25f3 defm $16&$8&$8
defm "Turn the printer "&$ff
.l2608 defm $16&$0a&$0c
defm "ONLINE "&$ff
.l2613 defm $16&$0a&$0c
defm "OFFLINE"&$ff
.l261e defm $16&$0c&$4
defm "Press any key to continue"&$ff
defm $16&$10&$5
defm "Passed - press [ENTER]"&$ff
defm $16&$10&$5
defm "Failed - press [SPACE]"&$ff
; Subroutine to do some initialisation
.l266f ld a,$52 ; signal "in test program"
ex af,af'
jp l016c ; do some initialisation & return here
.l2675 ld a,$02
rst $28
defw $1601 ; open channel to stream 2
.l267a ld hl,l2681
call l2703 ; output normal colour control codes
ret
; "Normal" colour control codes
.l2681 defb $10,$00,$11,$07
defb $13,$00,$14,$00
defb $15,$00,$12,$00
defb $ff
; Apparently unused routine, to pause
.l268e push bc
push hl
ld b,$19
ei
.l2693 halt
djnz l2693
.l2696 pop hl
.l2697 pop bc
di
ret
; Subroutine to pause for approx 0.8s
.l269a ld b,$28
ei
.l269d halt
djnz l269d
di
ret
; Pause subroutine
.l26a2 ld hl,$3000
.l26a5 dec hl
push ix
pop ix
ld a,l
or h
jr nz,l26a5
ret
; Subroutine to wait for ENTER or SPACE to be pressed.
; On exit, carry is set if ENTER was pressed, reset if SPACE.
.l26af push hl ; save registers
push de
push bc
ld bc,$00fe
.l26b5 in a,(c) ; scan all keyrows
and $1f
cp $1f
jr nz,l26b5 ; loop back if any are pressed
.l26bd call l26d2 ; get a scancode
cp $21 ; check for ENTER
scf
.l26c3 jr z,l26c9 ; if so, move on with carry set
cp $20 ; check for SPACE
jr nz,l26bd ; loop back if not
.l26c9 push af ; save carry
call l2720 ; make a beep
pop af ; restore registers
pop bc
pop de
pop hl
ret
.l26d2 call l26d6
ret
; Subroutine to read the keyboard, returning a scancode
; in DE. This routine is a virtual copy of the routine
; at 028e in ROM 3, but doesn't return until a scancode
; has been detected.
.l26d6 ld l,$2f
ld de,$ffff
ld bc,$fefe
.l26de in a,(c)
cpl
and $1f
jr z,l26f4
ld h,a
ld a,l
.l26e7 inc d
jr nz,l26d6
.l26ea sub $08
srl h
jr nc,l26ea
ld d,e
ld e,a
jr nz,l26e7
.l26f4 dec l
rlc b
jr c,l26de
ld a,e
cp $ff
ret nz
ld a,d
cp $ff
jr z,l26d6
ret
; Subroutine to output an $ff-terminated string
.l2703 ld a,(hl) ; get byte
cp $ff
ret z ; exit if $ff
rst $10 ; else output
inc hl
jr l2703 ; back for more
; Subroutine to set colours to INK b, PAPER c
.l270b ld a,$10
rst $10
ld a,b
rst $10
ld a,$11
rst $10
ld a,c
rst $10
ret
; Subroutine to output a character
.l2716 rst $28
defw $0010
.l2719 ret
; Subroutine to clear screen
.l271a rst $28
defw $0daf ; call ROM 3 CLS
jp l267a ; go to set "normal" colours & exit
; Subroutine to make a beep
.l2720 ld hl,$0100 ; parameters for the beep
ld de,$00a0
.l2726 call l34e9 ; call BEEPER
di ; re-disable interrupts
ret
; Copy of next routine, apparently unused
ld a,$7f
in a,($fe)
rra
ret
; Subroutine to check for SPACE, exiting with carry reset if pressed
.l2731 ld a,$7f
in a,($fe)
rr a
ret
; Apparently unused routine, to check for SPACE+Symbol shift
ld a,$7f
in a,($fe)
or $e0
cp $fc
ret
; Apparently unused routine, to output D spaces and set A'='8'
ld a,'8'
ex af,af'
.l2744 ld a,' '
call l2716
dec d
jr nz,l2744
ret
; Keyboard test
.l274d call l271a ; cls
ld a,$38
ld (BORDCR),a
ld a,$07
out ($fe),a ; white border
ld hl,l2f17
call l2703 ; display test message
call l26a2 ; pause
call l2766 ; execute test
ret
.l2766 ld hl,l2841 ; keyboard test table
push hl
.l276a pop hl
ld a,(hl) ; get next test value
inc a
ret z ; exit if end of table
push hl
call l26d2 ; get keyscan code
ld bc,$1000
.l2775 dec bc
ld a,b
or c
jr nz,l2775 ; timing loop
ld a,d
cp $ff
jr z,l27e0 ; move on if no first key
cp $27
jr z,l2790 ; move on if capsshift held
cp $18
jr z,l27db ; move on if symshift held
ld a,e ; swap scancodes
ld e,d
ld d,a
cp $18
jr z,l27db ; move on if symshift held
jr l276a ; loop back if no shifts
.l2790 ld a,e ; here we substitute various codes for
cp $23 ; keys with caps shift
ld e,$28
jr z,l27f9
cp $24
ld e,$29
jr z,l27f9
cp $1c
ld e,$2a
jr z,l27f9
cp $14
ld e,$2b
jr z,l27f9
cp $0c
ld e,$2c
jr z,l27f9
cp $04
ld e,$2d
jr z,l27f9
cp $03
ld e,$2e
jr z,l27f9
cp $0b
ld e,$2f
jr z,l27f9
cp $13
ld e,$30
jr z,l27f9
cp $1b
ld e,$31
jr z,l27f9
cp $20
ld e,$32
jr z,l27f9
cp $18
ld e,$37
jr z,l27f9
jr l276a ; loop back for untested caps shift codes
.l27db ld a,e ; here we substitute various codes for keys
cp $10 ; with symbol shift
ld e,$33
.l27e0 jr z,l27f9
cp $08
ld e,$34
jr z,l27f9
cp $1a
ld e,$35
jr z,l27f9
cp $22
ld e,$36
jr z,l27f9
ld e,$37
jp nz,$276a
.l27f9 ld a,e ; A=final scancode
pop hl
push hl
cp (hl) ; test against table entry
jp nz,l276a ; loop back if not equal
pop hl
inc hl ; get to next entry
push hl
ld hl,$0080
ld de,$0080
push af
push bc
push ix
call l2726 ; make a beep
pop ix
pop bc
pop af
pop hl
push hl
ld a,$11 ; set PAPER 2
rst $10
ld a,$02
rst $10
dec hl
ld de,$003b
add hl,de
ld a,(hl) ; get position code from table
and $f0
rra
rra
rra
ld b,$06
add a,b
ld b,a ; B=line+1
ld a,(hl)
and $0f
rla
ld c,$01
add a,c ; C=column
ld c,a
ld a,$16 ; output space to blank key at correct pos
rst $10
ld a,b
dec a
rst $10
ld a,c
rst $10
ld a,' '
rst $10
jp l276a ; back for more
; Keyboard test table of scancodes
.l2841 defb $2b,$2c,$24,$1c
defb $14,$0c,$04,$03
defb $0b,$13,$1b,$23
defb $32,$28,$31,$25
defb $1d,$15,$0d,$05
defb $02,$0a,$12,$1a
defb $22,$37,$29,$26
defb $1e,$16,$0e,$06
defb $01,$09,$11,$19
defb $21,$27,$2a,$1f
defb $17,$0f,$07,$00
defb $08,$10,$33,$27
defb $18,$35,$36,$2d
defb $30,$20,$2f,$2e
defb $34,$18,$ff
; Keyboard test table of screen positions
defb $00,$01,$02,$03
defb $04,$05,$06,$07
defb $08,$09,$0a,$0b
defb $0d,$10,$11,$13
defb $14,$15,$16,$17
defb $18,$19,$1a,$1b
defb $1c,$20,$21,$23
defb $24,$25,$26,$27
defb $28,$29,$2a,$2b
defb $2d,$30,$31,$33
defb $34,$35,$36,$37
defb $38,$39,$3a,$3d
defb $40,$41,$42,$43
defb $44,$47,$4a,$4b
defb $4c,$4d
; Symbolshift-A test
.l28b6 call l271a ; cls
ld a,$05
out ($fe),a ; cyan border
ld bc,$0600
call l270b ; INK 6, PAPER 0
ld hl,l30d9
call l2703 ; display test message
.l28c9 call l28e5
jr nz,l28c9 ; loop back until symshift-A pressed
ld bc,$0200 ; timing counter
.l28d1 push bc
call l28e5 ; check for symshift-A
pop bc
jr nz,l28e1 ; exit with error if not pressed
dec bc
ld a,b
or c
jr nz,l28d1 ; loop back to test again
scf
jp l2429 ; exit, setting "success" flag
.l28e1 or a
jp l2429 ; exit, setting "fail" flag
; Subroutine to check if symbol-shift & A are being pressed
; On exit, Z is set if both are being pressed
.l28e5 call l26d2 ; get key scan code
ld a,d
cp $18
jr z,l28f3 ; move on if first key is sym/shft
ld a,e ; swap keys
ld e,d
ld d,a
cp $18
ret nz ; exit with Z reset if 2nd key not sym/shft
.l28f3 ld a,e
cp $26 ; compare other key with A and exit
ret
; Subroutine to initialise test environment, display title & get
; colour test results
.l28f7 call l266f ; do some initialisation
call l291d ; fill attributes, do sound registers
ld bc,$0000
ld hl,l311e
call l2703 ; output test program title
call l26af ; wait for ENTER or SPACE
call l2429 ; update results flags
ld c,$fd ; some sound stuff
ld d,$ff
ld e,$bf
ld h,$ff
ld b,d
ld a,$07
out (c),a
ld b,e
out (c),h
ret
; Subroutine to fill attributes & set up some sound registers
.l291d xor a
ld hl,$5800 ; start of attributes
ld b,$10 ; 16 x 2chars = 1 line
.l2923 ld (hl),a
inc hl
ld (hl),a ; colour next two chars
add a,$08 ; increment paper & higher attributes
inc hl
djnz l2923 ; back for rest of line
ld de,$5820
ld bc,$02df
ldir ; fill rest of attribs with what's on line 1
ld c,$fd
ld d,$ff
ld e,$bf
ld hl,l2d0c ; sound data
.l293c ld a,(hl) ; loop to set up two sound registers
inc hl
bit 7,a
jr nz,l294c
ld b,d
out (c),a
ld a,(hl)
inc hl
ld b,e
out (c),a
jr l293c
.l294c ld c,$fd ; set up more sound registers
ld d,$ff
ld e,$bf
ld h,$fb
ld b,d
ld a,$07
out (c),a
ld b,e
out (c),h
ret
; ULA test
.l295d call l271a ; cls
ld hl,l324e
call l2703 ; display test message
ld de,$6000
call l298c ; copy test routine to RAM at $6000
call $6000 ; execute test
ld a,$aa ; test RAM integrity
ld ($8000),a
ld a,($8000)
cp $aa
jr nz,l2984 ; move on if error
ld de,$8000
call l298c ; copy test routine to RAM at $8000
call $8000 ; execute test
.l2984 ld a,$06
out ($fe),a ; yellow border
scf
jp l2429 ; exit, setting "success" flag
; Subroutine to copy following routine to memory at DE
.l298c ld hl,l2995
ld bc,$003b
ldir
ret
; Routine to execute in RAM to test ULA
.l2995 ld bc,$2000 ; $2000 times
.l2998 ld a,$00 ; alternately output $00/$ff to port $fe
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
out ($fe),a
cpl
dec bc
ld a,b
or c
jr nz,l2998 ; loop back for more
ret
; Joystick test
.l29d0 call l271a ; cls
ld hl,l32e0
call l2703 ; display test message
ld de,$1f1f ; initially, no bits reset in D or E ports
.l29dc push de
ld bc,$effe
in a,(c)
cpl
and d
xor d
ld d,a ; mask in reset bits from port 1 to D
ld bc,$f7fe
in a,(c)
cpl
and e
xor e
ld e,a ; mask in reset bits from port 2 to D
pop bc
ld a,d
cp b
jr nz,l2a06 ; move on if change in port 1
ld a,e
cp c
jr nz,l2a06 ; move on if change in port 2
call l2731 ; check for SPACE
jr c,l29dc
jr z,l29dc
and a
jr l2a03 ; fail if SPACE pressed
.l2a02 scf ; set success
.l2a03 jp l2429 ; exit, setting success/fail flag
.l2a06 push de
ld hl,l3530 ; table of screen positions
ld b,$05 ; 5 bits for first joystick port in D
.l2a0c rrc d
call nc,l2a28 ; blank screen chars if reset
inc hl
inc hl
djnz l2a0c
ld b,$05 ; 5 bits for second joystick port in E
.l2a17 rrc e
call nc,l2a28 ; blank screen chars if reset
inc hl
inc hl
djnz l2a17
pop de
ld a,d
or e
jr z,l2a02 ; exit with success once all reset
jp l29dc ; back for more
; Joystick subroutine to output two red spaces at position
; in table referenced at HL
.l2a28 push bc
ld b,(hl)
inc hl
ld c,(hl) ; get position from table
ld a,$16 ; output spaces at position
rst $10
ld a,b
dec a
dec a
dec a
rst $10
ld a,c
rst $10
ld a,$11
rst $10
ld a,$02
rst $10
ld a,' '
rst $10
ld a,' '
rst $10
ld a,$11
rst $10
ld a,$07
rst $10
dec hl
pop bc
ret
; Screen switching test
.l2a4b call l271a ; cls
di
ld hl,$5800
ld de,$5801
ld bc,$02ff
ld (hl),$00
ldir ; set page 5 screen attributes to black
ld hl,l2acb
call l2703 ; display test message
ld hl,l2ae8
call l2703 ; and success - press ENTER message
ld a,(BANKM)
push af
or $07
ld (BANKM),a
ld bc,$7ffd
out (c),a ; switch in page 7
ld hl,$4000
ld de,$c000
ld bc,$1800
ldir ; copy screen into page 7
ld hl,l2acb ; display test message
call l2703
ld hl,l2b06 ; and fail - press SPACE message
call l2703
ld a,(BANKM)
set 3,a
ld (BANKM),a
ld bc,$7ffd
out (c),a ; switch in alternate screen
ld hl,$5800
ld de,$5801
ld bc,$02ff
ld (hl),$38
ldir ; change attribs on normal screen to visible
ld hl,$d800
ld de,$d801
ld bc,$02ff
ld (hl),$38
ldir ; and on alternate screen
call l26af ; get ENTER or SPACE as appropriate
call l2429 ; set success/failure flag
call l271a ; cls
pop af
ld (BANKM),a
ld bc,$7ffd
out (c),a ; switch back original memory & screen
call l271a ; cls
ei
ret
.l2acb defm $16&$8&$3&$11&$0&$10&$0
defm "Screen switching test"&$ff
.l2ae8 defm $16&$0c&$3&$11&$0&$10&$0
defm "Passed - press [ENTER]"&$ff
.l2b06 defm $16&$0c&$3&$11&$0&$10&$0
defm "Failed - press [SPACE]"&$ff
; Cassette output test
.l2b24 call l271a ; cls
ld a,$02
out ($fe),a ; red border
ld a,$08
ld (BORDCR),a
ld hl,l32c1
call l2703 ; display test message
ld hl,$0100 ; ouput a tone to MIC
ld de,$0a00
di
push ix
ld a,l
srl l
.l2b42 srl l
cpl
and $03
ld c,a
ld b,$00
ld ix,l2b5a
add ix,bc
ld a,(BORDCR)
and $38
rrca
rrca
rrca
.l2b58 or $10
.l2b5a nop
nop
nop
inc b
inc c
.l2b5f dec c
jr nz,l2b5f
ld c,$3f
dec b
jp nz,l2b5f
xor $08
out ($fe),a
ld b,h
ld c,a
bit 3,a
jr nz,l2b7b
ld a,d
or e
jr z,l2b7f
ld a,c
ld c,l
.l2b78 dec de
jp (ix)
.l2b7b ld c,l
inc c
jp (ix)
.l2b7f pop ix
ld bc,$1200
ld hl,l2d21
.l2b87 call l2703 ; ask if heard sound
call l26af ; get ENTER/SPACE
call l2429 ; signal success/failure
ret
; End of test program - display results
.l2b91 call l271a ; cls
push ix
pop de ; DE=results
ld a,e
and d
cp $ff
jr nz,l2ba9 ; move on if any test failed
ld a,$04
out ($fe),a ; green border
ld hl,l346f
call l2703 ; display success message
jr l2bee ; move on
.l2ba9 ld a,$02
out ($fe),a ; red border
ld hl,l3486
call l2703 ; display fail message
ld bc,$0807
push ix
pop de
push de ; E=low byte of results
ld hl,l2ec7 ; HL=table of message addresses
ld d,$08 ; 8 bits
.l2bbf rr e ; get next result
jr c,l2bce ; move on if passed
push hl
push de
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
call l2703 ; display appropriate message
pop de
pop hl
.l2bce inc hl ; get to next table entry
inc hl
dec d
jr nz,l2bbf ; back for more bits
pop de
ld e,d ; E=high byte of results
ld d,$08 ; 8 bits
.l2bd7 rr e ; get next result
jr c,l2be9 ; move on if passed
push hl
push de
push bc
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
call l2703 ; display appropriate message
pop bc
pop de
pop hl
inc b
.l2be9 inc hl ; get to next table entry
inc hl
dec d
jr nz,l2bd7 ; loop back for more bits
.l2bee ld hl,l2c00
ld bc,$1000
call l2703 ; display end message
.l2bf7 call l26af ; get SPACE or ENTER
jr c,l2bf7 ; loop until SPACE
di
jp $0000 ; reset
.l2c00 defm $0d&$0d
defm "Hold [BREAK] to repeat tests"&$ff
; ULA sound test
.l2c1f ld c,$fd ; some sound stuff
ld d,$ff ; to clear AY registers ?
ld e,$bf
ld b,d
ld a,$0e
out (c),a
ld a,$ff
ld b,e
out (c),a
ld b,d
in a,(c)
cp $ff
jr nz,l2c6a
ld a,$fe
ld b,e
out (c),a
ld b,d
in a,(c)
cp $7e
jr nz,l2c6a
ld a,$fd
ld b,e
out (c),a
ld b,d
in a,(c)
cp $bd
jr nz,l2c6a
ld a,$fb
ld b,e
out (c),a
ld b,d
in a,(c)
cp $db
jr nz,l2c6a
ld a,$f7
ld b,e
out (c),a
ld b,d
in a,(c)
cp $e7
jr nz,l2c6a
scf
jp l2429 ; exit with success
.l2c6a or a
jp l2429 ; exit with failure
; ULA sound test part 2
.l2c6e call l271a ; clear screen
ld a,$02
out ($fe),a ; red border
ld a,$08
ld (BORDCR),a
ld hl,l32a6
call l2703 ; display test message
ld hl,$0100
ld de,$0a00
call l2726 ; make a beep
ld bc,$1200
ld hl,l2d21
call l2703 ; ask if heard sound
call l26af ; get ENTER/SPACE
call l2429 ; set success/fail flag
ret
; GI Sound Test routine
.l2c99 call l271a ; clear screen
ld a,$05
out ($fe),a ; cyan border
ld hl,l328d
call l2703 ; display GI message
ld c,$fd ; make some sounds
ld d,$ff
ld e,$bf
ld hl,l2d0c
.l2caf ld a,(hl)
inc hl
bit 7,a
jr nz,l2cbf
ld b,d
out (c),a
ld a,(hl)
inc hl
ld b,e
out (c),a
jr l2caf
.l2cbf ld c,$fd
ld d,$ff
ld e,$bf
ld l,$03
ld h,$fe
.l2cc9 ld b,d
ld a,$07
out (c),a
ld b,e
out (c),h
push hl
push de
push bc
call l269a ; pause
pop bc
pop de
pop hl
scf
rl h
dec l
jr nz,l2cc9 ; loop back for more
ld h,$f8
ld b,d
ld a,$07
out (c),a
ld b,e
out (c),h
push hl
push de
push bc
call l269a ; pause
pop bc
pop de
pop hl
ld h,$ff
ld b,d
ld a,$07
out (c),a
ld b,e
out (c),h
ld bc,$0a00
ld hl,l34a8
call l2703 ; ask if heard sounds
call l26af ; get ENTER/SPACE
jp l2429 ; rotate into flags & exit
.l2d0c defb $00,$40,$01,$00
defb $02,$80
defb $03,$00,$04,$00
defb $05,$01,$06,$1f
defb $08,$0f,$09,$0f
defb $0a,$0f,$80
.l2d21 defm "Press [ENTER] if you heard the tone, else press [SPACE]"&$ff
.l2d5a defm "colour test failed"&$0d&$ff
.l2d6e defm "ULA sound test failed"&$0d&$ff
.l2d85 defm "Symshft/A key test failed"&$0d&$ff
.l2da0 defm "ULA test failed"&$0d&$ff
.l2db1 defm "RS232 test failed"&$0d&$ff
.l2dc4 defm "GI sound test failed"&$0d&$ff
.l2dda defm "All-RAM page test failed"&$0d&$ff
.l2df4 defm "Joystick test failed"&$0d&$ff
.l2e0a defm "IC 7 checksum failed"&$0d&$ff
.l2e20 defm "IC 8 checksum failed"&$0d&$ff
.l2e36 defm "Disk tests failed"&$0d&$ff
.l2e49 defm "Second Screen test failed"&$0d&$ff
.l2e64 defm "Cassette Output failed"&$0d&$ff
.l2e7c defm "Cassette Input failed"&$0d&$ff
.l2e93 defm "Printer BUSY test failed"&$0d&$ff
.l2ead defm "Printer DATA test failed"&$0d&$ff
; Table of test failure message addresses
.l2ec7 defw l2e7c
defw l2e36
defw l2ead
defw l2e93
defw l2e49
defw l2e64
defw l2df4
defw l2d6e
defw l2db1
defw l2da0
defw l2d85
defw l2dc4
defw l2dda
defw l2e20
defw l2e0a
defw l2d5a
; Test program messages
.l2ee7 defm $16&$5&$5&$12&$1
defm "ROM TEST FAILED"&$12&$0&$0d&$ff
defm $16&$5&$5&$12&$1
defm "RAM TEST FAILED"&$12&$0&$0d&$ff
.l2f17 defm $16&$2&$0
defm " >>> SPECTRUM KEYBOARD TEST <<< "&$0d&$0d
defm $14&$1
defm " "
defm "t i 1 2 3 4 5 6 7 8 9 0 b"
defm " "
defm "d g Q W E R T Y U I O P "
defm " "
defm "e e A S D F G H J K L e"
defm " "
defm "c c Z X C V B N M . c"
defm " "
defm "s ; "&$22&" < > S ^ v , s"
defm " "
defm " "
defm $14&$0&$16&$14&$5&$12&$1
defm "TEST ALL THE KEYS"&$12&$0&$ff
.l30d9 defm $16&$5&$5&$14&$1
defm " SYM SHFT/A TEST "
defm $16&$0a&$5
defm " Press "
defm $16&$0c&$5&$12&$1
defm "SYM SHFT/A"
defm $12&$0&$16&$0e&$5
defm " for 1 sec "&$14&$0&$ff
.l311e defm $16&$9&$0&$14&$1
defm " SPECTRUM +3 test program V 4.0 AMSTRAD 1987..."
defm " by RG/CL/VO "&$0d
defm " Check TV tuning "
defm "connect the loopback connector! "&$0d
defm "Press [ENTER] if colour is OK, "
defm "press [SPACE] if it is not "&$0d
defm $12&$1&$0d
defm "TAKE CARE - THESE TESTS CORRUPT DISKS, AND REQUIRE"
defm " FACTORY TEST EQUIPMENT! "
defm $14&$0
defm "YOU HAVE BEEN WARNED!"
defm $14&$0&$12&$0&$ff
.l324e defm $16&$5&$5&$14&$1
defm " ULA TEST "
defm $14&$0&$0d&$ff
.l3261 defm $16&$5&$7&$14&$1
defm "RAM DATA TESTS"&$16&$0a&$5&".. STARTING NOW .."
defm $14&$0&$0d&$ff
.l328d defm $16&$5&$5&$14&$1
defm " GI SOUND TEST "
defm $0d&$0d&$14&$0&$ff
.l32a6 defm $16&$5&$5&$14&$1
defm " ULA SOUND TEST "
defm $0d&$0d&$14&$0&$ff&$0
.l32c1 defm $16&$5&$5&$14&$1
defm "CASSETTE OUTPUT TEST"
defm $14&$0&$0d&$0d&$ff&$0
.l32e0 defm $16&$0&$0a&$14&$1
defm "JOYSTICK TEST"
defm $14&$0&$0d&$0d
defm "Move both joysticks and press"&$0d
defm "the FIRE buttons until the"&$0d
defm "letters below are wiped out"&$0d&$0d
defm "Press [SPACE] to give up."&$0d&$0d&$0d&$0d
defm "+-----J1-----------J2------+"&$0d
defm "! !"&$0d
defm "! UP UP !"&$0d
defm "! !"&$0d
defm "! LF FI RI LF FI RI !"&$0d
defm "! !"&$0d
defm "! DN DN !"&$0d
defm "! !"&$0d
defm "+--------------------------+"&$0d&$ff
.l346f defm $16&$5&$5
defm " ALL TESTS PASSED "&$0d&$ff
.l3486 defm $16&$0&$0&$12&$1
defm " TEST FAILED, because:- "&$0d&$12&$0&$0d&$ff
.l34a8 defm "press [ENTER] if you heard four sounds, "
defm "else press [SPACE]. "&$ff
; Subroutine to make a beep. This is a copy of the BEEPER
; subroutine at 03B5 in ROM3
.l34e9 di
push ix
ld a,l
srl l
srl l
cpl
and $03
ld c,a
ld b,$00
ld ix,l3507
add ix,bc
ld a,(BORDCR)
and $38
rrca
rrca
rrca
or $08
.l3507 nop
.l3508 nop
nop
.l350a inc b
inc c
.l350c dec c
jr nz,l350c
ld c,$3f
dec b
jp nz,l350c
xor $10
out ($fe),a
ld b,h
ld c,a
bit 4,a
jr nz,l3528
ld a,d
.l3520 or e
jr z,l352c
ld a,c
ld c,l
dec de
.l3526 jp (ix)
.l3528 ld c,l
inc c
.l352a jp (ix)
.l352c ei
pop ix
ret
; Table of screen positions for joystick test
.l3530 defb $11,$06,$0f,$06
defb $13,$06,$11,$09
defb $11,$03,$11,$10
defb $11,$16,$13,$13
defb $0f,$13,$11,$13
; These bits don't seem to be used
.l3544 defm "FIUPDNRILFLFRIDNUPFI"
; Integral disk test
.l3558 ld hl,l3566 ; address of routine to execute in RAM
ld de,$5f00
ld bc,$003d
ldir ; copy it
jp $5f00 ; jump into it
; Integral disk test routine to execute in RAM
.l3566 ld a,$04
ld bc,$1ffd
out (c),a ; switch in ROM 2
ld hl,$245c ; copy routine from ROM 2 to RAM
ld de,$6000
ld bc,$0c00
ldir
ld a,$00
ld bc,$1ffd
out (c),a ; switch in ROM 0
ld (BANK678),a
ld a,$10
ld b,$7f
out (c),a ; switch in ROM 1
ld (BANKM),a
ei
push ix
call $6000 ; call ROM 2 routine in RAM
pop ix
push af ; save success/fail flag
ld a,$00
ld bc,$7ffd
out (c),a ; switch in ROM 0
ld (BANKM),a
pop af
call l2429 ; set success/fail in flags
ret ; done
; Tape test
.l35a3 call l271a ; cls
ld hl,l362b
call l2703 ; display test message
call l3612 ; short pause
di
ld hl,$58e1 ; set up attribs
ld de,$0006
ld b,e
ld a,d
.l35b8 ld (hl),a
add hl,de
djnz l35b8
.l35bc ld hl,$0000 ; tape testing
ld de,$1000
ld c,$fe
ld b,$7f
in a,(c)
bit 0,a
jp z,l361f ; move on if SPACE pressed
ld bc,$bffe
in a,(c)
bit 0,a
jp z,l3625 ; move on if ENTER pressed
.l35d7 dec de
ld a,d
or e
jr z,l35e7
in a,($fe)
and $40
cp c
jr z,l35d7
inc hl
ld c,a
jr l35d7
.l35e7 rl l
rl h
rl l
rl h
rl l
rl h
ld l,h
ld a,$20
cp h
jr nc,l35fb
ld l,$20
.l35fb xor a
ld h,a
ld de,$591f
ld b,$20
ld a,$48
ei
halt
di
.l3607 ld (de),a
dec de
djnz l3607
inc de
add hl,de
ld a,$68
ld (hl),a
jr l35bc
; Subroutine to pause for a short while
.l3612 ei
ld b,$19
.l3615 halt
djnz l3615 ; pause
ld hl,FLAGS
res 5,(hl) ; clear "new key" flag
scf
ret
; Set "tape test fail" flag
.l361f and a
call l2429
jr l3612
; Set "tape test succeed" flag
.l3625 scf
call l2429
jr l3612
.l362b defm $16&$0&$0
defm "Insert test tape, press PLAY,"&$0d
defm "and adjust azimuth screw for"&$0d
defm "maximum reading on screen."&$0d
defm "Press [ENTER] if successful,"&$0d
defm "press [SPACE] if failed"&$0d&$ff
; *********** END OF SELF-TEST PROGRAM SECTION ***********
.l36ba ld (hl),h
rst $18
sbc a,$55
djnz $3712 ; (82)
ret
sbc a,(hl)
sbc a,(hl)
cp l
ld h,d
push bc
ret nz
ld d,l
jp nz,$1044
rla
.l36cc cp $5f
sub b
cp $d1
defb $dd
push de
.l36d3 rla
sub b
rst $30
rst $18
rst $18
call nc,$d9c7
sbc a,$c3
cp l
di
call c,$d659
ld d,(hl)
djnz $36fc ; (23)
ld h,h
.l36e6 ld b,a
ld e,a
sub b
.l36e9 ld h,b
rst $18
ld b,b
.l36ec ld b,e
sub a
djnz $36ec ; (-4)
.l36f0 ld d,c
rst $0
ld b,e
ld e,a
sbc a,$bd
ld h,(hl)
exx
.l36f8 ld e,e
sub b
rla
jp po,$54d5
djnz $36f8 ; (-8)
ld d,l
ld b,d
ld b,d
.l3703 ld e,c
sbc a,$57
rla
sub b
ld a,a
.l3709 ld e,h
ld e,h
exx
add a,$55
jp nz,$5190
sbc a,$bd
call po,$d5d8
sub b
ld (hl),h
ld e,a
.l3719 jp nz,$595b
ld e,(hl)
rst $10
sub b
ld a,l
ld e,a
jp nc,$64bd
ld e,b
pop de
.l3726 ld e,(hl)
in a,($c3)
djnz $36ef ; (-60)
ld e,a
ld e,$1e
cp l
ld h,h
ret c
push de
djnz $3726 ; (-14)
ld b,d
push de
ld b,a
push de
ld b,d
ret
sub b
call po,$c0d1
sub b
defb $18
defb 88
exx
out ($19),a
cp l
jp po,$dc5f
.l3748 ld d,c
sbc a,$54
inc e
sub b
ld h,d
exx
out ($58),a
ld d,c
jp nz,$9054
ld d,l
ld b,h
sub b
pop de
ld e,h
cp l
ld d,c
ld e,(hl)
ld d,h
sub b
ld sp,hl
add a,$df
ld b,d
djnz $36fd ; (-104)
rst $0
ret c
ld c,c
djnz $3748 ; (-34)
ld e,a
.l376b call nz,$bd19
ld h,a
ld b,d
exx
ld b,h
call nz,$5ed5
sub b
rst $18
ld e,(hl)
sub b
ld h,b
di
ld h,a
sub b
adc a,b
dec b
add a,c
ld (bc),a
ld b,e
inc e
djnz $37ca ; (69)
ld b,e
exx
ld e,(hl)
cp l
defb $fd
ex af,af'
nop
sub b
ld d,c
.l378e sbc a,$d4
djnz $378e ; (-4)
ex af,af'
nop
djnz $37db ; (69)
ld e,(hl)
call nc,$c255
djnz $378f ; (-13)
ld h,b
sbc a,a
defb $fd
sbc a,e
cp l
cp l
jp $c490
rst $18
ld e,$9e
cp l
ld h,h
ret c
ld d,l
djnz $376b ; (-67)
defs $1c
.l37ca defs $11
.l37db defs $59
.l3834 defs $05cc
ld (OLDHL),hl
push af
pop hl
.l3e05 ld (OLDAF),hl
ex (sp),hl
ld c,(hl)
inc hl
ld b,(hl)
inc hl
ex (sp),hl
push bc
pop hl
ld a,(BANK678)
ld bc,$1ffd
res 2,a
di
ld (BANK678),a
out (c),a
ei
ld bc,$3e2d
push bc
push hl
ld hl,(OLDAF)
push hl
pop af
ld hl,(OLDHL)
ret
push bc
push af
ld a,(BANK678)
ld bc,$1ffd
set 2,a
di
ld (BANK678),a
out (c),a
ei
pop af
pop bc
ret
defs $3f
; Subroutine to call a subroutine in ROM 1
; The address to call is stored inline after the call to this routine
.l3e80 ld (OLDHL),hl ; save HL in OLDHL
ld (OLDBC),bc ; save BC in OLDBC
push af
pop hl
ld (OLDAF),hl ; save AF in OLDAF
ex (sp),hl ; HL=return address
ld c,(hl)
inc hl
ld b,(hl) ; BC=inline address for ROM 1
inc hl
ex (sp),hl ; restore proper return address
push bc
pop hl ; HL=address in ROM 1 to call
ld a,(BANKM)
or $10
di
ld (BANKM),a
ld bc,$7ffd
out (c),a ; page in ROM 1
; The rest of the routine continues at $3ea2 in ROM 1
; The following is a continuation of a mirrored routine in ROM 1 for
; returning to this ROM
.l3ea2 ei
ld bc,$3eb5
push bc ; stack return add to swap back ROMS
push hl ; stack address of routine to call
ld hl,(OLDAF)
push hl
pop af ; restore AF
ld bc,(OLDBC) ; restore BC
ld hl,(OLDHL) ; restore HL
ret ; exit to routine in this ROM
; This is the routine which returns control to the calling routine in ROM 1
.l3eb5 push af ; save AF & BC
push bc
ld a,(BANKM)
or $10
di
ld (BANKM),a
ld bc,$7ffd
out (c),a ; page back ROM 1
; The rest of the routine continues at $3ec5 in ROM 1
; The following is a continuation of a mirrored routine in ROM 1 for
; returning to this ROM
.l3ec5 ei
pop bc
pop af
ret
defs $37
; Subroutine to call a subroutine in ROM 2, with inline address
; This routine is not used in this ROM, but is a duplicate of a
; routine in ROM 1, which takes over during ROM switching to ROM 2
; via this ROM, and back again at the end.
.l3f00 ld (OLDHL),hl ; save HL, BC and AF
ld (OLDBC),bc
push af
pop hl
ld (OLDAF),hl
ex (sp),hl
ld c,(hl)
inc hl
ld b,(hl) ; BC=inline address
inc hl
ex (sp),hl ; restack updated return address
push bc
pop hl
ld a,(BANKM)
and $ef
di
ld (BANKM),a
ld bc,$7ffd
out (c),a ; switch in ROM 0
ld a,(BANK678)
or $04
ld (BANK678),a
ld bc,$1ffd
out (c),a ; switch in ROM 2
ei
ld bc,l3f42
push bc ; stack routine address to return to ROM 1
push hl ; stack routine address to call in ROM 2
ld hl,(OLDAF) ; restore registers
push hl
pop af
ld bc,(OLDBC)
ld hl,(OLDHL)
ret ; exit to routine
; This part of the routine then returns control to ROM 1
.l3f42 push bc ; save registers
push af
ld a,(BANK678)
and $fb
di
ld (BANK678),a
ld bc,$1ffd
out (c),a ; page in ROM 0
ld a,(BANKM)
or $10
ld (BANKM),a
ld bc,$7ffd
out (c),a ; page in ROM 1
ei
pop af ; restore registers
pop bc
ret ; done!
defs $8d
; This routine is called from ROM 2 to display error messages, and
; optionally get a response
.l3ff0 jp l2187 ; go to the routine
rst $38
rst $38
rst $38
rst $38
rst $38
rst $38
rst $38
rst $38
rst $38
rst $38
rst $38
rst $38
adc a,e
| 27.78292 | 90 | 0.393577 |
ea62051fa235fd40cd0588729d1a8a034e8142f8 | 2,383 | asm | Assembly | gnu/gcc/gcc/config/alpha/vms-dwarf2.asm | ArrogantWombatics/openbsd-src | 75721e1d44322953075b7c4b89337b163a395291 | [
"BSD-3-Clause"
] | 105 | 2015-03-02T16:58:34.000Z | 2022-03-28T07:17:49.000Z | gnu/gcc/gcc/config/alpha/vms-dwarf2.asm | ArrogantWombatics/openbsd-src | 75721e1d44322953075b7c4b89337b163a395291 | [
"BSD-3-Clause"
] | 145 | 2015-03-18T10:08:17.000Z | 2022-03-31T01:27:08.000Z | gnu/gcc/gcc/config/alpha/vms-dwarf2.asm | ArrogantWombatics/openbsd-src | 75721e1d44322953075b7c4b89337b163a395291 | [
"BSD-3-Clause"
] | 26 | 2015-10-10T09:37:44.000Z | 2022-02-23T02:02:05.000Z | /* VMS dwarf2 section sequentializer.
Copyright (C) 2001 Free Software Foundation, Inc.
Contributed by Douglas B. Rupp (rupp@gnat.com).
This file is part of GCC.
GCC 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 2, or (at your option)
any later version.
In addition to the permissions in the GNU General Public License, the
Free Software Foundation gives you unlimited permission to link the
compiled version of this file into combinations with other programs,
and to distribute those combinations without any restriction coming
from the use of this file. (The General Public License restrictions
do apply in other respects; for example, they cover modification of
the file, and distribution when not linked into a combine
executable.)
GCC 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 GCC; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* Linking with this file forces Dwarf2 debug sections to be
sequentially loaded by the VMS linker, enabling GDB to read them. */
.section .debug_abbrev,NOWRT
.align 0
.globl $dwarf2.debug_abbrev
$dwarf2.debug_abbrev:
.section .debug_aranges,NOWRT
.align 0
.globl $dwarf2.debug_aranges
$dwarf2.debug_aranges:
.section .debug_frame,NOWRT
.align 0
.globl $dwarf2.debug_frame
$dwarf2.debug_frame:
.section .debug_info,NOWRT
.align 0
.globl $dwarf2.debug_info
$dwarf2.debug_info:
.section .debug_line,NOWRT
.align 0
.globl $dwarf2.debug_line
$dwarf2.debug_line:
.section .debug_loc,NOWRT
.align 0
.globl $dwarf2.debug_loc
$dwarf2.debug_loc:
.section .debug_macinfo,NOWRT
.align 0
.globl $dwarf2.debug_macinfo
$dwarf2.debug_macinfo:
.section .debug_pubnames,NOWRT
.align 0
.globl $dwarf2.debug_pubnames
$dwarf2.debug_pubnames:
.section .debug_str,NOWRT
.align 0
.globl $dwarf2.debug_str
$dwarf2.debug_str:
.section .debug_zzzzzz,NOWRT
.align 0
.globl $dwarf2.debug_zzzzzz
$dwarf2.debug_zzzzzz:
| 28.710843 | 72 | 0.769618 |
14a87390a9c2579269e56b8d54ac30fc1a9b714f | 1,114 | asm | Assembly | programs/oeis/038/A038722.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/038/A038722.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/038/A038722.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A038722: Take the sequence of natural numbers (A000027) and reverse successive subsequences of lengths 1,2,3,4,... .
; 1,3,2,6,5,4,10,9,8,7,15,14,13,12,11,21,20,19,18,17,16,28,27,26,25,24,23,22,36,35,34,33,32,31,30,29,45,44,43,42,41,40,39,38,37,55,54,53,52,51,50,49,48,47,46,66,65,64,63,62,61,60,59,58,57,56,78,77,76,75,74,73,72,71,70,69,68,67,91,90,89,88,87,86,85,84,83,82,81,80,79,105,104,103,102,101,100,99,98,97,96,95,94,93,92,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,136,135,134,133,132,131,130,129,128,127,126,125,124,123,122,121,153,152,151,150,149,148,147,146,145,144,143,142,141,140,139,138,137,171,170,169,168,167,166,165,164,163,162,161,160,159,158,157,156,155,154,190,189,188,187,186,185,184,183,182,181,180,179,178,177,176,175,174,173,172,210,209,208,207,206,205,204,203,202,201,200,199,198,197,196,195,194,193,192,191,231,230,229,228,227,226,225,224,223,222,221,220,219,218,217,216,215,214,213,212,211,253,252,251,250,249,248,247,246,245,244,243,242,241,240,239,238,237,236,235
mov $3,1
lpb $0,1
sub $0,1
add $1,1
mov $2,$0
trn $0,$1
add $3,$1
lpe
sub $1,$2
add $1,$3
| 79.571429 | 893 | 0.70018 |
5f05102f360db85916ac63430616996090f66ea0 | 1,417 | asm | Assembly | test/16_acx_anx.asm | x86128/pymesm | 4f5f2fe9ae06fd7023ef1022040774e157fd0792 | [
"MIT"
] | 2 | 2021-04-30T19:30:58.000Z | 2021-04-30T21:29:44.000Z | test/16_acx_anx.asm | x86128/pymesm | 4f5f2fe9ae06fd7023ef1022040774e157fd0792 | [
"MIT"
] | null | null | null | test/16_acx_anx.asm | x86128/pymesm | 4f5f2fe9ae06fd7023ef1022040774e157fd0792 | [
"MIT"
] | null | null | null | #
# Test for instructions ACX, ANX.
#
org 1
lbl start
ita 0
acx 0
uia fail
xta cful
acx 0
aex i48
uia fail
xta chess+1
acx im24
aex i1
uia fail
vtm -48,12
vtm 48,11
vtm ws+1,15
xta i1
lbl loop
vim nz,11
xta 0
lbl nz
atx ws
anx 0
its 11
aex 0,15
uia fail
xta ws
asn 63 # 64-1
its 11
aax i7
aox 0,15
utm -1,11
vlm loop,12
xta 0
anx cful
aex cful
uia fail
vtm 0o1001,14
ita 14 # проверка
anx cful # засылки
yta 0
aex c008u # остатка
uia fail # в РМР
lbl pass
stop 0o12345,6
lbl fail
stop 0o76543,2
#-------------------------
dorg 0o2000 # данные с адреса 2000
arr cful 0o7777777777777777
arr i1 1
arr i7 7
arr i48 0o60
arr im24 0o7777777777777750
arr c008u 0o0010000000000000
arr chess [0o5252525252525252,
0o2525252525252525]
mem ws 2
| 22.140625 | 48 | 0.374735 |
a7038e31a2d50165e1f7e334a292616e4c2c995d | 752 | asm | Assembly | oeis/324/A324648.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/324/A324648.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/324/A324648.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A324648: a(n) = n - A318458(n), where A318458(n) is bitwise-AND of n and the sum of proper divisors of n (sigma(n)-n).
; Submitted by Jamie Morken(w4)
; 1,2,2,4,4,0,6,8,9,2,10,12,12,4,6,16,16,2,18,0,20,16,22,24,25,10,18,0,28,20,30,32,32,34,34,0,36,32,38,8,40,8,42,4,12,36,46,48,49,16,34,16,52,52,38,56,40,26,58,16,60,28,22,64,64,0,66,68,68,4,70,0,72,66,74,12,76,4,78,16,81,82,82,80,64,80,86,0,88,74,74,16,92,76,70,96,96,34,66,0
mov $5,$0
add $0,1
max $2,$0
seq $2,70939 ; Length of binary representation of n.
mov $4,1
seq $5,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
sub $5,$0
lpb $2
mov $3,$0
add $3,$5
mul $3,$0
div $0,2
mod $3,2
mul $3,$4
add $1,$3
sub $2,1
mul $4,2
div $5,2
lpe
mov $0,$1
| 30.08 | 276 | 0.614362 |
14ae15fd709e5c4a8548e83a3111be1b7e74fcd6 | 367 | asm | Assembly | libsrc/_DEVELOPMENT/adt/ba_priority_queue/c/sccz80/ba_priority_queue_size.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/adt/ba_priority_queue/c/sccz80/ba_priority_queue_size.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/adt/ba_priority_queue/c/sccz80/ba_priority_queue_size.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; size_t ba_priority_queue_size(ba_priority_queue_t *q)
SECTION code_clib
SECTION code_adt_ba_priority_queue
PUBLIC ba_priority_queue_size
EXTERN asm_ba_priority_queue_size
defc ba_priority_queue_size = asm_ba_priority_queue_size
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _ba_priority_queue_size
defc _ba_priority_queue_size = ba_priority_queue_size
ENDIF
| 19.315789 | 56 | 0.880109 |
36bac58c2fd070ec269b54a2c929d84ff0cef22c | 507 | asm | Assembly | programs/oeis/003/A003063.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/003/A003063.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/003/A003063.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A003063: a(n) = 3^(n-1)-2^n.
; -1,-1,1,11,49,179,601,1931,6049,18659,57001,173051,523249,1577939,4750201,14283371,42915649,128878019,386896201,1161212891,3484687249,10456158899,31372671001,94126401611,282395982049,847221500579,2541731610601,7625329049531,22876255584049,68629303623059,205888984611001,617669101316651,1853011598917249,5559043386686339
add $0,1
mov $1,2
mov $2,6
lpb $0
sub $0,1
mul $1,2
mul $2,2
mov $3,$1
div $1,2
add $1,$3
lpe
sub $1,$2
sub $1,6
div $1,12
mul $1,2
add $1,1
| 25.35 | 321 | 0.741617 |
96daffe98c150f44b4d5e14e62a4a4b8f4d52267 | 367 | asm | Assembly | oeis/179/A179870.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/179/A179870.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/179/A179870.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A179870: a(n) = ((n-1)! * (n+1)!) ^ 2.
; Submitted by Jamie Morken(s1.)
; 4,36,2304,518400,298598400,365783040000,842764124160000,3344930808791040000,21407557176262656000000,209815467884550291456000000,3021342737537524196966400000000,61783437639904832303765913600000000
mov $1,1
lpb $0
mul $1,$0
add $0,2
mul $1,$0
sub $0,3
lpe
pow $1,2
mov $0,$1
mul $0,4
| 24.466667 | 197 | 0.73297 |
4e686f449865a83385e1b637faaefcef9be53c01 | 265 | asm | Assembly | Levels/AIZ/Misc Object Data/Map - Act 2 Boss Small.asm | NatsumiFox/AMPS-Sonic-3-Knuckles | af951b39f0ca103a905d7492448ac5245a2e8104 | [
"Apache-2.0"
] | 5 | 2021-07-09T08:17:56.000Z | 2022-02-27T19:57:47.000Z | Levels/AIZ/Misc Object Data/Map - Act 2 Boss Small.asm | NatsumiFox/AMPS-Sonic-3-Knuckles | af951b39f0ca103a905d7492448ac5245a2e8104 | [
"Apache-2.0"
] | null | null | null | Levels/AIZ/Misc Object Data/Map - Act 2 Boss Small.asm | NatsumiFox/AMPS-Sonic-3-Knuckles | af951b39f0ca103a905d7492448ac5245a2e8104 | [
"Apache-2.0"
] | null | null | null | Map_AIZ2BossSmall_:dc.w word_23C266-Map_AIZ2BossSmall_
word_23C266: dc.w 6
dc.b $E4, $E,$20,$86,$FF,$F0
dc.b $F4, 0,$20,$92,$FF,$E8
dc.b $F4, 0,$20,$93, 0,$10
dc.b $FC, $E,$20,$94,$FF,$E0
dc.b $FC, $E,$20,$A0, 0, 0
dc.b $14, $C,$20,$AC,$FF,$F0
| 29.444444 | 54 | 0.550943 |
623b89929aa044bf70e32f8a345929e2846267c9 | 831 | asm | Assembly | oeis/212/A212744.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/212/A212744.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/212/A212744.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A212744: Number of (w,x,y,z) with all terms in {0,...,n} and w=max{w,x,y,z}-min{w,x,y,z}; i.e., the range of (w,x,y,z) is its first term.
; Submitted by Simon Strandgaard
; 1,8,34,83,181,314,532,791,1177,1604,2206,2843,3709,4598,5776,6959,8497,10016,11962,13859,16261,18578,21484,24263,27721,31004,35062,38891,43597,48014,53416,58463,64609,70328,77266,83699,91477,98666,107332,115319,124921,133748,144334,154043,165661,176294,188992,200591,214417,227024,242026,255683,271909,286658,304156,320039,338857,355916,376102,394379,415981,435518,458584,479423,504001,526184,552322,575891,603637,628634,658036,684503,715609,743588,776446,805979,840637,871766,908272,941039,979441
mov $2,$0
mov $3,2
lpb $3
mov $0,$2
sub $3,1
add $0,$3
max $0,0
seq $0,309335 ; a(n) = n^3 if n odd, 7*n^3/8 if n even.
add $1,$0
lpe
mov $0,$1
| 51.9375 | 499 | 0.728039 |
6a1c598704b00aa9a0ab5d28175cbdf8993a1ba8 | 598 | asm | Assembly | oeis/005/A005557.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/005/A005557.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/005/A005557.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A005557: Number of walks on square lattice.
; 42,132,297,572,1001,1638,2548,3808,5508,7752,10659,14364,19019,24794,31878,40480,50830,63180,77805,95004,115101,138446,165416,196416,231880,272272,318087,369852,428127,493506,566618,648128,738738,839188,950257,1072764,1207569,1355574,1517724,1695008,1888460,2099160,2328235,2576860,2846259,3137706,3452526,3792096,4157846,4551260,4973877,5427292,5913157,6433182,6989136,7582848,8216208,8891168,9609743,10374012,11186119,12048274,12962754,13931904,14958138,16043940,17191865,18404540,19684665
mov $2,$0
add $0,1
add $2,10
bin $2,4
mul $0,$2
div $0,5
| 59.8 | 493 | 0.817726 |
a5a429b822888f72362e1ee3491c4bda85ad5d91 | 485 | asm | Assembly | programs/oeis/201/A201498.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/201/A201498.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/201/A201498.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A201498: a(n) = (prime(n) - 1)*(prime(n+1) - 1)/2 + 3.
; 4,7,15,33,63,99,147,201,311,423,543,723,843,969,1199,1511,1743,1983,2313,2523,2811,3201,3611,4227,4803,5103,5409,5727,6051,7059,8193,8843,9387,10215,11103,11703,12639,13449,14279,15311,16023,17103,18243,18819,19407
seq $0,40 ; The prime numbers.
seq $0,13636 ; n*nextprime(n).
mov $1,$0
seq $1,3415 ; a(n) = n' = arithmetic derivative of n: a(0) = a(1) = 0, a(prime) = 1, a(mn) = m*a(n) + n*a(m).
sub $0,$1
div $0,2
add $0,4
| 44.090909 | 216 | 0.643299 |
a7d3dd1da710d4e51a41ea45414794ac9c9dd38b | 32,034 | asm | Assembly | EngineHacks/CoreSupport/SaveData/Src/MSCore.asm | MokhaLeee/FE16re-Proto | a3bf9ea299f117de0dc90aa4b139bd4f8167418e | [
"MIT"
] | 5 | 2021-11-28T19:51:03.000Z | 2021-12-25T06:15:13.000Z | EngineHacks/CoreSupport/SaveData/Src/MSCore.asm | MokhaLeee/FE16re-Proto | a3bf9ea299f117de0dc90aa4b139bd4f8167418e | [
"MIT"
] | null | null | null | EngineHacks/CoreSupport/SaveData/Src/MSCore.asm | MokhaLeee/FE16re-Proto | a3bf9ea299f117de0dc90aa4b139bd4f8167418e | [
"MIT"
] | null | null | null | .cpu arm7tdmi
.eabi_attribute 20, 1 @ Tag_ABI_FP_denormal
.eabi_attribute 21, 1 @ Tag_ABI_FP_exceptions
.eabi_attribute 23, 3 @ Tag_ABI_FP_number_model
.eabi_attribute 24, 1 @ Tag_ABI_align8_needed
.eabi_attribute 25, 1 @ Tag_ABI_align8_preserved
.eabi_attribute 26, 1 @ Tag_ABI_enum_size
.eabi_attribute 30, 4 @ Tag_ABI_optimization_goals
.eabi_attribute 34, 0 @ Tag_CPU_unaligned_access
.eabi_attribute 18, 4 @ Tag_ABI_PCS_wchar_t
.file "MSCore.c"
@ GNU C17 (devkitARM release 56) version 11.1.0 (arm-none-eabi)
@ compiled by GNU C version 10.3.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.18-GMP
@ GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
@ options passed: -mcpu=arm7tdmi -mthumb -mthumb-interwork -mtune=arm7tdmi -mlong-calls -march=armv4t -Os -ffreestanding
.text
.align 1
.global MS_GetSaveAddressBySlot
.arch armv4t
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_GetSaveAddressBySlot, %function
MS_GetSaveAddressBySlot:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:3: void* MS_GetSaveAddressBySlot(unsigned slot) {
movs r3, r0 @ slot, tmp121
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:5: return NULL;
movs r0, #0 @ <retval>,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:4: if (slot > SAVE_BLOCK_UNK6)
cmp r3, #6 @ slot,
bhi .L1 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:7: return (void*)(0xE000000) + gSaveBlockDecl[slot].offset;
ldr r2, .L4 @ tmp117,
lsls r3, r3, #2 @ tmp118, slot,
ldrh r0, [r3, r2] @ tmp119, gSaveBlockDecl
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:7: return (void*)(0xE000000) + gSaveBlockDecl[slot].offset;
movs r3, #224 @ tmp124,
lsls r3, r3, #20 @ tmp124, tmp124,
adds r0, r0, r3 @ <retval>, tmp119, tmp124
.L1:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:8: }
@ sp needed @
bx lr
.L5:
.align 2
.L4:
.word gSaveBlockDecl
.size MS_GetSaveAddressBySlot, .-MS_GetSaveAddressBySlot
.align 1
.global MS_FindGameSaveChunk
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_FindGameSaveChunk, %function
MS_FindGameSaveChunk:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:10: const struct SaveChunkDecl* MS_FindGameSaveChunk(unsigned chunkId) {
movs r3, r0 @ chunkId, tmp122
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:11: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r2, .L10 @ tmp120,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:11: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r0, .L10+4 @ <retval>,
.L7:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:11: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldrh r1, [r0] @ MEM[(short unsigned int *)chunk_4], MEM[(short unsigned int *)chunk_4]
cmp r1, r2 @ MEM[(short unsigned int *)chunk_4], tmp120
bne .L9 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:15: return NULL;
movs r0, #0 @ <retval>,
.L6:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:16: }
@ sp needed @
bx lr
.L9:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:12: if (chunk->identifier == chunkId)
ldrh r1, [r0, #12] @ MEM[(short unsigned int *)chunk_4 + 12B], MEM[(short unsigned int *)chunk_4 + 12B]
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:12: if (chunk->identifier == chunkId)
cmp r1, r3 @ MEM[(short unsigned int *)chunk_4 + 12B], chunkId
beq .L6 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:11: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
adds r0, r0, #16 @ <retval>,
b .L7 @
.L11:
.align 2
.L10:
.word 65535
.word gGameSaveChunks
.size MS_FindGameSaveChunk, .-MS_FindGameSaveChunk
.align 1
.global MS_FindSuspendSaveChunk
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_FindSuspendSaveChunk, %function
MS_FindSuspendSaveChunk:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:18: const struct SaveChunkDecl* MS_FindSuspendSaveChunk(unsigned chunkId) {
movs r3, r0 @ chunkId, tmp122
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:19: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r2, .L16 @ tmp120,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:19: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r0, .L16+4 @ <retval>,
.L13:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:19: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldrh r1, [r0] @ MEM[(short unsigned int *)chunk_4], MEM[(short unsigned int *)chunk_4]
cmp r1, r2 @ MEM[(short unsigned int *)chunk_4], tmp120
bne .L15 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:23: return NULL;
movs r0, #0 @ <retval>,
.L12:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:24: }
@ sp needed @
bx lr
.L15:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:20: if (chunk->identifier == chunkId)
ldrh r1, [r0, #12] @ MEM[(short unsigned int *)chunk_4 + 12B], MEM[(short unsigned int *)chunk_4 + 12B]
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:20: if (chunk->identifier == chunkId)
cmp r1, r3 @ MEM[(short unsigned int *)chunk_4 + 12B], chunkId
beq .L12 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:19: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
adds r0, r0, #16 @ <retval>,
b .L13 @
.L17:
.align 2
.L16:
.word 65535
.word gSuspendSaveChunks
.size MS_FindSuspendSaveChunk, .-MS_FindSuspendSaveChunk
.align 1
.global MS_LoadChapterStateFromGameSave
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_LoadChapterStateFromGameSave, %function
MS_LoadChapterStateFromGameSave:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr} @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:27: void* const source = GetSaveSourceAddress(slot);
ldr r3, .L19 @ tmp125,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:31: }
@ sp needed @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:26: void MS_LoadChapterStateFromGameSave(unsigned slot, struct ChapterState* target) {
movs r5, r1 @ target, tmp133
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:27: void* const source = GetSaveSourceAddress(slot);
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:28: const struct SaveChunkDecl* const chunk = MS_FindGameSaveChunk(gMS_ChapterStateChunkId);
ldr r3, .L19+4 @ tmp126,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:27: void* const source = GetSaveSourceAddress(slot);
movs r4, r0 @ source, tmp134
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:28: const struct SaveChunkDecl* const chunk = MS_FindGameSaveChunk(gMS_ChapterStateChunkId);
ldrb r0, [r3] @ gMS_ChapterStateChunkId, gMS_ChapterStateChunkId
bl MS_FindGameSaveChunk @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:30: gpReadSramFast(source + chunk->offset, target, chunk->size);
ldrh r2, [r0, #2] @ tmp128,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:30: gpReadSramFast(source + chunk->offset, target, chunk->size);
ldrh r0, [r0] @ *chunk_13, *chunk_13
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:30: gpReadSramFast(source + chunk->offset, target, chunk->size);
movs r1, r5 @, target
ldr r3, .L19+8 @ tmp131,
adds r0, r4, r0 @ tmp130, source, *chunk_13
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:31: }
pop {r4, r5, r6}
pop {r0}
bx r0
.L20:
.align 2
.L19:
.word GetSaveSourceAddress
.word gMS_ChapterStateChunkId
.word gpReadSramFast
.size MS_LoadChapterStateFromGameSave, .-MS_LoadChapterStateFromGameSave
.align 1
.global MS_LoadChapterStateFromSuspendSave
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_LoadChapterStateFromSuspendSave, %function
MS_LoadChapterStateFromSuspendSave:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr} @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:34: void* const source = GetSaveSourceAddress(slot);
ldr r3, .L23 @ tmp125,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:38: }
@ sp needed @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:33: void MS_LoadChapterStateFromSuspendSave(unsigned slot, struct ChapterState* target) {
movs r5, r1 @ target, tmp133
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:34: void* const source = GetSaveSourceAddress(slot);
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:35: const struct SaveChunkDecl* const chunk = MS_FindSuspendSaveChunk(gMS_ChapterStateChunkId);
ldr r3, .L23+4 @ tmp126,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:34: void* const source = GetSaveSourceAddress(slot);
movs r4, r0 @ source, tmp134
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:35: const struct SaveChunkDecl* const chunk = MS_FindSuspendSaveChunk(gMS_ChapterStateChunkId);
ldrb r0, [r3] @ gMS_ChapterStateChunkId, gMS_ChapterStateChunkId
bl MS_FindSuspendSaveChunk @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:37: gpReadSramFast(source + chunk->offset, target, chunk->size);
ldrh r2, [r0, #2] @ tmp128,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:37: gpReadSramFast(source + chunk->offset, target, chunk->size);
ldrh r0, [r0] @ *chunk_13, *chunk_13
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:37: gpReadSramFast(source + chunk->offset, target, chunk->size);
movs r1, r5 @, target
ldr r3, .L23+8 @ tmp131,
adds r0, r4, r0 @ tmp130, source, *chunk_13
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:38: }
pop {r4, r5, r6}
pop {r0}
bx r0
.L24:
.align 2
.L23:
.word GetSaveSourceAddress
.word gMS_ChapterStateChunkId
.word gpReadSramFast
.size MS_LoadChapterStateFromSuspendSave, .-MS_LoadChapterStateFromSuspendSave
.align 1
.global MS_GetClaimFlagsFromGameSave
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_GetClaimFlagsFromGameSave, %function
MS_GetClaimFlagsFromGameSave:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 0, uses_anonymous_args = 0
push {r0, r1, r4, lr} @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:43: void* const source = GetSaveSourceAddress(slot);
ldr r3, .L26 @ tmp123,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:49: }
@ sp needed @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:43: void* const source = GetSaveSourceAddress(slot);
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:44: const struct SaveChunkDecl* const chunk = MS_FindGameSaveChunk(gMS_ClaimFlagsChunkId);
ldr r3, .L26+4 @ tmp124,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:43: void* const source = GetSaveSourceAddress(slot);
movs r4, r0 @ source, tmp132
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:44: const struct SaveChunkDecl* const chunk = MS_FindGameSaveChunk(gMS_ClaimFlagsChunkId);
ldrb r0, [r3] @ gMS_ClaimFlagsChunkId, gMS_ClaimFlagsChunkId
bl MS_FindGameSaveChunk @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:46: gpReadSramFast(source + chunk->offset, &buf, 4);
ldrh r0, [r0] @ *chunk_11, *chunk_11
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:46: gpReadSramFast(source + chunk->offset, &buf, 4);
movs r2, #4 @,
ldr r3, .L26+8 @ tmp129,
adds r0, r4, r0 @ tmp128, source, *chunk_11
add r1, sp, #4 @,,
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:48: return buf;
ldr r0, [sp, #4] @ <retval>, buf
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:49: }
pop {r1, r2, r4}
pop {r1}
bx r1
.L27:
.align 2
.L26:
.word GetSaveSourceAddress
.word gMS_ClaimFlagsChunkId
.word gpReadSramFast
.size MS_GetClaimFlagsFromGameSave, .-MS_GetClaimFlagsFromGameSave
.align 1
.global MS_LoadWMDataFromGameSave
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_LoadWMDataFromGameSave, %function
MS_LoadWMDataFromGameSave:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr} @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:53: void* const source = GetSaveSourceAddress(slot);
ldr r3, .L29 @ tmp123,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:57: }
@ sp needed @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:52: void MS_LoadWMDataFromGameSave(unsigned slot, void* target) {
movs r5, r1 @ target, tmp130
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:53: void* const source = GetSaveSourceAddress(slot);
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:54: const struct SaveChunkDecl* const chunk = MS_FindGameSaveChunk(gMS_WMDataChunkId);
ldr r3, .L29+4 @ tmp124,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:53: void* const source = GetSaveSourceAddress(slot);
movs r4, r0 @ source, tmp131
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:54: const struct SaveChunkDecl* const chunk = MS_FindGameSaveChunk(gMS_WMDataChunkId);
ldrb r0, [r3] @ gMS_WMDataChunkId, gMS_WMDataChunkId
bl MS_FindGameSaveChunk @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:56: LoadWMStuff(source + chunk->offset, target);
ldrh r0, [r0] @ *chunk_11, *chunk_11
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:56: LoadWMStuff(source + chunk->offset, target);
movs r1, r5 @, target
ldr r3, .L29+8 @ tmp128,
adds r0, r4, r0 @ tmp127, source, *chunk_11
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:57: }
pop {r4, r5, r6}
pop {r0}
bx r0
.L30:
.align 2
.L29:
.word GetSaveSourceAddress
.word gMS_WMDataChunkId
.word LoadWMStuff
.size MS_LoadWMDataFromGameSave, .-MS_LoadWMDataFromGameSave
.align 1
.global MS_CheckEid8AFromGameSave
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_CheckEid8AFromGameSave, %function
MS_CheckEid8AFromGameSave:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr} @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:60: void* const source = GetSaveSourceAddress(slot);
ldr r3, .L32 @ tmp126,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:66: }
@ sp needed @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:60: void* const source = GetSaveSourceAddress(slot);
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:61: const struct SaveChunkDecl* const chunk = MS_FindGameSaveChunk(gMS_PermanentEidsChunkId);
ldr r3, .L32+4 @ tmp127,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:60: void* const source = GetSaveSourceAddress(slot);
movs r4, r0 @ source, tmp140
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:61: const struct SaveChunkDecl* const chunk = MS_FindGameSaveChunk(gMS_PermanentEidsChunkId);
ldrb r0, [r3] @ gMS_PermanentEidsChunkId, gMS_PermanentEidsChunkId
bl MS_FindGameSaveChunk @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:64: gpReadSramFast(source + chunk->offset, gGenericBuffer, chunk->size);
ldr r5, .L32+8 @ tmp130,
ldrh r2, [r0, #2] @ tmp129,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:64: gpReadSramFast(source + chunk->offset, gGenericBuffer, chunk->size);
ldrh r0, [r0] @ *chunk_14, *chunk_14
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:64: gpReadSramFast(source + chunk->offset, gGenericBuffer, chunk->size);
movs r1, r5 @, tmp130
ldr r3, .L32+12 @ tmp133,
adds r0, r4, r0 @ tmp132, source, *chunk_14
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:65: return ((u8(*)(unsigned eid, void* buf))(0x08083D34+1))(0x8A, gGenericBuffer);
movs r1, r5 @, tmp130
ldr r3, .L32+16 @ tmp135,
movs r0, #138 @,
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:66: }
pop {r4, r5, r6}
pop {r1}
bx r1
.L33:
.align 2
.L32:
.word GetSaveSourceAddress
.word gMS_PermanentEidsChunkId
.word gGenericBuffer
.word gpReadSramFast
.word 134757685
.size MS_CheckEid8AFromGameSave, .-MS_CheckEid8AFromGameSave
.align 1
.global MS_CopyGameSave
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_CopyGameSave, %function
MS_CopyGameSave:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 24
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, r7, lr} @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:69: void* const source = GetSaveSourceAddress(sourceSlot);
ldr r3, .L35 @ tmp119,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:68: void MS_CopyGameSave(int sourceSlot, int targetSlot) {
sub sp, sp, #28 @,,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:68: void MS_CopyGameSave(int sourceSlot, int targetSlot) {
movs r4, r1 @ targetSlot, tmp134
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:69: void* const source = GetSaveSourceAddress(sourceSlot);
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:70: void* const target = GetSaveTargetAddress(targetSlot);
ldr r3, .L35+4 @ tmp120,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:69: void* const source = GetSaveSourceAddress(sourceSlot);
movs r6, r0 @ source, tmp135
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:70: void* const target = GetSaveTargetAddress(targetSlot);
movs r0, r4 @, targetSlot
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:72: unsigned size = gSaveBlockTypeSizeLookup[SAVE_TYPE_GAME];
ldr r3, .L35+8 @ tmp121,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:74: gpReadSramFast(source, gGenericBuffer, size);
ldr r5, .L35+12 @ tmp122,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:72: unsigned size = gSaveBlockTypeSizeLookup[SAVE_TYPE_GAME];
ldrh r7, [r3] @ size, gSaveBlockTypeSizeLookup
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:74: gpReadSramFast(source, gGenericBuffer, size);
movs r1, r5 @, tmp122
movs r2, r7 @, size
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:70: void* const target = GetSaveTargetAddress(targetSlot);
str r0, [sp, #4] @ tmp136, %sfp
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:74: gpReadSramFast(source, gGenericBuffer, size);
ldr r3, .L35+16 @ tmp123,
movs r0, r6 @, source
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:75: WriteAndVerifySramFast(gGenericBuffer, target, size);
movs r2, r7 @, size
ldr r1, [sp, #4] @, %sfp
movs r0, r5 @, tmp122
ldr r3, .L35+20 @ tmp125,
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:79: sbm.magic1 = SBM_MAGIC1_GAME;
ldr r3, .L35+24 @ tmp127,
str r3, [sp, #8] @ tmp127, sbm.magic1
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:80: sbm.type = SAVE_TYPE_GAME;
movs r3, #0 @ tmp129,
add r2, sp, #8 @ tmp139,,
strb r3, [r2, #6] @ tmp129, sbm.type
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:82: SaveMetadata_Save(&sbm, targetSlot);
movs r1, r4 @, targetSlot
movs r0, r2 @, tmp139
ldr r3, .L35+28 @ tmp132,
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:83: }
add sp, sp, #28 @,,
@ sp needed @
pop {r4, r5, r6, r7}
pop {r0}
bx r0
.L36:
.align 2
.L35:
.word GetSaveSourceAddress
.word GetSaveTargetAddress
.word gSaveBlockTypeSizeLookup
.word gGenericBuffer
.word gpReadSramFast
.word WriteAndVerifySramFast
.word 263716
.word SaveMetadata_Save
.size MS_CopyGameSave, .-MS_CopyGameSave
.align 1
.global MS_SaveGame
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_SaveGame, %function
MS_SaveGame:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 16
@ frame_needed = 0, uses_anonymous_args = 0
push {r0, r1, r2, r3, r4, r5, r6, lr} @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:86: void* const base = GetSaveTargetAddress(slot);
ldr r3, .L44 @ tmp124,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:85: void MS_SaveGame(unsigned slot) {
movs r4, r0 @ slot.10_1, tmp139
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:86: void* const base = GetSaveTargetAddress(slot);
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:89: ClearSaveBlock(SAVE_BLOCK_SUSPEND);
ldr r3, .L44+4 @ tmp125,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:86: void* const base = GetSaveTargetAddress(slot);
movs r6, r0 @ base, tmp140
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:89: ClearSaveBlock(SAVE_BLOCK_SUSPEND);
movs r0, #3 @,
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:92: gChapterData.saveSlotIndex = slot;
ldr r3, .L44+8 @ tmp126,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:95: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r5, .L44+12 @ chunk,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:92: gChapterData.saveSlotIndex = slot;
strb r4, [r3, #12] @ slot.10_1, gChapterData.saveSlotIndex
.L38:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:95: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldrh r0, [r5] @ _8, MEM[(short unsigned int *)chunk_9]
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:95: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r3, .L44+16 @ tmp130,
cmp r0, r3 @ _8, tmp130
bne .L40 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:110: }
@ sp needed @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:103: sbm.magic1 = SBM_MAGIC1_GAME;
ldr r3, .L44+20 @ tmp132,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:104: sbm.type = SAVE_TYPE_GAME;
mov r2, sp @ tmp142,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:103: sbm.magic1 = SBM_MAGIC1_GAME;
str r3, [sp] @ tmp132, sbm.magic1
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:104: sbm.type = SAVE_TYPE_GAME;
movs r3, #0 @ tmp134,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:106: SaveMetadata_Save(&sbm, slot);
movs r1, r4 @, slot.10_1
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:104: sbm.type = SAVE_TYPE_GAME;
strb r3, [r2, #6] @ tmp134, sbm.type
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:106: SaveMetadata_Save(&sbm, slot);
mov r0, sp @,
ldr r3, .L44+24 @ tmp137,
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:109: UpdateLastUsedGameSaveSlot(slot);
movs r0, r4 @, slot.10_1
ldr r3, .L44+28 @ tmp138,
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:110: }
pop {r0, r1, r2, r3, r4, r5, r6}
pop {r0}
bx r0
.L40:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:96: if (chunk->save)
ldr r3, [r5, #4] @ _3, MEM[(void (*<T5d9>) (void *, unsigned int) *)chunk_9 + 4B]
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:96: if (chunk->save)
cmp r3, #0 @ _3,
beq .L39 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:97: chunk->save(base + chunk->offset, chunk->size);
ldrh r1, [r5, #2] @ MEM[(short unsigned int *)chunk_9 + 2B], MEM[(short unsigned int *)chunk_9 + 2B]
adds r0, r6, r0 @ tmp129, base, _8
bl .L21 @
.L39:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:95: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
adds r5, r5, #16 @ chunk,
b .L38 @
.L45:
.align 2
.L44:
.word GetSaveTargetAddress
.word ClearSaveBlock
.word gChapterData
.word gGameSaveChunks
.word 65535
.word 263716
.word SaveMetadata_Save
.word UpdateLastUsedGameSaveSlot
.size MS_SaveGame, .-MS_SaveGame
.align 1
.global MS_LoadGame
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_LoadGame, %function
MS_LoadGame:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr} @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:113: void* const base = GetSaveSourceAddress(slot);
ldr r3, .L55 @ tmp125,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:112: void MS_LoadGame(unsigned slot) {
movs r5, r0 @ slot.13_1, tmp139
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:113: void* const base = GetSaveSourceAddress(slot);
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:115: if (!(gChapterData.chapterStateBits & 0x40))
ldr r3, .L55+4 @ tmp126,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:115: if (!(gChapterData.chapterStateBits & 0x40))
ldrb r3, [r3, #20] @ tmp128,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:113: void* const base = GetSaveSourceAddress(slot);
movs r6, r0 @ base, tmp140
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:115: if (!(gChapterData.chapterStateBits & 0x40))
lsls r3, r3, #25 @ tmp141, tmp128,
bmi .L47 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:117: ClearSaveBlock(SAVE_BLOCK_SUSPEND);
movs r0, #3 @,
ldr r3, .L55+8 @ tmp134,
bl .L21 @
.L47:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:112: void MS_LoadGame(unsigned slot) {
ldr r4, .L55+12 @ chunk,
.L48:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:120: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldrh r0, [r4] @ _8, MEM[(short unsigned int *)chunk_10]
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:120: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r3, .L55+16 @ tmp137,
cmp r0, r3 @ _8, tmp137
bne .L50 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:126: }
@ sp needed @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:125: UpdateLastUsedGameSaveSlot(slot);
movs r0, r5 @, slot.13_1
ldr r3, .L55+20 @ tmp138,
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:126: }
pop {r4, r5, r6}
pop {r0}
bx r0
.L50:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:121: if (chunk->load)
ldr r3, [r4, #8] @ _3, MEM[(void (*<T5d9>) (void *, unsigned int) *)chunk_10 + 8B]
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:121: if (chunk->load)
cmp r3, #0 @ _3,
beq .L49 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:122: chunk->load(base + chunk->offset, chunk->size);
ldrh r1, [r4, #2] @ MEM[(short unsigned int *)chunk_10 + 2B], MEM[(short unsigned int *)chunk_10 + 2B]
adds r0, r6, r0 @ tmp136, base, _8
bl .L21 @
.L49:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:120: for (const struct SaveChunkDecl* chunk = gGameSaveChunks; chunk->offset != 0xFFFF; ++chunk)
adds r4, r4, #16 @ chunk,
b .L48 @
.L56:
.align 2
.L55:
.word GetSaveSourceAddress
.word gChapterData
.word ClearSaveBlock
.word gGameSaveChunks
.word 65535
.word UpdateLastUsedGameSaveSlot
.size MS_LoadGame, .-MS_LoadGame
.align 1
.global MS_SaveSuspend
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_SaveSuspend, %function
MS_SaveSuspend:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 16
@ frame_needed = 0, uses_anonymous_args = 0
push {r0, r1, r2, r3, r4, r5, r6, lr} @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:129: if (gChapterData.chapterStateBits & 8)
ldr r3, .L70 @ tmp126,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:129: if (gChapterData.chapterStateBits & 8)
ldrb r3, [r3, #20] @ tmp128,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:128: void MS_SaveSuspend(unsigned slot) {
movs r5, r0 @ slot, tmp146
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:129: if (gChapterData.chapterStateBits & 8)
lsls r3, r3, #28 @ tmp149, tmp128,
bmi .L57 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:132: if (!IsSramWorking())
ldr r3, .L70+4 @ tmp134,
bl .L21 @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:132: if (!IsSramWorking())
cmp r0, #0 @ tmp147,
beq .L57 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:135: void* const base = GetSaveTargetAddress(slot);
movs r0, r5 @, slot
ldr r3, .L70+8 @ tmp135,
bl .L21 @
movs r6, r0 @ base, tmp148
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:138: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r4, .L70+12 @ chunk,
.L59:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:138: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldrh r0, [r4] @ _9, MEM[(short unsigned int *)chunk_10]
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:138: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r3, .L70+16 @ tmp138,
cmp r0, r3 @ _9, tmp138
bne .L61 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:146: sbm.magic1 = SBM_MAGIC1_GAME;
ldr r3, .L70+20 @ tmp140,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:147: sbm.type = SAVE_TYPE_SUSPEND;
mov r2, sp @ tmp151,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:146: sbm.magic1 = SBM_MAGIC1_GAME;
str r3, [sp] @ tmp140, sbm.magic1
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:147: sbm.type = SAVE_TYPE_SUSPEND;
movs r3, #1 @ tmp142,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:149: SaveMetadata_Save(&sbm, slot);
movs r1, r5 @, slot
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:147: sbm.type = SAVE_TYPE_SUSPEND;
strb r3, [r2, #6] @ tmp142, sbm.type
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:149: SaveMetadata_Save(&sbm, slot);
mov r0, sp @,
ldr r3, .L70+24 @ tmp145,
bl .L21 @
.L57:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:150: }
@ sp needed @
pop {r0, r1, r2, r3, r4, r5, r6}
pop {r0}
bx r0
.L61:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:139: if (chunk->save)
ldr r3, [r4, #4] @ _4, MEM[(void (*<T5d9>) (void *, unsigned int) *)chunk_10 + 4B]
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:139: if (chunk->save)
cmp r3, #0 @ _4,
beq .L60 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:140: chunk->save(base + chunk->offset, chunk->size);
ldrh r1, [r4, #2] @ MEM[(short unsigned int *)chunk_10 + 2B], MEM[(short unsigned int *)chunk_10 + 2B]
adds r0, r6, r0 @ tmp137, base, _9
bl .L21 @
.L60:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:138: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
adds r4, r4, #16 @ chunk,
b .L59 @
.L71:
.align 2
.L70:
.word gChapterData
.word IsSramWorking
.word GetSaveTargetAddress
.word gSuspendSaveChunks
.word 65535
.word 263716
.word SaveMetadata_Save
.size MS_SaveSuspend, .-MS_SaveSuspend
.align 1
.global MS_LoadSuspend
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type MS_LoadSuspend, %function
MS_LoadSuspend:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr} @
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:153: void* const base = GetSaveSourceAddress(slot);
ldr r3, .L79 @ tmp123,
bl .L21 @
movs r5, r0 @ base, tmp128
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:155: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r4, .L79+4 @ chunk,
.L73:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:155: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldrh r0, [r4] @ _7, MEM[(short unsigned int *)chunk_8]
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:155: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
ldr r3, .L79+8 @ tmp126,
cmp r0, r3 @ _7, tmp126
bne .L75 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:158: }
@ sp needed @
pop {r4, r5, r6}
pop {r0}
bx r0
.L75:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:156: if (chunk->load)
ldr r3, [r4, #8] @ _2, MEM[(void (*<T5d9>) (void *, unsigned int) *)chunk_8 + 8B]
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:156: if (chunk->load)
cmp r3, #0 @ _2,
beq .L74 @,
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:157: chunk->load(base + chunk->offset, chunk->size);
ldrh r1, [r4, #2] @ MEM[(short unsigned int *)chunk_8 + 2B], MEM[(short unsigned int *)chunk_8 + 2B]
adds r0, r5, r0 @ tmp125, base, _7
bl .L21 @
.L74:
@ CoreSupport/ExpandedModularSave/Src/MSCore.c:155: for (const struct SaveChunkDecl* chunk = gSuspendSaveChunks; chunk->offset != 0xFFFF; ++chunk)
adds r4, r4, #16 @ chunk,
b .L73 @
.L80:
.align 2
.L79:
.word GetSaveSourceAddress
.word gSuspendSaveChunks
.word 65535
.size MS_LoadSuspend, .-MS_LoadSuspend
.ident "GCC: (devkitARM release 56) 11.1.0"
.code 16
.align 1
.L21:
bx r3
| 41.710938 | 147 | 0.736468 |
e263f9882b50a1b00706956368d62a19f3f37e19 | 2,513 | asm | Assembly | igzip/bitbuf2.asm | tipabu/isa-l | abb6bd3ee8665db76c5da1a2f64952e8e3dfb391 | [
"BSD-3-Clause"
] | 17 | 2019-01-30T23:44:08.000Z | 2021-08-13T09:39:21.000Z | igzip/bitbuf2.asm | tipabu/isa-l | abb6bd3ee8665db76c5da1a2f64952e8e3dfb391 | [
"BSD-3-Clause"
] | 1 | 2019-02-19T12:09:33.000Z | 2019-02-19T12:09:33.000Z | igzip/bitbuf2.asm | tipabu/isa-l | abb6bd3ee8665db76c5da1a2f64952e8e3dfb391 | [
"BSD-3-Clause"
] | 9 | 2019-02-04T09:12:33.000Z | 2021-11-14T23:06:47.000Z | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2011-2016 Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in
; the documentation and/or other materials provided with the
; distribution.
; * Neither the name of Intel Corporation nor the names of its
; contributors may be used to endorse or promote products derived
; from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
; LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
; DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
; THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
%include "options.asm"
; Assumes m_out_buf is a register
; Clobbers RCX
; code is clobbered
; write_bits_always m_bits, m_bit_count, code, count, m_out_buf
%macro write_bits 5
%define %%m_bits %1
%define %%m_bit_count %2
%define %%code %3
%define %%count %4
%define %%m_out_buf %5
%ifdef USE_HSWNI
shlx %%code, %%code, %%m_bit_count
%else
mov rcx, %%m_bit_count
shl %%code, cl
%endif
or %%m_bits, %%code
add %%m_bit_count, %%count
mov [%%m_out_buf], %%m_bits
mov rcx, %%m_bit_count
shr rcx, 3 ; rcx = bytes
add %%m_out_buf, rcx
shl rcx, 3 ; rcx = bits
sub %%m_bit_count, rcx
%ifdef USE_HSWNI
shrx %%m_bits, %%m_bits, rcx
%else
shr %%m_bits, cl
%endif
%endm
%macro write_dword 2
%define %%data %1d
%define %%addr %2
mov [%%addr], %%data
add %%addr, 4
%endm
| 35.394366 | 72 | 0.693195 |
c23c86748d554d204599e3a322975332c8c79c65 | 443 | asm | Assembly | Palmtree.Math.Core.Sint/vs_build/x86_Release/pmc_divrem.asm | rougemeilland/Palmtree.Math.Core.Sint | 0895fd4988b146f01ec705e091ef3fd79a721b40 | [
"MIT"
] | null | null | null | Palmtree.Math.Core.Sint/vs_build/x86_Release/pmc_divrem.asm | rougemeilland/Palmtree.Math.Core.Sint | 0895fd4988b146f01ec705e091ef3fd79a721b40 | [
"MIT"
] | null | null | null | Palmtree.Math.Core.Sint/vs_build/x86_Release/pmc_divrem.asm | rougemeilland/Palmtree.Math.Core.Sint | 0895fd4988b146f01ec705e091ef3fd79a721b40 | [
"MIT"
] | null | null | null | ; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1
TITLE z:\sources\lunor\repos\rougemeilland\palmtree.math.core.sint\palmtree.math.core.sint\pmc_divrem.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB OLDNAMES
PUBLIC _PMC_DivRem_X_X@16
PUBLIC _PMC_DivRem_X_UX@16
PUBLIC _PMC_DivRem_X_L@20
PUBLIC _PMC_DivRem_X_I@16
PUBLIC _PMC_DivRem_UX_X@16
PUBLIC _PMC_DivRem_L_X@20
PUBLIC _PMC_DivRem_I_X@16
END
| 23.315789 | 104 | 0.828442 |
08313c3f4ed8957c404ab5aef194b2020d507dcb | 310 | asm | Assembly | programs/oeis/021/A021290.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/021/A021290.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/021/A021290.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A021290: Decimal expansion of 1/286.
; 0,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3,4,9,6,5,0,3
add $0,1
mov $1,10
pow $1,$0
mul $1,6
div $1,1716
mod $1,10
mov $0,$1
| 28.181818 | 199 | 0.541935 |
1eb7a03d3fda53b5ceb6bac07df6f295230e323f | 609 | asm | Assembly | oeis/151/A151817.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/151/A151817.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/151/A151817.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A151817: a(n) = 2*(2*n)!/n!.
; 2,4,24,240,3360,60480,1330560,34594560,1037836800,35286451200,1340885145600,56317176115200,2590590101299200,129529505064960000,6994593273507840000,405686409863454720000,25152557411534192640000,1660068789161256714240000,116204815241287969996800000,8599156327855309779763200000,670734193572714162821529600000,55000203872962561351365427200000,4730017533074780276217426739200000,425701577976730224859568406528000000,40015948329812641136799430213632000000,3921562936321638831406344160935936000000
mov $1,1
mov $2,$0
lpb $0
sub $0,1
add $2,1
mul $1,$2
lpe
mul $1,2
mov $0,$1
| 46.846154 | 493 | 0.855501 |
757bf6a9a36ade33f36cc7fcb3c84f32bacb7594 | 13,913 | asm | Assembly | codec/decoder/core/asm/mc_luma.asm | TechSmith/openh264 | 5d616714c4cdd30287e2c6a8aa485c2fc6c68b84 | [
"BSD-2-Clause"
] | 1 | 2016-12-06T07:56:36.000Z | 2016-12-06T07:56:36.000Z | codec/decoder/core/asm/mc_luma.asm | 3990995/openh264 | f2aa3c75ae8a3d41ef85be739752d3f189c7eea3 | [
"BSD-2-Clause"
] | null | null | null | codec/decoder/core/asm/mc_luma.asm | 3990995/openh264 | f2aa3c75ae8a3d41ef85be739752d3f189c7eea3 | [
"BSD-2-Clause"
] | null | null | null | ;*!
;* \copy
;* Copyright (c) 2009-2013, Cisco Systems
;* All rights reserved.
;*
;* Redistribution and use in source and binary forms, with or without
;* modification, are permitted provided that the following conditions
;* are met:
;*
;* * Redistributions of source code must retain the above copyright
;* notice, this list of conditions and the following disclaimer.
;*
;* * Redistributions in binary form must reproduce the above copyright
;* notice, this list of conditions and the following disclaimer in
;* the documentation and/or other materials provided with the
;* distribution.
;*
;* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
;* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
;* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
;* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
;* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
;* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
;* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
;* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
;* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
;* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
;* POSSIBILITY OF SUCH DAMAGE.
;*
;*
;* mc_luma.asm
;*
;* Abstract
;* sse2 motion compensation
;*
;* History
;* 17/08/2009 Created
;*
;*
;*************************************************************************/
%include "asm_inc.asm"
BITS 32
;*******************************************************************************
; Local Data (Read Only)
;*******************************************************************************
SECTION .rodata align=16
;*******************************************************************************
; Various memory constants (trigonometric values or rounding values)
;*******************************************************************************
ALIGN 16
h264_w0x10:
dw 16, 16, 16, 16
;*******************************************************************************
; Code
;*******************************************************************************
SECTION .text
WELS_EXTERN McHorVer20WidthEq4_mmx
ALIGN 16
;*******************************************************************************
; void_t McHorVer20WidthEq4_mmx( uint8_t *pSrc,
; int iSrcStride,
; uint8_t *pDst,
; int iDstStride,
; int iHeight)
;*******************************************************************************
McHorVer20WidthEq4_mmx:
push esi
push edi
mov esi, [esp+12]
mov eax, [esp+16]
mov edi, [esp+20]
mov ecx, [esp+24]
mov edx, [esp+28]
sub esi, 2
WELS_Zero mm7
movq mm6, [h264_w0x10]
.height_loop:
movd mm0, [esi]
punpcklbw mm0, mm7
movd mm1, [esi+5]
punpcklbw mm1, mm7
movd mm2, [esi+1]
punpcklbw mm2, mm7
movd mm3, [esi+4]
punpcklbw mm3, mm7
movd mm4, [esi+2]
punpcklbw mm4, mm7
movd mm5, [esi+3]
punpcklbw mm5, mm7
paddw mm2, mm3
paddw mm4, mm5
psllw mm4, 2
psubw mm4, mm2
paddw mm0, mm1
paddw mm0, mm4
psllw mm4, 2
paddw mm0, mm4
paddw mm0, mm6
psraw mm0, 5
packuswb mm0, mm7
movd [edi], mm0
add esi, eax
add edi, ecx
dec edx
jnz .height_loop
WELSEMMS
pop edi
pop esi
ret
;*******************************************************************************
; Macros and other preprocessor constants
;*******************************************************************************
%macro SSE_LOAD_8P 3
movq %1, %3
punpcklbw %1, %2
%endmacro
%macro FILTER_HV_W8 9
paddw %1, %6
movdqa %8, %3
movdqa %7, %2
paddw %1, [h264_w0x10_1]
paddw %8, %4
paddw %7, %5
psllw %8, 2
psubw %8, %7
paddw %1, %8
psllw %8, 2
paddw %1, %8
psraw %1, 5
WELS_Zero %8
packuswb %1, %8
movq %9, %1
%endmacro
;*******************************************************************************
; Local Data (Read Only)
;*******************************************************************************
SECTION .rodata align=16
;*******************************************************************************
; Various memory constants (trigonometric values or rounding values)
;*******************************************************************************
ALIGN 16
h264_w0x10_1:
dw 16, 16, 16, 16, 16, 16, 16, 16
ALIGN 16
h264_mc_hc_32:
dw 32, 32, 32, 32, 32, 32, 32, 32
;*******************************************************************************
; Code
;*******************************************************************************
SECTION .text
WELS_EXTERN McHorVer22Width8HorFirst_sse2
WELS_EXTERN McHorVer22VerLast_sse2
WELS_EXTERN McHorVer02WidthEq8_sse2
WELS_EXTERN McHorVer20WidthEq8_sse2
WELS_EXTERN McHorVer20WidthEq16_sse2
ALIGN 16
;***********************************************************************
; void_t McHorVer22Width8HorFirst_sse2(int16_t *pSrc,
; int16_t iSrcStride,
; uint8_t *pDst,
; int32_t iDstStride
; int32_t iHeight
; )
;***********************************************************************
McHorVer22Width8HorFirst_sse2:
push esi
push edi
push ebx
mov esi, [esp+16] ;pSrc
mov eax, [esp+20] ;iSrcStride
mov edi, [esp+24] ;pDst
mov edx, [esp+28] ;iDstStride
mov ebx, [esp+32] ;iHeight
pxor xmm7, xmm7
sub esi, eax ;;;;;;;;need more 5 lines.
sub esi, eax
.yloop_width_8:
movq xmm0, [esi]
punpcklbw xmm0, xmm7
movq xmm1, [esi+5]
punpcklbw xmm1, xmm7
movq xmm2, [esi+1]
punpcklbw xmm2, xmm7
movq xmm3, [esi+4]
punpcklbw xmm3, xmm7
movq xmm4, [esi+2]
punpcklbw xmm4, xmm7
movq xmm5, [esi+3]
punpcklbw xmm5, xmm7
paddw xmm2, xmm3
paddw xmm4, xmm5
psllw xmm4, 2
psubw xmm4, xmm2
paddw xmm0, xmm1
paddw xmm0, xmm4
psllw xmm4, 2
paddw xmm0, xmm4
movdqa [edi], xmm0
add esi, eax
add edi, edx
dec ebx
jnz .yloop_width_8
pop ebx
pop edi
pop esi
ret
ALIGN 16
;***********************************************************************
;void_t McHorVer22VerLast_sse2(
; uint8_t *pSrc,
; int32_t pSrcStride,
; uint8_t * pDst,
; int32_t iDstStride,
; int32_t iWidth,
; int32_t iHeight);
;***********************************************************************
%macro FILTER_VER 9
paddw %1, %6
movdqa %7, %2
movdqa %8, %3
paddw %7, %5
paddw %8, %4
psubw %1, %7
psraw %1, 2
paddw %1, %8
psubw %1, %7
psraw %1, 2
paddw %8, %1
paddw %8, [h264_mc_hc_32]
psraw %8, 6
packuswb %8, %8
movq %9, %8
%endmacro
McHorVer22VerLast_sse2:
push esi
push edi
push ebx
push ebp
mov esi, [esp+20]
mov eax, [esp+24]
mov edi, [esp+28]
mov edx, [esp+32]
mov ebx, [esp+36]
mov ecx, [esp+40]
shr ebx, 3
.width_loop:
movdqa xmm0, [esi]
movdqa xmm1, [esi+eax]
lea esi, [esi+2*eax]
movdqa xmm2, [esi]
movdqa xmm3, [esi+eax]
lea esi, [esi+2*eax]
movdqa xmm4, [esi]
movdqa xmm5, [esi+eax]
FILTER_VER xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, [edi]
dec ecx
lea esi, [esi+2*eax]
movdqa xmm6, [esi]
movdqa xmm0, xmm1
movdqa xmm1, xmm2
movdqa xmm2, xmm3
movdqa xmm3, xmm4
movdqa xmm4, xmm5
movdqa xmm5, xmm6
add edi, edx
sub esi, eax
.start:
FILTER_VER xmm0,xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, [edi]
dec ecx
jz near .x_loop_dec
lea esi, [esi+2*eax]
movdqa xmm6, [esi]
FILTER_VER xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0,[edi+edx]
dec ecx
jz near .x_loop_dec
lea edi, [edi+2*edx]
movdqa xmm7, [esi+eax]
FILTER_VER xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, [edi]
dec ecx
jz near .x_loop_dec
lea esi, [esi+2*eax]
movdqa xmm0, [esi]
FILTER_VER xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2,[edi+edx]
dec ecx
jz near .x_loop_dec
lea edi, [edi+2*edx]
movdqa xmm1, [esi+eax]
FILTER_VER xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3,[edi]
dec ecx
jz near .x_loop_dec
lea esi, [esi+2*eax]
movdqa xmm2, [esi]
FILTER_VER xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3,xmm4,[edi+edx]
dec ecx
jz near .x_loop_dec
lea edi, [edi+2*edx]
movdqa xmm3, [esi+eax]
FILTER_VER xmm6, xmm7, xmm0, xmm1, xmm2, xmm3,xmm4,xmm5,[edi]
dec ecx
jz near .x_loop_dec
lea esi, [esi+2*eax]
movdqa xmm4, [esi]
FILTER_VER xmm7, xmm0, xmm1, xmm2, xmm3,xmm4,xmm5,xmm6, [edi+edx]
dec ecx
jz near .x_loop_dec
lea edi, [edi+2*edx]
movdqa xmm5, [esi+eax]
jmp near .start
.x_loop_dec:
dec ebx
jz near .exit
mov esi, [esp+20]
mov edi, [esp+28]
mov ecx, [esp+40]
add esi, 16
add edi, 8
jmp .width_loop
.exit:
pop ebp
pop ebx
pop edi
pop esi
ret
ALIGN 16
;*******************************************************************************
; void_t McHorVer20WidthEq8_sse2( uint8_t *pSrc,
; int iSrcStride,
; uint8_t *pDst,
; int iDstStride,
; int iHeight,
; );
;*******************************************************************************
McHorVer20WidthEq8_sse2:
push esi
push edi
mov esi, [esp + 12] ;pSrc
mov eax, [esp + 16] ;iSrcStride
mov edi, [esp + 20] ;pDst
mov ecx, [esp + 28] ;iHeight
mov edx, [esp + 24] ;iDstStride
lea esi, [esi-2] ;pSrc -= 2;
pxor xmm7, xmm7
movdqa xmm6, [h264_w0x10_1]
.y_loop:
movq xmm0, [esi]
punpcklbw xmm0, xmm7
movq xmm1, [esi+5]
punpcklbw xmm1, xmm7
movq xmm2, [esi+1]
punpcklbw xmm2, xmm7
movq xmm3, [esi+4]
punpcklbw xmm3, xmm7
movq xmm4, [esi+2]
punpcklbw xmm4, xmm7
movq xmm5, [esi+3]
punpcklbw xmm5, xmm7
paddw xmm2, xmm3
paddw xmm4, xmm5
psllw xmm4, 2
psubw xmm4, xmm2
paddw xmm0, xmm1
paddw xmm0, xmm4
psllw xmm4, 2
paddw xmm0, xmm4
paddw xmm0, xmm6
psraw xmm0, 5
packuswb xmm0, xmm7
movq [edi], xmm0
lea edi, [edi+edx]
lea esi, [esi+eax]
dec ecx
jnz near .y_loop
pop edi
pop esi
ret
ALIGN 16
;*******************************************************************************
; void_t McHorVer20WidthEq16_sse2( uint8_t *pSrc,
; int iSrcStride,
; uint8_t *pDst,
; int iDstStride,
; int iHeight,
; );
;*******************************************************************************
McHorVer20WidthEq16_sse2:
push esi
push edi
mov esi, [esp + 12] ;pSrc
mov eax, [esp + 16] ;iSrcStride
mov edi, [esp + 20] ;pDst
mov ecx, [esp + 28] ;iHeight
mov edx, [esp + 24] ;iDstStride
lea esi, [esi-2] ;pSrc -= 2;
pxor xmm7, xmm7
movdqa xmm6, [h264_w0x10_1]
.y_loop:
movq xmm0, [esi]
punpcklbw xmm0, xmm7
movq xmm1, [esi+5]
punpcklbw xmm1, xmm7
movq xmm2, [esi+1]
punpcklbw xmm2, xmm7
movq xmm3, [esi+4]
punpcklbw xmm3, xmm7
movq xmm4, [esi+2]
punpcklbw xmm4, xmm7
movq xmm5, [esi+3]
punpcklbw xmm5, xmm7
paddw xmm2, xmm3
paddw xmm4, xmm5
psllw xmm4, 2
psubw xmm4, xmm2
paddw xmm0, xmm1
paddw xmm0, xmm4
psllw xmm4, 2
paddw xmm0, xmm4
paddw xmm0, xmm6
psraw xmm0, 5
packuswb xmm0, xmm7
movq [edi], xmm0
movq xmm0, [esi+8]
punpcklbw xmm0, xmm7
movq xmm1, [esi+5+8]
punpcklbw xmm1, xmm7
movq xmm2, [esi+1+8]
punpcklbw xmm2, xmm7
movq xmm3, [esi+4+8]
punpcklbw xmm3, xmm7
movq xmm4, [esi+2+8]
punpcklbw xmm4, xmm7
movq xmm5, [esi+3+8]
punpcklbw xmm5, xmm7
paddw xmm2, xmm3
paddw xmm4, xmm5
psllw xmm4, 2
psubw xmm4, xmm2
paddw xmm0, xmm1
paddw xmm0, xmm4
psllw xmm4, 2
paddw xmm0, xmm4
paddw xmm0, xmm6
psraw xmm0, 5
packuswb xmm0, xmm7
movq [edi+8], xmm0
lea edi, [edi+edx]
lea esi, [esi+eax]
dec ecx
jnz near .y_loop
pop edi
pop esi
ret
;*******************************************************************************
; void_t McHorVer02WidthEq8_sse2( uint8_t *pSrc,
; int iSrcStride,
; uint8_t *pDst,
; int iDstStride,
; int iHeight )
;*******************************************************************************
ALIGN 16
McHorVer02WidthEq8_sse2:
push esi
push edi
mov esi, [esp + 12] ;pSrc
mov edx, [esp + 16] ;iSrcStride
mov edi, [esp + 20] ;pDst
mov eax, [esp + 24] ;iDstStride
mov ecx, [esp + 28] ;iHeight
sub esi, edx
sub esi, edx
WELS_Zero xmm7
SSE_LOAD_8P xmm0, xmm7, [esi]
SSE_LOAD_8P xmm1, xmm7, [esi+edx]
lea esi, [esi+2*edx]
SSE_LOAD_8P xmm2, xmm7, [esi]
SSE_LOAD_8P xmm3, xmm7, [esi+edx]
lea esi, [esi+2*edx]
SSE_LOAD_8P xmm4, xmm7, [esi]
SSE_LOAD_8P xmm5, xmm7, [esi+edx]
.start:
FILTER_HV_W8 xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, [edi]
dec ecx
jz near .xx_exit
lea esi, [esi+2*edx]
SSE_LOAD_8P xmm6, xmm7, [esi]
FILTER_HV_W8 xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, [edi+eax]
dec ecx
jz near .xx_exit
lea edi, [edi+2*eax]
SSE_LOAD_8P xmm7, xmm0, [esi+edx]
FILTER_HV_W8 xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, [edi]
dec ecx
jz near .xx_exit
lea esi, [esi+2*edx]
SSE_LOAD_8P xmm0, xmm1, [esi]
FILTER_HV_W8 xmm3, xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, [edi+eax]
dec ecx
jz near .xx_exit
lea edi, [edi+2*eax]
SSE_LOAD_8P xmm1, xmm2, [esi+edx]
FILTER_HV_W8 xmm4, xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3, [edi]
dec ecx
jz near .xx_exit
lea esi, [esi+2*edx]
SSE_LOAD_8P xmm2, xmm3, [esi]
FILTER_HV_W8 xmm5, xmm6, xmm7, xmm0, xmm1, xmm2, xmm3, xmm4, [edi+eax]
dec ecx
jz near .xx_exit
lea edi, [edi+2*eax]
SSE_LOAD_8P xmm3, xmm4, [esi+edx]
FILTER_HV_W8 xmm6, xmm7, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, [edi]
dec ecx
jz near .xx_exit
lea esi, [esi+2*edx]
SSE_LOAD_8P xmm4, xmm5, [esi]
FILTER_HV_W8 xmm7, xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, [edi+eax]
dec ecx
jz near .xx_exit
lea edi, [edi+2*eax]
SSE_LOAD_8P xmm5, xmm6, [esi+edx]
jmp near .start
.xx_exit:
pop edi
pop esi
ret
| 22.586039 | 80 | 0.549917 |
4d6a738cf1bfb60f5b3a628df9454b7df4177b25 | 452 | asm | Assembly | oeis/124/A124780.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | oeis/124/A124780.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | oeis/124/A124780.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | null | null | null | ; A124780: a(n) = gcd(A(n), A(n+2)) where A(n) = A000522(n) = Sum_{k=0..n} n!/k!.
; Submitted by Jamie Morken(w3)
; 1,2,5,2,1,2,1,10,1,2,13,2,5,2,1,2,1,10,1,2,1,2,5,26,1,2,1,10,1,2,1,2,5,2,37,2,13,10,1,2,1,2,5,2,1,2,1,10,1,26,1,2,5,2,1,2,1,10,1,2,1,2,65,2,1,2,1,10,1,2,1,74,5,2,1,26,1,10,1,2,1,2,5,2,1,2,1,10,13,2,1,2,5,2,1,2,1,10,1,2
mov $2,$0
seq $0,143918 ; G.f. A(x) satisfies: A(x) = 1/(1-x)^2 + x^2*A'(x).
mov $1,$0
add $2,3
gcd $1,$2
mov $0,$1
| 41.090909 | 220 | 0.535398 |
72f42deb9654386d943e425c876e9e0f5130248d | 138 | asm | Assembly | tests/parsing/if_dup_if_nesting.asm | cizo2000/sjasmplus | 615d7c0e09a44aa2a923095fc9ed6dca6ecae4a4 | [
"BSD-3-Clause"
] | 220 | 2016-10-22T19:44:39.000Z | 2022-03-29T20:57:04.000Z | tests/parsing/if_dup_if_nesting.asm | ped7g/sjasmplus | 487635c8057cd5594c372d9b70bc00a3f3a1ecc4 | [
"BSD-3-Clause"
] | 153 | 2018-05-07T10:31:23.000Z | 2022-03-30T04:35:59.000Z | tests/parsing/if_dup_if_nesting.asm | ped7g/sjasmplus | 487635c8057cd5594c372d9b70bc00a3f3a1ecc4 | [
"BSD-3-Clause"
] | 51 | 2016-05-12T21:27:36.000Z | 2022-03-27T15:16:16.000Z | OUTPUT if_dup_if_nesting.bin
IF 1
DUP 2
IF 1
ld b,c
ENDIF
EDUP
ENDIF
| 15.333333 | 32 | 0.391304 |
6fdc895bd58161c3525e4d6a7de6c556cdde2c14 | 134 | asm | Assembly | libsrc/_DEVELOPMENT/z80/c/sccz80/z80_inp.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/z80/c/sccz80/z80_inp.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/z80/c/sccz80/z80_inp.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; uint8_t z80_inp(uint16_t port)
SECTION code_clib
SECTION code_z80
PUBLIC z80_inp
EXTERN asm_z80_inp
defc z80_inp = asm_z80_inp
| 11.166667 | 32 | 0.813433 |
4b856c25112d344bab0fa0111485851119f1b19c | 290 | asm | Assembly | libsrc/_DEVELOPMENT/string/c/sdcc_iy/strtok_r.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/string/c/sdcc_iy/strtok_r.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/string/c/sdcc_iy/strtok_r.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; char *strtok_r(char * restrict s, const char * restrict sep, char ** restrict lasts)
SECTION code_clib
SECTION code_string
PUBLIC _strtok_r
EXTERN asm_strtok_r
_strtok_r:
pop af
pop hl
pop de
pop bc
push bc
push de
push hl
push af
jp asm_strtok_r
| 12.083333 | 86 | 0.675862 |
bd82c65a47479de72b4b16ed08f496892ccb5bb1 | 2,278 | asm | Assembly | Projeto _Bootloader/boot2.asm | maluwastaken/Infra_de_Software | 2166d339805349f3adc9c6aaeeb00ec42eb84e2c | [
"MIT"
] | null | null | null | Projeto _Bootloader/boot2.asm | maluwastaken/Infra_de_Software | 2166d339805349f3adc9c6aaeeb00ec42eb84e2c | [
"MIT"
] | null | null | null | Projeto _Bootloader/boot2.asm | maluwastaken/Infra_de_Software | 2166d339805349f3adc9c6aaeeb00ec42eb84e2c | [
"MIT"
] | 1 | 2021-03-02T14:56:41.000Z | 2021-03-02T14:56:41.000Z | org 0x500;
jmp 0x000: start
str1 db 'Adjusting kernel structures',0
str2 db 'Adjusting memory games', 0
str3 db 'Loading kernel', 0
str4 db 'Running kernel', 0
dot db '.', 0
finalDot db '.', 10, 13, 0
printString:
;; Printa a string que esta em si
lodsb
cmp al, 0
je exit
mov ah, 0xe
int 10h
mov dx, 100;tempo do delay
call delay
jmp printString
exit:
ret
delay:
;; Função que aplica um delay(improvisado) baseado no valor de dx
mov bp, dx
back:
dec bp
nop
jnz back
dec dx
cmp dx,0
jnz back
ret
printDots:
;; Printa os pontos das reticências
mov cx, 2
for:
mov si, dot
call printString
mov dx, 600
call delay
dec cx
cmp cx, 0
jne for
mov dx, 1200
call delay
mov si, finalDot
call printString
ret
limpaTela:
;; Limpa a tela dos caracteres colocados pela BIOS
; Set the cursor to top left-most corner of screen
mov dx, 0
mov bh, 0
mov ah, 0x2
int 0x10
; print 2000 blanck chars to clean
mov cx, 2000
mov bh, 0
mov al, 0x20 ; blank char
mov ah, 0x9
int 0x10
;Reset cursor to top left-most corner of screen
mov dx, 0
mov bh, 0
mov ah, 0x2
int 0x10
ret
start:
mov bl, 3 ; Seta cor dos caracteres para verde
call limpaTela
mov si, str1
call printString
call printDots
mov si, str2
call printString
call printDots
mov si, str3
call printString
call printDots
mov si, str4
call printString
call printDots
;Carrega na memoria o kernel
xor ax, ax
mov ds, ax
;Resetando o disco floppy, forçando também a setar todas as trilhas para 0
reset:
mov ah,0
mov dl,0
int 13h
jc reset ;em caso de erro, tenta de novo,
load_menu:
;Setando a posição do disco onde kernel.asm foi armazenado(ES:BX = [0x7E00:0x0])
mov ax,0x7E0 ;0x7E0<<1 + 0 = 0x7E00
mov es,ax
xor bx,bx ;Zerando o offset
;Setando a posição da Ram onde o menu será lido
mov ah, 0x02 ;comando de ler setor do disco
mov al,4 ;quantidade de blocos ocupados pelo menu
mov dl,0 ;drive floppy
;Usaremos as seguintes posições na memoria:
mov ch,0 ;trilha 0
mov cl,3 ;setor 3
mov dh,0 ;cabeca 0
int 13h
jc load_menu ;em caso de erro, tenta de novo
break:
jmp 0x7e00 ;Pula para a posição carregada
times 510-($-$$) db 0
dw 0xaa55
| 16.271429 | 80 | 0.676471 |
7a2041277fe0a67f2b760ad4ea7735dd92b2d857 | 6,105 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_zr_/i3-7100_9_0xca_notsx.log_21829_1479.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_zr_/i3-7100_9_0xca_notsx.log_21829_1479.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_zr_/i3-7100_9_0xca_notsx.log_21829_1479.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x869f, %rsi
lea addresses_normal_ht+0x9f7b, %rdi
clflush (%rsi)
nop
nop
xor $51366, %rbp
mov $49, %rcx
rep movsw
nop
nop
add %rsi, %rsi
lea addresses_UC_ht+0xa7bb, %r11
and $20582, %r9
mov $0x6162636465666768, %r12
movq %r12, %xmm7
movups %xmm7, (%r11)
nop
nop
nop
nop
cmp $62147, %rbp
lea addresses_normal_ht+0x19c75, %r9
nop
nop
nop
nop
xor $53793, %r11
mov (%r9), %bp
nop
nop
nop
add $64890, %rcx
lea addresses_UC_ht+0x17b7b, %rdi
nop
nop
nop
nop
nop
xor $26595, %rsi
mov $0x6162636465666768, %r12
movq %r12, (%rdi)
nop
nop
nop
add $47942, %rbp
lea addresses_WC_ht+0x7373, %rsi
nop
nop
nop
nop
nop
sub $34007, %rdi
movb (%rsi), %r9b
xor $5854, %rdi
lea addresses_WC_ht+0x1407b, %rbp
clflush (%rbp)
nop
nop
nop
nop
add %rsi, %rsi
movb (%rbp), %r9b
nop
nop
nop
nop
inc %rsi
lea addresses_WT_ht+0x1e17b, %rsi
sub %rcx, %rcx
mov (%rsi), %rbp
nop
and $62682, %rcx
lea addresses_WC_ht+0x8f7b, %r11
add $57442, %rsi
movups (%r11), %xmm7
vpextrq $1, %xmm7, %r9
nop
nop
xor %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r13
push %r9
push %rbx
push %rdx
push %rsi
// Store
lea addresses_A+0x1b07b, %r12
nop
nop
and $26820, %r13
movw $0x5152, (%r12)
nop
xor $44329, %r9
// Faulty Load
lea addresses_A+0x47b, %r12
nop
nop
add %rsi, %rsi
mov (%r12), %r10w
lea oracles, %r12
and $0xff, %r10
shlq $12, %r10
mov (%r12,%r10,1), %r10
pop %rsi
pop %rdx
pop %rbx
pop %r9
pop %r13
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_A', 'size': 32, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_A', 'size': 2, 'AVXalign': False}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': True, 'type': 'addresses_A', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False}}
{'src': {'same': True, 'congruent': 1, 'NT': False, 'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False}}
{'src': {'same': False, 'congruent': 3, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 10, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 8, 'NT': False, 'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False}, 'OP': 'LOAD'}
{'35': 21828, '00': 1}
00 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
| 39.387097 | 2,999 | 0.655692 |
de2b06b9884d8a42f3085743a4c90c35900ce771 | 149 | asm | Assembly | libsrc/_DEVELOPMENT/adt/w_vector/c/sdcc_iy/w_vector_at.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/w_vector/c/sdcc_iy/w_vector_at.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/w_vector/c/sdcc_iy/w_vector_at.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; void *w_vector_at(b_vector_t *v, size_t idx)
SECTION code_adt_w_vector
PUBLIC _w_vector_at
EXTERN _w_array_at
defc _w_vector_at = _w_array_at
| 13.545455 | 46 | 0.812081 |
e2489d03d2452e7085ff1aefd657608a36e53d5c | 870 | asm | Assembly | uP8086/fact.asm | pankajpatro703/uP8086 | e1736d101092bf3d53c8fef8ec0802c32328a09e | [
"ECL-2.0"
] | null | null | null | uP8086/fact.asm | pankajpatro703/uP8086 | e1736d101092bf3d53c8fef8ec0802c32328a09e | [
"ECL-2.0"
] | null | null | null | uP8086/fact.asm | pankajpatro703/uP8086 | e1736d101092bf3d53c8fef8ec0802c32328a09e | [
"ECL-2.0"
] | null | null | null | ;Factorial of user entered number
.MODEL SMALL
.STACK 100H
.DATA
prompt DB 'Enter $' ;prompt message for user
num DB 00h ;memory for number
result DB 'Factorial is $' ;messgae for displaying result
.CODE
START: mov ax,@DATA
mov ds,ax
mov dx,OFFSET prompt
mov ah,09h
int 21h ;display prompt message
mov ah,01h
int 21h ;get user input
sub al,30h ;get number from ascii
mov num,al ;store number(n)
mov cx,0001h ;i=1
UP: cmp num,ch ;check if n==0
jz STAR
inc ch
mov al,ch
mul cl
mov cl,al ;i=i+1 if n!=0
jmp UP ;repeat until n==0
STAR: add cl,30h
mov num,cl ;convert back to ascii
mov ah,02h
mov dl,0dh
int 21h
mov dl,0ah
int 21h ;print newline
mov dx,OFFSET result
mov ah,09h
int 21h ;print message
mov ah,02h
mov dl,num
int 21h ;display factorial
mov ah,4ch
int 21h ;return to dos
END START
END
| 16.730769 | 59 | 0.677011 |
b994aa89f77018f5649eebf82e5b3e5328837980 | 7,555 | asm | Assembly | main/mplayer/mpoptmnu.asm | zlatkok/swospp | 27a2d2061af2f46c59f2470b138c7170c45fe03b | [
"MIT"
] | 12 | 2016-02-18T12:53:52.000Z | 2022-02-09T11:07:23.000Z | main/mplayer/mpoptmnu.asm | zlatkok/swospp | 27a2d2061af2f46c59f2470b138c7170c45fe03b | [
"MIT"
] | null | null | null | main/mplayer/mpoptmnu.asm | zlatkok/swospp | 27a2d2061af2f46c59f2470b138c7170c45fe03b | [
"MIT"
] | null | null | null | ; Multiplayer options menu, actual menu stream.
;
[list -]
%include "swos.inc"
%include "swsmenu.inc"
[list +]
section .data
;
; multiplayer options menu
;
extern InitializeMPOptionsMenu, MPOptionsMenuAfterDraw, IncreaseNetworkTimeout, DecreaseNetworkTimeout
extern IncreaseSkipFrames, DecreaseSkipFrames
extern ChooseMPTactics, ExitMultiplayerOptions
extern NetworkTimeoutBeforeDraw, SkipFramesBeforeDraw, mpOptSelectTeamBeforeDraw
extern MP_Tactics, MPMenuSetPlayerNick, ChooseTeam
StartMenu mpOptionsMenu, InitializeMPOptionsMenu, MPOptionsMenuAfterDraw, 0, 1
%assign START_Y 30
%assign WIDTH_COLUMN_1 124
%assign WIDTH_COLUMN_2 136
%assign OPTION_HEIGHT 11
%assign X_COLUMN_1 (WIDTH - WIDTH_COLUMN_1 - WIDTH_COLUMN_2 - 5) / 2
%assign X_COLUMN_2 X_COLUMN_1 + WIDTH_COLUMN_1 + 5
%assign CHANGER_WIDTH 16
%assign CHANGER_HEIGHT 11
%assign CHANGER_OPTION_WIDTH WIDTH_COLUMN_2 - CHANGER_WIDTH * 2 - 2
MenuXY -8, 0
; [0] "nickname"
StartEntry X_COLUMN_1, START_Y, WIDTH_COLUMN_1, OPTION_HEIGHT
EntryColor 9
EntryString 0, "NICKNAME"
EndEntry
; [1] nickname value
StartEntry X_COLUMN_2, previousEntryY, WIDTH_COLUMN_2, OPTION_HEIGHT, nickname
NextEntries -1, -1, -1, 3
EntryColor 13
EntryString 0, -1
OnSelect MPMenuSetPlayerNick
EndEntry
; [2] "network timeout"
StartEntry X_COLUMN_1, previousEntryY + 15, WIDTH_COLUMN_1, OPTION_HEIGHT
EntryColor 9
EntryString 0, "NETWORK TIMEOUT"
EndEntry
; [3] "+" to increase network timeout
StartEntry X_COLUMN_2, previousEntryY, CHANGER_WIDTH, CHANGER_HEIGHT, incNetworkTimeout
NextEntries -1, 5, mpOptionsMenu_nickname, 7
EntryColor 13
EntryString 0, aPlus
OnSelect IncreaseNetworkTimeout
EndEntry
; [4] network timeout value
StartEntry previousEntryEndX + 1, previousEntryY, CHANGER_OPTION_WIDTH, OPTION_HEIGHT
EntryColor 13
EntryString 0, -1
BeforeDraw NetworkTimeoutBeforeDraw
EndEntry
; [5] "-" to decrease network timeout
StartEntry previousEntryEndX + 1, previousEntryY, CHANGER_WIDTH, CHANGER_HEIGHT, decNetworkTimeout
NextEntries mpOptionsMenu_incNetworkTimeout, -1, mpOptionsMenu_nickname, 9
EntryColor 13
EntryString 0, aMinus
OnSelect DecreaseNetworkTimeout
EndEntry
; [6] "skip frames"
StartEntry X_COLUMN_1, previousEntryY + 15, WIDTH_COLUMN_1, OPTION_HEIGHT
EntryColor 9
EntryString 0, "SKIP FRAMES"
EndEntry
; [7] "+" to increase skip frames
StartEntry X_COLUMN_2, previousEntryY, CHANGER_WIDTH, CHANGER_HEIGHT, incSkipFrames
NextEntries -1, 9, mpOptionsMenu_incNetworkTimeout, 11
EntryColor 13
EntryString 0, aPlus
OnSelect IncreaseSkipFrames
EndEntry
; [8] skip frames value
StartEntry previousEntryEndX + 1, previousEntryY, CHANGER_OPTION_WIDTH, OPTION_HEIGHT
EntryColor 13
EntryString 0, -1
BeforeDraw SkipFramesBeforeDraw
EndEntry
; [9] "-" to decrease skip frames
StartEntry previousEntryEndX + 1, previousEntryY, CHANGER_WIDTH, CHANGER_HEIGHT, decSkipFrames
NextEntries mpOptionsMenu_incSkipFrames, -1, mpOptionsMenu_decNetworkTimeout, 11
EntryColor 13
EntryString 0, aMinus
OnSelect DecreaseSkipFrames
EndEntry
; [10] "team"
StartEntry X_COLUMN_1, previousEntryY + 15, WIDTH_COLUMN_1, OPTION_HEIGHT
EntryColor 9
EntryString 0, "TEAM"
EndEntry
; [11] selected team
StartEntry X_COLUMN_2, previousEntryY, WIDTH_COLUMN_2, OPTION_HEIGHT, selectedTeam
NextEntries -1, -1, mpOptionsMenu_decSkipFrames, 16
EntryColor 12
EntryString 0, 0
OnSelect ChooseTeam
BeforeDraw mpOptSelectTeamBeforeDraw
EndEntry
; [12] tactics title
StartEntry (WIDTH - WIDTH_COLUMN_1) / 2, previousEntryY + 20, WIDTH_COLUMN_1, OPTION_HEIGHT
EntryColor 9
EntryString 0, "EDIT TACTICS:"
EndEntry
; [13-18] custom tactics, 2 columns, 3 rows
MarkNextEntryOrdinal mpOptionsTacticsStart
%assign TACTICS_WIDTH 140
%assign TACTICS_HEIGHT 15
%assign TACTICS_X (WIDTH - 2 * TACTICS_WIDTH - 5) / 2
%assign TACTICS_Y previousEntryY + 20
StartTemplateEntry
StartEntry
EntryColor 0x0e
OnSelect ChooseMPTactics
EndEntry
StartEntry TACTICS_X, TACTICS_Y, TACTICS_WIDTH, TACTICS_HEIGHT
NextEntries -1, mpOptionsTacticsStart + 3, mpOptionsMenu_selectedTeam, currentEntry + 1
EntryString 0, MP_Tactics
EndEntry
StartEntry previousEntryX, previousEntryEndY + 4, TACTICS_WIDTH, TACTICS_HEIGHT
NextEntries -1, mpOptionsTacticsStart + 4, currentEntry - 1, currentEntry + 1
EntryString 0, MP_Tactics + TACTICS_SIZE
EndEntry
StartEntry previousEntryX, previousEntryEndY + 4, TACTICS_WIDTH, TACTICS_HEIGHT
NextEntries -1, mpOptionsTacticsStart + 5, currentEntry - 1, 19
EntryString 0, MP_Tactics + 2 * TACTICS_SIZE
EndEntry
StartEntry previousEntryEndX + 5, TACTICS_Y, TACTICS_WIDTH, TACTICS_HEIGHT
NextEntries mpOptionsTacticsStart, -1, mpOptionsMenu_selectedTeam, currentEntry + 1
EntryString 0, MP_Tactics + 3 * TACTICS_SIZE
EndEntry
StartEntry previousEntryX, previousEntryEndY + 4, TACTICS_WIDTH, TACTICS_HEIGHT
NextEntries mpOptionsTacticsStart + 1, -1, currentEntry - 1, currentEntry + 1
EntryString 0, MP_Tactics + 4 * TACTICS_SIZE
EndEntry
StartEntry previousEntryX, previousEntryEndY + 4, TACTICS_WIDTH, TACTICS_HEIGHT
NextEntries mpOptionsTacticsStart + 2, -1, currentEntry - 1, 19
EntryString 0, MP_Tactics + 5 * TACTICS_SIZE
EndEntry
; [19] exit
StartEntry 110, 185, 100, 15
NextEntries -1, -1, mpOptionsTacticsStart + 5, -1
EntryColor 12
EntryString 0, aExit
OnSelect ExitMultiplayerOptions
EndEntry
; [20] title
StartEntry 87, 0, 130, 15
EntryColor 0x17
EntryString 0, "MULTIPLAYER OPTIONS"
EndEntry
EndMenu
;
; direct connect menu (at startup)
;
extern SearchForTheGameInit, UpdateGameSearch
StartMenu directConnectMenu, SearchForTheGameInit, 0, UpdateGameSearch, 1
StartEntry 2, 40, 300, 40
EntryColor 0x0c
EndEntry
StartEntry 89, 60, 0, 0
EntryString 0x8010, "SEARCHING FOR GAME..."
EndEntry
EndMenu
section .text
global ShowMPOptions
ShowMPOptions:
mov [A6], dword mpOptionsMenu
jmpa ShowMenu
; GetDirectConnectMenu
;
; Return direct connect menu to go directly into at startup if requested.
;
global GetDirectConnectMenu
GetDirectConnectMenu:
mov eax, directConnectMenu
retn
| 34.976852 | 106 | 0.642224 |
1c538ea54dd2dc90e836cf9812c311c64a3e5529 | 505 | asm | Assembly | asm/inc/defines.asm | pvmoore/dlang-common | 5a5759a9f21920031361cff3f3dec96808170f58 | [
"MIT"
] | 5 | 2019-10-01T02:49:42.000Z | 2022-02-12T18:29:07.000Z | asm/inc/defines.asm | pvmoore/dlang-common | 5a5759a9f21920031361cff3f3dec96808170f58 | [
"MIT"
] | null | null | null | asm/inc/defines.asm | pvmoore/dlang-common | 5a5759a9f21920031361cff3f3dec96808170f58 | [
"MIT"
] | null | null | null |
save_rcx textequ <mov [rsp+16], rcx>
save_rdx textequ <mov [rsp+24], rdx>
save_r8 textequ <mov [rsp+32], r8>
save_r9 textequ <mov [rsp+48], r9>
restore_rcx textequ <mov rcx, [rsp+@LOCAL_SIZE+16]>
restore_rdx textequ <mov rdx, [rsp+@LOCAL_SIZE+24]>
restore_r8 textequ <mov r8, [rsp+@LOCAL_SIZE+32]>
restore_r9 textequ <mov r9, [rsp+@LOCAL_SIZE+48]>
save_temps macro
save_rcx
save_rdx
save_r8
save_r9
endm
restore_temps macro
restore_rcx
restore_rdx
restore_r8
restore_r9
endm
| 21.956522 | 51 | 0.722772 |
8964d5befacd667a049fd506b836417d40acd310 | 147,002 | asm | Assembly | circuits/witnessgen/fr.asm | aspiers/maci | f17c1293a2609fd3bc8e80444b68b3eea6672421 | [
"MIT"
] | 174 | 2020-05-22T14:15:29.000Z | 2022-03-31T16:07:58.000Z | circuits/witnessgen/fr.asm | aspiers/maci | f17c1293a2609fd3bc8e80444b68b3eea6672421 | [
"MIT"
] | 143 | 2020-05-18T08:25:33.000Z | 2022-03-31T18:04:47.000Z | circuits/witnessgen/fr.asm | aspiers/maci | f17c1293a2609fd3bc8e80444b68b3eea6672421 | [
"MIT"
] | 32 | 2020-05-27T18:41:45.000Z | 2022-03-22T08:30:29.000Z |
global Fr_copy
global Fr_copyn
global Fr_add
global Fr_sub
global Fr_neg
global Fr_mul
global Fr_square
global Fr_band
global Fr_bor
global Fr_bxor
global Fr_bnot
global Fr_eq
global Fr_neq
global Fr_lt
global Fr_gt
global Fr_leq
global Fr_geq
global Fr_land
global Fr_lor
global Fr_lnot
global Fr_toNormal
global Fr_toLongNormal
global Fr_toMontgomery
global Fr_toInt
global Fr_isTrue
global Fr_q
global Fr_R3
global Fr_rawCopy
global Fr_rawSwap
global Fr_rawAdd
global Fr_rawSub
global Fr_rawNeg
global Fr_rawMMul
global Fr_rawMSquare
global Fr_rawToMontgomery
global Fr_rawFromMontgomery
global Fr_rawIsEq
global Fr_rawIsZero
global Fr_rawq
global Fr_rawR3
extern Fr_fail
DEFAULT REL
section .text
;;;;;;;;;;;;;;;;;;;;;;
; copy
;;;;;;;;;;;;;;;;;;;;;;
; Copies
; Params:
; rsi <= the src
; rdi <= the dest
;
; Nidified registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;;
Fr_copy:
mov rax, [rsi + 0]
mov [rdi + 0], rax
mov rax, [rsi + 8]
mov [rdi + 8], rax
mov rax, [rsi + 16]
mov [rdi + 16], rax
mov rax, [rsi + 24]
mov [rdi + 24], rax
mov rax, [rsi + 32]
mov [rdi + 32], rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawCopy
;;;;;;;;;;;;;;;;;;;;;;
; Copies
; Params:
; rsi <= the src
; rdi <= the dest
;
; Nidified registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;;
Fr_rawCopy:
mov rax, [rsi + 0]
mov [rdi + 0], rax
mov rax, [rsi + 8]
mov [rdi + 8], rax
mov rax, [rsi + 16]
mov [rdi + 16], rax
mov rax, [rsi + 24]
mov [rdi + 24], rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawSwap
;;;;;;;;;;;;;;;;;;;;;;
; Copies
; Params:
; rdi <= a
; rsi <= p
;
; Nidified registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;;
Fr_rawSwap:
mov rax, [rsi + 0]
mov rcx, [rdi + 0]
mov [rdi + 0], rax
mov [rsi + 0], rbx
mov rax, [rsi + 8]
mov rcx, [rdi + 8]
mov [rdi + 8], rax
mov [rsi + 8], rbx
mov rax, [rsi + 16]
mov rcx, [rdi + 16]
mov [rdi + 16], rax
mov [rsi + 16], rbx
mov rax, [rsi + 24]
mov rcx, [rdi + 24]
mov [rdi + 24], rax
mov [rsi + 24], rbx
ret
;;;;;;;;;;;;;;;;;;;;;;
; copy an array of integers
;;;;;;;;;;;;;;;;;;;;;;
; Copies
; Params:
; rsi <= the src
; rdi <= the dest
; rdx <= number of integers to copy
;
; Nidified registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;;
Fr_copyn:
Fr_copyn_loop:
mov r8, rsi
mov r9, rdi
mov rax, 5
mul rdx
mov rcx, rax
cld
rep movsq
mov rsi, r8
mov rdi, r9
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawCopyS2L
;;;;;;;;;;;;;;;;;;;;;;
; Convert a 64 bit integer to a long format field element
; Params:
; rsi <= the integer
; rdi <= Pointer to the overwritted element
;
; Nidified registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;;
rawCopyS2L:
mov al, 0x80
shl rax, 56
mov [rdi], rax ; set the result to LONG normal
cmp rsi, 0
js u64toLong_adjust_neg
mov [rdi + 8], rsi
xor rax, rax
mov [rdi + 16], rax
mov [rdi + 24], rax
mov [rdi + 32], rax
ret
u64toLong_adjust_neg:
add rsi, [q] ; Set the first digit
mov [rdi + 8], rsi ;
mov rsi, -1 ; all ones
mov rax, rsi ; Add to q
adc rax, [q + 8 ]
mov [rdi + 16], rax
mov rax, rsi ; Add to q
adc rax, [q + 16 ]
mov [rdi + 24], rax
mov rax, rsi ; Add to q
adc rax, [q + 24 ]
mov [rdi + 32], rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; toInt
;;;;;;;;;;;;;;;;;;;;;;
; Convert a 64 bit integer to a long format field element
; Params:
; rsi <= Pointer to the element
; Returs:
; rax <= The value
;;;;;;;;;;;;;;;;;;;;;;;
Fr_toInt:
mov rax, [rdi]
bt rax, 63
jc Fr_long
movsx rax, eax
ret
Fr_long:
push rbp
push rsi
push rdx
mov rbp, rsp
bt rax, 62
jnc Fr_longNormal
Fr_longMontgomery:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
Fr_longNormal:
mov rax, [rdi + 8]
mov rcx, rax
shr rcx, 31
jnz Fr_longNeg
mov rcx, [rdi + 16]
test rcx, rcx
jnz Fr_longNeg
mov rcx, [rdi + 24]
test rcx, rcx
jnz Fr_longNeg
mov rcx, [rdi + 32]
test rcx, rcx
jnz Fr_longNeg
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
Fr_longNeg:
mov rax, [rdi + 8]
sub rax, [q]
jnc Fr_longErr
mov rcx, [rdi + 16]
sbb rcx, [q + 8]
jnc Fr_longErr
mov rcx, [rdi + 24]
sbb rcx, [q + 16]
jnc Fr_longErr
mov rcx, [rdi + 32]
sbb rcx, [q + 24]
jnc Fr_longErr
mov rcx, rax
sar rcx, 31
add rcx, 1
jnz Fr_longErr
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
Fr_longErr:
push rdi
mov rdi, 0
call Fr_fail
pop rdi
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
Fr_rawMMul:
push r15
push r14
push r13
push r12
mov rcx,rdx
mov r9,[ np ]
xor r10,r10
; FirstLoop
mov rdx,[rsi + 0]
mulx rax,r11,[rcx]
mulx r8,r12,[rcx +8]
adcx r12,rax
mulx rax,r13,[rcx +16]
adcx r13,r8
mulx r8,r14,[rcx +24]
adcx r14,rax
mov r15,r10
adcx r15,r8
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
; FirstLoop
mov rdx,[rsi + 8]
mov r15,r10
mulx r8,rax,[rcx +0]
adcx r11,rax
adox r12,r8
mulx r8,rax,[rcx +8]
adcx r12,rax
adox r13,r8
mulx r8,rax,[rcx +16]
adcx r13,rax
adox r14,r8
mulx r8,rax,[rcx +24]
adcx r14,rax
adox r15,r8
adcx r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
; FirstLoop
mov rdx,[rsi + 16]
mov r15,r10
mulx r8,rax,[rcx +0]
adcx r11,rax
adox r12,r8
mulx r8,rax,[rcx +8]
adcx r12,rax
adox r13,r8
mulx r8,rax,[rcx +16]
adcx r13,rax
adox r14,r8
mulx r8,rax,[rcx +24]
adcx r14,rax
adox r15,r8
adcx r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
; FirstLoop
mov rdx,[rsi + 24]
mov r15,r10
mulx r8,rax,[rcx +0]
adcx r11,rax
adox r12,r8
mulx r8,rax,[rcx +8]
adcx r12,rax
adox r13,r8
mulx r8,rax,[rcx +16]
adcx r13,rax
adox r14,r8
mulx r8,rax,[rcx +24]
adcx r14,rax
adox r15,r8
adcx r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
;comparison
cmp r14,[q + 24]
jc Fr_rawMMul_done
jnz Fr_rawMMul_sq
cmp r13,[q + 16]
jc Fr_rawMMul_done
jnz Fr_rawMMul_sq
cmp r12,[q + 8]
jc Fr_rawMMul_done
jnz Fr_rawMMul_sq
cmp r11,[q + 0]
jc Fr_rawMMul_done
jnz Fr_rawMMul_sq
Fr_rawMMul_sq:
sub r11,[q +0]
sbb r12,[q +8]
sbb r13,[q +16]
sbb r14,[q +24]
Fr_rawMMul_done:
mov [rdi + 0],r11
mov [rdi + 8],r12
mov [rdi + 16],r13
mov [rdi + 24],r14
pop r12
pop r13
pop r14
pop r15
ret
Fr_rawMSquare:
push r15
push r14
push r13
push r12
mov rcx,rdx
mov r9,[ np ]
xor r10,r10
; FirstLoop
mov rdx,[rsi + 0]
mulx rax,r11,rdx
mulx r8,r12,[rsi +8]
adcx r12,rax
mulx rax,r13,[rsi +16]
adcx r13,r8
mulx r8,r14,[rsi +24]
adcx r14,rax
mov r15,r10
adcx r15,r8
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
; FirstLoop
mov rdx,[rsi + 8]
mov r15,r10
mulx r8,rax,[rsi +0]
adcx r11,rax
adox r12,r8
mulx r8,rax,[rsi +8]
adcx r12,rax
adox r13,r8
mulx r8,rax,[rsi +16]
adcx r13,rax
adox r14,r8
mulx r8,rax,[rsi +24]
adcx r14,rax
adox r15,r8
adcx r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
; FirstLoop
mov rdx,[rsi + 16]
mov r15,r10
mulx r8,rax,[rsi +0]
adcx r11,rax
adox r12,r8
mulx r8,rax,[rsi +8]
adcx r12,rax
adox r13,r8
mulx r8,rax,[rsi +16]
adcx r13,rax
adox r14,r8
mulx r8,rax,[rsi +24]
adcx r14,rax
adox r15,r8
adcx r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
; FirstLoop
mov rdx,[rsi + 24]
mov r15,r10
mulx r8,rax,[rsi +0]
adcx r11,rax
adox r12,r8
mulx r8,rax,[rsi +8]
adcx r12,rax
adox r13,r8
mulx r8,rax,[rsi +16]
adcx r13,rax
adox r14,r8
mulx r8,rax,[rsi +24]
adcx r14,rax
adox r15,r8
adcx r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
;comparison
cmp r14,[q + 24]
jc Fr_rawMSquare_done
jnz Fr_rawMSquare_sq
cmp r13,[q + 16]
jc Fr_rawMSquare_done
jnz Fr_rawMSquare_sq
cmp r12,[q + 8]
jc Fr_rawMSquare_done
jnz Fr_rawMSquare_sq
cmp r11,[q + 0]
jc Fr_rawMSquare_done
jnz Fr_rawMSquare_sq
Fr_rawMSquare_sq:
sub r11,[q +0]
sbb r12,[q +8]
sbb r13,[q +16]
sbb r14,[q +24]
Fr_rawMSquare_done:
mov [rdi + 0],r11
mov [rdi + 8],r12
mov [rdi + 16],r13
mov [rdi + 24],r14
pop r12
pop r13
pop r14
pop r15
ret
Fr_rawMMul1:
push r15
push r14
push r13
push r12
mov rcx,rdx
mov r9,[ np ]
xor r10,r10
; FirstLoop
mov rdx,rcx
mulx rax,r11,[rsi]
mulx r8,r12,[rsi +8]
adcx r12,rax
mulx rax,r13,[rsi +16]
adcx r13,r8
mulx r8,r14,[rsi +24]
adcx r14,rax
mov r15,r10
adcx r15,r8
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
mov r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
mov r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
mov r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
;comparison
cmp r14,[q + 24]
jc Fr_rawMMul1_done
jnz Fr_rawMMul1_sq
cmp r13,[q + 16]
jc Fr_rawMMul1_done
jnz Fr_rawMMul1_sq
cmp r12,[q + 8]
jc Fr_rawMMul1_done
jnz Fr_rawMMul1_sq
cmp r11,[q + 0]
jc Fr_rawMMul1_done
jnz Fr_rawMMul1_sq
Fr_rawMMul1_sq:
sub r11,[q +0]
sbb r12,[q +8]
sbb r13,[q +16]
sbb r14,[q +24]
Fr_rawMMul1_done:
mov [rdi + 0],r11
mov [rdi + 8],r12
mov [rdi + 16],r13
mov [rdi + 24],r14
pop r12
pop r13
pop r14
pop r15
ret
Fr_rawFromMontgomery:
push r15
push r14
push r13
push r12
mov rcx,rdx
mov r9,[ np ]
xor r10,r10
; FirstLoop
mov r11,[rsi +0]
mov r12,[rsi +8]
mov r13,[rsi +16]
mov r14,[rsi +24]
mov r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
mov r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
mov r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
mov r15,r10
; SecondLoop
mov rdx,r9
mulx rax,rdx,r11
mulx r8,rax,[q]
adcx rax,r11
mulx rax,r11,[q +8]
adcx r11,r8
adox r11,r12
mulx r8,r12,[q +16]
adcx r12,rax
adox r12,r13
mulx rax,r13,[q +24]
adcx r13,r8
adox r13,r14
mov r14,r10
adcx r14,rax
adox r14,r15
;comparison
cmp r14,[q + 24]
jc Fr_rawFromMontgomery_done
jnz Fr_rawFromMontgomery_sq
cmp r13,[q + 16]
jc Fr_rawFromMontgomery_done
jnz Fr_rawFromMontgomery_sq
cmp r12,[q + 8]
jc Fr_rawFromMontgomery_done
jnz Fr_rawFromMontgomery_sq
cmp r11,[q + 0]
jc Fr_rawFromMontgomery_done
jnz Fr_rawFromMontgomery_sq
Fr_rawFromMontgomery_sq:
sub r11,[q +0]
sbb r12,[q +8]
sbb r13,[q +16]
sbb r14,[q +24]
Fr_rawFromMontgomery_done:
mov [rdi + 0],r11
mov [rdi + 8],r12
mov [rdi + 16],r13
mov [rdi + 24],r14
pop r12
pop r13
pop r14
pop r15
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawToMontgomery
;;;;;;;;;;;;;;;;;;;;;;
; Convert a number to Montgomery
; rdi <= Pointer destination element
; rsi <= Pointer to src element
;;;;;;;;;;;;;;;;;;;;
Fr_rawToMontgomery:
push rdx
lea rdx, [R2]
call Fr_rawMMul
pop rdx
ret
;;;;;;;;;;;;;;;;;;;;;;
; toMontgomery
;;;;;;;;;;;;;;;;;;;;;;
; Convert a number to Montgomery
; rdi <= Destination
; rdi <= Pointer element to convert
; Modified registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;
Fr_toMontgomery:
mov rax, [rsi]
bt rax, 62 ; check if montgomery
jc toMontgomery_doNothing
bt rax, 63
jc toMontgomeryLong
toMontgomeryShort:
movsx rdx, eax
mov [rdi], rdx
add rdi, 8
lea rsi, [R2]
cmp rdx, 0
js negMontgomeryShort
posMontgomeryShort:
call Fr_rawMMul1
sub rdi, 8
mov r11b, 0x40
shl r11d, 24
mov [rdi+4], r11d
ret
negMontgomeryShort:
neg rdx ; Do the multiplication positive and then negate the result.
call Fr_rawMMul1
mov rsi, rdi
call rawNegL
sub rdi, 8
mov r11b, 0x40
shl r11d, 24
mov [rdi+4], r11d
ret
toMontgomeryLong:
mov [rdi], rax
add rdi, 8
add rsi, 8
lea rdx, [R2]
call Fr_rawMMul
sub rsi, 8
sub rdi, 8
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
ret
toMontgomery_doNothing:
call Fr_copy
ret
;;;;;;;;;;;;;;;;;;;;;;
; toNormal
;;;;;;;;;;;;;;;;;;;;;;
; Convert a number from Montgomery
; rdi <= Destination
; rsi <= Pointer element to convert
; Modified registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;
Fr_toNormal:
mov rax, [rsi]
bt rax, 62 ; check if montgomery
jnc toNormal_doNothing
bt rax, 63 ; if short, it means it's converted
jnc toNormal_doNothing
toNormalLong:
add rdi, 8
add rsi, 8
call Fr_rawFromMontgomery
sub rsi, 8
sub rdi, 8
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
ret
toNormal_doNothing:
call Fr_copy
ret
;;;;;;;;;;;;;;;;;;;;;;
; toLongNormal
;;;;;;;;;;;;;;;;;;;;;;
; Convert a number to long normal
; rdi <= Destination
; rsi <= Pointer element to convert
; Modified registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;
Fr_toLongNormal:
mov rax, [rsi]
bt rax, 63 ; check if long
jnc toLongNormal_fromShort
bt rax, 62 ; check if montgomery
jc toLongNormal_fromMontgomery
call Fr_copy ; It is already long
ret
toLongNormal_fromMontgomery:
add rdi, 8
add rsi, 8
call Fr_rawFromMontgomery
sub rsi, 8
sub rdi, 8
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
ret
toLongNormal_fromShort:
mov r8, rsi ; save rsi
movsx rsi, eax
call rawCopyS2L
mov rsi, r8 ; recover rsi
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
ret
;;;;;;;;;;;;;;;;;;;;;;
; add
;;;;;;;;;;;;;;;;;;;;;;
; Adds two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result
; Modified Registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_add:
push rbp
push rsi
push rdx
mov rbp, rsp
mov rax, [rsi]
mov rcx, [rdx]
bt rax, 63 ; Check if is short first operand
jc add_l1
bt rcx, 63 ; Check if is short second operand
jc add_s1l2
add_s1s2: ; Both operands are short
xor rdx, rdx
mov edx, eax
add edx, ecx
jo add_manageOverflow ; rsi already is the 64bits result
mov [rdi], rdx ; not necessary to adjust so just save and return
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
add_manageOverflow: ; Do the operation in 64 bits
push rsi
movsx rsi, eax
movsx rdx, ecx
add rsi, rdx
call rawCopyS2L
pop rsi
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
add_l1:
bt rcx, 63 ; Check if is short second operand
jc add_l1l2
;;;;;;;;
add_l1s2:
bt rax, 62 ; check if montgomery first
jc add_l1ms2
add_l1ns2:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
add rsi, 8
movsx rdx, ecx
add rdi, 8
cmp rdx, 0
jns tmp_1
neg rdx
call rawSubLS
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_1:
call rawAddLS
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
add_l1ms2:
bt rcx, 62 ; check if montgomery second
jc add_l1ms2m
add_l1ms2n:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toMontgomery
mov rdx, rdi
pop rdi
pop rsi
add rdi, 8
add rsi, 8
add rdx, 8
call rawAddLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
add_l1ms2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call rawAddLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;
add_s1l2:
bt rcx, 62 ; check if montgomery second
jc add_s1l2m
add_s1l2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
lea rsi, [rdx + 8]
movsx rdx, eax
add rdi, 8
cmp rdx, 0
jns tmp_2
neg rdx
call rawSubLS
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_2:
call rawAddLS
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
add_s1l2m:
bt rax, 62 ; check if montgomery first
jc add_s1ml2m
add_s1nl2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toMontgomery
mov rsi, rdi
pop rdi
pop rdx
add rdi, 8
add rsi, 8
add rdx, 8
call rawAddLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
add_s1ml2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call rawAddLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;
add_l1l2:
bt rax, 62 ; check if montgomery first
jc add_l1ml2
add_l1nl2:
bt rcx, 62 ; check if montgomery second
jc add_l1nl2m
add_l1nl2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call rawAddLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
add_l1nl2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toMontgomery
mov rsi, rdi
pop rdi
pop rdx
add rdi, 8
add rsi, 8
add rdx, 8
call rawAddLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
add_l1ml2:
bt rcx, 62 ; check if montgomery seconf
jc add_l1ml2m
add_l1ml2n:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toMontgomery
mov rdx, rdi
pop rdi
pop rsi
add rdi, 8
add rsi, 8
add rdx, 8
call rawAddLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
add_l1ml2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call rawAddLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawAddLL
;;;;;;;;;;;;;;;;;;;;;;
; Adds two elements of type long
; Params:
; rsi <= Pointer to the long data of element 1
; rdx <= Pointer to the long data of element 2
; rdi <= Pointer to the long data of result
; Modified Registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;
rawAddLL:
Fr_rawAdd:
; Add component by component with carry
mov rax, [rsi + 0]
add rax, [rdx + 0]
mov [rdi + 0], rax
mov rax, [rsi + 8]
adc rax, [rdx + 8]
mov [rdi + 8], rax
mov rax, [rsi + 16]
adc rax, [rdx + 16]
mov [rdi + 16], rax
mov rax, [rsi + 24]
adc rax, [rdx + 24]
mov [rdi + 24], rax
jc rawAddLL_sq ; if overflow, substract q
; Compare with q
cmp rax, [q + 24]
jc rawAddLL_done ; q is bigget so done.
jnz rawAddLL_sq ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 16]
jc rawAddLL_done ; q is bigget so done.
jnz rawAddLL_sq ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 8]
jc rawAddLL_done ; q is bigget so done.
jnz rawAddLL_sq ; q is lower
mov rax, [rdi + 0]
cmp rax, [q + 0]
jc rawAddLL_done ; q is bigget so done.
jnz rawAddLL_sq ; q is lower
; If equal substract q
rawAddLL_sq:
mov rax, [q + 0]
sub [rdi + 0], rax
mov rax, [q + 8]
sbb [rdi + 8], rax
mov rax, [q + 16]
sbb [rdi + 16], rax
mov rax, [q + 24]
sbb [rdi + 24], rax
rawAddLL_done:
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawAddLS
;;;;;;;;;;;;;;;;;;;;;;
; Adds two elements of type long
; Params:
; rdi <= Pointer to the long data of result
; rsi <= Pointer to the long data of element 1
; rdx <= Value to be added
;;;;;;;;;;;;;;;;;;;;;;
rawAddLS:
; Add component by component with carry
add rdx, [rsi]
mov [rdi] ,rdx
mov rdx, 0
adc rdx, [rsi + 8]
mov [rdi + 8], rdx
mov rdx, 0
adc rdx, [rsi + 16]
mov [rdi + 16], rdx
mov rdx, 0
adc rdx, [rsi + 24]
mov [rdi + 24], rdx
jc rawAddLS_sq ; if overflow, substract q
; Compare with q
mov rax, [rdi + 24]
cmp rax, [q + 24]
jc rawAddLS_done ; q is bigget so done.
jnz rawAddLS_sq ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 16]
jc rawAddLS_done ; q is bigget so done.
jnz rawAddLS_sq ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 8]
jc rawAddLS_done ; q is bigget so done.
jnz rawAddLS_sq ; q is lower
mov rax, [rdi + 0]
cmp rax, [q + 0]
jc rawAddLS_done ; q is bigget so done.
jnz rawAddLS_sq ; q is lower
; If equal substract q
rawAddLS_sq:
mov rax, [q + 0]
sub [rdi + 0], rax
mov rax, [q + 8]
sbb [rdi + 8], rax
mov rax, [q + 16]
sbb [rdi + 16], rax
mov rax, [q + 24]
sbb [rdi + 24], rax
rawAddLS_done:
ret
;;;;;;;;;;;;;;;;;;;;;;
; sub
;;;;;;;;;;;;;;;;;;;;;;
; Substracts two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result
; Modified Registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_sub:
push rbp
push rsi
push rdx
mov rbp, rsp
mov rax, [rsi]
mov rcx, [rdx]
bt rax, 63 ; Check if is long first operand
jc sub_l1
bt rcx, 63 ; Check if is long second operand
jc sub_s1l2
sub_s1s2: ; Both operands are short
xor rdx, rdx
mov edx, eax
sub edx, ecx
jo sub_manageOverflow ; rsi already is the 64bits result
mov [rdi], rdx ; not necessary to adjust so just save and return
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
sub_manageOverflow: ; Do the operation in 64 bits
push rsi
movsx rsi, eax
movsx rdx, ecx
sub rsi, rdx
call rawCopyS2L
pop rsi
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
sub_l1:
bt rcx, 63 ; Check if is short second operand
jc sub_l1l2
;;;;;;;;
sub_l1s2:
bt rax, 62 ; check if montgomery first
jc sub_l1ms2
sub_l1ns2:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
add rsi, 8
movsx rdx, ecx
add rdi, 8
cmp rdx, 0
jns tmp_3
neg rdx
call rawAddLS
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_3:
call rawSubLS
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
sub_l1ms2:
bt rcx, 62 ; check if montgomery second
jc sub_l1ms2m
sub_l1ms2n:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toMontgomery
mov rdx, rdi
pop rdi
pop rsi
add rdi, 8
add rsi, 8
add rdx, 8
call rawSubLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
sub_l1ms2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call rawSubLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;
sub_s1l2:
bt rcx, 62 ; check if montgomery first
jc sub_s1l2m
sub_s1l2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
cmp eax, 0
js tmp_4
; First Operand is positive
push rsi
add rdi, 8
movsx rsi, eax
add rdx, 8
call rawSubSL
sub rdi, 8
pop rsi
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_4: ; First operand is negative
push rsi
lea rsi, [rdx + 8]
movsx rdx, eax
add rdi, 8
neg rdx
call rawNegLS
sub rdi, 8
pop rsi
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
sub_s1l2m:
bt rax, 62 ; check if montgomery second
jc sub_s1ml2m
sub_s1nl2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toMontgomery
mov rsi, rdi
pop rdi
pop rdx
add rdi, 8
add rsi, 8
add rdx, 8
call rawSubLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
sub_s1ml2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call rawSubLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;
sub_l1l2:
bt rax, 62 ; check if montgomery first
jc sub_l1ml2
sub_l1nl2:
bt rcx, 62 ; check if montgomery second
jc sub_l1nl2m
sub_l1nl2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call rawSubLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
sub_l1nl2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toMontgomery
mov rsi, rdi
pop rdi
pop rdx
add rdi, 8
add rsi, 8
add rdx, 8
call rawSubLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
sub_l1ml2:
bt rcx, 62 ; check if montgomery seconf
jc sub_l1ml2m
sub_l1ml2n:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toMontgomery
mov rdx, rdi
pop rdi
pop rsi
add rdi, 8
add rsi, 8
add rdx, 8
call rawSubLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
sub_l1ml2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call rawSubLL
sub rdi, 8
sub rsi, 8
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawSubLS
;;;;;;;;;;;;;;;;;;;;;;
; Substracts a short element from the long element
; Params:
; rdi <= Pointer to the long data of result
; rsi <= Pointer to the long data of element 1 where will be substracted
; rdx <= Value to be substracted
; [rdi] = [rsi] - rdx
; Modified Registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;
rawSubLS:
; Substract first digit
mov rax, [rsi]
sub rax, rdx
mov [rdi] ,rax
mov rdx, 0
mov rax, [rsi + 8]
sbb rax, rdx
mov [rdi + 8], rax
mov rax, [rsi + 16]
sbb rax, rdx
mov [rdi + 16], rax
mov rax, [rsi + 24]
sbb rax, rdx
mov [rdi + 24], rax
jnc rawSubLS_done ; if overflow, add q
; Add q
rawSubLS_aq:
mov rax, [q + 0]
add [rdi + 0], rax
mov rax, [q + 8]
adc [rdi + 8], rax
mov rax, [q + 16]
adc [rdi + 16], rax
mov rax, [q + 24]
adc [rdi + 24], rax
rawSubLS_done:
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawSubSL
;;;;;;;;;;;;;;;;;;;;;;
; Substracts a long element from a short element
; Params:
; rdi <= Pointer to the long data of result
; rsi <= Value from where will bo substracted
; rdx <= Pointer to long of the value to be substracted
;
; [rdi] = rsi - [rdx]
; Modified Registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;
rawSubSL:
; Substract first digit
sub rsi, [rdx]
mov [rdi] ,rsi
mov rax, 0
sbb rax, [rdx + 8]
mov [rdi + 8], rax
mov rax, 0
sbb rax, [rdx + 16]
mov [rdi + 16], rax
mov rax, 0
sbb rax, [rdx + 24]
mov [rdi + 24], rax
jnc rawSubSL_done ; if overflow, add q
; Add q
rawSubSL_aq:
mov rax, [q + 0]
add [rdi + 0], rax
mov rax, [q + 8]
adc [rdi + 8], rax
mov rax, [q + 16]
adc [rdi + 16], rax
mov rax, [q + 24]
adc [rdi + 24], rax
rawSubSL_done:
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawSubLL
;;;;;;;;;;;;;;;;;;;;;;
; Substracts a long element from a short element
; Params:
; rdi <= Pointer to the long data of result
; rsi <= Pointer to long from where substracted
; rdx <= Pointer to long of the value to be substracted
;
; [rdi] = [rsi] - [rdx]
; Modified Registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;
rawSubLL:
Fr_rawSub:
; Substract first digit
mov rax, [rsi + 0]
sub rax, [rdx + 0]
mov [rdi + 0], rax
mov rax, [rsi + 8]
sbb rax, [rdx + 8]
mov [rdi + 8], rax
mov rax, [rsi + 16]
sbb rax, [rdx + 16]
mov [rdi + 16], rax
mov rax, [rsi + 24]
sbb rax, [rdx + 24]
mov [rdi + 24], rax
jnc rawSubLL_done ; if overflow, add q
; Add q
rawSubLL_aq:
mov rax, [q + 0]
add [rdi + 0], rax
mov rax, [q + 8]
adc [rdi + 8], rax
mov rax, [q + 16]
adc [rdi + 16], rax
mov rax, [q + 24]
adc [rdi + 24], rax
rawSubLL_done:
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawNegLS
;;;;;;;;;;;;;;;;;;;;;;
; Substracts a long element and a short element form 0
; Params:
; rdi <= Pointer to the long data of result
; rsi <= Pointer to long from where substracted
; rdx <= short value to be substracted too
;
; [rdi] = -[rsi] - rdx
; Modified Registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;
rawNegLS:
mov rax, [q]
sub rax, rdx
mov [rdi], rax
mov rax, [q + 8 ]
sbb rax, 0
mov [rdi + 8], rax
mov rax, [q + 16 ]
sbb rax, 0
mov [rdi + 16], rax
mov rax, [q + 24 ]
sbb rax, 0
mov [rdi + 24], rax
setc dl
mov rax, [rdi + 0 ]
sub rax, [rsi + 0]
mov [rdi + 0], rax
mov rax, [rdi + 8 ]
sbb rax, [rsi + 8]
mov [rdi + 8], rax
mov rax, [rdi + 16 ]
sbb rax, [rsi + 16]
mov [rdi + 16], rax
mov rax, [rdi + 24 ]
sbb rax, [rsi + 24]
mov [rdi + 24], rax
setc dh
or dl, dh
jz rawNegSL_done
; it is a negative value, so add q
mov rax, [q + 0]
add [rdi + 0], rax
mov rax, [q + 8]
adc [rdi + 8], rax
mov rax, [q + 16]
adc [rdi + 16], rax
mov rax, [q + 24]
adc [rdi + 24], rax
rawNegSL_done:
ret
;;;;;;;;;;;;;;;;;;;;;;
; neg
;;;;;;;;;;;;;;;;;;;;;;
; Adds two elements of any kind
; Params:
; rsi <= Pointer to element to be negated
; rdi <= Pointer to result
; [rdi] = -[rsi]
;;;;;;;;;;;;;;;;;;;;;;
Fr_neg:
mov rax, [rsi]
bt rax, 63 ; Check if is short first operand
jc neg_l
neg_s: ; Operand is short
neg eax
jo neg_manageOverflow ; Check if overflow. (0x80000000 is the only case)
mov [rdi], rax ; not necessary to adjust so just save and return
ret
neg_manageOverflow: ; Do the operation in 64 bits
push rsi
movsx rsi, eax
neg rsi
call rawCopyS2L
pop rsi
ret
neg_l:
mov [rdi], rax ; Copy the type
add rdi, 8
add rsi, 8
call rawNegL
sub rdi, 8
sub rsi, 8
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawNeg
;;;;;;;;;;;;;;;;;;;;;;
; Negates a value
; Params:
; rdi <= Pointer to the long data of result
; rsi <= Pointer to the long data of element 1
;
; [rdi] = - [rsi]
;;;;;;;;;;;;;;;;;;;;;;
rawNegL:
Fr_rawNeg:
; Compare is zero
xor rax, rax
cmp [rsi + 0], rax
jnz doNegate
cmp [rsi + 8], rax
jnz doNegate
cmp [rsi + 16], rax
jnz doNegate
cmp [rsi + 24], rax
jnz doNegate
; it's zero so just set to zero
mov [rdi + 0], rax
mov [rdi + 8], rax
mov [rdi + 16], rax
mov [rdi + 24], rax
ret
doNegate:
mov rax, [q + 0]
sub rax, [rsi + 0]
mov [rdi + 0], rax
mov rax, [q + 8]
sbb rax, [rsi + 8]
mov [rdi + 8], rax
mov rax, [q + 16]
sbb rax, [rsi + 16]
mov [rdi + 16], rax
mov rax, [q + 24]
sbb rax, [rsi + 24]
mov [rdi + 24], rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; square
;;;;;;;;;;;;;;;;;;;;;;
; Squares a field element
; Params:
; rsi <= Pointer to element 1
; rdi <= Pointer to result
; [rdi] = [rsi] * [rsi]
; Modified Registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_square:
mov r8, [rsi]
bt r8, 63 ; Check if is short first operand
jc square_l1
square_s1: ; Both operands are short
xor rax, rax
mov eax, r8d
imul eax
jo square_manageOverflow ; rsi already is the 64bits result
mov [rdi], rax ; not necessary to adjust so just save and return
square_manageOverflow: ; Do the operation in 64 bits
push rsi
movsx rax, r8d
imul rax
mov rsi, rax
call rawCopyS2L
pop rsi
ret
square_l1:
bt r8, 62 ; check if montgomery first
jc square_l1m
square_l1n:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
call Fr_rawMSquare
sub rdi, 8
sub rsi, 8
push rsi
add rdi, 8
mov rsi, rdi
lea rdx, [R3]
call Fr_rawMMul
sub rdi, 8
pop rsi
ret
square_l1m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
call Fr_rawMSquare
sub rdi, 8
sub rsi, 8
ret
;;;;;;;;;;;;;;;;;;;;;;
; mul
;;;;;;;;;;;;;;;;;;;;;;
; Multiplies two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result
; [rdi] = [rsi] * [rdi]
; Modified Registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_mul:
mov r8, [rsi]
mov r9, [rdx]
bt r8, 63 ; Check if is short first operand
jc mul_l1
bt r9, 63 ; Check if is short second operand
jc mul_s1l2
mul_s1s2: ; Both operands are short
xor rax, rax
mov eax, r8d
imul r9d
jo mul_manageOverflow ; rsi already is the 64bits result
mov [rdi], rax ; not necessary to adjust so just save and return
mul_manageOverflow: ; Do the operation in 64 bits
push rsi
movsx rax, r8d
movsx rcx, r9d
imul rcx
mov rsi, rax
call rawCopyS2L
pop rsi
ret
mul_l1:
bt r9, 63 ; Check if is short second operand
jc mul_l1l2
;;;;;;;;
mul_l1s2:
bt r8, 62 ; check if montgomery first
jc mul_l1ms2
mul_l1ns2:
bt r9, 62 ; check if montgomery first
jc mul_l1ns2m
mul_l1ns2n:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
push rsi
add rsi, 8
movsx rdx, r9d
add rdi, 8
cmp rdx, 0
jns tmp_5
neg rdx
call Fr_rawMMul1
mov rsi, rdi
call rawNegL
sub rdi, 8
pop rsi
jmp tmp_6
tmp_5:
call Fr_rawMMul1
sub rdi, 8
pop rsi
tmp_6:
push rsi
add rdi, 8
mov rsi, rdi
lea rdx, [R3]
call Fr_rawMMul
sub rdi, 8
pop rsi
ret
mul_l1ns2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call Fr_rawMMul
sub rdi, 8
sub rsi, 8
ret
mul_l1ms2:
bt r9, 62 ; check if montgomery second
jc mul_l1ms2m
mul_l1ms2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
push rsi
add rsi, 8
movsx rdx, r9d
add rdi, 8
cmp rdx, 0
jns tmp_7
neg rdx
call Fr_rawMMul1
mov rsi, rdi
call rawNegL
sub rdi, 8
pop rsi
jmp tmp_8
tmp_7:
call Fr_rawMMul1
sub rdi, 8
pop rsi
tmp_8:
ret
mul_l1ms2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call Fr_rawMMul
sub rdi, 8
sub rsi, 8
ret
;;;;;;;;
mul_s1l2:
bt r8, 62 ; check if montgomery first
jc mul_s1ml2
mul_s1nl2:
bt r9, 62 ; check if montgomery first
jc mul_s1nl2m
mul_s1nl2n:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
push rsi
lea rsi, [rdx + 8]
movsx rdx, r8d
add rdi, 8
cmp rdx, 0
jns tmp_9
neg rdx
call Fr_rawMMul1
mov rsi, rdi
call rawNegL
sub rdi, 8
pop rsi
jmp tmp_10
tmp_9:
call Fr_rawMMul1
sub rdi, 8
pop rsi
tmp_10:
push rsi
add rdi, 8
mov rsi, rdi
lea rdx, [R3]
call Fr_rawMMul
sub rdi, 8
pop rsi
ret
mul_s1nl2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
push rsi
lea rsi, [rdx + 8]
movsx rdx, r8d
add rdi, 8
cmp rdx, 0
jns tmp_11
neg rdx
call Fr_rawMMul1
mov rsi, rdi
call rawNegL
sub rdi, 8
pop rsi
jmp tmp_12
tmp_11:
call Fr_rawMMul1
sub rdi, 8
pop rsi
tmp_12:
ret
mul_s1ml2:
bt r9, 62 ; check if montgomery first
jc mul_s1ml2m
mul_s1ml2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call Fr_rawMMul
sub rdi, 8
sub rsi, 8
ret
mul_s1ml2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call Fr_rawMMul
sub rdi, 8
sub rsi, 8
ret
;;;;
mul_l1l2:
bt r8, 62 ; check if montgomery first
jc mul_l1ml2
mul_l1nl2:
bt r9, 62 ; check if montgomery second
jc mul_l1nl2m
mul_l1nl2n:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call Fr_rawMMul
sub rdi, 8
sub rsi, 8
push rsi
add rdi, 8
mov rsi, rdi
lea rdx, [R3]
call Fr_rawMMul
sub rdi, 8
pop rsi
ret
mul_l1nl2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call Fr_rawMMul
sub rdi, 8
sub rsi, 8
ret
mul_l1ml2:
bt r9, 62 ; check if montgomery seconf
jc mul_l1ml2m
mul_l1ml2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call Fr_rawMMul
sub rdi, 8
sub rsi, 8
ret
mul_l1ml2m:
mov r11b, 0xC0
shl r11d, 24
mov [rdi+4], r11d
add rdi, 8
add rsi, 8
add rdx, 8
call Fr_rawMMul
sub rdi, 8
sub rsi, 8
ret
;;;;;;;;;;;;;;;;;;;;;;
; band
;;;;;;;;;;;;;;;;;;;;;;
; Adds two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result
; Modified Registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_band:
push rbp
push rsi
push rdx
mov rbp, rsp
mov rax, [rsi]
mov rcx, [rdx]
bt rax, 63 ; Check if is short first operand
jc and_l1
bt rcx, 63 ; Check if is short second operand
jc and_s1l2
and_s1s2:
cmp eax, 0
js tmp_13
cmp ecx, 0
js tmp_13
xor rdx, rdx ; both ops are positive so do the op and return
mov edx, eax
and edx, ecx
mov [rdi], rdx ; not necessary to adjust so just save and return
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_13:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov rax, [rsi + 8]
and rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
and rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
and rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_15 ; q is bigget so done.
jnz tmp_14 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_15 ; q is bigget so done.
jnz tmp_14 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_15 ; q is bigget so done.
jnz tmp_14 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_15 ; q is bigget so done.
jnz tmp_14 ; q is lower
; If equal substract q
tmp_14:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_15:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
and_l1:
bt rcx, 63 ; Check if is short second operand
jc and_l1l2
and_l1s2:
bt rax, 62 ; check if montgomery first
jc and_l1ms2
and_l1ns2:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rcx, [rdx]
cmp ecx, 0
js tmp_16
movsx rax, ecx
and rax, [rsi +8]
mov [rdi+8], rax
xor rax, rax
and rax, [rsi + 16];
mov [rdi + 16 ], rax;
xor rax, rax
and rax, [rsi + 24];
mov [rdi + 24 ], rax;
xor rax, rax
and rax, [rsi + 32];
and rax, [lboMask] ;
mov [rdi + 32 ], rax;
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_18 ; q is bigget so done.
jnz tmp_17 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_18 ; q is bigget so done.
jnz tmp_17 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_18 ; q is bigget so done.
jnz tmp_17 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_18 ; q is bigget so done.
jnz tmp_17 ; q is lower
; If equal substract q
tmp_17:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_18:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_16:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
and rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
and rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
and rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_20 ; q is bigget so done.
jnz tmp_19 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_20 ; q is bigget so done.
jnz tmp_19 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_20 ; q is bigget so done.
jnz tmp_19 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_20 ; q is bigget so done.
jnz tmp_19 ; q is lower
; If equal substract q
tmp_19:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_20:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
and_l1ms2:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov rcx, [rdx]
cmp ecx, 0
js tmp_21
movsx rax, ecx
and rax, [rsi +8]
mov [rdi+8], rax
xor rax, rax
and rax, [rsi + 16];
mov [rdi + 16 ], rax;
xor rax, rax
and rax, [rsi + 24];
mov [rdi + 24 ], rax;
xor rax, rax
and rax, [rsi + 32];
and rax, [lboMask] ;
mov [rdi + 32 ], rax;
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_23 ; q is bigget so done.
jnz tmp_22 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_23 ; q is bigget so done.
jnz tmp_22 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_23 ; q is bigget so done.
jnz tmp_22 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_23 ; q is bigget so done.
jnz tmp_22 ; q is lower
; If equal substract q
tmp_22:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_23:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_21:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
and rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
and rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
and rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_25 ; q is bigget so done.
jnz tmp_24 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_25 ; q is bigget so done.
jnz tmp_24 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_25 ; q is bigget so done.
jnz tmp_24 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_25 ; q is bigget so done.
jnz tmp_24 ; q is lower
; If equal substract q
tmp_24:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_25:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
and_s1l2:
bt rcx, 62 ; check if montgomery first
jc and_s1l2m
and_s1l2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov eax, [rsi]
cmp eax, 0
js tmp_26
and rax, [rdx +8]
mov [rdi+8], rax
xor rax, rax
and rax, [rdx + 16]
mov [rdi + 16 ], rax
xor rax, rax
and rax, [rdx + 24]
mov [rdi + 24 ], rax
xor rax, rax
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_28 ; q is bigget so done.
jnz tmp_27 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_28 ; q is bigget so done.
jnz tmp_27 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_28 ; q is bigget so done.
jnz tmp_27 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_28 ; q is bigget so done.
jnz tmp_27 ; q is lower
; If equal substract q
tmp_27:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_28:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_26:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
and rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
and rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
and rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_30 ; q is bigget so done.
jnz tmp_29 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_30 ; q is bigget so done.
jnz tmp_29 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_30 ; q is bigget so done.
jnz tmp_29 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_30 ; q is bigget so done.
jnz tmp_29 ; q is lower
; If equal substract q
tmp_29:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_30:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
and_s1l2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
mov eax, [rsi]
cmp eax, 0
js tmp_31
and rax, [rdx +8]
mov [rdi+8], rax
xor rax, rax
and rax, [rdx + 16]
mov [rdi + 16 ], rax
xor rax, rax
and rax, [rdx + 24]
mov [rdi + 24 ], rax
xor rax, rax
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_33 ; q is bigget so done.
jnz tmp_32 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_33 ; q is bigget so done.
jnz tmp_32 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_33 ; q is bigget so done.
jnz tmp_32 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_33 ; q is bigget so done.
jnz tmp_32 ; q is lower
; If equal substract q
tmp_32:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_33:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_31:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
and rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
and rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
and rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_35 ; q is bigget so done.
jnz tmp_34 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_35 ; q is bigget so done.
jnz tmp_34 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_35 ; q is bigget so done.
jnz tmp_34 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_35 ; q is bigget so done.
jnz tmp_34 ; q is lower
; If equal substract q
tmp_34:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_35:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
and_l1l2:
bt rax, 62 ; check if montgomery first
jc and_l1ml2
bt rcx, 62 ; check if montgomery first
jc and_l1nl2m
and_l1nl2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
and rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
and rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
and rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_37 ; q is bigget so done.
jnz tmp_36 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_37 ; q is bigget so done.
jnz tmp_36 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_37 ; q is bigget so done.
jnz tmp_36 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_37 ; q is bigget so done.
jnz tmp_36 ; q is lower
; If equal substract q
tmp_36:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_37:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
and_l1nl2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
mov rax, [rsi + 8]
and rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
and rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
and rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_39 ; q is bigget so done.
jnz tmp_38 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_39 ; q is bigget so done.
jnz tmp_38 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_39 ; q is bigget so done.
jnz tmp_38 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_39 ; q is bigget so done.
jnz tmp_38 ; q is lower
; If equal substract q
tmp_38:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_39:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
and_l1ml2:
bt rcx, 62 ; check if montgomery first
jc and_l1ml2m
and_l1ml2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov rax, [rsi + 8]
and rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
and rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
and rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_41 ; q is bigget so done.
jnz tmp_40 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_41 ; q is bigget so done.
jnz tmp_40 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_41 ; q is bigget so done.
jnz tmp_40 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_41 ; q is bigget so done.
jnz tmp_40 ; q is lower
; If equal substract q
tmp_40:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_41:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
and_l1ml2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
mov rax, [rsi + 8]
and rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
and rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
and rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
and rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_43 ; q is bigget so done.
jnz tmp_42 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_43 ; q is bigget so done.
jnz tmp_42 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_43 ; q is bigget so done.
jnz tmp_42 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_43 ; q is bigget so done.
jnz tmp_42 ; q is lower
; If equal substract q
tmp_42:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_43:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;;;;;;;;;;;;;;;
; bor
;;;;;;;;;;;;;;;;;;;;;;
; Adds two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result
; Modified Registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_bor:
push rbp
push rsi
push rdx
mov rbp, rsp
mov rax, [rsi]
mov rcx, [rdx]
bt rax, 63 ; Check if is short first operand
jc or_l1
bt rcx, 63 ; Check if is short second operand
jc or_s1l2
or_s1s2:
cmp eax, 0
js tmp_44
cmp ecx, 0
js tmp_44
xor rdx, rdx ; both ops are positive so do the op and return
mov edx, eax
or edx, ecx
mov [rdi], rdx ; not necessary to adjust so just save and return
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_44:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov rax, [rsi + 8]
or rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
or rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
or rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_46 ; q is bigget so done.
jnz tmp_45 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_46 ; q is bigget so done.
jnz tmp_45 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_46 ; q is bigget so done.
jnz tmp_45 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_46 ; q is bigget so done.
jnz tmp_45 ; q is lower
; If equal substract q
tmp_45:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_46:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
or_l1:
bt rcx, 63 ; Check if is short second operand
jc or_l1l2
or_l1s2:
bt rax, 62 ; check if montgomery first
jc or_l1ms2
or_l1ns2:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rcx, [rdx]
cmp ecx, 0
js tmp_47
movsx rax, ecx
or rax, [rsi +8]
mov [rdi+8], rax
xor rax, rax
or rax, [rsi + 16];
mov [rdi + 16 ], rax;
xor rax, rax
or rax, [rsi + 24];
mov [rdi + 24 ], rax;
xor rax, rax
or rax, [rsi + 32];
and rax, [lboMask] ;
mov [rdi + 32 ], rax;
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_49 ; q is bigget so done.
jnz tmp_48 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_49 ; q is bigget so done.
jnz tmp_48 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_49 ; q is bigget so done.
jnz tmp_48 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_49 ; q is bigget so done.
jnz tmp_48 ; q is lower
; If equal substract q
tmp_48:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_49:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_47:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
or rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
or rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
or rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_51 ; q is bigget so done.
jnz tmp_50 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_51 ; q is bigget so done.
jnz tmp_50 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_51 ; q is bigget so done.
jnz tmp_50 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_51 ; q is bigget so done.
jnz tmp_50 ; q is lower
; If equal substract q
tmp_50:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_51:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
or_l1ms2:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov rcx, [rdx]
cmp ecx, 0
js tmp_52
movsx rax, ecx
or rax, [rsi +8]
mov [rdi+8], rax
xor rax, rax
or rax, [rsi + 16];
mov [rdi + 16 ], rax;
xor rax, rax
or rax, [rsi + 24];
mov [rdi + 24 ], rax;
xor rax, rax
or rax, [rsi + 32];
and rax, [lboMask] ;
mov [rdi + 32 ], rax;
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_54 ; q is bigget so done.
jnz tmp_53 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_54 ; q is bigget so done.
jnz tmp_53 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_54 ; q is bigget so done.
jnz tmp_53 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_54 ; q is bigget so done.
jnz tmp_53 ; q is lower
; If equal substract q
tmp_53:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_54:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_52:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
or rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
or rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
or rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_56 ; q is bigget so done.
jnz tmp_55 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_56 ; q is bigget so done.
jnz tmp_55 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_56 ; q is bigget so done.
jnz tmp_55 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_56 ; q is bigget so done.
jnz tmp_55 ; q is lower
; If equal substract q
tmp_55:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_56:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
or_s1l2:
bt rcx, 62 ; check if montgomery first
jc or_s1l2m
or_s1l2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov eax, [rsi]
cmp eax, 0
js tmp_57
or rax, [rdx +8]
mov [rdi+8], rax
xor rax, rax
or rax, [rdx + 16]
mov [rdi + 16 ], rax
xor rax, rax
or rax, [rdx + 24]
mov [rdi + 24 ], rax
xor rax, rax
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_59 ; q is bigget so done.
jnz tmp_58 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_59 ; q is bigget so done.
jnz tmp_58 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_59 ; q is bigget so done.
jnz tmp_58 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_59 ; q is bigget so done.
jnz tmp_58 ; q is lower
; If equal substract q
tmp_58:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_59:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_57:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
or rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
or rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
or rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_61 ; q is bigget so done.
jnz tmp_60 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_61 ; q is bigget so done.
jnz tmp_60 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_61 ; q is bigget so done.
jnz tmp_60 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_61 ; q is bigget so done.
jnz tmp_60 ; q is lower
; If equal substract q
tmp_60:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_61:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
or_s1l2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
mov eax, [rsi]
cmp eax, 0
js tmp_62
or rax, [rdx +8]
mov [rdi+8], rax
xor rax, rax
or rax, [rdx + 16]
mov [rdi + 16 ], rax
xor rax, rax
or rax, [rdx + 24]
mov [rdi + 24 ], rax
xor rax, rax
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_64 ; q is bigget so done.
jnz tmp_63 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_64 ; q is bigget so done.
jnz tmp_63 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_64 ; q is bigget so done.
jnz tmp_63 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_64 ; q is bigget so done.
jnz tmp_63 ; q is lower
; If equal substract q
tmp_63:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_64:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_62:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
or rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
or rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
or rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_66 ; q is bigget so done.
jnz tmp_65 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_66 ; q is bigget so done.
jnz tmp_65 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_66 ; q is bigget so done.
jnz tmp_65 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_66 ; q is bigget so done.
jnz tmp_65 ; q is lower
; If equal substract q
tmp_65:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_66:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
or_l1l2:
bt rax, 62 ; check if montgomery first
jc or_l1ml2
bt rcx, 62 ; check if montgomery first
jc or_l1nl2m
or_l1nl2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
or rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
or rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
or rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_68 ; q is bigget so done.
jnz tmp_67 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_68 ; q is bigget so done.
jnz tmp_67 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_68 ; q is bigget so done.
jnz tmp_67 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_68 ; q is bigget so done.
jnz tmp_67 ; q is lower
; If equal substract q
tmp_67:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_68:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
or_l1nl2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
mov rax, [rsi + 8]
or rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
or rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
or rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_70 ; q is bigget so done.
jnz tmp_69 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_70 ; q is bigget so done.
jnz tmp_69 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_70 ; q is bigget so done.
jnz tmp_69 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_70 ; q is bigget so done.
jnz tmp_69 ; q is lower
; If equal substract q
tmp_69:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_70:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
or_l1ml2:
bt rcx, 62 ; check if montgomery first
jc or_l1ml2m
or_l1ml2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov rax, [rsi + 8]
or rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
or rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
or rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_72 ; q is bigget so done.
jnz tmp_71 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_72 ; q is bigget so done.
jnz tmp_71 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_72 ; q is bigget so done.
jnz tmp_71 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_72 ; q is bigget so done.
jnz tmp_71 ; q is lower
; If equal substract q
tmp_71:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_72:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
or_l1ml2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
mov rax, [rsi + 8]
or rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
or rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
or rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
or rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_74 ; q is bigget so done.
jnz tmp_73 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_74 ; q is bigget so done.
jnz tmp_73 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_74 ; q is bigget so done.
jnz tmp_73 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_74 ; q is bigget so done.
jnz tmp_73 ; q is lower
; If equal substract q
tmp_73:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_74:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;;;;;;;;;;;;;;;
; bxor
;;;;;;;;;;;;;;;;;;;;;;
; Adds two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result
; Modified Registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_bxor:
push rbp
push rsi
push rdx
mov rbp, rsp
mov rax, [rsi]
mov rcx, [rdx]
bt rax, 63 ; Check if is short first operand
jc xor_l1
bt rcx, 63 ; Check if is short second operand
jc xor_s1l2
xor_s1s2:
cmp eax, 0
js tmp_75
cmp ecx, 0
js tmp_75
xor rdx, rdx ; both ops are positive so do the op and return
mov edx, eax
xor edx, ecx
mov [rdi], rdx ; not necessary to adjust so just save and return
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_75:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov rax, [rsi + 8]
xor rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_77 ; q is bigget so done.
jnz tmp_76 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_77 ; q is bigget so done.
jnz tmp_76 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_77 ; q is bigget so done.
jnz tmp_76 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_77 ; q is bigget so done.
jnz tmp_76 ; q is lower
; If equal substract q
tmp_76:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_77:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
xor_l1:
bt rcx, 63 ; Check if is short second operand
jc xor_l1l2
xor_l1s2:
bt rax, 62 ; check if montgomery first
jc xor_l1ms2
xor_l1ns2:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rcx, [rdx]
cmp ecx, 0
js tmp_78
movsx rax, ecx
xor rax, [rsi +8]
mov [rdi+8], rax
xor rax, rax
xor rax, [rsi + 16];
mov [rdi + 16 ], rax;
xor rax, rax
xor rax, [rsi + 24];
mov [rdi + 24 ], rax;
xor rax, rax
xor rax, [rsi + 32];
and rax, [lboMask] ;
mov [rdi + 32 ], rax;
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_80 ; q is bigget so done.
jnz tmp_79 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_80 ; q is bigget so done.
jnz tmp_79 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_80 ; q is bigget so done.
jnz tmp_79 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_80 ; q is bigget so done.
jnz tmp_79 ; q is lower
; If equal substract q
tmp_79:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_80:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_78:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
xor rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_82 ; q is bigget so done.
jnz tmp_81 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_82 ; q is bigget so done.
jnz tmp_81 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_82 ; q is bigget so done.
jnz tmp_81 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_82 ; q is bigget so done.
jnz tmp_81 ; q is lower
; If equal substract q
tmp_81:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_82:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
xor_l1ms2:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov rcx, [rdx]
cmp ecx, 0
js tmp_83
movsx rax, ecx
xor rax, [rsi +8]
mov [rdi+8], rax
xor rax, rax
xor rax, [rsi + 16];
mov [rdi + 16 ], rax;
xor rax, rax
xor rax, [rsi + 24];
mov [rdi + 24 ], rax;
xor rax, rax
xor rax, [rsi + 32];
and rax, [lboMask] ;
mov [rdi + 32 ], rax;
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_85 ; q is bigget so done.
jnz tmp_84 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_85 ; q is bigget so done.
jnz tmp_84 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_85 ; q is bigget so done.
jnz tmp_84 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_85 ; q is bigget so done.
jnz tmp_84 ; q is lower
; If equal substract q
tmp_84:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_85:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_83:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
xor rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_87 ; q is bigget so done.
jnz tmp_86 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_87 ; q is bigget so done.
jnz tmp_86 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_87 ; q is bigget so done.
jnz tmp_86 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_87 ; q is bigget so done.
jnz tmp_86 ; q is lower
; If equal substract q
tmp_86:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_87:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
xor_s1l2:
bt rcx, 62 ; check if montgomery first
jc xor_s1l2m
xor_s1l2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov eax, [rsi]
cmp eax, 0
js tmp_88
xor rax, [rdx +8]
mov [rdi+8], rax
xor rax, rax
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
xor rax, rax
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
xor rax, rax
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_90 ; q is bigget so done.
jnz tmp_89 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_90 ; q is bigget so done.
jnz tmp_89 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_90 ; q is bigget so done.
jnz tmp_89 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_90 ; q is bigget so done.
jnz tmp_89 ; q is lower
; If equal substract q
tmp_89:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_90:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_88:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
xor rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_92 ; q is bigget so done.
jnz tmp_91 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_92 ; q is bigget so done.
jnz tmp_91 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_92 ; q is bigget so done.
jnz tmp_91 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_92 ; q is bigget so done.
jnz tmp_91 ; q is lower
; If equal substract q
tmp_91:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_92:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
xor_s1l2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
mov eax, [rsi]
cmp eax, 0
js tmp_93
xor rax, [rdx +8]
mov [rdi+8], rax
xor rax, rax
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
xor rax, rax
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
xor rax, rax
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_95 ; q is bigget so done.
jnz tmp_94 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_95 ; q is bigget so done.
jnz tmp_94 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_95 ; q is bigget so done.
jnz tmp_94 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_95 ; q is bigget so done.
jnz tmp_94 ; q is lower
; If equal substract q
tmp_94:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_95:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
tmp_93:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
xor rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_97 ; q is bigget so done.
jnz tmp_96 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_97 ; q is bigget so done.
jnz tmp_96 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_97 ; q is bigget so done.
jnz tmp_96 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_97 ; q is bigget so done.
jnz tmp_96 ; q is lower
; If equal substract q
tmp_96:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_97:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
xor_l1l2:
bt rax, 62 ; check if montgomery first
jc xor_l1ml2
bt rcx, 62 ; check if montgomery first
jc xor_l1nl2m
xor_l1nl2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi + 8]
xor rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_99 ; q is bigget so done.
jnz tmp_98 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_99 ; q is bigget so done.
jnz tmp_98 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_99 ; q is bigget so done.
jnz tmp_98 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_99 ; q is bigget so done.
jnz tmp_98 ; q is lower
; If equal substract q
tmp_98:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_99:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
xor_l1nl2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
mov rax, [rsi + 8]
xor rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_101 ; q is bigget so done.
jnz tmp_100 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_101 ; q is bigget so done.
jnz tmp_100 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_101 ; q is bigget so done.
jnz tmp_100 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_101 ; q is bigget so done.
jnz tmp_100 ; q is lower
; If equal substract q
tmp_100:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_101:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
xor_l1ml2:
bt rcx, 62 ; check if montgomery first
jc xor_l1ml2m
xor_l1ml2n:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov rax, [rsi + 8]
xor rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_103 ; q is bigget so done.
jnz tmp_102 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_103 ; q is bigget so done.
jnz tmp_102 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_103 ; q is bigget so done.
jnz tmp_102 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_103 ; q is bigget so done.
jnz tmp_102 ; q is lower
; If equal substract q
tmp_102:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_103:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
xor_l1ml2m:
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
mov rax, [rsi + 8]
xor rax, [rdx + 8]
mov [rdi + 8 ], rax
mov rax, [rsi + 16]
xor rax, [rdx + 16]
mov [rdi + 16 ], rax
mov rax, [rsi + 24]
xor rax, [rdx + 24]
mov [rdi + 24 ], rax
mov rax, [rsi + 32]
xor rax, [rdx + 32]
and rax, [lboMask]
mov [rdi + 32 ], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_105 ; q is bigget so done.
jnz tmp_104 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_105 ; q is bigget so done.
jnz tmp_104 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_105 ; q is bigget so done.
jnz tmp_104 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_105 ; q is bigget so done.
jnz tmp_104 ; q is lower
; If equal substract q
tmp_104:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_105:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;;;;;;;;;;;;;;;
; bnot
;;;;;;;;;;;;;;;;;;;;;;
; Adds two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdi <= Pointer to result
; Modified Registers:
; r8, r9, 10, r11, rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_bnot:
push rbp
push rsi
push rdx
mov rbp, rsp
mov r11b, 0x80
shl r11d, 24
mov [rdi+4], r11d
mov rax, [rsi]
bt rax, 63 ; Check if is long operand
jc bnot_l1
bnot_s:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
jmp bnot_l1n
bnot_l1:
bt rax, 62 ; check if montgomery first
jnc bnot_l1n
bnot_l1m:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
bnot_l1n:
mov rax, [rsi + 8]
not rax
mov [rdi + 8], rax
mov rax, [rsi + 16]
not rax
mov [rdi + 16], rax
mov rax, [rsi + 24]
not rax
mov [rdi + 24], rax
mov rax, [rsi + 32]
not rax
and rax, [lboMask]
mov [rdi + 32], rax
; Compare with q
mov rax, [rdi + 32]
cmp rax, [q + 24]
jc tmp_107 ; q is bigget so done.
jnz tmp_106 ; q is lower
mov rax, [rdi + 24]
cmp rax, [q + 16]
jc tmp_107 ; q is bigget so done.
jnz tmp_106 ; q is lower
mov rax, [rdi + 16]
cmp rax, [q + 8]
jc tmp_107 ; q is bigget so done.
jnz tmp_106 ; q is lower
mov rax, [rdi + 8]
cmp rax, [q + 0]
jc tmp_107 ; q is bigget so done.
jnz tmp_106 ; q is lower
; If equal substract q
tmp_106:
mov rax, [q + 0]
sub [rdi + 8], rax
mov rax, [q + 8]
sbb [rdi + 16], rax
mov rax, [q + 16]
sbb [rdi + 24], rax
mov rax, [q + 24]
sbb [rdi + 32], rax
tmp_107:
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;;;;;;;;;;;;;;;
; rgt - Raw Greater Than
;;;;;;;;;;;;;;;;;;;;;;
; returns in ax 1 id *rsi > *rdx
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rax <= Return 1 or 0
; Modified Registers:
; r8, r9, rax
;;;;;;;;;;;;;;;;;;;;;;
Fr_rgt:
push rbp
push rsi
push rdx
mov rbp, rsp
mov r8, [rsi]
mov r9, [rdx]
bt r8, 63 ; Check if is short first operand
jc rgt_l1
bt r9, 63 ; Check if is short second operand
jc rgt_s1l2
rgt_s1s2: ; Both operands are short
cmp r8d, r9d
jg rgt_ret1
jmp rgt_ret0
rgt_l1:
bt r9, 63 ; Check if is short second operand
jc rgt_l1l2
;;;;;;;;
rgt_l1s2:
bt r8, 62 ; check if montgomery first
jc rgt_l1ms2
rgt_l1ns2:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
jmp rgtL1L2
rgt_l1ms2:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
jmp rgtL1L2
;;;;;;;;
rgt_s1l2:
bt r9, 62 ; check if montgomery second
jc rgt_s1l2m
rgt_s1l2n:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
jmp rgtL1L2
rgt_s1l2m:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
jmp rgtL1L2
;;;;
rgt_l1l2:
bt r8, 62 ; check if montgomery first
jc rgt_l1ml2
rgt_l1nl2:
bt r9, 62 ; check if montgomery second
jc rgt_l1nl2m
rgt_l1nl2n:
jmp rgtL1L2
rgt_l1nl2m:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
jmp rgtL1L2
rgt_l1ml2:
bt r9, 62 ; check if montgomery second
jc rgt_l1ml2m
rgt_l1ml2n:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
jmp rgtL1L2
rgt_l1ml2m:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
jmp rgtL1L2
;;;;;;
; rgtL1L2
;;;;;;
rgtL1L2:
mov rax, [rsi + 32]
cmp [half + 24], rax ; comare with (q-1)/2
jc rgtl1l2_n1 ; half<rax => e1-e2 is neg => e1 < e2
jnz rgtl1l2_p1 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rsi + 24]
cmp [half + 16], rax ; comare with (q-1)/2
jc rgtl1l2_n1 ; half<rax => e1-e2 is neg => e1 < e2
jnz rgtl1l2_p1 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rsi + 16]
cmp [half + 8], rax ; comare with (q-1)/2
jc rgtl1l2_n1 ; half<rax => e1-e2 is neg => e1 < e2
jnz rgtl1l2_p1 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rsi + 8]
cmp [half + 0], rax ; comare with (q-1)/2
jc rgtl1l2_n1 ; half<rax => e1-e2 is neg => e1 < e2
jmp rgtl1l2_p1
rgtl1l2_p1:
mov rax, [rdx + 32]
cmp [half + 24], rax ; comare with (q-1)/2
jc rgt_ret1 ; half<rax => e1-e2 is neg => e1 < e2
jnz rgtRawL1L2 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 24]
cmp [half + 16], rax ; comare with (q-1)/2
jc rgt_ret1 ; half<rax => e1-e2 is neg => e1 < e2
jnz rgtRawL1L2 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 16]
cmp [half + 8], rax ; comare with (q-1)/2
jc rgt_ret1 ; half<rax => e1-e2 is neg => e1 < e2
jnz rgtRawL1L2 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 8]
cmp [half + 0], rax ; comare with (q-1)/2
jc rgt_ret1 ; half<rax => e1-e2 is neg => e1 < e2
jmp rgtRawL1L2
rgtl1l2_n1:
mov rax, [rdx + 32]
cmp [half + 24], rax ; comare with (q-1)/2
jc rgtRawL1L2 ; half<rax => e1-e2 is neg => e1 < e2
jnz rgt_ret0 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 24]
cmp [half + 16], rax ; comare with (q-1)/2
jc rgtRawL1L2 ; half<rax => e1-e2 is neg => e1 < e2
jnz rgt_ret0 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 16]
cmp [half + 8], rax ; comare with (q-1)/2
jc rgtRawL1L2 ; half<rax => e1-e2 is neg => e1 < e2
jnz rgt_ret0 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 8]
cmp [half + 0], rax ; comare with (q-1)/2
jc rgtRawL1L2 ; half<rax => e1-e2 is neg => e1 < e2
jmp rgt_ret0
rgtRawL1L2:
mov rax, [rsi + 32]
cmp [rdx + 32], rax ; comare with (q-1)/2
jc rgt_ret1 ; rsi<rdx => 1st > 2nd
jnz rgt_ret0
mov rax, [rsi + 24]
cmp [rdx + 24], rax ; comare with (q-1)/2
jc rgt_ret1 ; rsi<rdx => 1st > 2nd
jnz rgt_ret0
mov rax, [rsi + 16]
cmp [rdx + 16], rax ; comare with (q-1)/2
jc rgt_ret1 ; rsi<rdx => 1st > 2nd
jnz rgt_ret0
mov rax, [rsi + 8]
cmp [rdx + 8], rax ; comare with (q-1)/2
jc rgt_ret1 ; rsi<rdx => 1st > 2nd
rgt_ret0:
xor rax, rax
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
rgt_ret1:
mov rax, 1
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;;;;;;;;;;;;;;;
; rlt - Raw Less Than
;;;;;;;;;;;;;;;;;;;;;;
; returns in ax 1 id *rsi > *rdx
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rax <= Return 1 or 0
; Modified Registers:
; r8, r9, rax
;;;;;;;;;;;;;;;;;;;;;;
Fr_rlt:
push rbp
push rsi
push rdx
mov rbp, rsp
mov r8, [rsi]
mov r9, [rdx]
bt r8, 63 ; Check if is short first operand
jc rlt_l1
bt r9, 63 ; Check if is short second operand
jc rlt_s1l2
rlt_s1s2: ; Both operands are short
cmp r8d, r9d
jl rlt_ret1
jmp rlt_ret0
rlt_l1:
bt r9, 63 ; Check if is short second operand
jc rlt_l1l2
;;;;;;;;
rlt_l1s2:
bt r8, 62 ; check if montgomery first
jc rlt_l1ms2
rlt_l1ns2:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
jmp rltL1L2
rlt_l1ms2:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
jmp rltL1L2
;;;;;;;;
rlt_s1l2:
bt r9, 62 ; check if montgomery second
jc rlt_s1l2m
rlt_s1l2n:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
jmp rltL1L2
rlt_s1l2m:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
jmp rltL1L2
;;;;
rlt_l1l2:
bt r8, 62 ; check if montgomery first
jc rlt_l1ml2
rlt_l1nl2:
bt r9, 62 ; check if montgomery second
jc rlt_l1nl2m
rlt_l1nl2n:
jmp rltL1L2
rlt_l1nl2m:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
jmp rltL1L2
rlt_l1ml2:
bt r9, 62 ; check if montgomery second
jc rlt_l1ml2m
rlt_l1ml2n:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
jmp rltL1L2
rlt_l1ml2m:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toNormal
mov rsi, rdi
pop rdi
pop rdx
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toNormal
mov rdx, rdi
pop rdi
pop rsi
jmp rltL1L2
;;;;;;
; rltL1L2
;;;;;;
rltL1L2:
mov rax, [rsi + 32]
cmp [half + 24], rax ; comare with (q-1)/2
jc rltl1l2_n1 ; half<rax => e1-e2 is neg => e1 < e2
jnz rltl1l2_p1 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rsi + 24]
cmp [half + 16], rax ; comare with (q-1)/2
jc rltl1l2_n1 ; half<rax => e1-e2 is neg => e1 < e2
jnz rltl1l2_p1 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rsi + 16]
cmp [half + 8], rax ; comare with (q-1)/2
jc rltl1l2_n1 ; half<rax => e1-e2 is neg => e1 < e2
jnz rltl1l2_p1 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rsi + 8]
cmp [half + 0], rax ; comare with (q-1)/2
jc rltl1l2_n1 ; half<rax => e1-e2 is neg => e1 < e2
jmp rltl1l2_p1
rltl1l2_p1:
mov rax, [rdx + 32]
cmp [half + 24], rax ; comare with (q-1)/2
jc rlt_ret0 ; half<rax => e1-e2 is neg => e1 < e2
jnz rltRawL1L2 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 24]
cmp [half + 16], rax ; comare with (q-1)/2
jc rlt_ret0 ; half<rax => e1-e2 is neg => e1 < e2
jnz rltRawL1L2 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 16]
cmp [half + 8], rax ; comare with (q-1)/2
jc rlt_ret0 ; half<rax => e1-e2 is neg => e1 < e2
jnz rltRawL1L2 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 8]
cmp [half + 0], rax ; comare with (q-1)/2
jc rlt_ret0 ; half<rax => e1-e2 is neg => e1 < e2
jmp rltRawL1L2
rltl1l2_n1:
mov rax, [rdx + 32]
cmp [half + 24], rax ; comare with (q-1)/2
jc rltRawL1L2 ; half<rax => e1-e2 is neg => e1 < e2
jnz rlt_ret1 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 24]
cmp [half + 16], rax ; comare with (q-1)/2
jc rltRawL1L2 ; half<rax => e1-e2 is neg => e1 < e2
jnz rlt_ret1 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 16]
cmp [half + 8], rax ; comare with (q-1)/2
jc rltRawL1L2 ; half<rax => e1-e2 is neg => e1 < e2
jnz rlt_ret1 ; half>rax => e1 -e2 is pos => e1 > e2
mov rax, [rdx + 8]
cmp [half + 0], rax ; comare with (q-1)/2
jc rltRawL1L2 ; half<rax => e1-e2 is neg => e1 < e2
jmp rlt_ret1
rltRawL1L2:
mov rax, [rsi + 32]
cmp [rdx + 32], rax ; comare with (q-1)/2
jc rlt_ret0 ; rsi<rdx => 1st > 2nd
jnz rlt_ret1
mov rax, [rsi + 24]
cmp [rdx + 24], rax ; comare with (q-1)/2
jc rlt_ret0 ; rsi<rdx => 1st > 2nd
jnz rlt_ret1
mov rax, [rsi + 16]
cmp [rdx + 16], rax ; comare with (q-1)/2
jc rlt_ret0 ; rsi<rdx => 1st > 2nd
jnz rlt_ret1
mov rax, [rsi + 8]
cmp [rdx + 8], rax ; comare with (q-1)/2
jc rlt_ret0 ; rsi<rdx => 1st > 2nd
jnz rlt_ret1
rlt_ret0:
xor rax, rax
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
rlt_ret1:
mov rax, 1
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;;;;;;;;;;;;;;;
; req - Raw Eq
;;;;;;;;;;;;;;;;;;;;;;
; returns in ax 1 id *rsi == *rdx
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rax <= Return 1 or 0
; Modified Registers:
; r8, r9, rax
;;;;;;;;;;;;;;;;;;;;;;
Fr_req:
push rbp
push rsi
push rdx
mov rbp, rsp
mov r8, [rsi]
mov r9, [rdx]
bt r8, 63 ; Check if is short first operand
jc req_l1
bt r9, 63 ; Check if is short second operand
jc req_s1l2
req_s1s2: ; Both operands are short
cmp r8d, r9d
je req_ret1
jmp req_ret0
req_l1:
bt r9, 63 ; Check if is short second operand
jc req_l1l2
;;;;;;;;
req_l1s2:
bt r8, 62 ; check if montgomery first
jc req_l1ms2
req_l1ns2:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toLongNormal
mov rdx, rdi
pop rdi
pop rsi
jmp reqL1L2
req_l1ms2:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toMontgomery
mov rdx, rdi
pop rdi
pop rsi
jmp reqL1L2
;;;;;;;;
req_s1l2:
bt r9, 62 ; check if montgomery second
jc req_s1l2m
req_s1l2n:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toLongNormal
mov rsi, rdi
pop rdi
pop rdx
jmp reqL1L2
req_s1l2m:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toMontgomery
mov rsi, rdi
pop rdi
pop rdx
jmp reqL1L2
;;;;
req_l1l2:
bt r8, 62 ; check if montgomery first
jc req_l1ml2
req_l1nl2:
bt r9, 62 ; check if montgomery second
jc req_l1nl2m
req_l1nl2n:
jmp reqL1L2
req_l1nl2m:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rdx
push r8
call Fr_toMontgomery
mov rsi, rdi
pop rdi
pop rdx
jmp reqL1L2
req_l1ml2:
bt r9, 62 ; check if montgomery second
jc req_l1ml2m
req_l1ml2n:
mov r8, rdi
sub rsp, 40
mov rdi, rsp
push rsi
mov rsi, rdx
push r8
call Fr_toMontgomery
mov rdx, rdi
pop rdi
pop rsi
jmp reqL1L2
req_l1ml2m:
jmp reqL1L2
;;;;;;
; eqL1L2
;;;;;;
reqL1L2:
mov rax, [rsi + 8]
cmp [rdx + 8], rax
jne req_ret0 ; rsi<rdi => 1st > 2nd
mov rax, [rsi + 16]
cmp [rdx + 16], rax
jne req_ret0 ; rsi<rdi => 1st > 2nd
mov rax, [rsi + 24]
cmp [rdx + 24], rax
jne req_ret0 ; rsi<rdi => 1st > 2nd
mov rax, [rsi + 32]
cmp [rdx + 32], rax
jne req_ret0 ; rsi<rdi => 1st > 2nd
req_ret1:
mov rax, 1
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
req_ret0:
xor rax, rax
mov rsp, rbp
pop rdx
pop rsi
pop rbp
ret
;;;;;;;;;;;;;;;;;;;;;;
; gt
;;;;;;;;;;;;;;;;;;;;;;
; Compares two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result can be zero or one.
; Modified Registers:
; rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_gt:
call Fr_rgt
mov [rdi], rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; lt
;;;;;;;;;;;;;;;;;;;;;;
; Compares two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result can be zero or one.
; Modified Registers:
; rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_lt:
call Fr_rlt
mov [rdi], rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; eq
;;;;;;;;;;;;;;;;;;;;;;
; Compares two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result can be zero or one.
; Modified Registers:
; rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_eq:
call Fr_req
mov [rdi], rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; neq
;;;;;;;;;;;;;;;;;;;;;;
; Compares two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result can be zero or one.
; Modified Registers:
; rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_neq:
call Fr_req
xor rax, 1
mov [rdi], rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; geq
;;;;;;;;;;;;;;;;;;;;;;
; Compares two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result can be zero or one.
; Modified Registers:
; rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_geq:
call Fr_rlt
xor rax, 1
mov [rdi], rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; leq
;;;;;;;;;;;;;;;;;;;;;;
; Compares two elements of any kind
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result can be zero or one.
; Modified Registers:
; rax, rcx
;;;;;;;;;;;;;;;;;;;;;;
Fr_leq:
call Fr_rgt
xor rax, 1
mov [rdi], rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawIsEq
;;;;;;;;;;;;;;;;;;;;;;
; Compares two elements of any kind
; Params:
; rdi <= Pointer to element 1
; rsi <= Pointer to element 2
; Returns
; ax <= 1 if are equal 0, otherwise
; Modified Registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;
Fr_rawIsEq:
mov rax, [rsi + 0]
cmp [rdi + 0], rax
jne rawIsEq_ret0
mov rax, [rsi + 8]
cmp [rdi + 8], rax
jne rawIsEq_ret0
mov rax, [rsi + 16]
cmp [rdi + 16], rax
jne rawIsEq_ret0
mov rax, [rsi + 24]
cmp [rdi + 24], rax
jne rawIsEq_ret0
rawIsEq_ret1:
mov rax, 1
ret
rawIsEq_ret0:
xor rax, rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; rawIsZero
;;;;;;;;;;;;;;;;;;;;;;
; Compares two elements of any kind
; Params:
; rdi <= Pointer to element 1
; Returns
; ax <= 1 if is 0, otherwise
; Modified Registers:
; rax
;;;;;;;;;;;;;;;;;;;;;;
Fr_rawIsZero:
cmp qword [rdi + 0], $0
jne rawIsZero_ret0
cmp qword [rdi + 8], $0
jne rawIsZero_ret0
cmp qword [rdi + 16], $0
jne rawIsZero_ret0
cmp qword [rdi + 24], $0
jne rawIsZero_ret0
rawIsZero_ret1:
mov rax, 1
ret
rawIsZero_ret0:
xor rax, rax
ret
;;;;;;;;;;;;;;;;;;;;;;
; land
;;;;;;;;;;;;;;;;;;;;;;
; Logical and between two elements
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result zero or one
; Modified Registers:
; rax, rcx, r8
;;;;;;;;;;;;;;;;;;;;;;
Fr_land:
mov rax, [rsi]
bt rax, 63
jc tmp_108
test eax, eax
jz retZero_110
jmp retOne_109
tmp_108:
mov rax, [rsi + 8]
test rax, rax
jnz retOne_109
mov rax, [rsi + 16]
test rax, rax
jnz retOne_109
mov rax, [rsi + 24]
test rax, rax
jnz retOne_109
mov rax, [rsi + 32]
test rax, rax
jnz retOne_109
retZero_110:
mov qword r8, 0
jmp done_111
retOne_109:
mov qword r8, 1
done_111:
mov rax, [rdx]
bt rax, 63
jc tmp_112
test eax, eax
jz retZero_114
jmp retOne_113
tmp_112:
mov rax, [rdx + 8]
test rax, rax
jnz retOne_113
mov rax, [rdx + 16]
test rax, rax
jnz retOne_113
mov rax, [rdx + 24]
test rax, rax
jnz retOne_113
mov rax, [rdx + 32]
test rax, rax
jnz retOne_113
retZero_114:
mov qword rcx, 0
jmp done_115
retOne_113:
mov qword rcx, 1
done_115:
and rcx, r8
mov [rdi], rcx
ret
;;;;;;;;;;;;;;;;;;;;;;
; lor
;;;;;;;;;;;;;;;;;;;;;;
; Logical or between two elements
; Params:
; rsi <= Pointer to element 1
; rdx <= Pointer to element 2
; rdi <= Pointer to result zero or one
; Modified Registers:
; rax, rcx, r8
;;;;;;;;;;;;;;;;;;;;;;
Fr_lor:
mov rax, [rsi]
bt rax, 63
jc tmp_116
test eax, eax
jz retZero_118
jmp retOne_117
tmp_116:
mov rax, [rsi + 8]
test rax, rax
jnz retOne_117
mov rax, [rsi + 16]
test rax, rax
jnz retOne_117
mov rax, [rsi + 24]
test rax, rax
jnz retOne_117
mov rax, [rsi + 32]
test rax, rax
jnz retOne_117
retZero_118:
mov qword r8, 0
jmp done_119
retOne_117:
mov qword r8, 1
done_119:
mov rax, [rdx]
bt rax, 63
jc tmp_120
test eax, eax
jz retZero_122
jmp retOne_121
tmp_120:
mov rax, [rdx + 8]
test rax, rax
jnz retOne_121
mov rax, [rdx + 16]
test rax, rax
jnz retOne_121
mov rax, [rdx + 24]
test rax, rax
jnz retOne_121
mov rax, [rdx + 32]
test rax, rax
jnz retOne_121
retZero_122:
mov qword rcx, 0
jmp done_123
retOne_121:
mov qword rcx, 1
done_123:
or rcx, r8
mov [rdi], rcx
ret
;;;;;;;;;;;;;;;;;;;;;;
; lnot
;;;;;;;;;;;;;;;;;;;;;;
; Do the logical not of an element
; Params:
; rsi <= Pointer to element to be tested
; rdi <= Pointer to result one if element1 is zero and zero otherwise
; Modified Registers:
; rax, rax, r8
;;;;;;;;;;;;;;;;;;;;;;
Fr_lnot:
mov rax, [rsi]
bt rax, 63
jc tmp_124
test eax, eax
jz retZero_126
jmp retOne_125
tmp_124:
mov rax, [rsi + 8]
test rax, rax
jnz retOne_125
mov rax, [rsi + 16]
test rax, rax
jnz retOne_125
mov rax, [rsi + 24]
test rax, rax
jnz retOne_125
mov rax, [rsi + 32]
test rax, rax
jnz retOne_125
retZero_126:
mov qword rcx, 0
jmp done_127
retOne_125:
mov qword rcx, 1
done_127:
test rcx, rcx
jz lnot_retOne
lnot_retZero:
mov qword [rdi], 0
ret
lnot_retOne:
mov qword [rdi], 1
ret
;;;;;;;;;;;;;;;;;;;;;;
; isTrue
;;;;;;;;;;;;;;;;;;;;;;
; Convert a 64 bit integer to a long format field element
; Params:
; rsi <= Pointer to the element
; Returs:
; rax <= 1 if true 0 if false
;;;;;;;;;;;;;;;;;;;;;;;
Fr_isTrue:
mov rax, [rdi]
bt rax, 63
jc tmp_128
test eax, eax
jz retZero_130
jmp retOne_129
tmp_128:
mov rax, [rdi + 8]
test rax, rax
jnz retOne_129
mov rax, [rdi + 16]
test rax, rax
jnz retOne_129
mov rax, [rdi + 24]
test rax, rax
jnz retOne_129
mov rax, [rdi + 32]
test rax, rax
jnz retOne_129
retZero_130:
mov qword rax, 0
jmp done_131
retOne_129:
mov qword rax, 1
done_131:
ret
section .data
Fr_q:
dd 0
dd 0x80000000
Fr_rawq:
q dq 0x43e1f593f0000001,0x2833e84879b97091,0xb85045b68181585d,0x30644e72e131a029
half dq 0xa1f0fac9f8000000,0x9419f4243cdcb848,0xdc2822db40c0ac2e,0x183227397098d014
R2 dq 0x1bb8e645ae216da7,0x53fe3ab1e35c59e3,0x8c49833d53bb8085,0x0216d0b17f4e44a5
Fr_R3:
dd 0
dd 0x80000000
Fr_rawR3:
R3 dq 0x5e94d8e1b4bf0040,0x2a489cbe1cfbb6b8,0x893cc664a19fcfed,0x0cf8594b7fcc657c
lboMask dq 0x3fffffffffffffff
np dq 0xc2e1f593efffffff
| 18.626711 | 91 | 0.431477 |
9dfd8bdf33f772903ca766b77f9a64899be05cb2 | 422 | asm | Assembly | Divisao_de_inteiros.asm | lucass235/Programas_em_Assembly | 651cdfbd2e40f964fdc5bd183b538ae0c2d71f83 | [
"MIT"
] | null | null | null | Divisao_de_inteiros.asm | lucass235/Programas_em_Assembly | 651cdfbd2e40f964fdc5bd183b538ae0c2d71f83 | [
"MIT"
] | null | null | null | Divisao_de_inteiros.asm | lucass235/Programas_em_Assembly | 651cdfbd2e40f964fdc5bd183b538ae0c2d71f83 | [
"MIT"
] | null | null | null | .data
.text
li $t0, 32
li $t1, 5
div $t0, $t1 # comando que faz a divisao de $t0/$t1
# o resultado vai pra o registrador (lo) e o resto para o (hi)
mflo $s0 #comando para mover o valor de (lo) para outro registrador.
mfhi $s1 #comando para mover o valor de (hi) para outro registrador.
srl $s2, $t1, 2 # coamndo para mover o binario (2) casas para a direita
# ou seja, e a mesma coisa que dividir ($t1)/(4). | 32.461538 | 72 | 0.668246 |
de5dd408bbedf42c35190e1ffae1b0191353fb5c | 462 | asm | Assembly | programs/oeis/037/A037506.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/037/A037506.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/037/A037506.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A037506: Base 5 digits are, in order, the first n terms of the periodic sequence with initial period 1,2,0.
; 1,7,35,176,882,4410,22051,110257,551285,2756426,13782132,68910660,344553301,1722766507,8613832535,43069162676,215345813382,1076729066910,5383645334551,26918226672757,134591133363785,672955666818926
add $0,2
mov $3,2
mov $4,1
lpb $0
sub $0,1
mul $4,5
add $4,3
mov $5,5
lpe
mov $1,$4
sub $5,$3
mov $2,$5
mul $2,2
add $2,25
div $1,$2
mov $0,$1
| 23.1 | 199 | 0.729437 |
5efee2bad59559b92242cda2d79d9d40975a5a39 | 20,089 | asm | Assembly | Library/User/Help/helpTextUtils.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Library/User/Help/helpTextUtils.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Library/User/Help/helpTextUtils.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: helpTextUtils.asm
AUTHOR: Gene Anderson, Oct 23, 1992
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Gene 10/23/92 Initial revision
DESCRIPTION:
Routines for dealing with the text object in the help controller
$Id: helpTextUtils.asm,v 1.1 97/04/07 11:47:43 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HelpControlCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTConnectTextAttributes
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Connect various text attribute structures to our text object
CALLED BY: HLDisplayText()
PASS: *ds:si - controller
ss:bp - inherited locals
childBlock - child block
RETURN: ax - VM handle of name array
ds - fixed up
DESTROYED: bx, cx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
NOTE: also sets the file handle for the text object to the help file
REVISION HISTORY:
Name Date Description
---- ---- -----------
gene 10/23/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HTConnectTextAttributes proc near
uses dx, di, si
HELP_LOCALS
.enter inherit
;
; Create new text storage
;
call HTCreateTextStorage
;
; Get the map block of the help file
;
call HFGetFile ;bx <- handle of help file
call DBLockMap ;*es:di <- map block
EC < tst di ;>
EC < ERROR_Z HELP_FILE_HAS_NO_MAP_BLOCK ;>
mov di, es:[di] ;es:di <- ptr HelpFileMapBlock
;
; Connect the object to the help file
;
mov cx, bx ;cx <- handle of help file
mov bx, ss:childBlock
mov si, offset HelpTextDisplay ;^lbx:si <- chunk of text object
mov ax, MSG_VIS_TEXT_SET_VM_FILE
call HUObjMessageSend
;
; Convert the fonts we use if we're connected to a TV or
; if the user has selected the largest system font (and
; hence we need to make the help text more readable)
;
mov ax, es:[di].HFMB_charAttrs ;ax <- VM handle of char attrs
call HTConvertFontsForTVOrLarge
;
; Connect the various attribute arrays
; NOTE: the order is important -- the names must be done first
; NOTE: see vTextC.def for details
;
mov ch, TRUE ;ch <- handles are VM
push bp
clr bp ;bp <- use 1st element
mov ax, MSG_VIS_TEXT_CHANGE_ELEMENT_ARRAY
mov dx, es:[di].HFMB_names ;dx <- VM handle of names
push dx
mov cl, VTSF_NAMES
call HUObjMessageSend
mov dx, es:[di].HFMB_charAttrs ;dx <- VM handle of char attrs
mov cl, mask VTSF_MULTIPLE_CHAR_ATTRS
call HUObjMessageSend
mov dx, es:[di].HFMB_paraAttrs ;dx <- VM handle of para attrs
mov cl, mask VTSF_MULTIPLE_PARA_ATTRS
call HUObjMessageSend
mov dx, es:[di].HFMB_graphics ;dx <- VM handle of graphics
mov cl, mask VTSF_GRAPHICS
call HUObjMessageSend
mov dx, es:[di].HFMB_types ;dx <- VM handle of types
mov cl, mask VTSF_TYPES
call HUObjMessageSend
pop ax ;ax <- VM handle of names
pop bp
;
; Finished with the map block of the help file
;
call DBUnlock
.leave
ret
HTConnectTextAttributes endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTConvertFontsForTVOrLarge
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Convert fonts & pointsizes for viewing on the TV
CALLED BY: HLDisplayText()
PASS: cx - handle of VM file holding character attr array
ax - handle of VM block holding character attr array
RETURN: none
DESTROYED: none
PSEUDO CODE/STRATEGY:
For each character array element {
if font/pointsize/etc. match element {
substitute new font/pointsize/etc.
}
}
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/20/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HTConvertFontsForTVOrLarge proc near
uses ax, bx, cx, dx, di, si, bp, ds, es
.enter
;
; Determine if we need to do anything at all:
; a) connected to a TV
; b) system font is set to large
;
mov di, offset HTConvertForTVCharAttrCB
call HTCheckIfTV
jc doConversion
mov di, offset HTConvertForLargeCharAttrCB
push cx, dx
call UserGetDefaultMonikerFont
cmp dx, 14
pop cx, dx
jb done
;
; Lock down the VM block holding the character attr array
; Offset of callback routine is already in DI
;
doConversion::
mov bx, cx ; VM file => BX
call VMLock ; block segment => AX
; memory handle => BP
mov ds, ax
mov si, 10h ; HACK!!!
mov bx, cs
call ChunkArrayEnum
call VMDirty
call VMUnlock
done:
.leave
ret
HTConvertFontsForTVOrLarge endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTCheckIfTV
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Convert fonts & pointsizes for viewing on the TV
CALLED BY: Utility
PASS: nothing
RETURN: carry - set if on TV, clear otherwise
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/21/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HTCheckIfTV proc far
uses ax
.enter
call UserGetDisplayType
and ah, mask DT_DISP_ASPECT_RATIO
cmp ah, DAR_TV shl offset DT_DISP_ASPECT_RATIO
je done
stc
done:
cmc
.leave
ret
HTCheckIfTV endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTConvertForTVCharAttrCB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Modify the passed VisTextCharAttr structure so
that the help text is readable on a TV
CALLED BY: HLConvertFontsForTVOrLarge via ChunkArrayEnum
PASS: DS:DI = VisTextCharAttr
RETURN: carry = clear (to continue enumeration)
DESTROYED: none
PSEUDO CODE/STRATEGY:
if pointsize = 10 or 12 then
if styles = none or underline
fontID = BERKELEY
pointsize = 14
else
fontID = "Cranbrook"
pointsize = 18
text color = blue
if pointsize = 16 then
pointsize = 18
if styles = bold+italic then
styles = none
text color = blue
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/20/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HTConvertForTVCharAttrCB proc far
uses ax, cx
.enter
;
; For now, just check for some point sizes and do the conversion
;
mov ax, ds:[di].VTCA_pointSize.WBF_int
mov cx, 14 ; convert to 14
cmp ax, 10
je doConversion
cmp ax, 12
je doConversion
mov cx, 18 ; convert to 18
cmp ax, 16
jne done
;
; For 16 point text, if it is bold + italic, convert to
; just bold, since italic looks crappy on a TV.
;
cmp ds:[di].VTCA_textStyles, mask TS_BOLD or mask TS_ITALIC
jne doConversion
clr ds:[di].VTCA_textStyles
call changeToBlue
;
; Store the new pointsize, and if we are converting to 14
; point text, then change the font to Berkeley (unless
; some style was present, in which case we change to
; Sather Gothic).
;
doConversion:
mov ds:[di].VTCA_pointSize.WBF_int, cx
clr ds:[di].VTCA_pointSize.WBF_frac
cmp cx, 14
jne done
mov cx, FID_BERKELEY
test ds:[di].VTCA_textStyles, mask TS_UNDERLINE
jnz changeFont
tst ds:[di].VTCA_textStyles
jz changeFont
clr ds:[di].VTCA_textStyles
mov ds:[di].VTCA_pointSize.WBF_int, 18
call changeToBlue
mov cx, FID_DTC_CENTURY_SCHOOLBOOK
changeFont:
mov ds:[di].VTCA_fontID, cx
done:
clc
.leave
ret
;
; Change the color to blue, if (and only if) the current
; color of the text is black. Otherwise, do nothing so
; we don't muck up the help text designer's intent. -Don 3/18/00
;
changeToBlue:
tst ds:[di].VTCA_color.CQ_info
jnz doneColorChange ; if not an INDEX, do nothing
cmp ds:[di].VTCA_color.CQ_redOrIndex, C_BLACK
jne doneColorChange
mov ds:[di].VTCA_color.CQ_redOrIndex, C_BLUE
doneColorChange:
retn
HTConvertForTVCharAttrCB endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTConvertForLargeCharAttrCB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Modify the passed VisTextCharAttr structure so
that the help text is more readable on the screen
(done because the user has chosen the largest font)
CALLED BY: HLConvertFontsForTVOrLarge via ChunkArrayEnum
PASS: DS:DI = VisTextCharAttr
RETURN: carry = clear (to continue enumeration)
DESTROYED: none
PSEUDO CODE/STRATEGY:
if pointsize = 10 or 12 then
pointsize = 14
if pointsize = 16 then
pointsize = 18
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 4/20/99 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HTConvertForLargeCharAttrCB proc far
uses ax, cx
.enter
;
; For now, just check for some point sizes and do the conversion
;
mov ax, ds:[di].VTCA_pointSize.WBF_int
mov cx, 14 ; convert to 14
cmp ax, 10
je doConversion
cmp ax, 12
je doConversion
mov cx, 18 ; convert to 18
cmp ax, 16
jne done
doConversion:
mov ds:[di].VTCA_pointSize.WBF_int, cx
clr ds:[di].VTCA_pointSize.WBF_frac
done:
clc
.leave
ret
HTConvertForLargeCharAttrCB endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTGetTextForContext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the text for a context and stuff it in the text display
CALLED BY: HLDisplayText()
PASS: *ds:si - controller
ss:bp - inherited locals
childBlock - handle of child block
context - name of context to get
RETURN: carry - set if error (context name doesn't exist)
DESTROYED: ax, bx, cx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
gene 10/25/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HTGetTextForContext proc near
class HelpControlClass
uses dx, si, di, es, ds
HELP_LOCALS
.enter inherit
;
; Find the name for the context
;
call HNFindNameForContext
jc quit ;branch if error
;
; Tell our text object to load the text
;
mov dx, ss:nameData.HFND_text.VTND_helpText.DBGI_item
tst dx ;any item?
stc ;carry <- in case of error
jz quit ;branch if no error
mov cx, ss:nameData.HFND_text.VTND_helpText.DBGI_group
mov di, ds:[si]
add di, ds:[di].HelpControl_offset
tst ds:[di].HCI_compressLib
jnz uncompress
; If no compression, just have the text be loaded up normally
mov bx, ss:childBlock
mov si, offset HelpTextDisplay ;^hbx:si <- OD of text object
push bp
mov ax, MSG_VIS_TEXT_LOAD_FROM_DB_ITEM
clr bp ;bp <- use VTI_vmFile
call HUObjMessageSend
pop bp
noError:
; Set the selection to be the start of the text
mov bx, ss:childBlock
mov si, offset HelpTextDisplay
mov ax, MSG_VIS_TEXT_SELECT_START
clr di ;Don't call HUObjMessageSend,
call ObjMessage ; as DS is not valid here
if HIGHLIGHT_LINK_WHEN_OPENED
mov ax, MSG_HELP_TEXT_NAVIGATE_TO_NEXT_FIELD
clr di ;Don't call HUObjMessageSend,
call ObjMessage ; as DS is not valid here
endif ; HIGHLIGHT_LINK_WHEN_OPENED
clc ;carry <- no error
quit:
.leave
ret
uncompress:
mov si, ds:[di].HCI_compressLib
;
; CX.DX <- group/item of compressed data
;
mov bx, ds:[di].HCI_curFile
movdw axdi, cxdx
call DBLock
;
; The first word is the uncompacted size
;
mov di, es:[di]
mov ax, es:[di] ;AX <- size of uncompacted data
ChunkSizePtr es, di, dx ;DX <- size of compacted data
sub dx, size word
add di, size word
; Allocate a block large enough to hold the uncompacted data
EC < push ax >
mov cx, ALLOC_DYNAMIC_LOCK
call MemAlloc
EC < pop cx >
jc uncompressError
push bx ;Save handle of data
mov ds, ax
EC < push cx > ;Save # bytes in data
mov ax, CL_DECOMP_BUFFER_TO_BUFFER or mask CLF_MOSTLY_ASCII
push ax
clr ax
push ax ;sourceFileHan (unused)
pushdw esdi ;sourceBuff
push dx ;sourceBuffSize
push ax ;destBuffHan
pushdw dsax ;destBuffer
mov bx, si
mov ax, enum CompressDecompress
call ProcGetLibraryEntry
call ProcCallFixedOrMovable ;AX <- # bytes written out (0 if err)
EC < pop dx >
tst ax
jz uncompressFreeError
EC < cmp dx, ax >
EC < ERROR_NE BAD_NUM_BYTES_WRITTEN_OUT >
call DBUnlock ;Unlock the DB item
; Send the data off to the object
mov ax, MSG_VIS_TEXT_LOAD_FROM_DB_ITEM_FORMAT
mov bx, ss:childBlock
mov si, offset HelpTextDisplay ;^hbx:si <- OD of text object
mov cx, ds ;CX.DX <- ptr to data to load
clr dx
push bp
mov di, mask MF_CALL
call ObjMessage
pop bp
pop bx ;Restore handle of uncompressed data
call MemFree ;Free it
jmp noError
uncompressFreeError:
pop bx
call MemFree
uncompressError:
call DBUnlock
stc
jmp quit
HTGetTextForContext endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTCreateTextStorage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Create storage for the HelpTextDisplay
CALLED BY: HelpControlInit()
PASS: *ds:si - controller
RETURN: ds - fixed up
DESTROYED: ax, bx, cx, dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
gene 10/25/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HTCreateTextStorage proc near
uses si
.enter
call HUGetChildBlockAndFeatures
mov si, offset HelpTextDisplay ;^lbx:si <- OD of text object
;
; Create storage for the text object
;
mov cx, mask VTSF_MULTIPLE_CHAR_ATTRS or \
mask VTSF_MULTIPLE_PARA_ATTRS or \
mask VTSF_GRAPHICS or \
mask VTSF_TYPES ;ch <- no regions
mov ax, MSG_VIS_TEXT_CREATE_STORAGE
call HUObjMessageSend
.leave
ret
HTCreateTextStorage endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTDestroyTextStorage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Free the storage for the text object
CALLED BY: HelpControlExit()
PASS: *ds:si - controller
RETURN: ds - fixed up
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
gene 10/25/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HTDestroyTextStorage proc near
uses ax, bx, cx, dx, si
.enter
call HUGetChildBlockAndFeatures
mov si, offset HelpTextDisplay ;^lbx:si <- OD of text object
clr cx ;cx <- don't destroy elements
mov ax, MSG_VIS_TEXT_FREE_STORAGE
call HUObjMessageSend
.leave
ret
HTDestroyTextStorage endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTGetTextForHistory
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get the text to record for history reference
CALLED BY: HHRecordHistory()
PASS: ss:bp - inherited locals
ds - block to allocate text chunk in
RETURN: bx - chunk of text
ds - fixed up
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
gene 11/ 9/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HTGetTextForHistory proc near
uses ax, cx, dx, bp, si
HELP_LOCALS
.enter inherit
clr dx ;dx <- current position
getTextLoop::
push ds:LMBH_handle ;save handle of block
mov bx, ss:childBlock
mov si, offset HelpTextDisplay ;^lbx:si <- OD of text object
;
; Get the range of the first line of text
; (ie. the first paragraph minus the <CR>)
;
push dx, bp
sub sp, (size VisTextGetTextRangeParameters)
mov bp, sp ;ss:bp <- params
mov ss:[bp].VTGTRP_range.VTR_start.low, dx
clr ss:[bp].VTGTRP_range.VTR_start.high
mov ss:[bp].VTGTRP_range.VTR_end.low, dx
clr ss:[bp].VTGTRP_range.VTR_end.high
CheckHack <(offset VTGTRP_range) eq 0>
mov dx, ss ;dx:bp <- ptr to range
mov cx, mask VTRC_PARAGRAPH_CHANGE
mov ax, MSG_VIS_TEXT_GET_RANGE
push bp
call callObjMessage
pop bp
decdw ss:[bp].VTGTRP_range.VTR_end ;-1 for CR
;
; Get the text for the range we've got
;
mov ss:[bp].VTGTRP_textReference.TR_type, TRT_SEGMENT_CHUNK
mov ss:[bp].VTGTRP_textReference.TR_ref.TRU_segChunk.TRSC_segment, ds
mov ss:[bp].VTGTRP_textReference.TR_ref.TRU_segChunk.TRSC_chunk, 0
mov ss:[bp].VTGTRP_flags, mask VTGTRF_ALLOCATE_ALWAYS
mov ax, MSG_VIS_TEXT_GET_TEXT_RANGE
call callObjMessage ;cx = allocated chunk.
add sp, (size VisTextGetTextRangeParameters)
pop dx, bp ;dx <- current position
;
; Dereference the block the text was copied into in case it moved.
;
pop bx ;bx <- handle of block
call MemDerefDS
mov bx, cx ;bx <- chunk of text
;
; Make sure the text isn't too long.
;
ChunkSizeHandle ds, bx, ax ;ax <- size of text (w/NULL)
DBCS < shr ax, 1 ;ax <- length (w/NULL)>
cmp ax, 1
jbe noText ;branch if no text
cmp ax, MAXIMUM_HISTORY_LENGTH
ja tooMuchText ;branch if text too long
done:
.leave
ret
;
; No text was on the line -- skip it.
;
noText:
inc dx ;dx <- skip <CR>
mov ax, bx ;ax <- chunk with text
call LMemFree
jmp getTextLoop
;
; Too much text was on this line -- truncate it.
;
tooMuchText:
mov ax, bx ;ax <- chunk of text
SBCS < mov cx, MAXIMUM_HISTORY_LENGTH+1 ;cx <- new size>
DBCS < mov cx, (MAXIMUM_HISTORY_LENGTH+1)*2 ;>
call LMemReAlloc
;
; Slap an ellipsis on the end...
; ...and NULL-terminate the beast.
;
mov si, ds:[bx] ;ds:si <- ptr to chunk
SBCS < mov {char}ds:[si][MAXIMUM_HISTORY_LENGTH-1], C_ELLIPSIS >
SBCS < mov {char}ds:[si][MAXIMUM_HISTORY_LENGTH], C_NULL >
DBCS < mov {wchar}ds:[si][2*MAXIMUM_HISTORY_LENGTH-2], C_HORIZONTAL_ELLIPSIS>
DBCS < mov {wchar}ds:[si][2*MAXIMUM_HISTORY_LENGTH], C_NULL >
jmp done
callObjMessage:
push di
mov di, mask MF_CALL
call ObjMessage
pop di
retn
HTGetTextForHistory endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
HTGetTypeForHistory
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Get type to record for history reference
CALLED BY: HHRecordHistory()
PASS: ss:bp - inherited locals
*ds:si - controller
RETURN: dl - VisTextContextType
DESTROYED: dh
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
gene 12/14/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
HTGetTypeForHistory proc near
uses ax, bx, cx, si
HELP_LOCALS
.enter inherit
;
; Get the context at the start of the page
;
push si
mov bx, ss:childBlock
mov si, offset HelpTextDisplay
clrdw dxax ;dx:ax <- offset to check
clrdw cxdi
call HTGetLinkForPos ;ax <- context at offset
pop si
;
; Get the type of the context
;
call HNGetTypeForContext
.leave
ret
HTGetTypeForHistory endp
HelpControlCode ends
| 25.821337 | 79 | 0.604759 |
9c8d42129dc61add44aadf547943ade9b2ff5742 | 262 | asm | Assembly | libsrc/_DEVELOPMENT/arch/ts2068/misc/c/sccz80/tshr_cls_attr.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/arch/ts2068/misc/c/sccz80/tshr_cls_attr.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/arch/ts2068/misc/c/sccz80/tshr_cls_attr.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ; void tshr_cls_attr(uchar ink)
SECTION code_clib
SECTION code_arch
PUBLIC tshr_cls_attr
EXTERN asm_tshr_cls_attr
defc tshr_cls_attr = asm_tshr_cls_attr
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC _tshr_cls_attr
defc _tshr_cls_attr = tshr_cls_attr
ENDIF
| 14.555556 | 38 | 0.839695 |
22679406c5e10e0c7622afddc807ef1160c62bc4 | 1,162 | asm | Assembly | programs/oeis/203/A203150.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/203/A203150.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/203/A203150.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A203150: (n-1)-st elementary symmetric function of the first n terms of (1,2,1,2,1,2,1,2,1,2,...)=A000034.
; 1,3,5,12,16,36,44,96,112,240,272,576,640,1344,1472,3072,3328,6912,7424,15360,16384,33792,35840,73728,77824,159744,167936,344064,360448,737280,770048,1572864,1638400,3342336,3473408,7077888,7340032,14942208,15466496,31457280,32505856,66060288,68157440,138412032,142606336,289406976,297795584,603979776,620756992,1258291200,1291845632,2617245696,2684354560,5435817984,5570035712,11274289152,11542724608,23353884672,23890755584,48318382080,49392123904,99857989632,102005473280,206158430208,210453397504,425201762304,433791696896,876173328384,893353197568,1803886264320,1838246002688,3710851743744,3779571220480,7627861917696,7765300871168,15668040695808,15942918602752,32160715112448,32710470926336,65970697666560,67070209294336,135239930216448,137438953472000,277076930199552,281474976710656,567347999932416,576144092954624,1161084278931456,1178676464975872,2374945115996160,2410129488084992,4855443348258816,4925812092436480
mov $1,$0
mul $0,2
add $1,1
mov $2,2
lpb $0
sub $0,2
trn $0,2
mul $1,2
sub $1,$2
add $1,1
mul $2,2
sub $2,1
lpe
| 68.352941 | 925 | 0.831325 |
919db8e22a88ea11eddd7912adc27fc1d0295c4e | 1,018 | asm | Assembly | ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/Arm/ArmCortexA5xHelper.asm | christopherco/RPi-UEFI | 48fd8bb20dd4d45a4cf0a8970a65837e45bbaa99 | [
"BSD-2-Clause"
] | 93 | 2016-10-27T12:03:57.000Z | 2022-03-29T15:22:10.000Z | ArmPkg/Drivers/ArmCpuLib/ArmCortexA5xLib/Arm/ArmCortexA5xHelper.asm | khezami/RPi-UEFI | 5bfd48d674e6c7efea6e31f9eb97b9da90c20263 | [
"BSD-2-Clause"
] | 16 | 2016-11-02T02:08:40.000Z | 2021-06-03T21:18:06.000Z | Pi3BoardPkg/Library/ArmCortexA5xLib/Arm/ArmCortexA5xHelper.asm | b-man/RaspberryPiPkg | 1aeaaab2197125b8503874194587f6c814d0d9be | [
"BSD-2-Clause"
] | 41 | 2016-11-02T00:05:02.000Z | 2022-03-29T14:33:09.000Z | //------------------------------------------------------------------------------
//
// Copyright (c) 2013 - 2014, ARM Limited. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License
// which accompanies this distribution. The full text of the license may be found at
// http://opensource.org/licenses/bsd-license.php
//
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
//
//------------------------------------------------------------------------------
#include <AsmMacroIoLib.h>
INCLUDE AsmMacroIoLib.inc
EXPORT ArmReadCpuExCr
EXPORT ArmWriteCpuExCr
AREA ArmCortexA5xHelper, CODE, READONLY
ArmReadCpuExCr
mrrc p15, 1, r0, r1, c15
bx lr
ArmWriteCpuExCr
mcrr p15, 1, r0, r1, c15
dsb
isb
bx lr
END
| 27.513514 | 85 | 0.60609 |
19d949d4f7fbcbf7ecbb209da930766752e2ae0b | 1,672 | asm | Assembly | Working Disassembly/Levels/HCZ/Misc Object Data/Map - Hand Launcher.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/Levels/HCZ/Misc Object Data/Map - Hand Launcher.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | null | null | null | Working Disassembly/Levels/HCZ/Misc Object Data/Map - Hand Launcher.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | null | null | null | Map_22F998: dc.w Frame_22F9A8-Map_22F998 ; ...
dc.w Frame_22F9CE-Map_22F998
dc.w Frame_22F9F4-Map_22F998
dc.w Frame_22FA1A-Map_22F998
dc.w Frame_22FA40-Map_22F998
dc.w Frame_22FA66-Map_22F998
dc.w Frame_22FA8C-Map_22F998
dc.w Frame_22FAA0-Map_22F998
Frame_22F9A8: dc.w 6
dc.b $D0, 1, 0,$16,$FF,$FC
dc.b $E0, 1, 0,$16,$FF,$FC
dc.b $F0, $C, 0, 0,$FF,$E0
dc.b $F0, $C, 0, 4, 0, 0
dc.b $F8, $C, 0,$10,$FF,$F0
dc.b 0, 4, 0,$14,$FF,$F8
Frame_22F9CE: dc.w 6
dc.b $D0, 1, 0,$16,$FF,$FC
dc.b $E0, 1, 0,$16,$FF,$FC
dc.b $F0, $C, 0, 8,$FF,$E0
dc.b $F0, $C, 0, $C, 0, 0
dc.b $F8, $C, 0,$10,$FF,$F0
dc.b 0, 4, 0,$14,$FF,$F8
Frame_22F9F4: dc.w 6
dc.b $D0, 1, 0,$16,$FF,$FC
dc.b $E0, 1, 0,$16,$FF,$FC
dc.b $F0, $C, 8, 4,$FF,$E0
dc.b $F0, $C, 8, 0, 0, 0
dc.b $F8, $C, 0,$10,$FF,$F0
dc.b 0, 4, 0,$14,$FF,$F8
Frame_22FA1A: dc.w 6
dc.b $D0, 1, 0,$16,$FF,$FC
dc.b $E0, 1, 0,$16,$FF,$FC
dc.b $F0, $C, 0, 0,$FF,$E0
dc.b $F0, $C, 0, 4, 0, 0
dc.b $F8, $C, 8,$10,$FF,$F0
dc.b 0, 4, 8,$14,$FF,$F8
Frame_22FA40: dc.w 6
dc.b $D0, 1, 0,$16,$FF,$FC
dc.b $E0, 1, 0,$16,$FF,$FC
dc.b $F0, $C, 0, 8,$FF,$E0
dc.b $F0, $C, 0, $C, 0, 0
dc.b $F8, $C, 8,$10,$FF,$F0
dc.b 0, 4, 8,$14,$FF,$F8
Frame_22FA66: dc.w 6
dc.b $D0, 1, 0,$16,$FF,$FC
dc.b $E0, 1, 0,$16,$FF,$FC
dc.b $F0, $C, 8, 4,$FF,$E0
dc.b $F0, $C, 8, 0, 0, 0
dc.b $F8, $C, 8,$10,$FF,$F0
dc.b 0, 4, 8,$14,$FF,$F8
Frame_22FA8C: dc.w 3
dc.b $BA, $A, 0,$18,$FF,$F4
dc.b $D0, 1, 0,$16,$FF,$FC
dc.b $E0, 1, 0,$16,$FF,$FC
Frame_22FAA0: dc.w 1
dc.b $C3, 9, 0,$21,$FF,$F4
| 29.333333 | 46 | 0.495215 |
621624c6a6b35159fc543a0cd6c998d4479f3d7b | 30 | asm | Assembly | test/link/overlay/a.asm | michealccc/rgbds | b51e1c7c2c4ce2769f01e016967d0115893a7a88 | [
"MIT"
] | 522 | 2017-02-25T21:10:13.000Z | 2020-09-13T14:26:18.000Z | test/link/overlay/a.asm | michealccc/rgbds | b51e1c7c2c4ce2769f01e016967d0115893a7a88 | [
"MIT"
] | 405 | 2017-02-25T21:32:37.000Z | 2020-09-13T16:43:29.000Z | test/link/overlay/a.asm | michealccc/rgbds | b51e1c7c2c4ce2769f01e016967d0115893a7a88 | [
"MIT"
] | 84 | 2017-02-25T21:10:26.000Z | 2020-09-13T14:28:25.000Z | SECTION "0", ROM0[0]
DS $8000
| 10 | 20 | 0.633333 |
bf6e242b510dba539398b470fa6dc17ae2853607 | 872 | asm | Assembly | programs/oeis/184/A184525.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/184/A184525.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/184/A184525.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A184525: Upper s-Wythoff sequence, where s=5n-1. Complement of A184524.
; 5,11,17,23,30,36,42,48,54,61,67,73,79,85,92,98,104,110,116,123,129,135,141,147,153,160,166,172,178,184,191,197,203,209,215,222,228,234,240,246,253,259,265,271,277,284,290,296,302,308,314,321,327,333,339,345,352,358,364,370,376,383,389,395,401,407,414,420,426,432,438,445,451,457,463,469,475,482,488,494,500,506,513,519,525,531,537,544,550,556,562,568,575,581,587,593,599,606,612,618
mov $2,$0
add $2,1
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
mov $6,$0
mov $7,0
mov $8,2
lpb $8
mov $0,$6
sub $8,1
add $0,$8
trn $0,1
seq $0,184524 ; Lower s-Wythoff sequence, where s=5n-1. Complement of A184525.
sub $0,1
mov $3,$0
mov $5,$8
mul $5,$0
add $7,$5
lpe
min $6,1
mul $6,$3
mov $3,$7
sub $3,$6
add $3,5
add $1,$3
lpe
mov $0,$1
| 25.647059 | 384 | 0.615826 |
e4eb29f8ae584fe38a867904a80a21141f606090 | 1,506 | asm | Assembly | programs/oeis/317/A317790.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/317/A317790.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/317/A317790.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A317790: a(n) = 2*a(n-1) - a(n-2) + a(n-4) - 2*(n-5) + a(n-6) for n>5, a(0)=a(1)=1, a(2)=a(3)=7, a(4)=13, a(5)=19.
; 1,1,7,7,13,19,31,37,49,61,79,91,109,127,151,169,193,217,247,271,301,331,367,397,433,469,511,547,589,631,679,721,769,817,871,919,973,1027,1087,1141,1201,1261,1327,1387,1453,1519,1591,1657,1729,1801,1879,1951,2029,2107,2191,2269,2353,2437,2527,2611,2701,2791,2887,2977,3073,3169,3271,3367,3469,3571,3679,3781,3889,3997,4111,4219,4333,4447,4567,4681,4801,4921,5047,5167,5293,5419,5551,5677,5809,5941,6079,6211,6349,6487,6631,6769,6913,7057,7207,7351,7501,7651,7807,7957,8113,8269,8431,8587,8749,8911,9079,9241,9409,9577,9751,9919,10093,10267,10447,10621,10801,10981,11167,11347,11533,11719,11911,12097,12289,12481,12679,12871,13069,13267,13471,13669,13873,14077,14287,14491,14701,14911,15127,15337,15553,15769,15991,16207,16429,16651,16879,17101,17329,17557,17791,18019,18253,18487,18727,18961,19201,19441,19687,19927,20173,20419,20671,20917,21169,21421,21679,21931,22189,22447,22711,22969,23233,23497,23767,24031,24301,24571,24847,25117,25393,25669,25951,26227,26509,26791,27079,27361,27649,27937,28231,28519,28813,29107,29407,29701,30001,30301,30607,30907,31213,31519,31831,32137,32449,32761,33079,33391,33709,34027,34351,34669,34993,35317,35647,35971,36301,36631,36967,37297,37633,37969,38311,38647,38989,39331,39679,40021,40369,40717,41071,41419,41773,42127,42487,42841,43201,43561,43927,44287,44653,45019,45391,45757,46129,46501
pow $0,2
add $0,5
div $0,8
mov $1,$0
mul $1,6
add $1,1
| 150.6 | 1,332 | 0.769588 |
c0d32451be36047eee3960c2b7f7e2d32fdb12d7 | 4,348 | asm | Assembly | Legacy Windows/Win95.Radix/Win95.Radix.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | 3 | 2021-05-15T15:57:13.000Z | 2022-03-16T09:11:05.000Z | Legacy Windows/Win95.Radix/Win95.Radix.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | null | null | null | Legacy Windows/Win95.Radix/Win95.Radix.asm | fengjixuchui/Family | 2abe167082817d70ff2fd6567104ce4bcf0fe304 | [
"MIT"
] | 3 | 2021-05-15T15:57:15.000Z | 2022-01-08T20:51:04.000Z | ; Win95.Radix by Radix16[MIONS]
; Made in Czech republic
;
;Hi,
;
;It's my first Ring3 virus for Win9x.Virus not testing WinNT system.
;
;Target : PE filez
;Virus size : 405(402)
;Resident : NO
;Polymorhic : NO
;
;Virus not dangerous, but .....
;
;Decription AVP:
;
;http://www.avp.ch/avpve/newexe/win95/radix.stm
;
;It is a harmless nonmemory resident parasitic Win9x virus. It searches
;for PE EXE files in the current directory, then writes itself to the
;middle of the file, to not used space at the end of the PE header.
;
;The virus does not manifest itself in any way. It contains the text:
;
; Radix16
;Greets to :
; Worf[MIONS]
; VirusBuster/29
; Prizzy/29A
;
;
;How to build:
; tasm32 -ml -m5 radix.asm
; tlink32 -Tpe -aa -c -x radix.obj,,, import32
; pewrsec radix.exe
;
;Contacty mee : Radix16@atlas.cz
; Radix16.cjb.net
.386p
locals
.Model Flat,STDCALL
extrn ExitProcess :proc
extrn GetModuleHandleA : proc
.Data
db ?
.Code
vStart label byte
Start:
db 68h
;Save old eip
oldip: dd offset exit
pushad
Call Next
id db 'Radix16'
Next:
pop ebp
mov esi,KERNEL32+3ch
lodsd
add eax,KERNEL32
xchg eax,esi
mov esi,dword ptr [esi+78h]
lea esi,dword ptr [esi+1ch+KERNEL32]
lodsd
mov eax,dword ptr [eax+KERNEL32]
add eax,KERNEL32
push eax
push 20060000h
push 0h
push 1h
db 68h
currPage:
dd FSTGENPAGE
push 1000dh
call eax
pop dword ptr [_VxDCALL0+ebp-X]
inc eax
jz _exit
inc eax
;allocation memory
push 00020000h or 00040000h
push 2h
push 80060000h
push 00010000h
call dword ptr [_VxDCALL0+ebp-X]
mov dword ptr [memory+ebp-X],eax
push 00020000h or 00040000h or 80000000h or 8h
push 0h
push 1h
push 2h
shr eax,12
push eax
push 00010001h
call dword ptr [_VxDCALL0+ebp-X]
;Create DTA
mov ah,1ah
mov edx,dword ptr [memory+ebp-X] ;buffer
add edx,1000h
call int21
mov ah,4eh ;FindFirstFile
lea edx,[_exe+ebp-X] ;What search
xor ecx,ecx ;normal attributes
tryanother:
call int21
jc _exit ;is filez ?
call _infect
mov ah,4fh ;FindNextFile
Jmp tryanother
_exit:
popad
ret
_exe db '*.*',0 ;filez search
int21:
;VxDCALL services
push ecx
push eax
push 002a0010h
call dword ptr [_VxDCALL0+ebp-X]
ret
FP: ;Set file pointer
mov ah,42h
cdq ;xor dx,dx
xor cx,cx
call int21
ret
_infect:
mov edx,dword ptr [memory+ebp-X] ;Name file
add edx,101eh
mov ax,3d02h ;Open File R/W
call int21
jc quit ;Error ?
xchg eax,ebx ;FileHandle
mov ah,3fh ;Read File
mov ecx,1000h ;Read 1000h bytes
mov edx,dword ptr [memory+ebp-X]
call int21
jc quitz ;Error ?
mov edi,edx
cmp word ptr [edi],'ZM' ;Test Header (EXE)
jne quitz ;yes or no ?
cmp word ptr [edi+32h],'61' ;Test infection
je quitz ;Yes, virus is in file ?
mov word ptr [edi+32h],'61' ;No ,Save ID to file
add edi,dword ptr [edi+3ch] ;Testing Portable Executable(PE)
cmp word ptr [edi],'EP'
jne quitz
mov esi,edi
mov eax,18h ;Shift image header
add ax,word ptr [edi+14h]
add edi,eax
;Search end section
movzx cx,word ptr [esi+06h]
mov ax,28h
mul cx
add edi,eax
mov ecx,dword ptr [esi+2ch]
mov dword ptr [esi+54h],ecx
push edi
sub edi,dword ptr [memory+ebp-X]
xchg edi,dword ptr [esi+28h]
mov eax,dword ptr [esi+34h]
add edi,eax
shr eax,12
mov dword ptr [currPage+ebp-X],eax
mov dword ptr [oldip+ebp-X],edi ;Save old EIP
pop edi
mov ecx,VirusSize
lea esi,[vStart+ebp-X]
rep movsb ;CopyVirus
xor al,al ;SetFilePointer 0=beginning file
call FP ;mov al,0
mov ah,40h ;Write to file
mov ecx,1000h
mov edx,dword ptr [memory+ebp-X]
call int21
quitz:
mov ah,3eh ;CloseFile
call int21
quit:
ret
exit:
vEnd label byte
ret
VirusSize equ vEnd-vStart
KERNEL32 equ 0bff70000h ;Win9X kernel address
FSTGENPAGE equ 000400000h/1000h
X equ offset id
_VxDCALL0 dd ?
memory dd ? ;Buffer
Virual_End:
ends
End Start
| 18.192469 | 72 | 0.621205 |
a5b55ae37a6f470bdf0b2935fb57912219c5c5bd | 126 | asm | Assembly | libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_iy/exp_fastcall.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_iy/exp_fastcall.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_iy/exp_fastcall.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
SECTION code_fp_math48
PUBLIC _exp_fastcall
EXTERN cm48_sdcciy_exp_fastcall
defc _exp_fastcall = cm48_sdcciy_exp_fastcall
| 14 | 45 | 0.880952 |
ab8720d823ac6a50d1b8e3d53b5e43a4c69b2d20 | 335 | asm | Assembly | programs/oeis/047/A047530.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/047/A047530.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/047/A047530.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A047530: Numbers that are congruent to {0, 1, 3, 7} mod 8.
; 0,1,3,7,8,9,11,15,16,17,19,23,24,25,27,31,32,33,35,39,40,41,43,47,48,49,51,55,56,57,59,63,64,65,67,71,72,73,75,79,80,81,83,87,88,89,91,95,96,97,99,103,104,105,107,111,112,113,115,119,120,121,123
mov $1,$0
lpb $0
sub $0,4
add $1,4
lpe
lpb $0
mod $0,2
add $1,1
lpe
| 25.769231 | 196 | 0.629851 |
7abe736d6de4db806483e2baefd7e36aed7bbac2 | 600 | asm | Assembly | oeis/007/A007821.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | oeis/007/A007821.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | oeis/007/A007821.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A007821: Primes p such that pi(p) is not prime.
; 2,7,13,19,23,29,37,43,47,53,61,71,73,79,89,97,101,103,107,113,131,137,139,149,151,163,167,173,181,193,197,199,223,227,229,233,239,251,257,263,269,271,281,293,307,311,313,317,337,347,349,359,373,379,383,389,397,409,419,421,433,439,443,449,457,463,467,479,487,491,499,503,521,523,541,557,569,571,577,593,601,607,613,619,631,641,643,647,653,659,661,673,677,683,691,701,719,727,733,743
seq $0,18252 ; The nonprime numbers: 1 together with the composite numbers, A002808.
sub $0,1
seq $0,6005 ; The odd prime numbers together with 1.
trn $0,2
add $0,2
| 66.666667 | 383 | 0.728333 |
c5b2d527dafcfda7f5a412ca6dbd747e49387039 | 618 | asm | Assembly | libsrc/sprites/software/sp1/zx81hr/sprites/sp1_InitCharStruct.asm | ahjelm/z88dk | c4de367f39a76b41f6390ceeab77737e148178fa | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/sprites/software/sp1/zx81hr/sprites/sp1_InitCharStruct.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/sprites/software/sp1/zx81hr/sprites/sp1_InitCharStruct.asm | C-Chads/z88dk | a4141a8e51205c6414b4ae3263b633c4265778e6 | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ; void sp1_InitCharStruct(struct sp1_cs *cs, void *drawf, uchar type, void *graphic, uchar plane)
; CALLER linkage for function pointers
SECTION code_sprite_sp1
PUBLIC sp1_InitCharStruct
EXTERN sp1_InitCharStruct_callee
EXTERN ASMDISP_SP1_INITCHARSTRUCT_CALLEE
.sp1_InitCharStruct
ld hl,2
add hl,sp
ld a,(hl)
ld ixl,a
inc hl
inc hl
ld c,(hl)
inc hl
ld b,(hl)
inc hl
ld a,(hl)
ld ixh,a
inc hl
inc hl
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
ld a,ixh
jp sp1_InitCharStruct_callee + ASMDISP_SP1_INITCHARSTRUCT_CALLEE
| 16.702703 | 97 | 0.679612 |
a02efb8686a5088e942d2e75849b9734293946ce | 1,254 | asm | Assembly | Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48_notsx.log_9_292.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48_notsx.log_9_292.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48_notsx.log_9_292.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r9
push %rax
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WT+0x14084, %rdi
nop
dec %r9
mov $0x5152535455565758, %rdx
movq %rdx, %xmm4
movaps %xmm4, (%rdi)
and $29529, %rdx
// Load
lea addresses_PSE+0x11204, %rax
nop
nop
nop
nop
nop
xor $32617, %r14
mov (%rax), %r12w
nop
nop
nop
nop
and %r9, %r9
// Faulty Load
lea addresses_US+0x19604, %rdx
nop
nop
nop
nop
nop
sub $26980, %r12
mov (%rdx), %r14
lea oracles, %r9
and $0xff, %r14
shlq $12, %r14
mov (%r9,%r14,1), %r14
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r9
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_US', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_WT', 'congruent': 7}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_PSE', 'congruent': 10}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_US', 'congruent': 0}}
<gen_prepare_buffer>
{'00': 9}
00 00 00 00 00 00 00 00 00
*/
| 17.178082 | 123 | 0.643541 |
e9eb1fcf9204853ecf548d9f788a12d9eb7da6bc | 375 | asm | Assembly | programs/oeis/027/A027382.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/027/A027382.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/027/A027382.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A027382: a(n) = n^4 - 6*n^3 + 12*n^2 - 4*n + 1.
; 1,4,9,16,49,156,409,904,1761,3124,5161,8064,12049,17356,24249,33016,43969,57444,73801,93424,116721,144124,176089,213096,255649,304276,359529,421984,492241,570924,658681
mov $3,$0
mov $6,$0
lpb $0
sub $3,3
mul $3,$0
mov $0,$5
lpe
mov $1,1
add $1,$3
pow $1,2
mov $2,$6
mul $2,2
add $1,$2
mov $4,$6
mul $4,$6
add $1,$4
| 18.75 | 170 | 0.629333 |
c42b3b203ff87925cf8eae2c6cd366a38e4053fd | 557 | asm | Assembly | programs/oeis/276/A276849.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/276/A276849.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/276/A276849.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A276849: a(0) = 5, a(1) = 2; for n>1, a(n) = 2*a(n-1) + a(n-2).
; 5,2,9,20,49,118,285,688,1661,4010,9681,23372,56425,136222,328869,793960,1916789,4627538,11171865,26971268,65114401,157200070,379514541,916229152,2211972845,5340174842,12892322529,31124819900,75141962329,181408744558,437959451445,1057327647448,2552614746341,6162557140130,14877729026601,35918015193332,86713759413265,209345534019862,505404827452989,1220155188925840,2945715205304669,7111585599535178
mov $1,5
mov $2,2
lpb $0,1
sub $0,1
mov $3,$1
mov $1,$2
mul $2,2
add $2,$3
lpe
| 42.846154 | 400 | 0.766607 |
5a54c522036cd982351ab395512589c18c9a4e61 | 7,835 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2.log_1111_1382.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2.log_1111_1382.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2.log_1111_1382.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x579a, %rsi
inc %r9
mov $0x6162636465666768, %rdx
movq %rdx, %xmm5
movups %xmm5, (%rsi)
nop
nop
nop
nop
nop
inc %r10
lea addresses_normal_ht+0x14cad, %rsi
lea addresses_A_ht+0x1506, %rdi
nop
nop
nop
nop
xor $54220, %rdx
mov $115, %rcx
rep movsw
nop
nop
nop
nop
xor $18118, %rdx
lea addresses_WC_ht+0x120da, %r10
nop
xor $47545, %r13
movb (%r10), %r9b
nop
nop
sub $2560, %r13
lea addresses_WC_ht+0x7a, %rsi
nop
nop
nop
and %r13, %r13
mov $0x6162636465666768, %r10
movq %r10, (%rsi)
nop
nop
nop
nop
nop
cmp $15205, %rdx
lea addresses_A_ht+0x10e9a, %rsi
lea addresses_normal_ht+0x1aeba, %rdi
clflush (%rsi)
nop
nop
nop
nop
nop
and %r13, %r13
mov $6, %rcx
rep movsl
nop
xor $51898, %rsi
lea addresses_normal_ht+0xd5a7, %rsi
lea addresses_WT_ht+0x196da, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor $36976, %r10
mov $0, %rcx
rep movsw
nop
sub $1266, %rcx
lea addresses_D_ht+0x1ec1a, %rcx
nop
xor $35772, %r13
movw $0x6162, (%rcx)
dec %r9
lea addresses_UC_ht+0xbe9a, %r13
nop
nop
sub %rcx, %rcx
mov (%r13), %r10
nop
nop
dec %rdx
lea addresses_UC_ht+0x1249a, %r10
nop
nop
nop
nop
sub %rdx, %rdx
movb $0x61, (%r10)
nop
nop
nop
nop
nop
sub %r10, %r10
lea addresses_WT_ht+0xa5da, %rsi
lea addresses_normal_ht+0x1ae9a, %rdi
xor %r11, %r11
mov $0, %rcx
rep movsw
nop
nop
xor $18138, %r13
lea addresses_D_ht+0x1459a, %rdi
nop
nop
inc %r13
movl $0x61626364, (%rdi)
nop
nop
and %r10, %r10
lea addresses_WT_ht+0x5e9a, %rsi
lea addresses_UC_ht+0xdd9a, %rdi
nop
and $64813, %r10
mov $88, %rcx
rep movsw
nop
nop
nop
nop
and %rcx, %rcx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r8
push %r9
push %rax
push %rbx
push %rdx
push %rsi
// Store
lea addresses_WT+0x1c4a, %rdx
nop
nop
nop
sub $25859, %r9
mov $0x5152535455565758, %rax
movq %rax, %xmm7
movntdq %xmm7, (%rdx)
nop
nop
add $61944, %rbx
// Store
lea addresses_normal+0x9264, %rsi
nop
nop
nop
nop
nop
add $37954, %r8
movw $0x5152, (%rsi)
nop
nop
nop
and $14591, %rax
// Store
lea addresses_WC+0x13e9a, %r8
cmp %rbx, %rbx
mov $0x5152535455565758, %r13
movq %r13, %xmm3
movups %xmm3, (%r8)
nop
nop
nop
cmp %rax, %rax
// Faulty Load
lea addresses_WC+0x13e9a, %rsi
nop
nop
nop
sub %r13, %r13
mov (%rsi), %bx
lea oracles, %rsi
and $0xff, %rbx
shlq $12, %rbx
mov (%rsi,%rbx,1), %rbx
pop %rsi
pop %rdx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 16, 'AVXalign': False, 'NT': True, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': True}, 'dst': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'58': 1111}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
| 33.059072 | 2,999 | 0.657945 |
140acc7ff331f9388c97659b38bdfe94bad86957 | 743 | asm | Assembly | programs/oeis/081/A081436.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/081/A081436.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/081/A081436.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A081436: Fifth subdiagonal in array of n-gonal numbers A081422.
; 1,7,24,58,115,201,322,484,693,955,1276,1662,2119,2653,3270,3976,4777,5679,6688,7810,9051,10417,11914,13548,15325,17251,19332,21574,23983,26565,29326,32272,35409,38743,42280,46026,49987,54169,58578,63220,68101,73227,78604,84238,90135,96301,102742,109464,116473,123775,131376,139282,147499,156033,164890,174076,183597,193459,203668,214230,225151,236437,248094,260128,272545,285351,298552,312154,326163,340585,355426,370692,386389,402523,419100,436126,453607,471549,489958,508840,528201,548047,568384,589218,610555,632401,654762,677644,701053,724995,749476,774502,800079,826213,852910,880176,908017,936439,965448,995050
add $0,1
mov $1,$0
pow $0,2
mul $0,$1
bin $1,2
sub $0,$1
| 74.3 | 618 | 0.806191 |
35422df58293b9ce61320c1bafe9908c4f669f46 | 358 | asm | Assembly | libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/vsnprintf_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/vsnprintf_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/stdio/c/sdcc_ix/vsnprintf_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; int vsnprintf_callee(char *s, size_t n, const char *format, void *arg)
SECTION code_clib
SECTION code_stdio
PUBLIC _vsnprintf_callee, l0_vsnprintf_callee
EXTERN asm_vsnprintf
_vsnprintf_callee:
pop af
exx
pop de
pop bc
exx
pop de
pop bc
push af
l0_vsnprintf_callee:
push ix
call asm_vsnprintf
pop ix
ret
| 11.933333 | 72 | 0.701117 |
79ee09dff51a9ec8faab6fe9f406dc6daa73dedc | 298 | asm | Assembly | programs/oeis/055/A055610.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/055/A055610.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/055/A055610.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A055610: A companion sequence to A011896.
; 0,0,0,1,2,5,9,15,24,36,52,71,95,123,156,195,240,292,350,416,489,570,660,759,868,986,1115,1254,1404,1566,1740,1927,2126,2339,2565,2805,3060,3330,3616,3917,4235,4569,4920,5289,5676,6082,6506,6950,7413,7896
bin $0,3
add $0,2
mul $0,6
div $0,14
mov $1,$0
| 33.111111 | 205 | 0.718121 |
21790c978c24271830e9a560514e4ab324b73d39 | 38,017 | asm | Assembly | v2.0/source/msdos/disk.asm | neozeed/MS-DOS | 1cb8b96cd347b7eb150922eeb4924ec92911dc31 | [
"MIT"
] | 7 | 2018-09-29T16:03:48.000Z | 2021-04-06T20:08:57.000Z | v2.0/source/msdos/disk.asm | neozeed/MS-DOS | 1cb8b96cd347b7eb150922eeb4924ec92911dc31 | [
"MIT"
] | null | null | null | v2.0/source/msdos/disk.asm | neozeed/MS-DOS | 1cb8b96cd347b7eb150922eeb4924ec92911dc31 | [
"MIT"
] | null | null | null | ;
; Disk routines for MSDOS
;
INCLUDE DOSSEG.ASM
CODE SEGMENT BYTE PUBLIC 'CODE'
ASSUME SS:DOSGROUP,CS:DOSGROUP
.xlist
.xcref
INCLUDE DOSSYM.ASM
INCLUDE DEVSYM.ASM
.cref
.list
TITLE DISK - Disk utility routines
NAME Disk
i_need COUTDSAV,BYTE
i_need COUTSAV,DWORD
i_need CINDSAV,BYTE
i_need CINSAV,DWORD
i_need CONSWAP,BYTE
i_need IDLEINT,BYTE
i_need THISFCB,DWORD
i_need DMAADD,DWORD
i_need DEVCALL,BYTE
i_need CALLSCNT,WORD
i_need CALLXAD,DWORD
i_need CONTPOS,WORD
i_need NEXTADD,WORD
i_need CONBUF,BYTE
i_need User_SS,WORD
i_need User_SP,WORD
i_need DSKStack,BYTE
i_need InDOS,BYTE
i_need NumIO,BYTE
i_need CurDrv,BYTE
i_need ThisDrv,BYTE
i_need ClusFac,BYTE
i_need SecClusPos,BYTE
i_need DirSec,WORD
i_need ClusNum,WORD
i_need NxtClusNum,WORD
i_need ReadOp,BYTE
i_need DskErr,BYTE
i_need RecCnt,WORD
i_need RecPos,4
i_need Trans,BYTE
i_need BytPos,4
i_need SecPos,WORD
i_need BytSecPos,WORD
i_need BytCnt1,WORD
i_need BytCnt2,WORD
i_need SecCnt,WORD
i_need ThisDPB,DWORD
i_need LastPos,WORD
i_need ValSec,WORD
i_need GrowCnt,DWORD
SUBTTL LOAD -- MAIN READ ROUTINE AND DEVICE IN ROUTINES
PAGE
; * * * * Drivers for file input from devices * * * *
procedure SWAPBACK,NEAR
ASSUME DS:DOSGROUP,ES:NOTHING
PUSH ES
PUSH DI
PUSH SI
PUSH BX
MOV BX,1
invoke get_sf_from_jfn
ADD DI,sf_fcb
MOV BL,BYTE PTR [COUTDSAV]
LDS SI,[COUTSAV]
ASSUME DS:NOTHING
MOV WORD PTR ES:[DI.fcb_FIRCLUS],SI
MOV WORD PTR ES:[DI.fcb_FIRCLUS+2],DS
MOV ES:[DI.fcb_DEVID],BL
PUSH SS
POP DS
ASSUME DS:DOSGROUP
XOR BX,BX
invoke get_sf_from_jfn
ADD DI,sf_fcb
MOV BL,BYTE PTR [CINDSAV]
LDS SI,[CINSAV]
ASSUME DS:NOTHING
MOV WORD PTR ES:[DI.fcb_FIRCLUS],SI
MOV WORD PTR ES:[DI.fcb_FIRCLUS+2],DS
MOV ES:[DI.fcb_DEVID],BL
PUSH SS
POP DS
ASSUME DS:DOSGROUP
MOV BYTE PTR [CONSWAP],0
MOV BYTE PTR [IDLEINT],1
SWAPRET:
POP BX
POP SI
POP DI
POP ES
return
SWAPBACK ENDP
procedure SWAPCON,NEAR
ASSUME DS:DOSGROUP,ES:NOTHING
PUSH ES
PUSH DI
PUSH SI
PUSH BX
MOV BYTE PTR [CONSWAP],1
MOV BYTE PTR [IDLEINT],0
XOR BX,BX
invoke get_sf_from_jfn
ADD DI,sf_fcb
MOV BL,ES:[DI.fcb_DEVID]
MOV BYTE PTR [CINDSAV],BL
LDS SI,DWORD PTR ES:[DI.fcb_FIRCLUS]
ASSUME DS:NOTHING
MOV WORD PTR [CINSAV],SI
MOV WORD PTR [CINSAV+2],DS
LDS SI,[THISFCB]
MOV BL,[SI.fcb_DEVID]
LDS SI,DWORD PTR [SI.fcb_FIRCLUS]
MOV ES:[DI.fcb_DEVID],BL
MOV WORD PTR ES:[DI.fcb_FIRCLUS],SI
MOV WORD PTR ES:[DI.fcb_FIRCLUS+2],DS
PUSH SS
POP DS
ASSUME DS:DOSGROUP
MOV BX,1
invoke get_sf_from_jfn
ADD DI,sf_fcb
MOV BL,ES:[DI.fcb_DEVID]
MOV BYTE PTR [COUTDSAV],BL
LDS SI,DWORD PTR ES:[DI.fcb_FIRCLUS]
ASSUME DS:NOTHING
MOV WORD PTR [COUTSAV],SI
MOV WORD PTR [COUTSAV+2],DS
LDS SI,[THISFCB]
MOV BL,[SI.fcb_DEVID]
LDS SI,DWORD PTR [SI.fcb_FIRCLUS]
MOV ES:[DI.fcb_DEVID],BL
MOV WORD PTR ES:[DI.fcb_FIRCLUS],SI
MOV WORD PTR ES:[DI.fcb_FIRCLUS+2],DS
PUSH SS
POP DS
JMP SWAPRET
SWAPCON ENDP
procedure LOAD,NEAR
ASSUME DS:NOTHING,ES:NOTHING
;
; Inputs:
; DS:DI point to FCB
; DX:AX = Position in file to read
; CX = No. of records to read
; Outputs:
; DX:AX = Position of last record read
; CX = No. of bytes read
; ES:DI point to FCB
; fcb_LSTCLUS, fcb_CLUSPOS fields in FCB set
call SETUP
ASSUME DS:DOSGROUP
OR BL,BL ; Check for named device I/O
JS READDEV
call DISKREAD
return
READDEV:
ASSUME DS:DOSGROUP,ES:NOTHING
LES DI,[DMAADD]
TEST BL,40H ; End of file?
JZ ENDRDDEVJ3
TEST BL,ISNULL ; NUL device?
JZ TESTRAW ; NO
XOR AL,AL ; Indicate EOF
ENDRDDEVJ3: JMP ENDRDDEVJ2
DVRDRAW:
ASSUME DS:DOSGROUP
PUSH ES
POP DS
ASSUME DS:NOTHING
DVRDRAWR:
MOV BX,DI ; DS:BX transfer addr
XOR DX,DX ; Start at 0
XOR AX,AX ; Media Byte, unit = 0
invoke SETREAD
LDS SI,[THISFCB]
invoke DEVIOCALL
MOV DX,DI ; DX is preserved by INT 24
MOV AH,86H ; Read error
MOV DI,[DEVCALL.REQSTAT]
TEST DI,STERR
JZ CRDROK ; No errors
invoke CHARHARD
MOV DI,DX
CMP AL,1
JZ DVRDRAWR ; Retry
CRDROK:
MOV DI,DX
ADD DI,[CALLSCNT] ; Amount transferred
JMP SHORT ENDRDDEVJ2
TESTRAW:
TEST BL,020H ; Raw mode?
JNZ DVRDRAW
TEST BL,ISCIN ; Is it console device?
JZ NOTRDCON
JMP READCON
NOTRDCON:
MOV AX,ES
MOV DS,AX
ASSUME DS:NOTHING
MOV BX,DI
XOR DX,DX
MOV AX,DX
PUSH CX
MOV CX,1
invoke SETREAD
POP CX
LDS SI,[THISFCB]
LDS SI,DWORD PTR [SI.fcb_FIRCLUS]
DVRDLP:
invoke DSKSTATCHK
invoke DEVIOCALL2
PUSH DI
MOV AH,86H
MOV DI,[DEVCALL.REQSTAT]
TEST DI,STERR
JZ CRDOK
invoke CHARHARD
POP DI
MOV [CALLSCNT],1
CMP AL,1
JZ DVRDLP ;Retry
XOR AL,AL ;Pick some random character
JMP SHORT DVRDIGN
CRDOK:
POP DI
CMP [CALLSCNT],1
JNZ ENDRDDEVJ2
PUSH DS
MOV DS,WORD PTR [CALLXAD+2]
MOV AL,BYTE PTR [DI]
POP DS
DVRDIGN:
INC WORD PTR [CALLXAD]
MOV [DEVCALL.REQSTAT],0
INC DI
CMP AL,1AH ; ^Z?
JZ ENDRDDEVJ
CMP AL,c_CR ; CR?
LOOPNZ DVRDLP
ENDRDDEVJ:
DEC DI
ENDRDDEVJ2:
JMP SHORT ENDRDDEV
ASSUME DS:NOTHING,ES:NOTHING
TRANBUF:
LODSB
STOSB
CMP AL,c_CR ; Check for carriage return
JNZ NORMCH
MOV BYTE PTR [SI],c_LF
NORMCH:
CMP AL,c_LF
LOOPNZ TRANBUF
JNZ ENDRDCON
XOR SI,SI ; Cause a new buffer to be read
invoke OUT ; Transmit linefeed
OR AL,1 ; Clear zero flag--not end of file
ENDRDCON:
PUSH SS
POP DS
ASSUME DS:DOSGROUP
CALL SWAPBACK
MOV [CONTPOS],SI
ENDRDDEV:
PUSH SS
POP DS
ASSUME DS:DOSGROUP
MOV [NEXTADD],DI
JNZ SETFCBC ; Zero set if Ctrl-Z found in input
LES DI,[THISFCB]
AND ES:BYTE PTR [DI.fcb_DEVID],0FFH-40H ; Mark as no more data available
SETFCBC:
call SETFCB
return
ASSUME DS:NOTHING,ES:NOTHING
READCON:
ASSUME DS:DOSGROUP
CALL SWAPCON
MOV SI,[CONTPOS]
OR SI,SI
JNZ TRANBUF
CMP BYTE PTR [CONBUF],128
JZ GETBUF
MOV WORD PTR [CONBUF],0FF80H ; Set up 128-byte buffer with no template
GETBUF:
PUSH CX
PUSH ES
PUSH DI
MOV DX,OFFSET DOSGROUP:CONBUF
invoke $STD_CON_STRING_INPUT ; Get input buffer
POP DI
POP ES
POP CX
MOV SI,2 + OFFSET DOSGROUP:CONBUF
CMP BYTE PTR [SI],1AH ; Check for Ctrl-Z in first character
JNZ TRANBUF
MOV AL,1AH
STOSB
DEC DI
MOV AL,10
invoke OUT ; Send linefeed
XOR SI,SI
JMP SHORT ENDRDCON
LOAD ENDP
SUBTTL STORE -- MAIN WRITE ROUTINE AND DEVICE OUT ROUTINES
PAGE
ASSUME DS:NOTHING,ES:NOTHING
procedure STORE,NEAR
ASSUME DS:NOTHING,ES:NOTHING
; Inputs:
; DS:DI point to FCB
; DX:AX = Position in file of disk transfer
; CX = Record count
; Outputs:
; DX:AX = Position of last record written
; CX = No. of records written
; ES:DI point to FCB
; fcb_LSTCLUS, fcb_CLUSPOS fields in FCB set
call SETUP
ASSUME DS:DOSGROUP
OR BL,BL
JS WRTDEV
invoke DATE16
MOV ES:[DI.fcb_FDATE],AX
MOV ES:[DI.fcb_FTIME],DX
call DISKWRITE
return
WRITECON:
PUSH DS
PUSH SS
POP DS
ASSUME DS:DOSGROUP
CALL SWAPCON
POP DS
ASSUME DS:NOTHING
MOV SI,BX
PUSH CX
WRCONLP:
LODSB
CMP AL,1AH ; ^Z?
JZ CONEOF
invoke OUT
LOOP WRCONLP
CONEOF:
POP AX ; Count
SUB AX,CX ; Amount actually written
POP DS
ASSUME DS:DOSGROUP
CALL SWAPBACK
JMP SHORT ENDWRDEV
DVWRTRAW:
ASSUME DS:NOTHING
XOR AX,AX ; Media Byte, unit = 0
invoke SETWRITE
LDS SI,[THISFCB]
invoke DEVIOCALL
MOV DX,DI
MOV AH,87H
MOV DI,[DEVCALL.REQSTAT]
TEST DI,STERR
JZ CWRTROK
invoke CHARHARD
MOV BX,DX ; Recall transfer addr
CMP AL,1
JZ DVWRTRAW ; Try again
CWRTROK:
POP DS
ASSUME DS:DOSGROUP
MOV AX,[CALLSCNT] ; Get actual number of bytes transferred
ENDWRDEV:
LES DI,[THISFCB]
XOR DX,DX
DIV ES:[DI.fcb_RECSIZ]
MOV CX,AX ; Partial record is ignored
call ADDREC
return
ASSUME DS:DOSGROUP
WRTDEV:
OR BL,40H ; Reset EOF for input
XOR AX,AX
JCXZ ENDWRDEV ; problem of creating on a device.
PUSH DS
MOV AL,BL
LDS BX,[DMAADD]
ASSUME DS:NOTHING
MOV DI,BX
XOR DX,DX ; Set starting point
TEST AL,020H ; Raw?
JNZ DVWRTRAW
TEST AL,ISCOUT ; Console output device?
JNZ WRITECON
TEST AL,ISNULL
JNZ WRTNUL
MOV AX,DX
CMP BYTE PTR [BX],1AH ; ^Z?
JZ WRTCOOKDONE ; Yes, transfer nothing
PUSH CX
MOV CX,1
invoke SETWRITE
POP CX
LDS SI,[THISFCB]
LDS SI,DWORD PTR [SI.fcb_FIRCLUS]
DVWRTLP:
invoke DSKSTATCHK
invoke DEVIOCALL2
PUSH DI
MOV AH,87H
MOV DI,[DEVCALL.REQSTAT]
TEST DI,STERR
JZ CWROK
invoke CHARHARD
POP DI
MOV [CALLSCNT],1
CMP AL,1
JZ DVWRTLP
JMP SHORT DVWRTIGN
CWROK:
POP DI
CMP [CALLSCNT],0
JZ WRTCOOKDONE
DVWRTIGN:
INC DX
INC WORD PTR [CALLXAD]
INC DI
PUSH DS
MOV DS,WORD PTR [CALLXAD+2]
CMP BYTE PTR [DI],1AH ; ^Z?
POP DS
JZ WRTCOOKDONE
MOV [DEVCALL.REQSTAT],0
LOOP DVWRTLP
WRTCOOKDONE:
MOV AX,DX
POP DS
JMP ENDWRDEV
WRTNUL:
MOV DX,CX ;Entire transfer done
JMP WRTCOOKDONE
STORE ENDP
procedure get_io_fcb,near
ASSUME DS:NOTHING,ES:NOTHING
; Convert JFN number in BX to FCB in DS:SI
PUSH SS
POP DS
ASSUME DS:DOSGROUP
PUSH ES
PUSH DI
invoke get_sf_from_jfn
JC RET44P
MOV SI,DI
ADD SI,sf_fcb
PUSH ES
POP DS
ASSUME DS:NOTHING
RET44P:
POP DI
POP ES
return
get_io_fcb ENDP
SUBTTL GETTHISDRV -- FIND CURRENT DRIVE
PAGE
; Input: AL has drive identifier (1=A, 0=default)
; Output: AL has physical drive (0=A)
; Carry set if invalid drive (and AL is garbage anyway)
procedure GetThisDrv,NEAR
ASSUME DS:NOTHING,ES:NOTHING
CMP BYTE PTR [NUMIO],AL
retc
DEC AL
JNS PHYDRV
MOV AL,[CURDRV]
PHYDRV:
MOV BYTE PTR [THISDRV],AL
return
GetThisDrv ENDP
SUBTTL DIRREAD -- READ A DIRECTORY SECTOR
PAGE
procedure DirRead,NEAR
ASSUME DS:DOSGROUP,ES:NOTHING
; Inputs:
; AX = Directory block number (relative to first block of directory)
; ES:BP = Base of drive parameters
; [DIRSEC] = First sector of first cluster of directory
; [CLUSNUM] = Next cluster
; [CLUSFAC] = Sectors/Cluster
; Function:
; Read the directory block into [CURBUF].
; Outputs:
; [NXTCLUSNUM] = Next cluster (after the one skipped to)
; [SECCLUSPOS] Set
; ES:BP unchanged [CURBUF] Points to Buffer with dir sector
; All other registers destroyed.
MOV CL,[CLUSFAC]
DIV CL ; AL # clusters to skip, AH position in cluster
MOV [SECCLUSPOS],AH
MOV CL,AL
XOR CH,CH
MOV DX,[DIRSEC]
ADD DL,AH
ADC DH,0
MOV BX,[CLUSNUM]
MOV [NXTCLUSNUM],BX
JCXZ FIRSTCLUSTER
SKPCLLP:
invoke UNPACK
XCHG BX,DI
CMP BX,0FF8H
JAE HAVESKIPPED
LOOP SKPCLLP
HAVESKIPPED:
MOV [NXTCLUSNUM],BX
MOV DX,DI
MOV BL,AH
invoke FIGREC
entry FIRSTCLUSTER
XOR AL,AL ; Indicate pre-read
MOV AH,DIRPRI
invoke GETBUFFR
ret
DirRead ENDP
SUBTTL FATSECRD -- READ A FAT SECTOR
PAGE
procedure FATSecRd,NEAR
ASSUME DS:NOTHING,ES:NOTHING
; Inputs:
; Same as DREAD
; DS:BX = Transfer address
; CX = Number of sectors
; DX = Absolute record number
; ES:BP = Base of drive parameters
; Function:
; Calls BIOS to perform FAT read.
; Outputs:
; Same as DREAD
MOV DI,CX
MOV CL,ES:[BP.dpb_FAT_count]
MOV AL,ES:[BP.dpb_FAT_size]
XOR AH,AH
MOV CH,AH
PUSH DX
NXTFAT:
PUSH CX
PUSH AX
MOV CX,DI
CALL DSKREAD
POP AX
POP CX
JZ RET41P
ADD DX,AX
LOOP NXTFAT
POP DX
MOV CX,DI
; NOTE FALL THROUGH
SUBTTL DREAD -- DO A DISK READ
PAGE
entry DREAD
ASSUME DS:NOTHING,ES:NOTHING
; Inputs:
; DS:BX = Transfer address
; CX = Number of sectors
; DX = Absolute record number
; ES:BP = Base of drive parameters
; Function:
; Calls BIOS to perform disk read. If BIOS reports
; errors, will call HARDERR for further action.
; DS,ES:BP preserved. All other registers destroyed.
CALL DSKREAD
retz
MOV BYTE PTR [READOP],0
invoke HARDERR
CMP AL,1 ; Check for retry
JZ DREAD
return ; Ignore otherwise
RET41P: POP DX
return
FATSecRd ENDP
SUBTTL DSKREAD -- PHYSICAL DISK READ
PAGE
procedure DskRead,NEAR
ASSUME DS:NOTHING,ES:NOTHING
; Inputs:
; DS:BX = Transfer addr
; CX = Number of sectors
; DX = Absolute record number
; ES:BP = Base of drive parameters
; Function:
; Call BIOS to perform disk read
; Outputs:
; DI = CX on entry
; CX = Number of sectors unsuccessfully transfered
; AX = Status word as returned by BIOS (error code in AL if error)
; Zero set if OK (from BIOS)
; Zero clear if error
; SI Destroyed, others preserved
PUSH CX
MOV AH,ES:[BP.dpb_media]
MOV AL,ES:[BP.dpb_UNIT]
PUSH BX
PUSH ES
invoke SETREAD
JMP DODSKOP
SUBTTL DWRITE -- SEE ABOUT WRITING
PAGE
entry DWRITE
ASSUME DS:NOTHING,ES:NOTHING
; Inputs:
; DS:BX = Transfer address
; CX = Number of sectors
; DX = Absolute record number
; ES:BP = Base of drive parameters
; Function:
; Calls BIOS to perform disk write. If BIOS reports
; errors, will call HARDERR for further action.
; BP preserved. All other registers destroyed.
CALL DSKWRITE
retz
MOV BYTE PTR [READOP],1
invoke HARDERR
CMP AL,1 ; Check for retry
JZ DWRITE
return
SUBTTL DSKWRITE -- PHYSICAL DISK WRITE
PAGE
entry DSKWRITE
ASSUME DS:NOTHING,ES:NOTHING
; Inputs:
; DS:BX = Transfer addr
; CX = Number of sectors
; DX = Absolute record number
; ES:BP = Base of drive parameters
; Function:
; Call BIOS to perform disk read
; Outputs:
; DI = CX on entry
; CX = Number of sectors unsuccessfully transfered
; AX = Status word as returned by BIOS (error code in AL if error)
; Zero set if OK (from BIOS)
; Zero clear if error
; SI Destroyed, others preserved
PUSH CX
MOV AH,ES:[BP.dpb_media]
MOV AL,ES:[BP.dpb_UNIT]
PUSH BX
PUSH ES
invoke SETWRITE
DODSKOP:
MOV CX,DS ; Save DS
POP DS ; DS:BP points to DPB
PUSH DS
LDS SI,DS:[BP.dpb_driver_addr]
invoke DEVIOCALL2
MOV DS,CX ; Restore DS
POP ES ; Restore ES
POP BX
MOV CX,[CALLSCNT] ; Number of sectors transferred
POP DI
SUB CX,DI
NEG CX ; Number of sectors not transferred
MOV AX,[DEVCALL.REQSTAT]
TEST AX,STERR
return
DskRead ENDP
SUBTTL SETUP -- SETUP A DISK READ OR WRITE FROM USER
PAGE
ASSUME DS:DOSGROUP,ES:NOTHING
procedure SETUP,NEAR
ASSUME DS:NOTHING,ES:NOTHING
; Inputs:
; DS:DI point to FCB
; DX:AX = Record position in file of disk transfer
; CX = Record count
; Outputs:
; DS = DOSGROUP
; BL = fcb_DEVID from FCB
; CX = No. of bytes to transfer (0 = 64K)
; [THISDPB] = Base of drive parameters
; [RECCNT] = Record count
; [RECPOS] = Record position in file
; ES:DI Points to FCB
; [THISFCB] = ES:DI
; [NEXTADD] = Displacement of disk transfer within segment
; [SECPOS] = Position of first sector
; [BYTPOS] = Byte position in file
; [BYTSECPOS] = Byte position in first sector
; [CLUSNUM] = First cluster
; [SECCLUSPOS] = Sector within first cluster
; [DSKERR] = 0 (no errors yet)
; [TRANS] = 0 (No transfers yet)
; [THISDRV] = Physical drive unit number
PUSH AX
MOV AL,[DI]
DEC AL
MOV BYTE PTR [THISDRV],AL
MOV AL,[DI.fcb_DEVID]
MOV SI,[DI.fcb_RECSIZ]
OR SI,SI
JNZ HAVRECSIZ
MOV SI,128
MOV [DI.fcb_RECSIZ],SI
HAVRECSIZ:
MOV WORD PTR [THISFCB+2],DS
PUSH SS
POP DS ; Set DS to DOSGROUP
ASSUME DS:DOSGROUP
MOV WORD PTR [THISFCB],DI
OR AL,AL ; Is it a device?
JNS NOTDEVICE
XOR AL,AL ; Fake in drive 0 so we can get BP
NOTDEVICE:
invoke GETBP
POP AX
JNC CheckRecLen
XOR CX,CX
MOV BYTE PTR [DSKERR],4
POP BX
return
CheckRecLen:
CMP SI,64 ; Check if highest byte of RECPOS is significant
JB SMALREC
XOR DH,DH ; Ignore MSB if record >= 64 bytes
SMALREC:
MOV [RECCNT],CX
MOV WORD PTR [RECPOS],AX
MOV WORD PTR [RECPOS+2],DX
MOV BX,WORD PTR [DMAADD]
MOV [NEXTADD],BX
MOV BYTE PTR [DSKERR],0
MOV BYTE PTR [TRANS],0
MOV BX,DX
MUL SI
MOV WORD PTR [BYTPOS],AX
PUSH DX
MOV AX,BX
MUL SI
POP BX
ADD AX,BX
ADC DX,0 ; Ripple carry
JNZ EOFERR
MOV WORD PTR [BYTPOS+2],AX
MOV DX,AX
MOV AX,WORD PTR [BYTPOS]
MOV BX,ES:[BP.dpb_sector_size]
CMP DX,BX ; See if divide will overflow
JNC EOFERR
DIV BX
MOV [SECPOS],AX
MOV [BYTSECPOS],DX
MOV DX,AX
AND AL,ES:[BP.dpb_cluster_mask]
MOV [SECCLUSPOS],AL
MOV AX,CX ; Record count
MOV CL,ES:[BP.dpb_cluster_shift]
SHR DX,CL
MOV [CLUSNUM],DX
MUL SI ; Multiply by bytes per record
MOV CX,AX
ADD AX,WORD PTR [DMAADD] ; See if it will fit in one segment
ADC DX,0
JZ OK ; Must be less than 64K
MOV AX,WORD PTR [DMAADD]
NEG AX ; Amount of room left in segment
JNZ PARTSEG
DEC AX
PARTSEG:
XOR DX,DX
DIV SI ; How many records will fit?
MOV [RECCNT],AX
MUL SI ; Translate that back into bytes
MOV BYTE PTR [DSKERR],2 ; Flag that trimming took place
MOV CX,AX
JCXZ NOROOM
OK:
LES DI,[THISFCB]
MOV BL,ES:[DI.fcb_DEVID]
return
EOFERR:
MOV BYTE PTR [DSKERR],1
XOR CX,CX
NOROOM:
LES DI,[THISFCB]
POP BX ; Kill return address
return
SETUP ENDP
SUBTTL BREAKDOWN -- CUT A USER READ OR WRITE INTO PIECES
PAGE
procedure BREAKDOWN,near
ASSUME DS:DOSGROUP,ES:NOTHING
; Inputs:
; CX = Length of disk transfer in bytes
; ES:BP = Base of drive parameters
; [BYTSECPOS] = Byte position witin first sector
; Outputs:
; [BYTCNT1] = Bytes to transfer in first sector
; [SECCNT] = No. of whole sectors to transfer
; [BYTCNT2] = Bytes to transfer in last sector
; AX, BX, DX destroyed. No other registers affected.
MOV AX,[BYTSECPOS]
MOV BX,CX
OR AX,AX
JZ SAVFIR ; Partial first sector?
SUB AX,ES:[BP.dpb_sector_size]
NEG AX ; Max number of bytes left in first sector
SUB BX,AX ; Subtract from total length
JAE SAVFIR
ADD AX,BX ; Don't use all of the rest of the sector
XOR BX,BX ; And no bytes are left
SAVFIR:
MOV [BYTCNT1],AX
MOV AX,BX
XOR DX,DX
DIV ES:[BP.dpb_sector_size] ; How many whole sectors?
MOV [SECCNT],AX
MOV [BYTCNT2],DX ; Bytes remaining for last sector
OR DX,[BYTCNT1]
retnz ; NOT (BYTCNT1 = BYTCNT2 = 0)
CMP AX,1
retnz
MOV AX,ES:[BP.dpb_sector_size] ; Buffer EXACT one sector I/O
MOV [BYTCNT2],AX
MOV [SECCNT],DX ; DX = 0
return
BreakDown ENDP
SUBTTL DISKREAD -- PERFORM USER DISK READ
PAGE
procedure DISKREAD,NEAR
ASSUME DS:DOSGROUP,ES:NOTHING
; Inputs:
; Outputs of SETUP
; Function:
; Perform disk read
; Outputs:
; DX:AX = Position of last record read
; CX = No. of records read
; ES:DI point to FCB
; fcb_LSTCLUS, fcb_CLUSPOS fields in FCB set
MOV AX,ES:WORD PTR [DI.fcb_FILSIZ]
MOV BX,ES:WORD PTR [DI.fcb_FILSIZ+2]
SUB AX,WORD PTR [BYTPOS]
SBB BX,WORD PTR [BYTPOS+2]
JB RDERR
JNZ ENUF
OR AX,AX
JZ RDERR
CMP AX,CX
JAE ENUF
MOV CX,AX
ENUF:
LES BP,[THISDPB]
CALL BREAKDOWN
MOV CX,[CLUSNUM]
invoke FNDCLUS
OR CX,CX
JZ SHORT SKIPERR
RDERR:
JMP WRTERR
RDLASTJ:JMP RDLAST
SETFCBJ2: JMP SETFCB
SKIPERR:
MOV [LASTPOS],DX
MOV [CLUSNUM],BX
CMP [BYTCNT1],0
JZ RDMID
invoke BUFRD
RDMID:
CMP [SECCNT],0
JZ RDLASTJ
invoke NEXTSEC
JC SETFCBJ2
MOV BYTE PTR [TRANS],1 ; A transfer is taking place
ONSEC:
MOV DL,[SECCLUSPOS]
MOV CX,[SECCNT]
MOV BX,[CLUSNUM]
RDLP:
invoke OPTIMIZE
PUSH DI
PUSH AX
PUSH BX
MOV DS,WORD PTR [DMAADD+2]
ASSUME DS:NOTHING
PUSH DX
PUSH CX
CALL DREAD
POP BX
POP DX
ADD BX,DX ; Upper bound of read
MOV AL,ES:[BP.dpb_drive]
invoke SETVISIT
NXTBUF: ; Must see if one of these sectors is buffered
MOV [DI.VISIT],1 ; Mark as visited
CMP AL,[DI.BUFDRV]
JNZ DONXTBUF ; Not for this drive
CMP [DI.BUFSECNO],DX
JC DONXTBUF ; Below first sector
CMP [DI.BUFSECNO],BX
JNC DONXTBUF ; Above last sector
CMP BYTE PTR [DI.BUFDIRTY],0
JZ CLBUFF ; Buffer is clean, so OK
; A sector has been read in when a dirty copy of it is in a buffer
; The buffered sector must now be read into the right place
POP AX ; Recall transfer address
PUSH AX
PUSH DI ; Save search environment
PUSH DX
SUB DX,[DI.BUFSECNO] ; How far into transfer?
NEG DX
MOV SI,DI
MOV DI,AX
MOV AX,DX
MOV CX,ES:[BP.dpb_sector_size]
MUL CX
ADD DI,AX ; Put the buffer here
ADD SI,BUFINSIZ
SHR CX,1
PUSH ES
MOV ES,WORD PTR [DMAADD+2]
REP MOVSW
JNC EVENMOV
MOVSB
EVENMOV:
POP ES
POP DX
POP DI
MOV AL,ES:[BP.dpb_drive]
CLBUFF:
invoke SCANPLACE
DONXTBUF:
invoke SKIPVISIT
JNZ NXTBUF
PUSH SS
POP DS
ASSUME DS:DOSGROUP
POP CX
POP CX
POP BX
JCXZ RDLAST
CMP BX,0FF8H
JAE SETFCB
MOV DL,0
INC [LASTPOS] ; We'll be using next cluster
JMP RDLP
RDLAST:
MOV AX,[BYTCNT2]
OR AX,AX
JZ SETFCB
MOV [BYTCNT1],AX
invoke NEXTSEC
JC SETFCB
MOV [BYTSECPOS],0
invoke BUFRD
entry SETFCB
LES SI,[THISFCB]
MOV AX,[NEXTADD]
MOV DI,AX
SUB AX,WORD PTR [DMAADD] ; Number of bytes transfered
XOR DX,DX
MOV CX,ES:[SI.fcb_RECSIZ]
DIV CX ; Number of records
CMP AX,[RECCNT] ; Check if all records transferred
JZ FULLREC
MOV BYTE PTR [DSKERR],1
OR DX,DX
JZ FULLREC ; If remainder 0, then full record transfered
MOV BYTE PTR [DSKERR],3 ; Flag partial last record
SUB CX,DX ; Bytes left in last record
PUSH ES
MOV ES,WORD PTR [DMAADD+2]
XCHG AX,BX ; Save the record count temporarily
XOR AX,AX ; Fill with zeros
SHR CX,1
JNC EVENFIL
STOSB
EVENFIL:
REP STOSW
XCHG AX,BX ; Restore record count to AX
POP ES
INC AX ; Add last (partial) record to total
FULLREC:
MOV CX,AX
MOV DI,SI ; ES:DI point to FCB
SETCLUS:
TEST ES:[DI].fcb_DEVID,-1
JS ADDREC ; don't set clisters if device
MOV AX,[CLUSNUM]
AND ES:[DI.fcb_LSTCLUS],0F000h ; fcb_lstclus is packed with dir clus
OR ES:[DI.fcb_LSTCLUS],AX ; drop in the correct part of fcb_lstclus
MOV AX,[LASTPOS]
MOV ES:[DI.fcb_CLUSPOS],AX
entry AddRec
MOV AX,WORD PTR [RECPOS]
MOV DX,WORD PTR [RECPOS+2]
JCXZ RET28 ; If no records read, don't change position
DEC CX
ADD AX,CX ; Update current record position
ADC DX,0
INC CX
RET28: return
DISKREAD ENDP
SUBTTL DISKWRITE -- PERFORM USER DISK WRITE
PAGE
procedure DISKWRITE,NEAR
ASSUME DS:DOSGROUP,ES:NOTHING
; Inputs:
; Outputs of SETUP
; Function:
; Perform disk write
; Outputs:
; DX:AX = Position of last record written
; CX = No. of records written
; ES:DI point to FCB
; fcb_LSTCLUS, fcb_CLUSPOS fields in FCB set
AND BL,3FH ; Mark file as dirty
MOV ES:[DI.fcb_DEVID],BL
LES BP,[THISDPB]
CALL BREAKDOWN
MOV AX,WORD PTR [BYTPOS]
MOV DX,WORD PTR [BYTPOS+2]
JCXZ WRTEOFJ
ADD AX,CX
ADC DX,0 ; AX:DX=last byte accessed
DIV ES:[BP.dpb_sector_size] ; AX=last sector accessed
MOV BX,AX ; Save last full sector
OR DX,DX
JNZ CALCLUS
DEC AX ; AX must be zero base indexed
CALCLUS:
MOV CL,ES:[BP.dpb_cluster_shift]
SHR AX,CL ; Last cluster to be accessed
PUSH AX
PUSH DX ; Save the size of the "tail"
PUSH ES
LES DI,[THISFCB]
MOV AX,ES:WORD PTR [DI.fcb_FILSIZ]
MOV DX,ES:WORD PTR [DI.fcb_FILSIZ+2]
POP ES
DIV ES:[BP.dpb_sector_size]
MOV CX,AX ; Save last full sector of current file
OR DX,DX
JZ NORNDUP
INC AX ; Round up if any remainder
NORNDUP:
MOV [VALSEC],AX ; Number of sectors that have been written
XOR AX,AX
MOV WORD PTR [GROWCNT],AX
MOV WORD PTR [GROWCNT+2],AX
POP AX
SUB BX,CX ; Number of full sectors
JB NOGROW
JZ TESTTAIL
MOV CX,DX
XCHG AX,BX
MUL ES:[BP.dpb_sector_size] ; Bytes of full sector growth
SUB AX,CX ; Take off current "tail"
SBB DX,0 ; 32-bit extension
ADD AX,BX ; Add on new "tail"
ADC DX,0 ; ripple tim's head off
JMP SHORT SETGRW
HAVSTART:
MOV CX,AX
invoke SKPCLP
JCXZ DOWRTJ
invoke ALLOCATE
JNC DOWRTJ
WRTERR:
XOR CX,CX
MOV BYTE PTR [DSKERR],1
MOV AX,WORD PTR [RECPOS]
MOV DX,WORD PTR [RECPOS+2]
LES DI,[THISFCB]
return
DOWRTJ: JMP DOWRT
WRTEOFJ:
JMP WRTEOF
TESTTAIL:
SUB AX,DX
JBE NOGROW
XOR DX,DX
SETGRW:
MOV WORD PTR [GROWCNT],AX
MOV WORD PTR [GROWCNT+2],DX
NOGROW:
POP AX
MOV CX,[CLUSNUM] ; First cluster accessed
invoke FNDCLUS
MOV [CLUSNUM],BX
MOV [LASTPOS],DX
SUB AX,DX ; Last cluster minus current cluster
JZ DOWRT ; If we have last clus, we must have first
JCXZ HAVSTART ; See if no more data
PUSH CX ; No. of clusters short of first
MOV CX,AX
invoke ALLOCATE
POP AX
JC WRTERR
MOV CX,AX
MOV DX,[LASTPOS]
INC DX
DEC CX
JZ NOSKIP
invoke SKPCLP
NOSKIP:
MOV [CLUSNUM],BX
MOV [LASTPOS],DX
DOWRT:
CMP [BYTCNT1],0
JZ WRTMID
MOV BX,[CLUSNUM]
invoke BUFWRT
WRTMID:
MOV AX,[SECCNT]
OR AX,AX
JZ WRTLAST
ADD [SECPOS],AX
invoke NEXTSEC
MOV BYTE PTR [TRANS],1 ; A transfer is taking place
MOV DL,[SECCLUSPOS]
MOV BX,[CLUSNUM]
MOV CX,[SECCNT]
WRTLP:
invoke OPTIMIZE
PUSH DI
PUSH AX
PUSH DX
PUSH BX
MOV AL,ES:[BP.dpb_drive]
MOV BX,CX
ADD BX,DX ; Upper bound of write
invoke SETVISIT
ASSUME DS:NOTHING
NEXTBUFF: ; Search for buffers
MOV [DI.VISIT],1 ; Mark as visited
CMP AL,[DI.BUFDRV]
JNZ DONEXTBUFF ; Not for this drive
CMP [DI.BUFSECNO],DX
JC DONEXTBUFF ; Buffer is not in range of write
CMP [DI.BUFSECNO],BX
JNC DONEXTBUFF ; Buffer is not in range of write
MOV WORD PTR [DI.BUFDRV],00FFH ; Free the buffer, it is being over written
invoke SCANPLACE
DONEXTBUFF:
invoke SKIPVISIT
JNZ NEXTBUFF
POP BX
POP DX
MOV DS,WORD PTR [DMAADD+2]
CALL DWRITE
POP CX
POP BX
PUSH SS
POP DS
ASSUME DS:DOSGROUP
JCXZ WRTLAST
MOV DL,0
INC [LASTPOS] ; We'll be using next cluster
JMP SHORT WRTLP
WRTERRJ: JMP WRTERR
WRTLAST:
MOV AX,[BYTCNT2]
OR AX,AX
JZ FINWRT
MOV [BYTCNT1],AX
invoke NEXTSEC
MOV [BYTSECPOS],0
invoke BUFWRT
FINWRT:
LES DI,[THISFCB]
MOV AX,WORD PTR [GROWCNT]
MOV CX,WORD PTR [GROWCNT+2]
OR AX,AX
JNZ UPDATE_size
OR CX,CX
JZ SAMSIZ
Update_size:
ADD WORD PTR ES:[DI.fcb_FILSIZ],AX
ADC WORD PTR ES:[DI.fcb_FILSIZ+2],CX
SAMSIZ:
MOV CX,[RECCNT]
JMP SETCLUS
WRTEOF:
MOV CX,AX
OR CX,DX
JZ KILLFIL
SUB AX,1
SBB DX,0
DIV ES:[BP.dpb_sector_size]
MOV CL,ES:[BP.dpb_cluster_shift]
SHR AX,CL
MOV CX,AX
invoke FNDCLUS
JCXZ RELFILE
invoke ALLOCATE
JC WRTERRJ
UPDATE:
LES DI,[THISFCB]
MOV AX,WORD PTR [BYTPOS]
MOV ES:WORD PTR [DI.fcb_FILSIZ],AX
MOV AX,WORD PTR [BYTPOS+2]
MOV ES:WORD PTR [DI.fcb_FILSIZ+2],AX
XOR CX,CX
JMP ADDREC
RELFILE:
MOV DX,0FFFH
invoke RELBLKS
JMP SHORT UPDATE
KILLFIL:
XOR BX,BX
PUSH ES
LES DI,[THISFCB]
MOV ES:[DI.fcb_CLUSPOS],BX
XCHG BX,ES:[DI.fcb_FIRCLUS]
AND ES:[DI.fcb_LSTCLUS],0F000H
POP ES
OR BX,BX
JZ UPDATE
invoke RELEASE
JMP SHORT UPDATE
DISKWRITE ENDP
do_ext
CODE ENDS
END
| 29.176516 | 113 | 0.479391 |
9a7abc27736a93ee9eb23bfbcea73e4ba3b350dd | 459 | asm | Assembly | Benchmarks/Ideal Pipeline Test.asm | Sara-HY/MIPS-CPU | 7702895aa389394ba9900e2d0b00fc10f051241e | [
"MIT"
] | null | null | null | Benchmarks/Ideal Pipeline Test.asm | Sara-HY/MIPS-CPU | 7702895aa389394ba9900e2d0b00fc10f051241e | [
"MIT"
] | null | null | null | Benchmarks/Ideal Pipeline Test.asm | Sara-HY/MIPS-CPU | 7702895aa389394ba9900e2d0b00fc10f051241e | [
"MIT"
] | null | null | null | #������ˮ�߲��ԣ�����ָ���������ԣ�һ��17��ָ�5����ˮ��ִ��������Ӧ����5+(17-1��=21
addi $s0,$zero, 0
addi $s1,$zero, 0
addi $s2,$zero, 0
addi $s3,$zero, 0
ori $s0,$s0, 0
ori $s1,$s1, 1
ori $s2,$s2, 2
ori $s3,$s3, 3
sw $s0, 0($s0)
sw $s1, 4($s0)
sw $s2, 8($s0)
sw $s3, 12($s0)
addi $v0,$zero,10 # system call for exit
addi $s1,$zero, 0 #���������
addi $s2,$zero, 0
addi $s3,$zero, 0
syscall # we are out of here.
sw $v0, 16($s0) | 24.157895 | 74 | 0.459695 |
9dbd05ad0b923bffd48e4accb66301125e0c2073 | 835 | asm | Assembly | oeis/132/A132894.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/132/A132894.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/132/A132894.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A132894: Number of (1,0) steps in all paths of length n with steps U=(1,1), D=(1,-1) and H=(1,0), starting at (0,0), staying weakly above the x-axis (i.e., in all length-n left factors of Motzkin paths).
; Submitted by Jon Maiga
; 0,1,4,15,52,175,576,1869,6000,19107,60460,190333,596652,1863745,5804176,18028755,55873872,172818243,533589660,1644921789,5063762220,15568666029,47811348816,146675181975,449538774048,1376564658525,4211870811876,12877425661779,39344347141540,120131281778527,366580520966400,1117993588666141,3407857358855104,10382686568637075,31618198945272012,96244351652059485,292842977377195548,890688064009302637,2708050360907451520,8230693880206361031,25007625708786684880,75957714343631787097
mov $2,18
mov $3,$0
lpb $3
mul $2,$3
add $1,$2
cmp $4,0
add $5,$4
div $2,$5
sub $3,1
lpe
mov $0,$1
div $0,18
| 49.117647 | 481 | 0.784431 |
fc88a504cffbe274921c5b786cb8edb0939221e8 | 6,198 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1183.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1183.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca.log_21829_1183.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_normal_ht+0x99ba, %r12
nop
nop
sub $28683, %r8
mov $0x6162636465666768, %rcx
movq %rcx, (%r12)
nop
nop
nop
xor $37908, %rdx
lea addresses_WC_ht+0x102da, %r12
nop
nop
nop
nop
nop
add $31972, %r11
movups (%r12), %xmm6
vpextrq $1, %xmm6, %r9
nop
nop
cmp %rdx, %rdx
lea addresses_WT_ht+0x10cba, %r12
nop
nop
xor %r15, %r15
mov (%r12), %r11w
nop
nop
nop
nop
inc %r15
lea addresses_normal_ht+0x3d58, %rsi
lea addresses_A_ht+0x19aa, %rdi
nop
inc %rdx
mov $4, %rcx
rep movsq
nop
cmp $1163, %r8
lea addresses_WC_ht+0x1a1aa, %r15
nop
nop
nop
inc %rcx
mov (%r15), %rdi
nop
nop
nop
nop
nop
and $11067, %rcx
lea addresses_WT_ht+0xacea, %rsi
lea addresses_WT_ht+0x82fa, %rdi
and $31041, %r11
mov $80, %rcx
rep movsq
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_A_ht+0x1d1aa, %rdi
nop
nop
nop
nop
add $45843, %r15
mov $0x6162636465666768, %rcx
movq %rcx, %xmm2
vmovups %ymm2, (%rdi)
dec %r9
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r8
push %r9
push %rax
push %rcx
push %rdi
// Store
lea addresses_D+0xddaa, %r9
nop
and $16971, %r14
mov $0x5152535455565758, %r8
movq %r8, %xmm0
vmovntdq %ymm0, (%r9)
nop
nop
nop
nop
inc %r14
// Store
lea addresses_normal+0x185aa, %rdi
sub $16244, %rcx
movw $0x5152, (%rdi)
nop
xor $45659, %rax
// Faulty Load
lea addresses_RW+0x5aa, %r8
nop
nop
nop
add %rcx, %rcx
mov (%r8), %di
lea oracles, %r8
and $0xff, %rdi
shlq $12, %rdi
mov (%r8,%rdi,1), %rdi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 32, 'NT': True, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': True, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 2, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 6, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
| 37.792683 | 2,999 | 0.658277 |
64ae8c55291331d19a519f5b7b9601cc9f3d108f | 412 | asm | Assembly | programs/oeis/216/A216871.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/216/A216871.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/216/A216871.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A216871: 16k^2-16k-4 interleaved with 16k^2+4 for k>=0.
; -4,4,-4,20,28,68,92,148,188,260,316,404,476,580,668,788,892,1028,1148,1300,1436,1604,1756,1940,2108,2308,2492,2708,2908,3140,3356,3604,3836,4100,4348,4628,4892,5188,5468,5780,6076,6404,6716,7060,7388,7748,8092
mov $1,9
mov $2,$0
mov $3,1
sub $3,$0
add $3,1
mul $2,$3
mov $4,$2
gcd $4,4
add $4,6
add $4,$2
sub $1,$4
sub $1,1
div $1,2
mul $1,8
add $1,4
| 21.684211 | 211 | 0.669903 |
d6dd52de48200ddfa2e501ed1b1f823941d56da9 | 708 | asm | Assembly | programs/oeis/313/A313537.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/313/A313537.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/313/A313537.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A313537: Coordination sequence Gal.5.66.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,5,10,14,19,23,27,32,36,41,46,51,56,60,65,69,73,78,82,87,92,97,102,106,111,115,119,124,128,133,138,143,148,152,157,161,165,170,174,179,184,189,194,198,203,207,211,216,220,225
mov $11,$0
mov $13,$0
add $13,1
lpb $13
clr $0,11
mov $0,$11
sub $13,1
sub $0,$13
mul $0,2
add $1,3
mul $0,$1
sub $1,$0
lpb $0
mov $0,$2
sub $0,6
div $1,2
add $0,$1
div $0,10
sub $2,$1
mod $2,10
mov $3,$1
mov $1,$2
gcd $3,2
add $3,2
lpe
mov $1,$3
add $1,1
add $12,$1
lpe
mov $1,$12
| 20.823529 | 177 | 0.594633 |
1601e51f9bfc78c8400ab342648eabb4931b6bd5 | 322 | asm | Assembly | programs/oeis/040/A040399.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/040/A040399.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/040/A040399.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A040399: Continued fraction for sqrt(420).
; 20,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40,2,40
mov $1,$0
cmp $0,0
sub $1,$0
gcd $1,2
add $1,8
add $0,$1
mul $0,$1
sub $0,80
mul $0,2
| 24.769231 | 189 | 0.599379 |
1ede80455649251c665a2b7cde953f68f3caeec7 | 644 | asm | Assembly | oeis/208/A208528.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/208/A208528.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/208/A208528.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A208528: Number of permutations of n>1 having exactly 3 points P on the boundary of their bounding square.
; 0,4,16,72,384,2400,17280,141120,1290240,13063680,145152000,1756339200,22992076800,323805081600,4881984307200,78460462080000,1339058552832000,24186745110528000,460970906812416000,9245027631071232000,194632160654131200000,4291639142423592960000,98912064044429475840000,2378385539977417850880000,59563046566390986178560000,1551121004333098598400000000,41942311957166986100736000000,1175997900645182033362944000000,34147494596511952376168448000000,1025644391273805426727059456000000
mov $1,$0
lpb $1
mul $0,$1
sub $1,1
lpe
mul $0,4
| 64.4 | 480 | 0.872671 |
5d3f17669cddf093212842a291e46cb7d583c41e | 765 | asm | Assembly | programs/oeis/070/A070388.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/070/A070388.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/070/A070388.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A070388: a(n) = 5^n mod 42.
; 1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41,37,17,1,5,25,41
mov $1,1
mov $2,$0
lpb $2,1
mul $1,5
mod $1,42
sub $2,1
lpe
| 69.545455 | 667 | 0.60915 |
a6bc5f2345bb3b3a0f44906eb0b1ffe6f4b8469d | 547 | asm | Assembly | oeis/017/A017350.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/017/A017350.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/017/A017350.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A017350: a(n) = (10*n + 6)^10.
; 60466176,1099511627776,141167095653376,3656158440062976,42420747482776576,303305489096114176,1568336880910795776,6428888932339941376,22130157888803070976,66483263599150104576,179084769654285362176,441143507864991563776,1008568618886953829376,2164656967840983678976,4400768849616443032576,8535834451185868210176,15888426175698793931776,28518499943362777317376,49559788255159621886976,83668255425284801560576,137617037244838084658176,221073919720733357899776,347603700728035650405376
mul $0,10
add $0,6
pow $0,10
| 78.142857 | 483 | 0.897623 |
4d89f8a2c0b9a0808f7c51085acc3dd6eeb61ea6 | 6,596 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_830.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_830.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_830.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 %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x1183e, %rsi
lea addresses_D_ht+0x493e, %rdi
add %r10, %r10
mov $58, %rcx
rep movsq
nop
nop
nop
nop
add $39987, %rbp
lea addresses_A_ht+0xa83e, %rsi
lea addresses_WC_ht+0x18a4, %rdi
nop
cmp %r12, %r12
mov $0, %rcx
rep movsb
nop
nop
cmp $59318, %rbp
lea addresses_WT_ht+0x9caa, %r10
nop
nop
nop
cmp %r14, %r14
mov (%r10), %di
nop
nop
nop
nop
xor %r14, %r14
lea addresses_WC_ht+0xbe3e, %rsi
lea addresses_D_ht+0x183e, %rdi
nop
nop
dec %r11
mov $13, %rcx
rep movsl
nop
nop
nop
nop
nop
and $28871, %rbp
lea addresses_D_ht+0xb83e, %r14
nop
nop
nop
nop
nop
dec %r10
mov $0x6162636465666768, %r12
movq %r12, %xmm4
and $0xffffffffffffffc0, %r14
movaps %xmm4, (%r14)
nop
nop
nop
xor %rdi, %rdi
lea addresses_WT_ht+0x1483e, %rsi
lea addresses_WT_ht+0xa96e, %rdi
nop
nop
nop
nop
xor %r11, %r11
mov $45, %rcx
rep movsq
nop
nop
nop
add %r10, %r10
lea addresses_D_ht+0x9dbe, %rbp
nop
nop
nop
nop
xor %r12, %r12
movw $0x6162, (%rbp)
nop
inc %rcx
lea addresses_WC_ht+0x962e, %rbp
nop
nop
cmp %rsi, %rsi
mov $0x6162636465666768, %r12
movq %r12, (%rbp)
nop
add %r11, %r11
lea addresses_WC_ht+0x10c3e, %rsi
lea addresses_WT_ht+0x1a94a, %rdi
nop
nop
add %r12, %r12
mov $115, %rcx
rep movsw
nop
and $12459, %rcx
lea addresses_normal_ht+0x1363e, %rsi
lea addresses_normal_ht+0x1b0b6, %rdi
nop
nop
nop
nop
sub $46910, %r10
mov $85, %rcx
rep movsl
nop
nop
nop
dec %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %rbp
push %rbx
push %rdx
// Faulty Load
lea addresses_D+0x383e, %rbx
nop
nop
nop
nop
and $47461, %r10
mov (%rbx), %r12
lea oracles, %rdx
and $0xff, %r12
shlq $12, %r12
mov (%rdx,%r12,1), %r12
pop %rdx
pop %rbx
pop %rbp
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0, 'same': False, 'type': 'addresses_D'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_D'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 9, 'same': True, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 8, 'same': True, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 37.05618 | 2,999 | 0.662523 |
b5fd727c13c4305ff3fa512f0358c2d236a2c8d8 | 6,517 | asm | Assembly | source/map.asm | evanbowman/Red | 85735269a46757305a81ad39f47034bc6cd97846 | [
"BSD-2-Clause"
] | 5 | 2021-08-30T16:18:55.000Z | 2021-10-30T20:23:32.000Z | source/map.asm | evanbowman/gbc-project | 85735269a46757305a81ad39f47034bc6cd97846 | [
"BSD-2-Clause"
] | null | null | null | source/map.asm | evanbowman/gbc-project | 85735269a46757305a81ad39f47034bc6cd97846 | [
"BSD-2-Clause"
] | null | null | null | ;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;;;
;;; ASM Source code for Red GBC, by Evan Bowman, 2021
;;;
;;;
;;; The following licence covers the source code included in this file. The
;;; game's characters and artwork belong to Evan Bowman, and should not be used
;;; without permission.
;;;
;;;
;;; Redistribution and use in source and binary forms, with or without
;;; modification, are permitted provided that the following conditions are met:
;;;
;;; 1. Redistributions of source code must retain the above copyright notice,
;;; this list of conditions and the following disclaimer.
;;;
;;; 2. Redistributions in binary form must reproduce the above copyright notice,
;;; this list of conditions and the following disclaimer in the documentation
;;; and/or other materials provided with the distribution.
;;;
;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
;;; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
;;; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
;;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
;;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
;;; SUBSTITUTE GOODS OR SERVICES LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
;;; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
;;; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
;;; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
;;; POSSIBILITY OF SUCH DAMAGE.
;;;
;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;;;
;;;
;;; Overworld Map
;;;
;;;
;;; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
;;; ----------------------------------------------------------------------------
IsTileLockedDoor:
cp COLLECTIBLE_TILE_DOOR
ret
;;; ----------------------------------------------------------------------------
IsTileCollectible:
;;; a - tile
cp COLLECTIBLE_TILE_POTATO
ret Z
cp COLLECTIBLE_TILE_STICK
ret Z
cp COLLECTIBLE_TILE_KEY
ret Z
cp COLLECTIBLE_TILE_HAMMER
ret Z
ret
;;; ----------------------------------------------------------------------------
;;; Copy map from wram to vram
MapShow:
ld c, 0
.loop:
;; All of the levels are typically loaded incrementally as the screen
;; scrolls, with the exception of the first room, which we need to
;; load all at once. But, we just build this on top of the incremental
;; loading code.
push bc
LONG_CALL r1_MapExpandRow
pop bc
fcall VBlankIntrWait ; r1_MapShowRow writes to vram.
push bc
LONG_CALL r1_MapShowRow
pop bc
inc c
ld a, c
cp 32
jr NZ, .loop
ret
;;; ----------------------------------------------------------------------------
MapGetTile:
;;; hl - map
;;; a - x
;;; b - y
;;; return value in b
;;; trashes hl, c
swap b ; map is 16 wide
add b
ld c, a
ld b, 0
add hl, bc
ld b, [hl]
ret
;;; ----------------------------------------------------------------------------
MapSetTile:
;;; hl - map
;;; a - x
;;; b - y
;;; d - tile
;;; trashes hl, c, a, b
swap b
add b
ld c, a
ld b, 0
add hl, bc
ld [hl], d
ret
;;; ----------------------------------------------------------------------------
;;; May only be called from rom0, due to all of the bank swapping.
GetRoomData__rom0_only:
;;; b - room x
;;; c - room y
;;; return hl - pointer to room's tilemap
RAM_BANK 1
LONG_CALL r1_LoadRoom
ld a, [hl+] ; \ Load adjacency mask from room data
and $0f ; /
ld b, [hl] ; Load room variant
ld e, a
ld d, 0
ld hl, .roomDataBankTab ; \
add hl, de ; | Set bank where we'll look for the
ld a, [hl] ; | map data.
SET_BANK_FROM_A ; /
sla e ; Two bytes per pointer in roomdata lut
ld hl, .roomDataLookupTab ; \ Load pointer to room data array
add hl, de ; /
ld e, [hl]
inc hl
ld d, [hl]
ld h, d
ld l, e
ld c, 0 ; Jump to variant in room table
; b is the higher byte, so implicit x256
add hl, bc
ret
.roomDataLookupTab::
DW r10_room_data_durl ; index 0 == no connections, so doesn't matter what we use.
DW r10_room_data_d
DW r10_room_data_u
DW r10_room_data_du
DW r10_room_data_r
DW r10_room_data_dr
DW r10_room_data_ur
DW r10_room_data_dur
DW r10_room_data_l
DW r10_room_data_dl
DW r10_room_data_ul
DW r10_room_data_dul
DW r10_room_data_rl
DW r10_room_data_drl
DW r10_room_data_url
DW r10_room_data_durl
.roomDataLookupTabEnd::
.roomDataBankTab::
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
DB 10
.roomDataBankTabEnd::
;;; ----------------------------------------------------------------------------
;;; Does a bunch of bank swapping, may only be called from rom0.
MapLoad2__rom0_only:
ld a, [var_room_x]
ld b, a
ld a, [var_room_y]
ld c, a
fcall GetRoomData__rom0_only
.copy:
ld bc, ROOM_DATA_SIZE
ld de, var_map_info
fcall Memcpy
;; Now, the room data is sitting in RAM. We can safely call back into
;; bank 1 to do whatever other loading or level generation that we want
;; to do.
LONG_CALL r1_InitializeRoom
ret
;;; ----------------------------------------------------------------------------
| 27.154167 | 91 | 0.479055 |
ef974d3188eaf60bd6eed621dbb224d52bb6c75b | 736 | asm | Assembly | smsq/q68/sbas/procs_prot.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | smsq/q68/sbas/procs_prot.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | smsq/q68/sbas/procs_prot.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ; SBAS_PROCS_PROT - SBASIC Prot/Slug bits V2.00 1994 Tony Tebby
; use q68_slug address for slugging V2.01 2017 W. Lenerz
section exten
xdef prot_date
xdef prot_mem
xdef slug
xref ut_gxin1
include 'dev8_keys_qdos_sms'
include 'dev8_keys_sys'
include 'dev8_keys_q68'
;+++
; SLUG n
;---
slug
jsr ut_gxin1 ; one param only
bne.s prot_rts
move.b 1(a6,a1.l),q68_slug ; (slug 0 to 255 only)
clr.l d0
rts
;+++
; PROT_DATE 0 or 1
;---
prot_date
lea sys_prtc,a0
bra.s prot
;+++
; PROT_MEM 0 to 7
;---
prot_mem
lea sys_pmem,a0
prot
jsr ut_gxin1 ; one param only
bne.s prot_rts
move.w (a6,a1.l),d1
moveq #sms.xtop,d0 ; system extop
trap #do.smsq
move.b d1,(a6,a0.l)
moveq #0,d0
prot_rts
rts
end
| 15.020408 | 69 | 0.67663 |
62b29912a608aece7656ffe419fb6eee68cfc034 | 1,220 | asm | Assembly | programs/oeis/008/A008596.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/008/A008596.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/008/A008596.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A008596: Multiples of 14.
; 0,14,28,42,56,70,84,98,112,126,140,154,168,182,196,210,224,238,252,266,280,294,308,322,336,350,364,378,392,406,420,434,448,462,476,490,504,518,532,546,560,574,588,602,616,630,644,658,672,686,700,714,728,742,756,770,784,798,812,826,840,854,868,882,896,910,924,938,952,966,980,994,1008,1022,1036,1050,1064,1078,1092,1106,1120,1134,1148,1162,1176,1190,1204,1218,1232,1246,1260,1274,1288,1302,1316,1330,1344,1358,1372,1386,1400,1414,1428,1442,1456,1470,1484,1498,1512,1526,1540,1554,1568,1582,1596,1610,1624,1638,1652,1666,1680,1694,1708,1722,1736,1750,1764,1778,1792,1806,1820,1834,1848,1862,1876,1890,1904,1918,1932,1946,1960,1974,1988,2002,2016,2030,2044,2058,2072,2086,2100,2114,2128,2142,2156,2170,2184,2198,2212,2226,2240,2254,2268,2282,2296,2310,2324,2338,2352,2366,2380,2394,2408,2422,2436,2450,2464,2478,2492,2506,2520,2534,2548,2562,2576,2590,2604,2618,2632,2646,2660,2674,2688,2702,2716,2730,2744,2758,2772,2786,2800,2814,2828,2842,2856,2870,2884,2898,2912,2926,2940,2954,2968,2982,2996,3010,3024,3038,3052,3066,3080,3094,3108,3122,3136,3150,3164,3178,3192,3206,3220,3234,3248,3262,3276,3290,3304,3318,3332,3346,3360,3374,3388,3402,3416,3430,3444,3458,3472,3486
mov $1,$0
mul $1,14
| 203.333333 | 1,170 | 0.778689 |
21721c532ab2b7cb2644949b12057cf032132c97 | 7,837 | asm | Assembly | packages/external/libmpg123-1.22.x/src/asm_nasm/synth_stereo_sse_float.asm | sezero/SDL2-OS2 | 795968f1bae0ecf4a3bfa9ea376a184a1ee7f220 | [
"Zlib"
] | 2 | 2020-10-14T21:07:10.000Z | 2021-03-06T12:40:08.000Z | packages/external/libmpg123-1.22.x/src/asm_nasm/synth_stereo_sse_float.asm | sezero/SDL2-OS2 | 795968f1bae0ecf4a3bfa9ea376a184a1ee7f220 | [
"Zlib"
] | null | null | null | packages/external/libmpg123-1.22.x/src/asm_nasm/synth_stereo_sse_float.asm | sezero/SDL2-OS2 | 795968f1bae0ecf4a3bfa9ea376a184a1ee7f220 | [
"Zlib"
] | null | null | null | ; 1 "synth_stereo_sse_float.S"
; 1 "<built-in>"
; 1 "<command line>"
; 1 "synth_stereo_sse_float.S"
; 9 "synth_stereo_sse_float.S"
; 1 "mangle.h" 1
; 13 "mangle.h"
; 1 "config.h" 1
; 14 "mangle.h" 2
; 1 "intsym.h" 1
; 15 "mangle.h" 2
; 10 "synth_stereo_sse_float.S" 2
; 30 "synth_stereo_sse_float.S"
%include "asm_nasm.inc"
_sym_mangle synth_1to1_real_s_sse_asm
SECTION .data
align 32
scale_sse:
dd 939524096
dd 939524096
dd 939524096
dd 939524096
SECTION .text
align 16
GLOBAL synth_1to1_real_s_sse_asm
synth_1to1_real_s_sse_asm:
push dword ebp
mov dword ebp, esp
and dword esp, -16
sub dword esp, 128
push dword ebx
push dword esi
push dword edi
mov dword ebx, [ebp+8]
mov dword edx, [ebp+12]
mov dword esi, [ebp+16]
mov dword edi, [ebp+20]
mov dword eax, [ebp+24]
shl dword eax, 2
lea dword ebx, [ebx+64]
sub dword ebx, eax
mov dword ecx, 4
align 16
Loop_start_1:
movups xmm0, [ebx]
movups xmm1, [ebx+16]
movups xmm2, [ebx+32]
movups xmm3, [ebx+48]
movaps xmm4, xmm0
movaps xmm5, xmm1
movaps xmm6, xmm2
movaps xmm7, xmm3
mulps xmm0, [edx+0]
mulps xmm1, [edx+16]
mulps xmm2, [edx+32]
mulps xmm3, [edx+48]
mulps xmm4, [esi+0]
mulps xmm5, [esi+16]
mulps xmm6, [esi+32]
mulps xmm7, [esi+48]
addps xmm0, xmm1
addps xmm2, xmm3
addps xmm4, xmm5
addps xmm6, xmm7
addps xmm0, xmm2
addps xmm4, xmm6
movaps [esp+(12+16*0)], xmm0
movaps [esp+(12+16*4)], xmm4
lea dword ebx, [ebx+128]
lea dword edx, [edx+64]
lea dword esi, [esi+64]
movups xmm0, [ebx]
movups xmm1, [ebx+16]
movups xmm2, [ebx+32]
movups xmm3, [ebx+48]
movaps xmm4, xmm0
movaps xmm5, xmm1
movaps xmm6, xmm2
movaps xmm7, xmm3
mulps xmm0, [edx+0]
mulps xmm1, [edx+16]
mulps xmm2, [edx+32]
mulps xmm3, [edx+48]
mulps xmm4, [esi+0]
mulps xmm5, [esi+16]
mulps xmm6, [esi+32]
mulps xmm7, [esi+48]
addps xmm0, xmm1
addps xmm2, xmm3
addps xmm4, xmm5
addps xmm6, xmm7
addps xmm0, xmm2
addps xmm4, xmm6
movaps [esp+(12+16*1)], xmm0
movaps [esp+(12+16*5)], xmm4
lea dword ebx, [ebx+128]
lea dword edx, [edx+64]
lea dword esi, [esi+64]
movups xmm0, [ebx]
movups xmm1, [ebx+16]
movups xmm2, [ebx+32]
movups xmm3, [ebx+48]
movaps xmm4, xmm0
movaps xmm5, xmm1
movaps xmm6, xmm2
movaps xmm7, xmm3
mulps xmm0, [edx+0]
mulps xmm1, [edx+16]
mulps xmm2, [edx+32]
mulps xmm3, [edx+48]
mulps xmm4, [esi+0]
mulps xmm5, [esi+16]
mulps xmm6, [esi+32]
mulps xmm7, [esi+48]
addps xmm0, xmm1
addps xmm2, xmm3
addps xmm4, xmm5
addps xmm6, xmm7
addps xmm0, xmm2
addps xmm4, xmm6
movaps [esp+(12+16*2)], xmm0
movaps [esp+(12+16*6)], xmm4
lea dword ebx, [ebx+128]
lea dword edx, [edx+64]
lea dword esi, [esi+64]
movups xmm0, [ebx]
movups xmm1, [ebx+16]
movups xmm2, [ebx+32]
movups xmm3, [ebx+48]
movaps xmm4, xmm0
movaps xmm5, xmm1
movaps xmm6, xmm2
movaps xmm7, xmm3
mulps xmm0, [edx+0]
mulps xmm1, [edx+16]
mulps xmm2, [edx+32]
mulps xmm3, [edx+48]
mulps xmm4, [esi+0]
mulps xmm5, [esi+16]
mulps xmm6, [esi+32]
mulps xmm7, [esi+48]
addps xmm0, xmm1
addps xmm2, xmm3
addps xmm4, xmm5
addps xmm6, xmm7
addps xmm0, xmm2
addps xmm4, xmm6
movaps xmm7, xmm0
movaps [esp+(12+16*7)], xmm4
lea dword ebx, [ebx+128]
lea dword edx, [edx+64]
lea dword esi, [esi+64]
movaps xmm4, [esp+(12+16*0)]
movaps xmm5, [esp+(12+16*1)]
movaps xmm6, [esp+(12+16*2)]
movaps xmm0, xmm4
movaps xmm1, xmm6
unpcklps xmm4, xmm5
unpcklps xmm6, xmm7
unpckhps xmm0, xmm5
unpckhps xmm1, xmm7
movaps xmm2, xmm4
movaps xmm3, xmm0
movlhps xmm4, xmm6
movhlps xmm6, xmm2
movlhps xmm0, xmm1
movhlps xmm1, xmm3
subps xmm4, xmm6
subps xmm0, xmm1
addps xmm0, xmm4
movaps xmm2, xmm0
movaps xmm4, [esp+(12+16*4)]
movaps xmm5, [esp+(12+16*5)]
movaps xmm6, [esp+(12+16*6)]
movaps xmm7, [esp+(12+16*7)]
movaps xmm0, xmm4
movaps xmm1, xmm6
unpcklps xmm4, xmm5
unpcklps xmm6, xmm7
unpckhps xmm0, xmm5
unpckhps xmm1, xmm7
movaps xmm5, xmm2
movaps xmm2, xmm4
movaps xmm3, xmm0
movlhps xmm4, xmm6
movhlps xmm6, xmm2
movlhps xmm0, xmm1
movhlps xmm1, xmm3
subps xmm4, xmm6
subps xmm0, xmm1
addps xmm0, xmm4
mulps xmm5, [scale_sse]
mulps xmm0, [scale_sse]
movaps xmm1, xmm5
unpcklps xmm5, xmm0
unpckhps xmm1, xmm0
movups [edi], xmm5
movups [edi+16], xmm1
lea dword edi, [edi+32]
dec dword ecx
jnz Loop_start_1
mov dword ecx, 4
align 16
Loop_start_2:
movups xmm0, [ebx]
movups xmm1, [ebx+16]
movups xmm2, [ebx+32]
movups xmm3, [ebx+48]
movaps xmm4, xmm0
movaps xmm5, xmm1
movaps xmm6, xmm2
movaps xmm7, xmm3
mulps xmm0, [edx+0]
mulps xmm1, [edx+16]
mulps xmm2, [edx+32]
mulps xmm3, [edx+48]
mulps xmm4, [esi+0]
mulps xmm5, [esi+16]
mulps xmm6, [esi+32]
mulps xmm7, [esi+48]
addps xmm0, xmm1
addps xmm2, xmm3
addps xmm4, xmm5
addps xmm6, xmm7
addps xmm0, xmm2
addps xmm4, xmm6
movaps [esp+(12+16*0)], xmm0
movaps [esp+(12+16*4)], xmm4
lea dword ebx, [ebx+128]
lea dword edx, [edx+-64]
lea dword esi, [esi+-64]
movups xmm0, [ebx]
movups xmm1, [ebx+16]
movups xmm2, [ebx+32]
movups xmm3, [ebx+48]
movaps xmm4, xmm0
movaps xmm5, xmm1
movaps xmm6, xmm2
movaps xmm7, xmm3
mulps xmm0, [edx+0]
mulps xmm1, [edx+16]
mulps xmm2, [edx+32]
mulps xmm3, [edx+48]
mulps xmm4, [esi+0]
mulps xmm5, [esi+16]
mulps xmm6, [esi+32]
mulps xmm7, [esi+48]
addps xmm0, xmm1
addps xmm2, xmm3
addps xmm4, xmm5
addps xmm6, xmm7
addps xmm0, xmm2
addps xmm4, xmm6
movaps [esp+(12+16*1)], xmm0
movaps [esp+(12+16*5)], xmm4
lea dword ebx, [ebx+128]
lea dword edx, [edx+-64]
lea dword esi, [esi+-64]
movups xmm0, [ebx]
movups xmm1, [ebx+16]
movups xmm2, [ebx+32]
movups xmm3, [ebx+48]
movaps xmm4, xmm0
movaps xmm5, xmm1
movaps xmm6, xmm2
movaps xmm7, xmm3
mulps xmm0, [edx+0]
mulps xmm1, [edx+16]
mulps xmm2, [edx+32]
mulps xmm3, [edx+48]
mulps xmm4, [esi+0]
mulps xmm5, [esi+16]
mulps xmm6, [esi+32]
mulps xmm7, [esi+48]
addps xmm0, xmm1
addps xmm2, xmm3
addps xmm4, xmm5
addps xmm6, xmm7
addps xmm0, xmm2
addps xmm4, xmm6
movaps [esp+(12+16*2)], xmm0
movaps [esp+(12+16*6)], xmm4
lea dword ebx, [ebx+128]
lea dword edx, [edx+-64]
lea dword esi, [esi+-64]
movups xmm0, [ebx]
movups xmm1, [ebx+16]
movups xmm2, [ebx+32]
movups xmm3, [ebx+48]
movaps xmm4, xmm0
movaps xmm5, xmm1
movaps xmm6, xmm2
movaps xmm7, xmm3
mulps xmm0, [edx+0]
mulps xmm1, [edx+16]
mulps xmm2, [edx+32]
mulps xmm3, [edx+48]
mulps xmm4, [esi+0]
mulps xmm5, [esi+16]
mulps xmm6, [esi+32]
mulps xmm7, [esi+48]
addps xmm0, xmm1
addps xmm2, xmm3
addps xmm4, xmm5
addps xmm6, xmm7
addps xmm0, xmm2
addps xmm4, xmm6
movaps xmm7, xmm0
movaps [esp+(12+16*7)], xmm4
lea dword ebx, [ebx+128]
lea dword edx, [edx+-64]
lea dword esi, [esi+-64]
movaps xmm4, [esp+(12+16*0)]
movaps xmm5, [esp+(12+16*1)]
movaps xmm6, [esp+(12+16*2)]
movaps xmm0, xmm4
movaps xmm1, xmm6
unpcklps xmm4, xmm5
unpcklps xmm6, xmm7
unpckhps xmm0, xmm5
unpckhps xmm1, xmm7
movaps xmm2, xmm4
movaps xmm3, xmm0
movlhps xmm4, xmm6
movhlps xmm6, xmm2
movlhps xmm0, xmm1
movhlps xmm1, xmm3
addps xmm4, xmm6
addps xmm0, xmm1
addps xmm0, xmm4
movaps xmm2, xmm0
movaps xmm4, [esp+(12+16*4)]
movaps xmm5, [esp+(12+16*5)]
movaps xmm6, [esp+(12+16*6)]
movaps xmm7, [esp+(12+16*7)]
movaps xmm0, xmm4
movaps xmm1, xmm6
unpcklps xmm4, xmm5
unpcklps xmm6, xmm7
unpckhps xmm0, xmm5
unpckhps xmm1, xmm7
movaps xmm5, xmm2
movaps xmm2, xmm4
movaps xmm3, xmm0
movlhps xmm4, xmm6
movhlps xmm6, xmm2
movlhps xmm0, xmm1
movhlps xmm1, xmm3
addps xmm4, xmm6
addps xmm0, xmm1
addps xmm0, xmm4
mulps xmm5, [scale_sse]
mulps xmm0, [scale_sse]
movaps xmm1, xmm5
unpcklps xmm5, xmm0
unpckhps xmm1, xmm0
movups [edi], xmm5
movups [edi+16], xmm1
lea dword edi, [edi+32]
dec dword ecx
jnz Loop_start_2
xor dword eax, eax
pop dword edi
pop dword esi
pop dword ebx
mov dword esp, ebp
pop dword ebp
ret
| 19.255528 | 37 | 0.678959 |
da98003fcc96b16c073b6a675cbb00545dbada1e | 39,848 | asm | Assembly | zombie.asm | gangwareGremlins/PA3 | 2d9b6103a93a2633e0328f9ba30347b01a37cde3 | [
"MIT-0"
] | null | null | null | zombie.asm | gangwareGremlins/PA3 | 2d9b6103a93a2633e0328f9ba30347b01a37cde3 | [
"MIT-0"
] | null | null | null | zombie.asm | gangwareGremlins/PA3 | 2d9b6103a93a2633e0328f9ba30347b01a37cde3 | [
"MIT-0"
] | null | null | null |
_zombie: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(void)
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 51 push %ecx
e: 83 ec 04 sub $0x4,%esp
if(fork() > 0)
11: e8 4c 02 00 00 call 262 <fork>
16: 85 c0 test %eax,%eax
18: 7e 0d jle 27 <main+0x27>
sleep(5); // Let child exit before parent.
1a: 83 ec 0c sub $0xc,%esp
1d: 6a 05 push $0x5
1f: e8 d6 02 00 00 call 2fa <sleep>
24: 83 c4 10 add $0x10,%esp
exit();
27: e8 3e 02 00 00 call 26a <exit>
0000002c <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
2c: 55 push %ebp
2d: 89 e5 mov %esp,%ebp
2f: 57 push %edi
30: 53 push %ebx
asm volatile("cld; rep stosb" :
31: 8b 4d 08 mov 0x8(%ebp),%ecx
34: 8b 55 10 mov 0x10(%ebp),%edx
37: 8b 45 0c mov 0xc(%ebp),%eax
3a: 89 cb mov %ecx,%ebx
3c: 89 df mov %ebx,%edi
3e: 89 d1 mov %edx,%ecx
40: fc cld
41: f3 aa rep stos %al,%es:(%edi)
43: 89 ca mov %ecx,%edx
45: 89 fb mov %edi,%ebx
47: 89 5d 08 mov %ebx,0x8(%ebp)
4a: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
4d: 5b pop %ebx
4e: 5f pop %edi
4f: 5d pop %ebp
50: c3 ret
00000051 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
51: 55 push %ebp
52: 89 e5 mov %esp,%ebp
54: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
57: 8b 45 08 mov 0x8(%ebp),%eax
5a: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
5d: 90 nop
5e: 8b 45 08 mov 0x8(%ebp),%eax
61: 8d 50 01 lea 0x1(%eax),%edx
64: 89 55 08 mov %edx,0x8(%ebp)
67: 8b 55 0c mov 0xc(%ebp),%edx
6a: 8d 4a 01 lea 0x1(%edx),%ecx
6d: 89 4d 0c mov %ecx,0xc(%ebp)
70: 8a 12 mov (%edx),%dl
72: 88 10 mov %dl,(%eax)
74: 8a 00 mov (%eax),%al
76: 84 c0 test %al,%al
78: 75 e4 jne 5e <strcpy+0xd>
;
return os;
7a: 8b 45 fc mov -0x4(%ebp),%eax
}
7d: c9 leave
7e: c3 ret
0000007f <strcmp>:
int
strcmp(const char *p, const char *q)
{
7f: 55 push %ebp
80: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
82: eb 06 jmp 8a <strcmp+0xb>
p++, q++;
84: ff 45 08 incl 0x8(%ebp)
87: ff 45 0c incl 0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
8a: 8b 45 08 mov 0x8(%ebp),%eax
8d: 8a 00 mov (%eax),%al
8f: 84 c0 test %al,%al
91: 74 0e je a1 <strcmp+0x22>
93: 8b 45 08 mov 0x8(%ebp),%eax
96: 8a 10 mov (%eax),%dl
98: 8b 45 0c mov 0xc(%ebp),%eax
9b: 8a 00 mov (%eax),%al
9d: 38 c2 cmp %al,%dl
9f: 74 e3 je 84 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
a1: 8b 45 08 mov 0x8(%ebp),%eax
a4: 8a 00 mov (%eax),%al
a6: 0f b6 d0 movzbl %al,%edx
a9: 8b 45 0c mov 0xc(%ebp),%eax
ac: 8a 00 mov (%eax),%al
ae: 0f b6 c0 movzbl %al,%eax
b1: 29 c2 sub %eax,%edx
b3: 89 d0 mov %edx,%eax
}
b5: 5d pop %ebp
b6: c3 ret
000000b7 <strlen>:
uint
strlen(char *s)
{
b7: 55 push %ebp
b8: 89 e5 mov %esp,%ebp
ba: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
bd: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
c4: eb 03 jmp c9 <strlen+0x12>
c6: ff 45 fc incl -0x4(%ebp)
c9: 8b 55 fc mov -0x4(%ebp),%edx
cc: 8b 45 08 mov 0x8(%ebp),%eax
cf: 01 d0 add %edx,%eax
d1: 8a 00 mov (%eax),%al
d3: 84 c0 test %al,%al
d5: 75 ef jne c6 <strlen+0xf>
;
return n;
d7: 8b 45 fc mov -0x4(%ebp),%eax
}
da: c9 leave
db: c3 ret
000000dc <memset>:
void*
memset(void *dst, int c, uint n)
{
dc: 55 push %ebp
dd: 89 e5 mov %esp,%ebp
stosb(dst, c, n);
df: 8b 45 10 mov 0x10(%ebp),%eax
e2: 50 push %eax
e3: ff 75 0c pushl 0xc(%ebp)
e6: ff 75 08 pushl 0x8(%ebp)
e9: e8 3e ff ff ff call 2c <stosb>
ee: 83 c4 0c add $0xc,%esp
return dst;
f1: 8b 45 08 mov 0x8(%ebp),%eax
}
f4: c9 leave
f5: c3 ret
000000f6 <strchr>:
char*
strchr(const char *s, char c)
{
f6: 55 push %ebp
f7: 89 e5 mov %esp,%ebp
f9: 83 ec 04 sub $0x4,%esp
fc: 8b 45 0c mov 0xc(%ebp),%eax
ff: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
102: eb 12 jmp 116 <strchr+0x20>
if(*s == c)
104: 8b 45 08 mov 0x8(%ebp),%eax
107: 8a 00 mov (%eax),%al
109: 3a 45 fc cmp -0x4(%ebp),%al
10c: 75 05 jne 113 <strchr+0x1d>
return (char*)s;
10e: 8b 45 08 mov 0x8(%ebp),%eax
111: eb 11 jmp 124 <strchr+0x2e>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
113: ff 45 08 incl 0x8(%ebp)
116: 8b 45 08 mov 0x8(%ebp),%eax
119: 8a 00 mov (%eax),%al
11b: 84 c0 test %al,%al
11d: 75 e5 jne 104 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
11f: b8 00 00 00 00 mov $0x0,%eax
}
124: c9 leave
125: c3 ret
00000126 <gets>:
char*
gets(char *buf, int max)
{
126: 55 push %ebp
127: 89 e5 mov %esp,%ebp
129: 83 ec 18 sub $0x18,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
12c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
133: eb 41 jmp 176 <gets+0x50>
cc = read(0, &c, 1);
135: 83 ec 04 sub $0x4,%esp
138: 6a 01 push $0x1
13a: 8d 45 ef lea -0x11(%ebp),%eax
13d: 50 push %eax
13e: 6a 00 push $0x0
140: e8 3d 01 00 00 call 282 <read>
145: 83 c4 10 add $0x10,%esp
148: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
14b: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
14f: 7f 02 jg 153 <gets+0x2d>
break;
151: eb 2c jmp 17f <gets+0x59>
buf[i++] = c;
153: 8b 45 f4 mov -0xc(%ebp),%eax
156: 8d 50 01 lea 0x1(%eax),%edx
159: 89 55 f4 mov %edx,-0xc(%ebp)
15c: 89 c2 mov %eax,%edx
15e: 8b 45 08 mov 0x8(%ebp),%eax
161: 01 c2 add %eax,%edx
163: 8a 45 ef mov -0x11(%ebp),%al
166: 88 02 mov %al,(%edx)
if(c == '\n' || c == '\r')
168: 8a 45 ef mov -0x11(%ebp),%al
16b: 3c 0a cmp $0xa,%al
16d: 74 10 je 17f <gets+0x59>
16f: 8a 45 ef mov -0x11(%ebp),%al
172: 3c 0d cmp $0xd,%al
174: 74 09 je 17f <gets+0x59>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
176: 8b 45 f4 mov -0xc(%ebp),%eax
179: 40 inc %eax
17a: 3b 45 0c cmp 0xc(%ebp),%eax
17d: 7c b6 jl 135 <gets+0xf>
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
17f: 8b 55 f4 mov -0xc(%ebp),%edx
182: 8b 45 08 mov 0x8(%ebp),%eax
185: 01 d0 add %edx,%eax
187: c6 00 00 movb $0x0,(%eax)
return buf;
18a: 8b 45 08 mov 0x8(%ebp),%eax
}
18d: c9 leave
18e: c3 ret
0000018f <stat>:
int
stat(char *n, struct stat *st)
{
18f: 55 push %ebp
190: 89 e5 mov %esp,%ebp
192: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
195: 83 ec 08 sub $0x8,%esp
198: 6a 00 push $0x0
19a: ff 75 08 pushl 0x8(%ebp)
19d: e8 08 01 00 00 call 2aa <open>
1a2: 83 c4 10 add $0x10,%esp
1a5: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
1a8: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
1ac: 79 07 jns 1b5 <stat+0x26>
return -1;
1ae: b8 ff ff ff ff mov $0xffffffff,%eax
1b3: eb 25 jmp 1da <stat+0x4b>
r = fstat(fd, st);
1b5: 83 ec 08 sub $0x8,%esp
1b8: ff 75 0c pushl 0xc(%ebp)
1bb: ff 75 f4 pushl -0xc(%ebp)
1be: e8 ff 00 00 00 call 2c2 <fstat>
1c3: 83 c4 10 add $0x10,%esp
1c6: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
1c9: 83 ec 0c sub $0xc,%esp
1cc: ff 75 f4 pushl -0xc(%ebp)
1cf: e8 be 00 00 00 call 292 <close>
1d4: 83 c4 10 add $0x10,%esp
return r;
1d7: 8b 45 f0 mov -0x10(%ebp),%eax
}
1da: c9 leave
1db: c3 ret
000001dc <atoi>:
int
atoi(const char *s)
{
1dc: 55 push %ebp
1dd: 89 e5 mov %esp,%ebp
1df: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
1e2: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
1e9: eb 24 jmp 20f <atoi+0x33>
n = n*10 + *s++ - '0';
1eb: 8b 55 fc mov -0x4(%ebp),%edx
1ee: 89 d0 mov %edx,%eax
1f0: c1 e0 02 shl $0x2,%eax
1f3: 01 d0 add %edx,%eax
1f5: 01 c0 add %eax,%eax
1f7: 89 c1 mov %eax,%ecx
1f9: 8b 45 08 mov 0x8(%ebp),%eax
1fc: 8d 50 01 lea 0x1(%eax),%edx
1ff: 89 55 08 mov %edx,0x8(%ebp)
202: 8a 00 mov (%eax),%al
204: 0f be c0 movsbl %al,%eax
207: 01 c8 add %ecx,%eax
209: 83 e8 30 sub $0x30,%eax
20c: 89 45 fc mov %eax,-0x4(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
20f: 8b 45 08 mov 0x8(%ebp),%eax
212: 8a 00 mov (%eax),%al
214: 3c 2f cmp $0x2f,%al
216: 7e 09 jle 221 <atoi+0x45>
218: 8b 45 08 mov 0x8(%ebp),%eax
21b: 8a 00 mov (%eax),%al
21d: 3c 39 cmp $0x39,%al
21f: 7e ca jle 1eb <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
221: 8b 45 fc mov -0x4(%ebp),%eax
}
224: c9 leave
225: c3 ret
00000226 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
226: 55 push %ebp
227: 89 e5 mov %esp,%ebp
229: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
22c: 8b 45 08 mov 0x8(%ebp),%eax
22f: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
232: 8b 45 0c mov 0xc(%ebp),%eax
235: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
238: eb 16 jmp 250 <memmove+0x2a>
*dst++ = *src++;
23a: 8b 45 fc mov -0x4(%ebp),%eax
23d: 8d 50 01 lea 0x1(%eax),%edx
240: 89 55 fc mov %edx,-0x4(%ebp)
243: 8b 55 f8 mov -0x8(%ebp),%edx
246: 8d 4a 01 lea 0x1(%edx),%ecx
249: 89 4d f8 mov %ecx,-0x8(%ebp)
24c: 8a 12 mov (%edx),%dl
24e: 88 10 mov %dl,(%eax)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
250: 8b 45 10 mov 0x10(%ebp),%eax
253: 8d 50 ff lea -0x1(%eax),%edx
256: 89 55 10 mov %edx,0x10(%ebp)
259: 85 c0 test %eax,%eax
25b: 7f dd jg 23a <memmove+0x14>
*dst++ = *src++;
return vdst;
25d: 8b 45 08 mov 0x8(%ebp),%eax
}
260: c9 leave
261: c3 ret
00000262 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
262: b8 01 00 00 00 mov $0x1,%eax
267: cd 40 int $0x40
269: c3 ret
0000026a <exit>:
SYSCALL(exit)
26a: b8 02 00 00 00 mov $0x2,%eax
26f: cd 40 int $0x40
271: c3 ret
00000272 <wait>:
SYSCALL(wait)
272: b8 03 00 00 00 mov $0x3,%eax
277: cd 40 int $0x40
279: c3 ret
0000027a <pipe>:
SYSCALL(pipe)
27a: b8 04 00 00 00 mov $0x4,%eax
27f: cd 40 int $0x40
281: c3 ret
00000282 <read>:
SYSCALL(read)
282: b8 05 00 00 00 mov $0x5,%eax
287: cd 40 int $0x40
289: c3 ret
0000028a <write>:
SYSCALL(write)
28a: b8 10 00 00 00 mov $0x10,%eax
28f: cd 40 int $0x40
291: c3 ret
00000292 <close>:
SYSCALL(close)
292: b8 15 00 00 00 mov $0x15,%eax
297: cd 40 int $0x40
299: c3 ret
0000029a <kill>:
SYSCALL(kill)
29a: b8 06 00 00 00 mov $0x6,%eax
29f: cd 40 int $0x40
2a1: c3 ret
000002a2 <exec>:
SYSCALL(exec)
2a2: b8 07 00 00 00 mov $0x7,%eax
2a7: cd 40 int $0x40
2a9: c3 ret
000002aa <open>:
SYSCALL(open)
2aa: b8 0f 00 00 00 mov $0xf,%eax
2af: cd 40 int $0x40
2b1: c3 ret
000002b2 <mknod>:
SYSCALL(mknod)
2b2: b8 11 00 00 00 mov $0x11,%eax
2b7: cd 40 int $0x40
2b9: c3 ret
000002ba <unlink>:
SYSCALL(unlink)
2ba: b8 12 00 00 00 mov $0x12,%eax
2bf: cd 40 int $0x40
2c1: c3 ret
000002c2 <fstat>:
SYSCALL(fstat)
2c2: b8 08 00 00 00 mov $0x8,%eax
2c7: cd 40 int $0x40
2c9: c3 ret
000002ca <link>:
SYSCALL(link)
2ca: b8 13 00 00 00 mov $0x13,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <mkdir>:
SYSCALL(mkdir)
2d2: b8 14 00 00 00 mov $0x14,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <chdir>:
SYSCALL(chdir)
2da: b8 09 00 00 00 mov $0x9,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <dup>:
SYSCALL(dup)
2e2: b8 0a 00 00 00 mov $0xa,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <getpid>:
SYSCALL(getpid)
2ea: b8 0b 00 00 00 mov $0xb,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <sbrk>:
SYSCALL(sbrk)
2f2: b8 0c 00 00 00 mov $0xc,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <sleep>:
SYSCALL(sleep)
2fa: b8 0d 00 00 00 mov $0xd,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <uptime>:
SYSCALL(uptime)
302: b8 0e 00 00 00 mov $0xe,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <getCallCount>:
SYSCALL(getCallCount)
30a: b8 16 00 00 00 mov $0x16,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <myMemory>:
SYSCALL(myMemory)
312: b8 17 00 00 00 mov $0x17,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
31a: 55 push %ebp
31b: 89 e5 mov %esp,%ebp
31d: 83 ec 18 sub $0x18,%esp
320: 8b 45 0c mov 0xc(%ebp),%eax
323: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
326: 83 ec 04 sub $0x4,%esp
329: 6a 01 push $0x1
32b: 8d 45 f4 lea -0xc(%ebp),%eax
32e: 50 push %eax
32f: ff 75 08 pushl 0x8(%ebp)
332: e8 53 ff ff ff call 28a <write>
337: 83 c4 10 add $0x10,%esp
}
33a: c9 leave
33b: c3 ret
0000033c <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
33c: 55 push %ebp
33d: 89 e5 mov %esp,%ebp
33f: 53 push %ebx
340: 83 ec 24 sub $0x24,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
343: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
34a: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
34e: 74 17 je 367 <printint+0x2b>
350: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
354: 79 11 jns 367 <printint+0x2b>
neg = 1;
356: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
35d: 8b 45 0c mov 0xc(%ebp),%eax
360: f7 d8 neg %eax
362: 89 45 ec mov %eax,-0x14(%ebp)
365: eb 06 jmp 36d <printint+0x31>
} else {
x = xx;
367: 8b 45 0c mov 0xc(%ebp),%eax
36a: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
36d: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
374: 8b 4d f4 mov -0xc(%ebp),%ecx
377: 8d 41 01 lea 0x1(%ecx),%eax
37a: 89 45 f4 mov %eax,-0xc(%ebp)
37d: 8b 5d 10 mov 0x10(%ebp),%ebx
380: 8b 45 ec mov -0x14(%ebp),%eax
383: ba 00 00 00 00 mov $0x0,%edx
388: f7 f3 div %ebx
38a: 89 d0 mov %edx,%eax
38c: 8a 80 e8 09 00 00 mov 0x9e8(%eax),%al
392: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
}while((x /= base) != 0);
396: 8b 5d 10 mov 0x10(%ebp),%ebx
399: 8b 45 ec mov -0x14(%ebp),%eax
39c: ba 00 00 00 00 mov $0x0,%edx
3a1: f7 f3 div %ebx
3a3: 89 45 ec mov %eax,-0x14(%ebp)
3a6: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
3aa: 75 c8 jne 374 <printint+0x38>
if(neg)
3ac: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
3b0: 74 0e je 3c0 <printint+0x84>
buf[i++] = '-';
3b2: 8b 45 f4 mov -0xc(%ebp),%eax
3b5: 8d 50 01 lea 0x1(%eax),%edx
3b8: 89 55 f4 mov %edx,-0xc(%ebp)
3bb: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
while(--i >= 0)
3c0: eb 1c jmp 3de <printint+0xa2>
putc(fd, buf[i]);
3c2: 8d 55 dc lea -0x24(%ebp),%edx
3c5: 8b 45 f4 mov -0xc(%ebp),%eax
3c8: 01 d0 add %edx,%eax
3ca: 8a 00 mov (%eax),%al
3cc: 0f be c0 movsbl %al,%eax
3cf: 83 ec 08 sub $0x8,%esp
3d2: 50 push %eax
3d3: ff 75 08 pushl 0x8(%ebp)
3d6: e8 3f ff ff ff call 31a <putc>
3db: 83 c4 10 add $0x10,%esp
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
3de: ff 4d f4 decl -0xc(%ebp)
3e1: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
3e5: 79 db jns 3c2 <printint+0x86>
putc(fd, buf[i]);
}
3e7: 8b 5d fc mov -0x4(%ebp),%ebx
3ea: c9 leave
3eb: c3 ret
000003ec <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
3ec: 55 push %ebp
3ed: 89 e5 mov %esp,%ebp
3ef: 83 ec 28 sub $0x28,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
3f2: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
3f9: 8d 45 0c lea 0xc(%ebp),%eax
3fc: 83 c0 04 add $0x4,%eax
3ff: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
402: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
409: e9 54 01 00 00 jmp 562 <printf+0x176>
c = fmt[i] & 0xff;
40e: 8b 55 0c mov 0xc(%ebp),%edx
411: 8b 45 f0 mov -0x10(%ebp),%eax
414: 01 d0 add %edx,%eax
416: 8a 00 mov (%eax),%al
418: 0f be c0 movsbl %al,%eax
41b: 25 ff 00 00 00 and $0xff,%eax
420: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
423: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
427: 75 2c jne 455 <printf+0x69>
if(c == '%'){
429: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
42d: 75 0c jne 43b <printf+0x4f>
state = '%';
42f: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
436: e9 24 01 00 00 jmp 55f <printf+0x173>
} else {
putc(fd, c);
43b: 8b 45 e4 mov -0x1c(%ebp),%eax
43e: 0f be c0 movsbl %al,%eax
441: 83 ec 08 sub $0x8,%esp
444: 50 push %eax
445: ff 75 08 pushl 0x8(%ebp)
448: e8 cd fe ff ff call 31a <putc>
44d: 83 c4 10 add $0x10,%esp
450: e9 0a 01 00 00 jmp 55f <printf+0x173>
}
} else if(state == '%'){
455: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
459: 0f 85 00 01 00 00 jne 55f <printf+0x173>
if(c == 'd'){
45f: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
463: 75 1e jne 483 <printf+0x97>
printint(fd, *ap, 10, 1);
465: 8b 45 e8 mov -0x18(%ebp),%eax
468: 8b 00 mov (%eax),%eax
46a: 6a 01 push $0x1
46c: 6a 0a push $0xa
46e: 50 push %eax
46f: ff 75 08 pushl 0x8(%ebp)
472: e8 c5 fe ff ff call 33c <printint>
477: 83 c4 10 add $0x10,%esp
ap++;
47a: 83 45 e8 04 addl $0x4,-0x18(%ebp)
47e: e9 d5 00 00 00 jmp 558 <printf+0x16c>
} else if(c == 'x' || c == 'p'){
483: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
487: 74 06 je 48f <printf+0xa3>
489: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
48d: 75 1e jne 4ad <printf+0xc1>
printint(fd, *ap, 16, 0);
48f: 8b 45 e8 mov -0x18(%ebp),%eax
492: 8b 00 mov (%eax),%eax
494: 6a 00 push $0x0
496: 6a 10 push $0x10
498: 50 push %eax
499: ff 75 08 pushl 0x8(%ebp)
49c: e8 9b fe ff ff call 33c <printint>
4a1: 83 c4 10 add $0x10,%esp
ap++;
4a4: 83 45 e8 04 addl $0x4,-0x18(%ebp)
4a8: e9 ab 00 00 00 jmp 558 <printf+0x16c>
} else if(c == 's'){
4ad: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
4b1: 75 40 jne 4f3 <printf+0x107>
s = (char*)*ap;
4b3: 8b 45 e8 mov -0x18(%ebp),%eax
4b6: 8b 00 mov (%eax),%eax
4b8: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
4bb: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
4bf: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
4c3: 75 07 jne 4cc <printf+0xe0>
s = "(null)";
4c5: c7 45 f4 98 07 00 00 movl $0x798,-0xc(%ebp)
while(*s != 0){
4cc: eb 1a jmp 4e8 <printf+0xfc>
putc(fd, *s);
4ce: 8b 45 f4 mov -0xc(%ebp),%eax
4d1: 8a 00 mov (%eax),%al
4d3: 0f be c0 movsbl %al,%eax
4d6: 83 ec 08 sub $0x8,%esp
4d9: 50 push %eax
4da: ff 75 08 pushl 0x8(%ebp)
4dd: e8 38 fe ff ff call 31a <putc>
4e2: 83 c4 10 add $0x10,%esp
s++;
4e5: ff 45 f4 incl -0xc(%ebp)
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
4e8: 8b 45 f4 mov -0xc(%ebp),%eax
4eb: 8a 00 mov (%eax),%al
4ed: 84 c0 test %al,%al
4ef: 75 dd jne 4ce <printf+0xe2>
4f1: eb 65 jmp 558 <printf+0x16c>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
4f3: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
4f7: 75 1d jne 516 <printf+0x12a>
putc(fd, *ap);
4f9: 8b 45 e8 mov -0x18(%ebp),%eax
4fc: 8b 00 mov (%eax),%eax
4fe: 0f be c0 movsbl %al,%eax
501: 83 ec 08 sub $0x8,%esp
504: 50 push %eax
505: ff 75 08 pushl 0x8(%ebp)
508: e8 0d fe ff ff call 31a <putc>
50d: 83 c4 10 add $0x10,%esp
ap++;
510: 83 45 e8 04 addl $0x4,-0x18(%ebp)
514: eb 42 jmp 558 <printf+0x16c>
} else if(c == '%'){
516: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
51a: 75 17 jne 533 <printf+0x147>
putc(fd, c);
51c: 8b 45 e4 mov -0x1c(%ebp),%eax
51f: 0f be c0 movsbl %al,%eax
522: 83 ec 08 sub $0x8,%esp
525: 50 push %eax
526: ff 75 08 pushl 0x8(%ebp)
529: e8 ec fd ff ff call 31a <putc>
52e: 83 c4 10 add $0x10,%esp
531: eb 25 jmp 558 <printf+0x16c>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
533: 83 ec 08 sub $0x8,%esp
536: 6a 25 push $0x25
538: ff 75 08 pushl 0x8(%ebp)
53b: e8 da fd ff ff call 31a <putc>
540: 83 c4 10 add $0x10,%esp
putc(fd, c);
543: 8b 45 e4 mov -0x1c(%ebp),%eax
546: 0f be c0 movsbl %al,%eax
549: 83 ec 08 sub $0x8,%esp
54c: 50 push %eax
54d: ff 75 08 pushl 0x8(%ebp)
550: e8 c5 fd ff ff call 31a <putc>
555: 83 c4 10 add $0x10,%esp
}
state = 0;
558: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
55f: ff 45 f0 incl -0x10(%ebp)
562: 8b 55 0c mov 0xc(%ebp),%edx
565: 8b 45 f0 mov -0x10(%ebp),%eax
568: 01 d0 add %edx,%eax
56a: 8a 00 mov (%eax),%al
56c: 84 c0 test %al,%al
56e: 0f 85 9a fe ff ff jne 40e <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
574: c9 leave
575: c3 ret
00000576 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
576: 55 push %ebp
577: 89 e5 mov %esp,%ebp
579: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
57c: 8b 45 08 mov 0x8(%ebp),%eax
57f: 83 e8 08 sub $0x8,%eax
582: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
585: a1 04 0a 00 00 mov 0xa04,%eax
58a: 89 45 fc mov %eax,-0x4(%ebp)
58d: eb 24 jmp 5b3 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
58f: 8b 45 fc mov -0x4(%ebp),%eax
592: 8b 00 mov (%eax),%eax
594: 3b 45 fc cmp -0x4(%ebp),%eax
597: 77 12 ja 5ab <free+0x35>
599: 8b 45 f8 mov -0x8(%ebp),%eax
59c: 3b 45 fc cmp -0x4(%ebp),%eax
59f: 77 24 ja 5c5 <free+0x4f>
5a1: 8b 45 fc mov -0x4(%ebp),%eax
5a4: 8b 00 mov (%eax),%eax
5a6: 3b 45 f8 cmp -0x8(%ebp),%eax
5a9: 77 1a ja 5c5 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
5ab: 8b 45 fc mov -0x4(%ebp),%eax
5ae: 8b 00 mov (%eax),%eax
5b0: 89 45 fc mov %eax,-0x4(%ebp)
5b3: 8b 45 f8 mov -0x8(%ebp),%eax
5b6: 3b 45 fc cmp -0x4(%ebp),%eax
5b9: 76 d4 jbe 58f <free+0x19>
5bb: 8b 45 fc mov -0x4(%ebp),%eax
5be: 8b 00 mov (%eax),%eax
5c0: 3b 45 f8 cmp -0x8(%ebp),%eax
5c3: 76 ca jbe 58f <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
5c5: 8b 45 f8 mov -0x8(%ebp),%eax
5c8: 8b 40 04 mov 0x4(%eax),%eax
5cb: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
5d2: 8b 45 f8 mov -0x8(%ebp),%eax
5d5: 01 c2 add %eax,%edx
5d7: 8b 45 fc mov -0x4(%ebp),%eax
5da: 8b 00 mov (%eax),%eax
5dc: 39 c2 cmp %eax,%edx
5de: 75 24 jne 604 <free+0x8e>
bp->s.size += p->s.ptr->s.size;
5e0: 8b 45 f8 mov -0x8(%ebp),%eax
5e3: 8b 50 04 mov 0x4(%eax),%edx
5e6: 8b 45 fc mov -0x4(%ebp),%eax
5e9: 8b 00 mov (%eax),%eax
5eb: 8b 40 04 mov 0x4(%eax),%eax
5ee: 01 c2 add %eax,%edx
5f0: 8b 45 f8 mov -0x8(%ebp),%eax
5f3: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
5f6: 8b 45 fc mov -0x4(%ebp),%eax
5f9: 8b 00 mov (%eax),%eax
5fb: 8b 10 mov (%eax),%edx
5fd: 8b 45 f8 mov -0x8(%ebp),%eax
600: 89 10 mov %edx,(%eax)
602: eb 0a jmp 60e <free+0x98>
} else
bp->s.ptr = p->s.ptr;
604: 8b 45 fc mov -0x4(%ebp),%eax
607: 8b 10 mov (%eax),%edx
609: 8b 45 f8 mov -0x8(%ebp),%eax
60c: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
60e: 8b 45 fc mov -0x4(%ebp),%eax
611: 8b 40 04 mov 0x4(%eax),%eax
614: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx
61b: 8b 45 fc mov -0x4(%ebp),%eax
61e: 01 d0 add %edx,%eax
620: 3b 45 f8 cmp -0x8(%ebp),%eax
623: 75 20 jne 645 <free+0xcf>
p->s.size += bp->s.size;
625: 8b 45 fc mov -0x4(%ebp),%eax
628: 8b 50 04 mov 0x4(%eax),%edx
62b: 8b 45 f8 mov -0x8(%ebp),%eax
62e: 8b 40 04 mov 0x4(%eax),%eax
631: 01 c2 add %eax,%edx
633: 8b 45 fc mov -0x4(%ebp),%eax
636: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
639: 8b 45 f8 mov -0x8(%ebp),%eax
63c: 8b 10 mov (%eax),%edx
63e: 8b 45 fc mov -0x4(%ebp),%eax
641: 89 10 mov %edx,(%eax)
643: eb 08 jmp 64d <free+0xd7>
} else
p->s.ptr = bp;
645: 8b 45 fc mov -0x4(%ebp),%eax
648: 8b 55 f8 mov -0x8(%ebp),%edx
64b: 89 10 mov %edx,(%eax)
freep = p;
64d: 8b 45 fc mov -0x4(%ebp),%eax
650: a3 04 0a 00 00 mov %eax,0xa04
}
655: c9 leave
656: c3 ret
00000657 <morecore>:
static Header*
morecore(uint nu)
{
657: 55 push %ebp
658: 89 e5 mov %esp,%ebp
65a: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
if(nu < 4096)
65d: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
664: 77 07 ja 66d <morecore+0x16>
nu = 4096;
666: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
66d: 8b 45 08 mov 0x8(%ebp),%eax
670: c1 e0 03 shl $0x3,%eax
673: 83 ec 0c sub $0xc,%esp
676: 50 push %eax
677: e8 76 fc ff ff call 2f2 <sbrk>
67c: 83 c4 10 add $0x10,%esp
67f: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
682: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
686: 75 07 jne 68f <morecore+0x38>
return 0;
688: b8 00 00 00 00 mov $0x0,%eax
68d: eb 26 jmp 6b5 <morecore+0x5e>
hp = (Header*)p;
68f: 8b 45 f4 mov -0xc(%ebp),%eax
692: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
695: 8b 45 f0 mov -0x10(%ebp),%eax
698: 8b 55 08 mov 0x8(%ebp),%edx
69b: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
69e: 8b 45 f0 mov -0x10(%ebp),%eax
6a1: 83 c0 08 add $0x8,%eax
6a4: 83 ec 0c sub $0xc,%esp
6a7: 50 push %eax
6a8: e8 c9 fe ff ff call 576 <free>
6ad: 83 c4 10 add $0x10,%esp
return freep;
6b0: a1 04 0a 00 00 mov 0xa04,%eax
}
6b5: c9 leave
6b6: c3 ret
000006b7 <malloc>:
void*
malloc(uint nbytes)
{
6b7: 55 push %ebp
6b8: 89 e5 mov %esp,%ebp
6ba: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6bd: 8b 45 08 mov 0x8(%ebp),%eax
6c0: 83 c0 07 add $0x7,%eax
6c3: c1 e8 03 shr $0x3,%eax
6c6: 40 inc %eax
6c7: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
6ca: a1 04 0a 00 00 mov 0xa04,%eax
6cf: 89 45 f0 mov %eax,-0x10(%ebp)
6d2: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
6d6: 75 23 jne 6fb <malloc+0x44>
base.s.ptr = freep = prevp = &base;
6d8: c7 45 f0 fc 09 00 00 movl $0x9fc,-0x10(%ebp)
6df: 8b 45 f0 mov -0x10(%ebp),%eax
6e2: a3 04 0a 00 00 mov %eax,0xa04
6e7: a1 04 0a 00 00 mov 0xa04,%eax
6ec: a3 fc 09 00 00 mov %eax,0x9fc
base.s.size = 0;
6f1: c7 05 00 0a 00 00 00 movl $0x0,0xa00
6f8: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6fb: 8b 45 f0 mov -0x10(%ebp),%eax
6fe: 8b 00 mov (%eax),%eax
700: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
703: 8b 45 f4 mov -0xc(%ebp),%eax
706: 8b 40 04 mov 0x4(%eax),%eax
709: 3b 45 ec cmp -0x14(%ebp),%eax
70c: 72 4d jb 75b <malloc+0xa4>
if(p->s.size == nunits)
70e: 8b 45 f4 mov -0xc(%ebp),%eax
711: 8b 40 04 mov 0x4(%eax),%eax
714: 3b 45 ec cmp -0x14(%ebp),%eax
717: 75 0c jne 725 <malloc+0x6e>
prevp->s.ptr = p->s.ptr;
719: 8b 45 f4 mov -0xc(%ebp),%eax
71c: 8b 10 mov (%eax),%edx
71e: 8b 45 f0 mov -0x10(%ebp),%eax
721: 89 10 mov %edx,(%eax)
723: eb 26 jmp 74b <malloc+0x94>
else {
p->s.size -= nunits;
725: 8b 45 f4 mov -0xc(%ebp),%eax
728: 8b 40 04 mov 0x4(%eax),%eax
72b: 2b 45 ec sub -0x14(%ebp),%eax
72e: 89 c2 mov %eax,%edx
730: 8b 45 f4 mov -0xc(%ebp),%eax
733: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
736: 8b 45 f4 mov -0xc(%ebp),%eax
739: 8b 40 04 mov 0x4(%eax),%eax
73c: c1 e0 03 shl $0x3,%eax
73f: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
742: 8b 45 f4 mov -0xc(%ebp),%eax
745: 8b 55 ec mov -0x14(%ebp),%edx
748: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
74b: 8b 45 f0 mov -0x10(%ebp),%eax
74e: a3 04 0a 00 00 mov %eax,0xa04
return (void*)(p + 1);
753: 8b 45 f4 mov -0xc(%ebp),%eax
756: 83 c0 08 add $0x8,%eax
759: eb 3b jmp 796 <malloc+0xdf>
}
if(p == freep)
75b: a1 04 0a 00 00 mov 0xa04,%eax
760: 39 45 f4 cmp %eax,-0xc(%ebp)
763: 75 1e jne 783 <malloc+0xcc>
if((p = morecore(nunits)) == 0)
765: 83 ec 0c sub $0xc,%esp
768: ff 75 ec pushl -0x14(%ebp)
76b: e8 e7 fe ff ff call 657 <morecore>
770: 83 c4 10 add $0x10,%esp
773: 89 45 f4 mov %eax,-0xc(%ebp)
776: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
77a: 75 07 jne 783 <malloc+0xcc>
return 0;
77c: b8 00 00 00 00 mov $0x0,%eax
781: eb 13 jmp 796 <malloc+0xdf>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
783: 8b 45 f4 mov -0xc(%ebp),%eax
786: 89 45 f0 mov %eax,-0x10(%ebp)
789: 8b 45 f4 mov -0xc(%ebp),%eax
78c: 8b 00 mov (%eax),%eax
78e: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
791: e9 6d ff ff ff jmp 703 <malloc+0x4c>
}
796: c9 leave
797: c3 ret
| 34.05812 | 60 | 0.41701 |
3f5ce7d14ebb22796a1f2db530657821e148e37d | 693 | asm | Assembly | oeis/221/A221574.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/221/A221574.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/221/A221574.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A221574: Number of 0..n arrays of length 3 with each element differing from at least one neighbor by something other than 1.
; 2,9,26,59,114,197,314,471,674,929,1242,1619,2066,2589,3194,3887,4674,5561,6554,7659,8882,10229,11706,13319,15074,16977,19034,21251,23634,26189,28922,31839,34946,38249,41754,45467,49394,53541,57914,62519,67362,72449,77786,83379,89234,95357,101754,108431,115394,122649,130202,138059,146226,154709,163514,172647,182114,191921,202074,212579,223442,234669,246266,258239,270594,283337,296474,310011,323954,338309,353082,368279,383906,399969,416474,433427,450834,468701,487034,505839,525122,544889,565146
add $0,1
mov $1,$0
pow $0,2
add $0,3
sub $1,1
mul $0,$1
add $0,2
| 63 | 499 | 0.792208 |
0ac6f5768bb55d7ef2c87c36f1592496a4b02e62 | 175 | asm | Assembly | samples/sum_of_odds.asm | SohamMalakar/Intel-8085 | 85b759c6c9a85691146270be920350ff45c0ea48 | [
"MIT"
] | null | null | null | samples/sum_of_odds.asm | SohamMalakar/Intel-8085 | 85b759c6c9a85691146270be920350ff45c0ea48 | [
"MIT"
] | null | null | null | samples/sum_of_odds.asm | SohamMalakar/Intel-8085 | 85b759c6c9a85691146270be920350ff45c0ea48 | [
"MIT"
] | null | null | null |
MVI H, 0AH
MVI L, 00H
LXI B, F100H
LOOP:
LDAX B
RAR
JNC EVEN
RAL
ADD L
MOV L, A
EVEN: INX B
DCR H
JNZ LOOP
// RST 1
HLT
| 7.608696 | 15 | 0.457143 |
096e4952ae95da3c0ecdb080ce5bea98b07c915f | 2,871 | asm | Assembly | Appl/GeoDex/Misc/miscUtils.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Appl/GeoDex/Misc/miscUtils.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Appl/GeoDex/Misc/miscUtils.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: GeoDex
MODULE: Misc
FILE: miscUtils.asm
AUTHOR: Ted H. Kim, 7/22/92
ROUTINES:
Name Description
---- -----------
MakeObjectUsable/MakeObjectNotUsable
Make the passed object usable/not-usable
ScanStrForNull Scan a string for null terminator
REVISION HISTORY:
Name Date Description
---- ---- -----------
ted 7/22/89 Initial revision
DESCRIPTION:
Contains utility routines for Misc module of GeoDex.
$Id: miscUtils.asm,v 1.1 97/04/04 15:50:13 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MenuCode segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MakeObjectUsable/MakeObjectNotUsable
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make the passed object usable/not-usable
CALLED BY: UTILITY
PASS: bx:si - OD of the object to make usable/not-usable
RETURN: nothing
DESTROYED: ax, di, dx
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
ted 3/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MakeObjectUsable proc far
mov ax, MSG_GEN_SET_USABLE
mov di, mask MF_FIXUP_DS
mov dl, VUM_DELAYED_VIA_APP_QUEUE ; dl - do it right now
call ObjMessage ; make this object usable
ret
MakeObjectUsable endp
MakeObjectNotUsable proc far
mov ax, MSG_GEN_SET_NOT_USABLE
mov di, mask MF_FIXUP_DS
mov dl, VUM_DELAYED_VIA_APP_QUEUE ; dl - do it right now
call ObjMessage ; make this object not usable
ret
MakeObjectNotUsable endp
if 0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ScanStrForNull
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Scan the string for null terminator. Returns size with NULL.
CALLED BY: UTILITY
PASS: es:di - string to scan
RETURN: cx - number of bytes in the string (including null)
es:di - points to the end of string
DESTROYED: ax
KNOWN BUGS/SIDE EFFECTS/IDEAS:
The usage of this routine should be reduced. There are
now kernel calls to do its job.
REVISION HISTORY:
Name Date Description
---- ---- -----------
ted 7/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ScanStrForNull proc far
mov cx, -1 ; scan until null terminator
LocalClrChar ax ; ax - char to search for
LocalFindChar ; search for terminating 0
not cx ; cx - total number of bytes
DBCS < shl cx, 1 ; cx - total number of bytes >
ret
ScanStrForNull endp
endif
MenuCode ends
| 25.864865 | 79 | 0.54441 |
7be2a6baeffd10a544cd6c1fbe62ca2737a3ff67 | 1,880 | asm | Assembly | programs/oeis/132/A132407.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/132/A132407.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/132/A132407.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A132407: Ceiling(exp(n)/n).
; 3,4,7,14,30,68,157,373,901,2203,5444,13563,34032,85901,217935,555382,1420880,3647777,9393806,24258260,62800750,162950584,423687107,1103713423,2880195974,7528061902,19705490393,51652038011,135563251626,356215819385,937059666621,2467592505709,6504350902604,17160639486102,45314670066099,119756431864311,316733577643314,838313993608257,2220343600615225,5884631670925500,15605938866586707,41411308131440502,109949755075101083,292081820780893370,776317134610779897,2064373787087488886,5492155077000143397,14618199816870066123,38925440255002034501,103694110571741449282,276342957338615450285,736732307830110932559,1964860270382846754186,5242135746804988704523,13990518663894576614878,37351062428803502748341,99749473672560214432287,266472230274155850060876,712069559964493941518067,1903345649692807139438262,5089013009347409686405479,13610252691518474982376338,36409256499517617128561157,97424204387681513795456855,260752191447743648329505171,698058580959286597375351280,1869198762451065344050032778,5006288308723147825554275276,13411277863170706667017967996,35934838155988100089511159633,96305228588207660095153420095,258148853511684441713940302953,692108716476178656788635387971,1855922945324562415924579094336,4977655995732002187006544423020,13352636685709062208321865580681,35824850058742470211512595063671,96133551243463082495841417836206,258010261583882122383837184014844,692577798049188756571396674478958,1859379400722259936237770531071204,4992679222106652069098675889424182,13407997045683848338398451544384829,36012825264299313550792457100517009,96741326054387217768286211957738526,259912395783106400865472759573571482,698394278742169212588773441164399549
add $0,1
mov $2,1
mov $3,$0
mul $3,5
lpb $3
mul $1,$0
mul $2,$3
add $1,$2
div $1,$0
div $2,$0
sub $3,1
max $3,1
lpe
mul $1,$0
div $1,$2
add $1,$3
div $1,$0
add $1,1
mov $0,$1
| 81.73913 | 1,659 | 0.894681 |
483082a1156c2bee9b1ef22a9b9db178c3040578 | 7,385 | asm | Assembly | scripts/SilphCo11F.asm | AmateurPanda92/pokemon-rby-dx | f7ba1cc50b22d93ed176571e074a52d73360da93 | [
"MIT"
] | 9 | 2020-07-12T19:44:21.000Z | 2022-03-03T23:32:40.000Z | scripts/SilphCo11F.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 7 | 2020-07-16T10:48:52.000Z | 2021-01-28T18:32:02.000Z | scripts/SilphCo11F.asm | JStar-debug2020/pokemon-rby-dx | c2fdd8145d96683addbd8d9075f946a68d1527a1 | [
"MIT"
] | 2 | 2021-03-28T18:33:43.000Z | 2021-05-06T13:12:09.000Z | SilphCo11F_Script:
call SilphCo11Script_62110
call EnableAutoTextBoxDrawing
ld hl, SilphCo11TrainerHeader0
ld de, SilphCo11F_ScriptPointers
ld a, [wSilphCo11FCurScript]
call ExecuteCurMapScriptInTable
ld [wSilphCo11FCurScript], a
ret
SilphCo11Script_62110:
ld hl, wCurrentMapScriptFlags
bit 5, [hl]
res 5, [hl]
ret z
ld hl, SilphCo11GateCoords
call SilphCo11Script_62137
call SilphCo11Script_62163
CheckEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR
ret nz
ld a, $20
ld [wNewTileBlockID], a
lb bc, 6, 3
predef_jump ReplaceTileBlock
SilphCo11GateCoords:
db $06,$03
db $FF
SilphCo11Script_62137:
push hl
ld hl, wCardKeyDoorY
ld a, [hli]
ld b, a
ld a, [hl]
ld c, a
xor a
ld [$ffe0], a
pop hl
.asm_62143
ld a, [hli]
cp $ff
jr z, .asm_6215f
push hl
ld hl, $ffe0
inc [hl]
pop hl
cp b
jr z, .asm_62154
inc hl
jr .asm_62143
.asm_62154
ld a, [hli]
cp c
jr nz, .asm_62143
ld hl, wCardKeyDoorY
xor a
ld [hli], a
ld [hl], a
ret
.asm_6215f
xor a
ld [$ffe0], a
ret
SilphCo11Script_62163:
ld a, [$ffe0]
and a
ret z
SetEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR
ret
SilphCo11Script_6216d:
ld hl, MissableObjectIDs_6219b
.asm_62170
ld a, [hli]
cp $ff
jr z, .asm_62181
push hl
ld [wMissableObjectIndex], a
predef HideObject
pop hl
jr .asm_62170
.asm_62181
ld hl, MissableObjectIDs_62194
.asm_62184
ld a, [hli]
cp $ff
ret z
push hl
ld [wMissableObjectIndex], a
predef ShowObject
pop hl
jr .asm_62184
MissableObjectIDs_62194:
db HS_SAFFRON_CITY_8
db HS_SAFFRON_CITY_9
db HS_SAFFRON_CITY_A
db HS_SAFFRON_CITY_B
db HS_SAFFRON_CITY_C
db HS_SAFFRON_CITY_D
db $FF
MissableObjectIDs_6219b:
db HS_SAFFRON_CITY_1
db HS_SAFFRON_CITY_2
db HS_SAFFRON_CITY_3
db HS_SAFFRON_CITY_4
db HS_SAFFRON_CITY_5
db HS_SAFFRON_CITY_6
db HS_SAFFRON_CITY_7
db HS_SAFFRON_CITY_E
db HS_SAFFRON_CITY_F
db HS_SILPH_CO_2F_2
db HS_SILPH_CO_2F_3
db HS_SILPH_CO_2F_4
db HS_SILPH_CO_2F_5
db HS_SILPH_CO_3F_1
db HS_SILPH_CO_3F_2
db HS_SILPH_CO_4F_1
db HS_SILPH_CO_4F_2
db HS_SILPH_CO_4F_3
db HS_SILPH_CO_5F_1
db HS_SILPH_CO_5F_2
db HS_SILPH_CO_5F_3
db HS_SILPH_CO_5F_4
db HS_SILPH_CO_6F_1
db HS_SILPH_CO_6F_2
db HS_SILPH_CO_6F_3
db HS_SILPH_CO_7F_1
db HS_SILPH_CO_7F_2
db HS_SILPH_CO_7F_3
db HS_SILPH_CO_7F_4
db HS_SILPH_CO_8F_1
db HS_SILPH_CO_8F_2
db HS_SILPH_CO_8F_3
db HS_SILPH_CO_9F_1
db HS_SILPH_CO_9F_2
db HS_SILPH_CO_9F_3
db HS_SILPH_CO_10F_1
db HS_SILPH_CO_10F_2
db HS_SILPH_CO_11F_1
db HS_SILPH_CO_11F_2
db HS_SILPH_CO_11F_3
db $FF
SilphCo11Script_621c4:
xor a
ld [wJoyIgnore], a
SilphCo11Script_621c8:
ld [wSilphCo11FCurScript], a
ld [wCurMapScript], a
ret
SilphCo11F_ScriptPointers:
dw SilphCo11Script0
dw DisplayEnemyTrainerTextAndStartBattle
dw EndTrainerBattle
dw SilphCo11Script3
dw SilphCo11Script4
dw SilphCo11Script5
SilphCo11Script0:
CheckEvent EVENT_BEAT_SILPH_CO_GIOVANNI
ret nz
ld hl, CoordsData_62211
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
ld a, [wCoordIndex]
ld [wcf0d], a
xor a
ld [hJoyHeld], a
ld a, $f0
ld [wJoyIgnore], a
ld a, $3
ld [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $3
ld [H_SPRITEINDEX], a
call SetSpriteMovementBytesToFF
ld de, MovementData_62216
call MoveSprite
ld a, $3
jp SilphCo11Script_621c8
CoordsData_62211:
db $0D,$06
db $0C,$07
db $FF
MovementData_62216:
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db NPC_MOVEMENT_DOWN
db $FF
SilphCo11Script_6221a:
ld [wPlayerMovingDirection], a
ld a, $3
ld [H_SPRITEINDEX], a
ld a, b
ld [hSpriteFacingDirection], a
jp SetSpriteFacingDirectionAndDelay
SilphCo11Script5:
ld a, [wIsInBattle]
cp $ff
jp z, SilphCo11Script_621c4
ld a, [wcf0d]
cp $1
jr z, .asm_6223c
ld a, PLAYER_DIR_LEFT
ld b, SPRITE_FACING_RIGHT
jr .asm_62240
.asm_6223c
ld a, PLAYER_DIR_UP
ld b, SPRITE_FACING_DOWN
.asm_62240
call SilphCo11Script_6221a
ld a, $f0
ld [wJoyIgnore], a
ld a, $6
ld [hSpriteIndexOrTextID], a
call DisplayTextID
call GBFadeOutToBlack
call SilphCo11Script_6216d
call UpdateSprites
call Delay3
call GBFadeInFromBlack
SetEvent EVENT_BEAT_SILPH_CO_GIOVANNI
xor a
ld [wJoyIgnore], a
jp SilphCo11Script_621c8
SilphCo11Script3:
ld a, [wd730]
bit 0, a
ret nz
ld a, $3
ld [H_SPRITEINDEX], a
call SetSpriteMovementBytesToFF
ld a, [wcf0d]
cp $1
jr z, .asm_62284
ld a, PLAYER_DIR_LEFT
ld b, SPRITE_FACING_RIGHT
jr .asm_62288
.asm_62284
ld a, PLAYER_DIR_UP
ld b, SPRITE_FACING_DOWN
.asm_62288
call SilphCo11Script_6221a
call Delay3
ld a, $4
jp SilphCo11Script_621c8
SilphCo11Script4:
ld hl, wd72d
set 6, [hl]
set 7, [hl]
ld hl, SilphCo10Text_62330
ld de, SilphCo10Text_62330
call SaveEndBattleTextPointers
ld a, [H_SPRITEINDEX]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
xor a
ld [wJoyIgnore], a
ld a, $5
jp SilphCo11Script_621c8
SilphCo11F_TextPointers:
dw SilphCo11Text1
dw SilphCo11Text2
dw SilphCo11Text3
dw SilphCo11Text4
dw SilphCo11Text5
dw SilphCo11Text6
SilphCo11TrainerHeader0:
dbEventFlagBit EVENT_BEAT_SILPH_CO_11F_TRAINER_0
db ($4 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_SILPH_CO_11F_TRAINER_0
dw SilphCo11BattleText1 ; TextBeforeBattle
dw SilphCo11AfterBattleText1 ; TextAfterBattle
dw SilphCo11EndBattleText1 ; TextEndBattle
dw SilphCo11EndBattleText1 ; TextEndBattle
SilphCo11TrainerHeader1:
dbEventFlagBit EVENT_BEAT_SILPH_CO_11F_TRAINER_1
db ($3 << 4) ; trainer's view range
dwEventFlagAddress EVENT_BEAT_SILPH_CO_11F_TRAINER_1
dw SilphCo11BattleText2 ; TextBeforeBattle
dw SilphCo11AfterBattleText2 ; TextAfterBattle
dw SilphCo11EndBattleText2 ; TextEndBattle
dw SilphCo11EndBattleText2 ; TextEndBattle
db $ff
SilphCo11Text1:
TX_ASM
CheckEvent EVENT_GOT_MASTER_BALL
jp nz, .asm_62308
ld hl, SilphCoPresidentText
call PrintText
lb bc, MASTER_BALL, 1
call GiveItem
jr nc, .BagFull
ld hl, ReceivedSilphCoMasterBallText
call PrintText
SetEvent EVENT_GOT_MASTER_BALL
jr .asm_6230e
.BagFull
ld hl, SilphCoMasterBallNoRoomText
call PrintText
jr .asm_6230e
.asm_62308
ld hl, SilphCo10Text_6231c
call PrintText
.asm_6230e
jp TextScriptEnd
SilphCoPresidentText:
TX_FAR _SilphCoPresidentText
db "@"
ReceivedSilphCoMasterBallText:
TX_FAR _ReceivedSilphCoMasterBallText
TX_SFX_KEY_ITEM
db "@"
SilphCo10Text_6231c:
TX_FAR _SilphCo10Text_6231c
db "@"
SilphCoMasterBallNoRoomText:
TX_FAR _SilphCoMasterBallNoRoomText
db "@"
SilphCo11Text2:
TX_FAR _SilphCo11Text2
db "@"
SilphCo11Text3:
TX_FAR _SilphCo11Text3
db "@"
SilphCo10Text_62330:
TX_FAR _SilphCo10Text_62330
db "@"
SilphCo11Text6:
TX_FAR _SilphCo10Text_62335
db "@"
SilphCo11Text4:
TX_ASM
ld hl, SilphCo11TrainerHeader0
call TalkToTrainer
jp TextScriptEnd
SilphCo11BattleText1:
TX_FAR _SilphCo11BattleText1
db "@"
SilphCo11EndBattleText1:
TX_FAR _SilphCo11EndBattleText1
db "@"
SilphCo11AfterBattleText1:
TX_FAR _SilphCo11AfterBattleText1
db "@"
SilphCo11Text5:
TX_ASM
ld hl, SilphCo11TrainerHeader1
call TalkToTrainer
jp TextScriptEnd
SilphCo11BattleText2:
TX_FAR _SilphCo11BattleText2
db "@"
SilphCo11EndBattleText2:
TX_FAR _SilphCo11EndBattleText2
db "@"
SilphCo11AfterBattleText2:
TX_FAR _SilphCo11AfterBattleText2
db "@"
SilphCo10Text_6236c:
TX_ASM
ld hl, SilphCo10Text_6237b
call PrintText
ld a, PORYGON
call DisplayPokedex
jp TextScriptEnd
SilphCo10Text_6237b:
TX_FAR _SilphCo10Text_6237b
db "@"
| 18.189655 | 53 | 0.795531 |
d6e698cc858fb4cef7fa0f4d3b3356d113698c19 | 745 | asm | Assembly | oeis/057/A057960.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/057/A057960.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/057/A057960.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A057960: Number of base 5 (n+1)-digit numbers starting with a zero and with adjacent digits differing by one or less.
; Submitted by Jamie Morken(w2)
; 1,2,5,13,35,95,259,707,1931,5275,14411,39371,107563,293867,802859,2193451,5992619,16372139,44729515,122203307,333865643,912137899,2492007083,6808289963,18600594091,50817768107,138836724395,379308985003,1036291418795,2831200807595,7734984452779,21132370520747,57734709947051,157734160935595,430937741765291,1177343805401771,3216563094334123,8787813799471787,24008753787611819,65593135174167211,179203777923558059,489593826195450539,1337595208238017195,3654378068866935467,9983946554209905323
lpb $0
sub $0,1
mov $3,$2
mul $4,2
add $4,1
mov $2,$4
add $4,$3
lpe
mov $0,$4
add $0,1
| 49.666667 | 492 | 0.81745 |
956de3471f56aa71aa02d018d48e343de3ff4a98 | 356 | asm | Assembly | programs/oeis/095/A095860.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/095/A095860.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/095/A095860.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A095860: Triangle read by rows: T(n,k) = n^(k^2), n>=1, 1<=k<=n.
; 1,2,16,3,81,19683,4,256,262144,4294967296,5,625,1953125,152587890625,298023223876953125,6,1296,10077696,2821109907456,28430288029929701376,10314424798490535546171949056,7,2401,40353607,33232930569601
mov $2,1
lpb $0
mov $1,$0
pow $1,2
add $2,1
trn $0,$2
lpe
pow $2,$1
mov $0,$2
| 27.384615 | 201 | 0.710674 |
5a835767fc5b60308b3a660640b60ecb4ad4ff05 | 5,989 | asm | Assembly | sudoku.asm | lukq/sudoku-mz | 01b8a448c10683e888c5576c29fd93708f4cd566 | [
"MIT"
] | null | null | null | sudoku.asm | lukq/sudoku-mz | 01b8a448c10683e888c5576c29fd93708f4cd566 | [
"MIT"
] | null | null | null | sudoku.asm | lukq/sudoku-mz | 01b8a448c10683e888c5576c29fd93708f4cd566 | [
"MIT"
] | null | null | null | ; Program to play sudoku on CP/M
; by Lukas Petru, February 2018
; compiled: 480 bytes + data
; Open source under the MIT License (Expat).
bdos .equ 5
charout .equ 2
strout .equ 9
kright .equ 4 ; keys
kleft .equ 19
kup .equ 5
kdown .equ 24
kclr .equ 7
size .equ 81 ; one puzzle size in bytes
testbuffer .equ 5 ; high byte of test buffer
puzzleaddr .equ 600h ; unpacked data go here
.org 100h
;unpack
ld de,puzzleaddr+size+10 ; address of row 1 column 1
ld hl,templ0 ; packed data start
uloop:
ld a,(hl)
rrca
rrca
rrca
rrca
and 15
cp 10 ; decode high nibble
jr c,$+5 ; if num=0ah
sub a ; set to 0
ld (de),a
inc de
ld (de),a ; may be repeated
inc de
ld a,(hl)
inc hl
ld (de),a ; copy low nibble
inc de
bit 2,h
jr z,uloop ; while data left
; skip puzzles
ld de,strstart
call prints
call waitkey
sub '2'
jr c,start
inc a
ld b,a
pskip:
call nextlvl
ret z
djnz pskip
; start game
start:
ld a,26 ; cls
call printc
printgrid:
ld c,-3 ; b=0-9
sub a
call gotoxy ; position for grid top left
call nl ; tab
ld hl,grid
ld c,7 ; grid has 7 segments
lgrid:
ld e,gridrow
ld b,3 ; 3 empty rows
bit 0,c
jr z,printrow ; print them
ld e,(hl)
inc hl
ld b,1
printrow:
ld d,gridrow/256
push bc
push de
ld c,7 ; row has 7 segments
rowloop:
ld a,(de) ; read segment char
ld b,1 ; segment length=1
bit 0,c
jr nz,printchar ; print single char
inc de ; filler char
cp 83h ; 82 - vertical line
ld a,81h ; 81 - horizontal line
sbc a,0 ; 80 - empty
ld b,5 ; segment length=5
printchar:
call printc
djnz printchar ; repeat char
dec c
jr nz,rowloop
call nl
pop de
pop bc
djnz printrow
dec c
jr nz,lgrid
; fill numbers from template into screen
fillin:
ld c,9 ; 9 rows
fillr:
ld b,9 ; 9 columns
fillc:
call istempl
and 15 ; clear high nibble
ld (hl),a ; clear user entry
jr z,contf
or 30h ; char from template
call gotoxy ; print
contf:
djnz fillc
dec c
jr nz,fillr
; wait for keypress
inc b
inc c ; b=c=1
kloop:
sub a
call gotoxy
exx
call waitkey
exx
cp 3
ret z ; ^c exit
cp kclr
jr z,printgrid
cp 32
jr nc,kput
dec c
cp kup
jr z,kmovey
inc c
inc c
cp kdown
jr z,kmovey
dec c
dec b
cp kleft
jr z,kmovex
inc b
inc b
kmovex:
ld a,b
call wrap
ld b,a
kmovey:
ld a,c
call wrap
ld c,a
jkloop:
jr kloop
kput:
; put char into cell
ex af,af'
call istempl
or a
jr nz,kloop ; cannot write here
ex af,af'
call printc
or 0b0h
ld (hl),a ; store user input
; test grid
exx
ld hl,testbuffer*256
sub a
ld (hl),a
dec l
jr nz,$-2
ld c,9
trow:
ld b,9
tcol:
call gettempl
and 15
jr z,contt
ld d,a
rlca
rlca
rlca
add a,d
ld d,a
add a,b
ld h,testbuffer
ld l,a
inc (hl)
ld a,c
add a,81
add a,d
ld l,a
inc (hl)
ld e,162-3
ld a,b
dec a
inc e
inc e
inc e
sub 3
jr nc,$-5
ld a,c
dec a
inc e
sub 3
jr nc,$-3
ld a,e
add a,d
ld l,a
inc (hl)
contt:
djnz tcol
dec c
jr nz,trow
ld c,243
ld l,10
sub a
cpir
exx
jr z,jkloop
; solved
ld hl,solved
inc (hl) ; solved puzzles count
ld b,(hl)
ld c,-3 ; above grid
ld a,0b7h ; heart
call gotoxy
call nextlvl
jp nz,printgrid ; loop if there are more puzzles
ld c,10 ; move cursor down
sub a
jr gotoxy ; and exit
waitkey:
ld c,6
ld e,255
call bdos
or a
jr z,waitkey
ret
nextlvl:
ld hl,(templ)
ld de,-size
add hl,de
ld (templ),hl
ld a,l
or a
ret
istempl:
call gettempl ; get current value
cp 0b0h ; if lower than b0
ret c ; it is a template number
sub a ; else it's user input
ret ; set to 0
gettempl:
ld a,c
rlca
rlca
rlca
add a,c
add a,b
ld d,0
ld e,a ; c*9+b
ld hl,(templ)
add hl,de
ld a,(hl) ; read template number
ret
wrap:
or a
jr nz,$+4
ld a,9
cp 10
jr nz,$+4
ld a,1
ret
gotoxy:
push bc
exx
pop bc
ld de,poscmd+4 ; load cursor command buffer
ld (de),a
dec de
ld a,b ; x
add a,a
add a,2fh
ld (de),a
dec de
ld a,c ; y
cp 4
sbc a,0 ; first grid divider
cp 7
sbc a,0 ; second grid divider
add a,26h
ld (de),a
ld de,poscmd
prints:
ld c,strout
call bdos
exx
ret
nl: ; print nl and 2xtab
ld a,14
dec a
call printc
cp 9
jr nz,nl+2
call printc
ret
printc:
exx
push af
ld c,charout
ld e,a
call bdos
pop af
exx
ret
grid:
.db gridtop,gridmid,gridmid,gridbot
gridtop:
.db 87h,8ah,8ah,86h
gridrow:
.db 82h,82h,82h,82h
gridmid:
.db 8bh,83h,83h,89h
gridbot:
.db 84h,88h,88h,85h
poscmd:
.db 27,"= $"
solved:
.db 0
strstart:
.db "Start from puzzle 1-"
; will be filled in by the generator
.db "2?$"
templ:
.dw 2*size+puzzleaddr ; last sudoku data
; packed data
templ0:
.db 03h,0a0h,06h,0a9h
.db 0a0h,48h,03h,05h
.db 81h,0a0h,0a2h,0a0h
.db 02h,10h,94h,0a0h
.db 03h,0a0h,02h,40h
.db 86h,0a0h,06h,0a0h
.db 0a4h,21h,09h,06h
.db 80h,50h,0a0h,50h
.db 0a0h,60h,80h,0a1h
.db 0a0h,90h,50h,80h
.db 70h,10h,0a4h,09h
.db 07h,0a0h,60h,70h
.db 10h,20h,50h,80h
.db 60h,10h,70h,10h
.db 50h,20h,90h,0a7h
.db 04h,06h,0a0h,80h
.db 30h,90h,40h,30h
.db 0a5h,0a0h,80h
| 14.293556 | 56 | 0.540992 |
cc83c1a8f77ce6a0691f203e1a59b2d54d7bba39 | 62,008 | asm | Assembly | myMemTest.asm | tamarros94/os192-Assignment3 | 2377e74178bb12d33756290f0fea3398b9d5583f | [
"MIT-0"
] | null | null | null | myMemTest.asm | tamarros94/os192-Assignment3 | 2377e74178bb12d33756290f0fea3398b9d5583f | [
"MIT-0"
] | null | null | null | myMemTest.asm | tamarros94/os192-Assignment3 | 2377e74178bb12d33756290f0fea3398b9d5583f | [
"MIT-0"
] | 1 | 2021-05-22T02:47:34.000Z | 2021-05-22T02:47:34.000Z |
_myMemTest: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
return 1;
}
int main(int argc, char *argv[]){
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 51 push %ecx
e: 83 ec 0c sub $0xc,%esp
printf(1, "--------- START TESTING! ---------\n\n\n");
11: 68 f4 0c 00 00 push $0xcf4
16: 6a 01 push $0x1
18: e8 13 06 00 00 call 630 <printf>
printf(1, "policy is SCFIFO\n");
1d: 58 pop %eax
1e: 5a pop %edx
1f: 68 f0 0b 00 00 push $0xbf0
24: 6a 01 push $0x1
26: e8 05 06 00 00 call 630 <printf>
print_policy();
printf(1, "------- first_test -------\n");
2b: 59 pop %ecx
2c: 58 pop %eax
2d: 68 31 0c 00 00 push $0xc31
32: 6a 01 push $0x1
34: e8 f7 05 00 00 call 630 <printf>
first_test();
39: e8 92 00 00 00 call d0 <first_test>
printf(1, "------- first_test passed-------\n\n");
3e: 58 pop %eax
3f: 5a pop %edx
40: 68 1c 0d 00 00 push $0xd1c
45: 6a 01 push $0x1
47: e8 e4 05 00 00 call 630 <printf>
printf(1, "------- second_test-------\n");
4c: 59 pop %ecx
4d: 58 pop %eax
4e: 68 4d 0c 00 00 push $0xc4d
53: 6a 01 push $0x1
55: e8 d6 05 00 00 call 630 <printf>
second_test();
5a: e8 11 01 00 00 call 170 <second_test>
printf(1, "------- second_test passed-------\n\n");
5f: 58 pop %eax
60: 5a pop %edx
61: 68 40 0d 00 00 push $0xd40
66: 6a 01 push $0x1
68: e8 c3 05 00 00 call 630 <printf>
printf(1, "------- third_test-------\n");
6d: 59 pop %ecx
6e: 58 pop %eax
6f: 68 69 0c 00 00 push $0xc69
74: 6a 01 push $0x1
76: e8 b5 05 00 00 call 630 <printf>
third_test();
7b: e8 b0 01 00 00 call 230 <third_test>
printf(1, "------- third_test passed-------\n\n");
80: 58 pop %eax
81: 5a pop %edx
82: 68 64 0d 00 00 push $0xd64
87: 6a 01 push $0x1
89: e8 a2 05 00 00 call 630 <printf>
printf(1, "--------- DONE TESTING! ---------\n\n");
8e: 59 pop %ecx
8f: 58 pop %eax
90: 68 88 0d 00 00 push $0xd88
95: 6a 01 push $0x1
97: e8 94 05 00 00 call 630 <printf>
exit();
9c: e8 31 04 00 00 call 4d2 <exit>
a1: 66 90 xchg %ax,%ax
a3: 66 90 xchg %ax,%ax
a5: 66 90 xchg %ax,%ax
a7: 66 90 xchg %ax,%ax
a9: 66 90 xchg %ax,%ax
ab: 66 90 xchg %ax,%ax
ad: 66 90 xchg %ax,%ax
af: 90 nop
000000b0 <print_policy>:
void print_policy(){
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
b3: 83 ec 10 sub $0x10,%esp
printf(1, "policy is SCFIFO\n");
b6: 68 f0 0b 00 00 push $0xbf0
bb: 6a 01 push $0x1
bd: e8 6e 05 00 00 call 630 <printf>
return;
c2: 83 c4 10 add $0x10,%esp
}
c5: c9 leave
c6: c3 ret
c7: 89 f6 mov %esi,%esi
c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000000d0 <first_test>:
int first_test(){
d0: 55 push %ebp
d1: 89 e5 mov %esp,%ebp
d3: 53 push %ebx
d4: 83 ec 10 sub $0x10,%esp
int* m = malloc(4096);
d7: 68 00 10 00 00 push $0x1000
dc: e8 2f 08 00 00 call 910 <malloc>
if(protect_page(m) == 0){
e1: 89 04 24 mov %eax,(%esp)
int* m = malloc(4096);
e4: 89 c3 mov %eax,%ebx
if(protect_page(m) == 0){
e6: e8 55 0a 00 00 call b40 <protect_page>
eb: 83 c4 10 add $0x10,%esp
ee: 85 c0 test %eax,%eax
f0: 74 5e je 150 <first_test+0x80>
free(m);
f2: 83 ec 0c sub $0xc,%esp
f5: 53 push %ebx
f6: e8 05 07 00 00 call 800 <free>
fb: 83 c4 10 add $0x10,%esp
int* p = pmalloc();
fe: e8 5d 09 00 00 call a60 <pmalloc>
if(protect_page(p) == -1){
103: 83 ec 0c sub $0xc,%esp
int* p = pmalloc();
106: 89 c3 mov %eax,%ebx
if(protect_page(p) == -1){
108: 50 push %eax
109: e8 32 0a 00 00 call b40 <protect_page>
10e: 83 c4 10 add $0x10,%esp
111: 83 f8 ff cmp $0xffffffff,%eax
114: 74 4a je 160 <first_test+0x90>
if (pfree(p) == -1) {
116: 83 ec 0c sub $0xc,%esp
protected_pg_num++;
119: 83 05 50 12 00 00 01 addl $0x1,0x1250
if (pfree(p) == -1) {
120: 53 push %ebx
121: e8 7a 0a 00 00 call ba0 <pfree>
126: 83 c4 10 add $0x10,%esp
129: 83 f8 ff cmp $0xffffffff,%eax
12c: 74 32 je 160 <first_test+0x90>
protected_pg_num--;
12e: 83 2d 50 12 00 00 01 subl $0x1,0x1250
STAY
135: 83 ec 0c sub $0xc,%esp
138: 6a 64 push $0x64
13a: e8 23 04 00 00 call 562 <sleep>
}
13f: b8 01 00 00 00 mov $0x1,%eax
144: 8b 5d fc mov -0x4(%ebp),%ebx
147: c9 leave
148: c3 ret
149: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
pfree(m);
150: 83 ec 0c sub $0xc,%esp
153: 53 push %ebx
154: e8 47 0a 00 00 call ba0 <pfree>
159: 83 c4 10 add $0x10,%esp
15c: eb a0 jmp fe <first_test+0x2e>
15e: 66 90 xchg %ax,%ax
free(p);
160: 83 ec 0c sub $0xc,%esp
163: 53 push %ebx
164: e8 97 06 00 00 call 800 <free>
169: 83 c4 10 add $0x10,%esp
16c: eb c7 jmp 135 <first_test+0x65>
16e: 66 90 xchg %ax,%ax
00000170 <second_test>:
int second_test(){
170: 55 push %ebp
171: 89 e5 mov %esp,%ebp
173: 53 push %ebx
for(i=0;i<ALLOC_NUM;i++){
174: 31 db xor %ebx,%ebx
int second_test(){
176: 83 ec 4c sub $0x4c,%esp
printf(1,"malloc pages\n");
179: 68 02 0c 00 00 push $0xc02
17e: 6a 01 push $0x1
180: e8 ab 04 00 00 call 630 <printf>
185: 83 c4 10 add $0x10,%esp
188: 90 nop
189: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
pages[i] = malloc(PGSIZE);
190: 83 ec 0c sub $0xc,%esp
193: 68 00 10 00 00 push $0x1000
198: e8 73 07 00 00 call 910 <malloc>
memset(pages[i], i, 1);
19d: 83 c4 0c add $0xc,%esp
pages[i] = malloc(PGSIZE);
1a0: 89 44 9d bc mov %eax,-0x44(%ebp,%ebx,4)
memset(pages[i], i, 1);
1a4: 6a 01 push $0x1
1a6: 53 push %ebx
for(i=0;i<ALLOC_NUM;i++){
1a7: 83 c3 01 add $0x1,%ebx
memset(pages[i], i, 1);
1aa: 50 push %eax
1ab: e8 80 01 00 00 call 330 <memset>
for(i=0;i<ALLOC_NUM;i++){
1b0: 83 c4 10 add $0x10,%esp
1b3: 83 fb 0f cmp $0xf,%ebx
1b6: 75 d8 jne 190 <second_test+0x20>
STAY
1b8: 83 ec 0c sub $0xc,%esp
1bb: 6a 64 push $0x64
1bd: e8 a0 03 00 00 call 562 <sleep>
printf(1,"validate pages\n");
1c2: 58 pop %eax
1c3: 5a pop %edx
1c4: 68 10 0c 00 00 push $0xc10
1c9: 6a 01 push $0x1
1cb: e8 60 04 00 00 call 630 <printf>
1d0: 83 c4 10 add $0x10,%esp
for(i=0;i<ALLOC_NUM;i++){
1d3: 31 c0 xor %eax,%eax
1d5: eb 11 jmp 1e8 <second_test+0x78>
1d7: 89 f6 mov %esi,%esi
1d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
1e0: 83 c0 01 add $0x1,%eax
1e3: 83 f8 0f cmp $0xf,%eax
1e6: 74 18 je 200 <second_test+0x90>
if(pages[i][0] != i){
1e8: 8b 54 85 bc mov -0x44(%ebp,%eax,4),%edx
1ec: 0f be 12 movsbl (%edx),%edx
1ef: 39 c2 cmp %eax,%edx
1f1: 74 ed je 1e0 <second_test+0x70>
return -1;
1f3: b8 ff ff ff ff mov $0xffffffff,%eax
}
1f8: 8b 5d fc mov -0x4(%ebp),%ebx
1fb: c9 leave
1fc: c3 ret
1fd: 8d 76 00 lea 0x0(%esi),%esi
char* extra_pg = malloc(PGSIZE);
200: 83 ec 0c sub $0xc,%esp
203: 68 00 10 00 00 push $0x1000
208: e8 03 07 00 00 call 910 <malloc>
memset(extra_pg,EXRA_DATA,1);
20d: 83 c4 0c add $0xc,%esp
210: 6a 01 push $0x1
212: 6a 12 push $0x12
214: 50 push %eax
215: e8 16 01 00 00 call 330 <memset>
21a: 83 c4 10 add $0x10,%esp
21d: b8 01 00 00 00 mov $0x1,%eax
}
222: 8b 5d fc mov -0x4(%ebp),%ebx
225: c9 leave
226: c3 ret
227: 89 f6 mov %esi,%esi
229: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000230 <third_test>:
int third_test(){
230: 55 push %ebp
231: 89 e5 mov %esp,%ebp
233: 83 ec 50 sub $0x50,%esp
printf(1," Execute Ctrl+P\n");
236: 68 20 0c 00 00 push $0xc20
23b: 6a 01 push $0x1
23d: e8 ee 03 00 00 call 630 <printf>
gets(input, 10);
242: 58 pop %eax
243: 8d 45 c6 lea -0x3a(%ebp),%eax
246: 5a pop %edx
247: 6a 0a push $0xa
249: 50 push %eax
24a: e8 41 01 00 00 call 390 <gets>
printf(1,"allocated pages: %d \npaged out num: %d \nprotected pages num: %d \npage faults num: %d \ntotal paged out num: %d \n", allocated_pg_num, pg_out_num, protected_pg_num, pgflt_num, total_pgout_num );
24f: 83 c4 0c add $0xc,%esp
252: 6a 29 push $0x29
254: 6a 1c push $0x1c
256: ff 35 50 12 00 00 pushl 0x1250
25c: 6a 0d push $0xd
25e: 6a 1d push $0x1d
260: 68 84 0c 00 00 push $0xc84
265: 6a 01 push $0x1
267: e8 c4 03 00 00 call 630 <printf>
}
26c: b8 01 00 00 00 mov $0x1,%eax
271: c9 leave
272: c3 ret
273: 66 90 xchg %ax,%ax
275: 66 90 xchg %ax,%ax
277: 66 90 xchg %ax,%ax
279: 66 90 xchg %ax,%ax
27b: 66 90 xchg %ax,%ax
27d: 66 90 xchg %ax,%ax
27f: 90 nop
00000280 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
280: 55 push %ebp
281: 89 e5 mov %esp,%ebp
283: 53 push %ebx
284: 8b 45 08 mov 0x8(%ebp),%eax
287: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
28a: 89 c2 mov %eax,%edx
28c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
290: 83 c1 01 add $0x1,%ecx
293: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
297: 83 c2 01 add $0x1,%edx
29a: 84 db test %bl,%bl
29c: 88 5a ff mov %bl,-0x1(%edx)
29f: 75 ef jne 290 <strcpy+0x10>
;
return os;
}
2a1: 5b pop %ebx
2a2: 5d pop %ebp
2a3: c3 ret
2a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
2aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000002b0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
2b0: 55 push %ebp
2b1: 89 e5 mov %esp,%ebp
2b3: 53 push %ebx
2b4: 8b 55 08 mov 0x8(%ebp),%edx
2b7: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
2ba: 0f b6 02 movzbl (%edx),%eax
2bd: 0f b6 19 movzbl (%ecx),%ebx
2c0: 84 c0 test %al,%al
2c2: 75 1c jne 2e0 <strcmp+0x30>
2c4: eb 2a jmp 2f0 <strcmp+0x40>
2c6: 8d 76 00 lea 0x0(%esi),%esi
2c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
2d0: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
2d3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
2d6: 83 c1 01 add $0x1,%ecx
2d9: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
2dc: 84 c0 test %al,%al
2de: 74 10 je 2f0 <strcmp+0x40>
2e0: 38 d8 cmp %bl,%al
2e2: 74 ec je 2d0 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
2e4: 29 d8 sub %ebx,%eax
}
2e6: 5b pop %ebx
2e7: 5d pop %ebp
2e8: c3 ret
2e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
2f0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
2f2: 29 d8 sub %ebx,%eax
}
2f4: 5b pop %ebx
2f5: 5d pop %ebp
2f6: c3 ret
2f7: 89 f6 mov %esi,%esi
2f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000300 <strlen>:
uint
strlen(char *s)
{
300: 55 push %ebp
301: 89 e5 mov %esp,%ebp
303: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
306: 80 39 00 cmpb $0x0,(%ecx)
309: 74 15 je 320 <strlen+0x20>
30b: 31 d2 xor %edx,%edx
30d: 8d 76 00 lea 0x0(%esi),%esi
310: 83 c2 01 add $0x1,%edx
313: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
317: 89 d0 mov %edx,%eax
319: 75 f5 jne 310 <strlen+0x10>
;
return n;
}
31b: 5d pop %ebp
31c: c3 ret
31d: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
320: 31 c0 xor %eax,%eax
}
322: 5d pop %ebp
323: c3 ret
324: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
32a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000330 <memset>:
void*
memset(void *dst, int c, uint n)
{
330: 55 push %ebp
331: 89 e5 mov %esp,%ebp
333: 57 push %edi
334: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
337: 8b 4d 10 mov 0x10(%ebp),%ecx
33a: 8b 45 0c mov 0xc(%ebp),%eax
33d: 89 d7 mov %edx,%edi
33f: fc cld
340: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
342: 89 d0 mov %edx,%eax
344: 5f pop %edi
345: 5d pop %ebp
346: c3 ret
347: 89 f6 mov %esi,%esi
349: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000350 <strchr>:
char*
strchr(const char *s, char c)
{
350: 55 push %ebp
351: 89 e5 mov %esp,%ebp
353: 53 push %ebx
354: 8b 45 08 mov 0x8(%ebp),%eax
357: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
35a: 0f b6 10 movzbl (%eax),%edx
35d: 84 d2 test %dl,%dl
35f: 74 1d je 37e <strchr+0x2e>
if(*s == c)
361: 38 d3 cmp %dl,%bl
363: 89 d9 mov %ebx,%ecx
365: 75 0d jne 374 <strchr+0x24>
367: eb 17 jmp 380 <strchr+0x30>
369: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
370: 38 ca cmp %cl,%dl
372: 74 0c je 380 <strchr+0x30>
for(; *s; s++)
374: 83 c0 01 add $0x1,%eax
377: 0f b6 10 movzbl (%eax),%edx
37a: 84 d2 test %dl,%dl
37c: 75 f2 jne 370 <strchr+0x20>
return (char*)s;
return 0;
37e: 31 c0 xor %eax,%eax
}
380: 5b pop %ebx
381: 5d pop %ebp
382: c3 ret
383: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
389: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000390 <gets>:
char*
gets(char *buf, int max)
{
390: 55 push %ebp
391: 89 e5 mov %esp,%ebp
393: 57 push %edi
394: 56 push %esi
395: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
396: 31 f6 xor %esi,%esi
398: 89 f3 mov %esi,%ebx
{
39a: 83 ec 1c sub $0x1c,%esp
39d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
3a0: eb 2f jmp 3d1 <gets+0x41>
3a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
3a8: 8d 45 e7 lea -0x19(%ebp),%eax
3ab: 83 ec 04 sub $0x4,%esp
3ae: 6a 01 push $0x1
3b0: 50 push %eax
3b1: 6a 00 push $0x0
3b3: e8 32 01 00 00 call 4ea <read>
if(cc < 1)
3b8: 83 c4 10 add $0x10,%esp
3bb: 85 c0 test %eax,%eax
3bd: 7e 1c jle 3db <gets+0x4b>
break;
buf[i++] = c;
3bf: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3c3: 83 c7 01 add $0x1,%edi
3c6: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
3c9: 3c 0a cmp $0xa,%al
3cb: 74 23 je 3f0 <gets+0x60>
3cd: 3c 0d cmp $0xd,%al
3cf: 74 1f je 3f0 <gets+0x60>
for(i=0; i+1 < max; ){
3d1: 83 c3 01 add $0x1,%ebx
3d4: 3b 5d 0c cmp 0xc(%ebp),%ebx
3d7: 89 fe mov %edi,%esi
3d9: 7c cd jl 3a8 <gets+0x18>
3db: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
3dd: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
3e0: c6 03 00 movb $0x0,(%ebx)
}
3e3: 8d 65 f4 lea -0xc(%ebp),%esp
3e6: 5b pop %ebx
3e7: 5e pop %esi
3e8: 5f pop %edi
3e9: 5d pop %ebp
3ea: c3 ret
3eb: 90 nop
3ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3f0: 8b 75 08 mov 0x8(%ebp),%esi
3f3: 8b 45 08 mov 0x8(%ebp),%eax
3f6: 01 de add %ebx,%esi
3f8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
3fa: c6 03 00 movb $0x0,(%ebx)
}
3fd: 8d 65 f4 lea -0xc(%ebp),%esp
400: 5b pop %ebx
401: 5e pop %esi
402: 5f pop %edi
403: 5d pop %ebp
404: c3 ret
405: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
409: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000410 <stat>:
int
stat(char *n, struct stat *st)
{
410: 55 push %ebp
411: 89 e5 mov %esp,%ebp
413: 56 push %esi
414: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
415: 83 ec 08 sub $0x8,%esp
418: 6a 00 push $0x0
41a: ff 75 08 pushl 0x8(%ebp)
41d: e8 f0 00 00 00 call 512 <open>
if(fd < 0)
422: 83 c4 10 add $0x10,%esp
425: 85 c0 test %eax,%eax
427: 78 27 js 450 <stat+0x40>
return -1;
r = fstat(fd, st);
429: 83 ec 08 sub $0x8,%esp
42c: ff 75 0c pushl 0xc(%ebp)
42f: 89 c3 mov %eax,%ebx
431: 50 push %eax
432: e8 f3 00 00 00 call 52a <fstat>
close(fd);
437: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
43a: 89 c6 mov %eax,%esi
close(fd);
43c: e8 b9 00 00 00 call 4fa <close>
return r;
441: 83 c4 10 add $0x10,%esp
}
444: 8d 65 f8 lea -0x8(%ebp),%esp
447: 89 f0 mov %esi,%eax
449: 5b pop %ebx
44a: 5e pop %esi
44b: 5d pop %ebp
44c: c3 ret
44d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
450: be ff ff ff ff mov $0xffffffff,%esi
455: eb ed jmp 444 <stat+0x34>
457: 89 f6 mov %esi,%esi
459: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000460 <atoi>:
int
atoi(const char *s)
{
460: 55 push %ebp
461: 89 e5 mov %esp,%ebp
463: 53 push %ebx
464: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
467: 0f be 11 movsbl (%ecx),%edx
46a: 8d 42 d0 lea -0x30(%edx),%eax
46d: 3c 09 cmp $0x9,%al
n = 0;
46f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
474: 77 1f ja 495 <atoi+0x35>
476: 8d 76 00 lea 0x0(%esi),%esi
479: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
480: 8d 04 80 lea (%eax,%eax,4),%eax
483: 83 c1 01 add $0x1,%ecx
486: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
48a: 0f be 11 movsbl (%ecx),%edx
48d: 8d 5a d0 lea -0x30(%edx),%ebx
490: 80 fb 09 cmp $0x9,%bl
493: 76 eb jbe 480 <atoi+0x20>
return n;
}
495: 5b pop %ebx
496: 5d pop %ebp
497: c3 ret
498: 90 nop
499: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000004a0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
4a0: 55 push %ebp
4a1: 89 e5 mov %esp,%ebp
4a3: 56 push %esi
4a4: 53 push %ebx
4a5: 8b 5d 10 mov 0x10(%ebp),%ebx
4a8: 8b 45 08 mov 0x8(%ebp),%eax
4ab: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
4ae: 85 db test %ebx,%ebx
4b0: 7e 14 jle 4c6 <memmove+0x26>
4b2: 31 d2 xor %edx,%edx
4b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
4b8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
4bc: 88 0c 10 mov %cl,(%eax,%edx,1)
4bf: 83 c2 01 add $0x1,%edx
while(n-- > 0)
4c2: 39 d3 cmp %edx,%ebx
4c4: 75 f2 jne 4b8 <memmove+0x18>
return vdst;
}
4c6: 5b pop %ebx
4c7: 5e pop %esi
4c8: 5d pop %ebp
4c9: c3 ret
000004ca <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
4ca: b8 01 00 00 00 mov $0x1,%eax
4cf: cd 40 int $0x40
4d1: c3 ret
000004d2 <exit>:
SYSCALL(exit)
4d2: b8 02 00 00 00 mov $0x2,%eax
4d7: cd 40 int $0x40
4d9: c3 ret
000004da <wait>:
SYSCALL(wait)
4da: b8 03 00 00 00 mov $0x3,%eax
4df: cd 40 int $0x40
4e1: c3 ret
000004e2 <pipe>:
SYSCALL(pipe)
4e2: b8 04 00 00 00 mov $0x4,%eax
4e7: cd 40 int $0x40
4e9: c3 ret
000004ea <read>:
SYSCALL(read)
4ea: b8 05 00 00 00 mov $0x5,%eax
4ef: cd 40 int $0x40
4f1: c3 ret
000004f2 <write>:
SYSCALL(write)
4f2: b8 10 00 00 00 mov $0x10,%eax
4f7: cd 40 int $0x40
4f9: c3 ret
000004fa <close>:
SYSCALL(close)
4fa: b8 15 00 00 00 mov $0x15,%eax
4ff: cd 40 int $0x40
501: c3 ret
00000502 <kill>:
SYSCALL(kill)
502: b8 06 00 00 00 mov $0x6,%eax
507: cd 40 int $0x40
509: c3 ret
0000050a <exec>:
SYSCALL(exec)
50a: b8 07 00 00 00 mov $0x7,%eax
50f: cd 40 int $0x40
511: c3 ret
00000512 <open>:
SYSCALL(open)
512: b8 0f 00 00 00 mov $0xf,%eax
517: cd 40 int $0x40
519: c3 ret
0000051a <mknod>:
SYSCALL(mknod)
51a: b8 11 00 00 00 mov $0x11,%eax
51f: cd 40 int $0x40
521: c3 ret
00000522 <unlink>:
SYSCALL(unlink)
522: b8 12 00 00 00 mov $0x12,%eax
527: cd 40 int $0x40
529: c3 ret
0000052a <fstat>:
SYSCALL(fstat)
52a: b8 08 00 00 00 mov $0x8,%eax
52f: cd 40 int $0x40
531: c3 ret
00000532 <link>:
SYSCALL(link)
532: b8 13 00 00 00 mov $0x13,%eax
537: cd 40 int $0x40
539: c3 ret
0000053a <mkdir>:
SYSCALL(mkdir)
53a: b8 14 00 00 00 mov $0x14,%eax
53f: cd 40 int $0x40
541: c3 ret
00000542 <chdir>:
SYSCALL(chdir)
542: b8 09 00 00 00 mov $0x9,%eax
547: cd 40 int $0x40
549: c3 ret
0000054a <dup>:
SYSCALL(dup)
54a: b8 0a 00 00 00 mov $0xa,%eax
54f: cd 40 int $0x40
551: c3 ret
00000552 <getpid>:
SYSCALL(getpid)
552: b8 0b 00 00 00 mov $0xb,%eax
557: cd 40 int $0x40
559: c3 ret
0000055a <sbrk>:
SYSCALL(sbrk)
55a: b8 0c 00 00 00 mov $0xc,%eax
55f: cd 40 int $0x40
561: c3 ret
00000562 <sleep>:
SYSCALL(sleep)
562: b8 0d 00 00 00 mov $0xd,%eax
567: cd 40 int $0x40
569: c3 ret
0000056a <uptime>:
SYSCALL(uptime)
56a: b8 0e 00 00 00 mov $0xe,%eax
56f: cd 40 int $0x40
571: c3 ret
00000572 <get_flags>:
SYSCALL(get_flags)
572: b8 17 00 00 00 mov $0x17,%eax
577: cd 40 int $0x40
579: c3 ret
0000057a <set_flag>:
SYSCALL(set_flag)
57a: b8 18 00 00 00 mov $0x18,%eax
57f: cd 40 int $0x40
581: c3 ret
00000582 <update_protected_pages>:
SYSCALL(update_protected_pages)
582: b8 19 00 00 00 mov $0x19,%eax
587: cd 40 int $0x40
589: c3 ret
58a: 66 90 xchg %ax,%ax
58c: 66 90 xchg %ax,%ax
58e: 66 90 xchg %ax,%ax
00000590 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
590: 55 push %ebp
591: 89 e5 mov %esp,%ebp
593: 57 push %edi
594: 56 push %esi
595: 53 push %ebx
596: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
599: 85 d2 test %edx,%edx
{
59b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
59e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
5a0: 79 76 jns 618 <printint+0x88>
5a2: f6 45 08 01 testb $0x1,0x8(%ebp)
5a6: 74 70 je 618 <printint+0x88>
x = -xx;
5a8: f7 d8 neg %eax
neg = 1;
5aa: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
5b1: 31 f6 xor %esi,%esi
5b3: 8d 5d d7 lea -0x29(%ebp),%ebx
5b6: eb 0a jmp 5c2 <printint+0x32>
5b8: 90 nop
5b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
5c0: 89 fe mov %edi,%esi
5c2: 31 d2 xor %edx,%edx
5c4: 8d 7e 01 lea 0x1(%esi),%edi
5c7: f7 f1 div %ecx
5c9: 0f b6 92 b8 0d 00 00 movzbl 0xdb8(%edx),%edx
}while((x /= base) != 0);
5d0: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
5d2: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
5d5: 75 e9 jne 5c0 <printint+0x30>
if(neg)
5d7: 8b 45 c4 mov -0x3c(%ebp),%eax
5da: 85 c0 test %eax,%eax
5dc: 74 08 je 5e6 <printint+0x56>
buf[i++] = '-';
5de: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
5e3: 8d 7e 02 lea 0x2(%esi),%edi
5e6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
5ea: 8b 7d c0 mov -0x40(%ebp),%edi
5ed: 8d 76 00 lea 0x0(%esi),%esi
5f0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
5f3: 83 ec 04 sub $0x4,%esp
5f6: 83 ee 01 sub $0x1,%esi
5f9: 6a 01 push $0x1
5fb: 53 push %ebx
5fc: 57 push %edi
5fd: 88 45 d7 mov %al,-0x29(%ebp)
600: e8 ed fe ff ff call 4f2 <write>
while(--i >= 0)
605: 83 c4 10 add $0x10,%esp
608: 39 de cmp %ebx,%esi
60a: 75 e4 jne 5f0 <printint+0x60>
putc(fd, buf[i]);
}
60c: 8d 65 f4 lea -0xc(%ebp),%esp
60f: 5b pop %ebx
610: 5e pop %esi
611: 5f pop %edi
612: 5d pop %ebp
613: c3 ret
614: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
618: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
61f: eb 90 jmp 5b1 <printint+0x21>
621: eb 0d jmp 630 <printf>
623: 90 nop
624: 90 nop
625: 90 nop
626: 90 nop
627: 90 nop
628: 90 nop
629: 90 nop
62a: 90 nop
62b: 90 nop
62c: 90 nop
62d: 90 nop
62e: 90 nop
62f: 90 nop
00000630 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
630: 55 push %ebp
631: 89 e5 mov %esp,%ebp
633: 57 push %edi
634: 56 push %esi
635: 53 push %ebx
636: 83 ec 2c sub $0x2c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
639: 8b 75 0c mov 0xc(%ebp),%esi
63c: 0f b6 1e movzbl (%esi),%ebx
63f: 84 db test %bl,%bl
641: 0f 84 b3 00 00 00 je 6fa <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
647: 8d 45 10 lea 0x10(%ebp),%eax
64a: 83 c6 01 add $0x1,%esi
state = 0;
64d: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
64f: 89 45 d4 mov %eax,-0x2c(%ebp)
652: eb 2f jmp 683 <printf+0x53>
654: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
658: 83 f8 25 cmp $0x25,%eax
65b: 0f 84 a7 00 00 00 je 708 <printf+0xd8>
write(fd, &c, 1);
661: 8d 45 e2 lea -0x1e(%ebp),%eax
664: 83 ec 04 sub $0x4,%esp
667: 88 5d e2 mov %bl,-0x1e(%ebp)
66a: 6a 01 push $0x1
66c: 50 push %eax
66d: ff 75 08 pushl 0x8(%ebp)
670: e8 7d fe ff ff call 4f2 <write>
675: 83 c4 10 add $0x10,%esp
678: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
67b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
67f: 84 db test %bl,%bl
681: 74 77 je 6fa <printf+0xca>
if(state == 0){
683: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
685: 0f be cb movsbl %bl,%ecx
688: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
68b: 74 cb je 658 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
68d: 83 ff 25 cmp $0x25,%edi
690: 75 e6 jne 678 <printf+0x48>
if(c == 'd'){
692: 83 f8 64 cmp $0x64,%eax
695: 0f 84 05 01 00 00 je 7a0 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
69b: 81 e1 f7 00 00 00 and $0xf7,%ecx
6a1: 83 f9 70 cmp $0x70,%ecx
6a4: 74 72 je 718 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
6a6: 83 f8 73 cmp $0x73,%eax
6a9: 0f 84 99 00 00 00 je 748 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
6af: 83 f8 63 cmp $0x63,%eax
6b2: 0f 84 08 01 00 00 je 7c0 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
6b8: 83 f8 25 cmp $0x25,%eax
6bb: 0f 84 ef 00 00 00 je 7b0 <printf+0x180>
write(fd, &c, 1);
6c1: 8d 45 e7 lea -0x19(%ebp),%eax
6c4: 83 ec 04 sub $0x4,%esp
6c7: c6 45 e7 25 movb $0x25,-0x19(%ebp)
6cb: 6a 01 push $0x1
6cd: 50 push %eax
6ce: ff 75 08 pushl 0x8(%ebp)
6d1: e8 1c fe ff ff call 4f2 <write>
6d6: 83 c4 0c add $0xc,%esp
6d9: 8d 45 e6 lea -0x1a(%ebp),%eax
6dc: 88 5d e6 mov %bl,-0x1a(%ebp)
6df: 6a 01 push $0x1
6e1: 50 push %eax
6e2: ff 75 08 pushl 0x8(%ebp)
6e5: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
6e8: 31 ff xor %edi,%edi
write(fd, &c, 1);
6ea: e8 03 fe ff ff call 4f2 <write>
for(i = 0; fmt[i]; i++){
6ef: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
6f3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
6f6: 84 db test %bl,%bl
6f8: 75 89 jne 683 <printf+0x53>
}
}
}
6fa: 8d 65 f4 lea -0xc(%ebp),%esp
6fd: 5b pop %ebx
6fe: 5e pop %esi
6ff: 5f pop %edi
700: 5d pop %ebp
701: c3 ret
702: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
708: bf 25 00 00 00 mov $0x25,%edi
70d: e9 66 ff ff ff jmp 678 <printf+0x48>
712: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
718: 83 ec 0c sub $0xc,%esp
71b: b9 10 00 00 00 mov $0x10,%ecx
720: 6a 00 push $0x0
722: 8b 7d d4 mov -0x2c(%ebp),%edi
725: 8b 45 08 mov 0x8(%ebp),%eax
728: 8b 17 mov (%edi),%edx
72a: e8 61 fe ff ff call 590 <printint>
ap++;
72f: 89 f8 mov %edi,%eax
731: 83 c4 10 add $0x10,%esp
state = 0;
734: 31 ff xor %edi,%edi
ap++;
736: 83 c0 04 add $0x4,%eax
739: 89 45 d4 mov %eax,-0x2c(%ebp)
73c: e9 37 ff ff ff jmp 678 <printf+0x48>
741: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
748: 8b 45 d4 mov -0x2c(%ebp),%eax
74b: 8b 08 mov (%eax),%ecx
ap++;
74d: 83 c0 04 add $0x4,%eax
750: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
753: 85 c9 test %ecx,%ecx
755: 0f 84 8e 00 00 00 je 7e9 <printf+0x1b9>
while(*s != 0){
75b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
75e: 31 ff xor %edi,%edi
s = (char*)*ap;
760: 89 cb mov %ecx,%ebx
while(*s != 0){
762: 84 c0 test %al,%al
764: 0f 84 0e ff ff ff je 678 <printf+0x48>
76a: 89 75 d0 mov %esi,-0x30(%ebp)
76d: 89 de mov %ebx,%esi
76f: 8b 5d 08 mov 0x8(%ebp),%ebx
772: 8d 7d e3 lea -0x1d(%ebp),%edi
775: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
778: 83 ec 04 sub $0x4,%esp
s++;
77b: 83 c6 01 add $0x1,%esi
77e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
781: 6a 01 push $0x1
783: 57 push %edi
784: 53 push %ebx
785: e8 68 fd ff ff call 4f2 <write>
while(*s != 0){
78a: 0f b6 06 movzbl (%esi),%eax
78d: 83 c4 10 add $0x10,%esp
790: 84 c0 test %al,%al
792: 75 e4 jne 778 <printf+0x148>
794: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
797: 31 ff xor %edi,%edi
799: e9 da fe ff ff jmp 678 <printf+0x48>
79e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
7a0: 83 ec 0c sub $0xc,%esp
7a3: b9 0a 00 00 00 mov $0xa,%ecx
7a8: 6a 01 push $0x1
7aa: e9 73 ff ff ff jmp 722 <printf+0xf2>
7af: 90 nop
write(fd, &c, 1);
7b0: 83 ec 04 sub $0x4,%esp
7b3: 88 5d e5 mov %bl,-0x1b(%ebp)
7b6: 8d 45 e5 lea -0x1b(%ebp),%eax
7b9: 6a 01 push $0x1
7bb: e9 21 ff ff ff jmp 6e1 <printf+0xb1>
putc(fd, *ap);
7c0: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
7c3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
7c6: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
7c8: 6a 01 push $0x1
ap++;
7ca: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
7cd: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
7d0: 8d 45 e4 lea -0x1c(%ebp),%eax
7d3: 50 push %eax
7d4: ff 75 08 pushl 0x8(%ebp)
7d7: e8 16 fd ff ff call 4f2 <write>
ap++;
7dc: 89 7d d4 mov %edi,-0x2c(%ebp)
7df: 83 c4 10 add $0x10,%esp
state = 0;
7e2: 31 ff xor %edi,%edi
7e4: e9 8f fe ff ff jmp 678 <printf+0x48>
s = "(null)";
7e9: bb b0 0d 00 00 mov $0xdb0,%ebx
while(*s != 0){
7ee: b8 28 00 00 00 mov $0x28,%eax
7f3: e9 72 ff ff ff jmp 76a <printf+0x13a>
7f8: 66 90 xchg %ax,%ax
7fa: 66 90 xchg %ax,%ax
7fc: 66 90 xchg %ax,%ax
7fe: 66 90 xchg %ax,%ax
00000800 <free>:
static Header base;
static Header *freep;
void
free(void *ap) {
800: 55 push %ebp
Header *bp, *p;
bp = (Header *) ap - 1;
for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
801: a1 54 12 00 00 mov 0x1254,%eax
free(void *ap) {
806: 89 e5 mov %esp,%ebp
808: 57 push %edi
809: 56 push %esi
80a: 53 push %ebx
80b: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header *) ap - 1;
80e: 8d 4b f8 lea -0x8(%ebx),%ecx
811: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
818: 39 c8 cmp %ecx,%eax
81a: 8b 10 mov (%eax),%edx
81c: 73 32 jae 850 <free+0x50>
81e: 39 d1 cmp %edx,%ecx
820: 72 04 jb 826 <free+0x26>
if (p >= p->s.ptr && (bp > p || bp < p->s.ptr))
822: 39 d0 cmp %edx,%eax
824: 72 32 jb 858 <free+0x58>
break;
if (bp + bp->s.size == p->s.ptr) {
826: 8b 73 fc mov -0x4(%ebx),%esi
829: 8d 3c f1 lea (%ecx,%esi,8),%edi
82c: 39 fa cmp %edi,%edx
82e: 74 30 je 860 <free+0x60>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
830: 89 53 f8 mov %edx,-0x8(%ebx)
if (p + p->s.size == bp) {
833: 8b 50 04 mov 0x4(%eax),%edx
836: 8d 34 d0 lea (%eax,%edx,8),%esi
839: 39 f1 cmp %esi,%ecx
83b: 74 3a je 877 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
83d: 89 08 mov %ecx,(%eax)
freep = p;
83f: a3 54 12 00 00 mov %eax,0x1254
}
844: 5b pop %ebx
845: 5e pop %esi
846: 5f pop %edi
847: 5d pop %ebp
848: c3 ret
849: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if (p >= p->s.ptr && (bp > p || bp < p->s.ptr))
850: 39 d0 cmp %edx,%eax
852: 72 04 jb 858 <free+0x58>
854: 39 d1 cmp %edx,%ecx
856: 72 ce jb 826 <free+0x26>
free(void *ap) {
858: 89 d0 mov %edx,%eax
85a: eb bc jmp 818 <free+0x18>
85c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
860: 03 72 04 add 0x4(%edx),%esi
863: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
866: 8b 10 mov (%eax),%edx
868: 8b 12 mov (%edx),%edx
86a: 89 53 f8 mov %edx,-0x8(%ebx)
if (p + p->s.size == bp) {
86d: 8b 50 04 mov 0x4(%eax),%edx
870: 8d 34 d0 lea (%eax,%edx,8),%esi
873: 39 f1 cmp %esi,%ecx
875: 75 c6 jne 83d <free+0x3d>
p->s.size += bp->s.size;
877: 03 53 fc add -0x4(%ebx),%edx
freep = p;
87a: a3 54 12 00 00 mov %eax,0x1254
p->s.size += bp->s.size;
87f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
882: 8b 53 f8 mov -0x8(%ebx),%edx
885: 89 10 mov %edx,(%eax)
}
887: 5b pop %ebx
888: 5e pop %esi
889: 5f pop %edi
88a: 5d pop %ebp
88b: c3 ret
88c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000890 <morecore>:
static Header*
morecore(uint nu, int pmalloced)
{
890: 55 push %ebp
char *p;
Header *hp;
if(nu < 4096 && !pmalloced)
891: 3d ff 0f 00 00 cmp $0xfff,%eax
{
896: 89 e5 mov %esp,%ebp
898: 56 push %esi
899: 53 push %ebx
89a: 89 c3 mov %eax,%ebx
if(nu < 4096 && !pmalloced)
89c: 77 52 ja 8f0 <morecore+0x60>
89e: 83 e2 01 and $0x1,%edx
8a1: 75 4d jne 8f0 <morecore+0x60>
8a3: be 00 80 00 00 mov $0x8000,%esi
nu = 4096;
8a8: bb 00 10 00 00 mov $0x1000,%ebx
printf(1 , "enter morecore %d\n", nu);
8ad: 83 ec 04 sub $0x4,%esp
8b0: 53 push %ebx
8b1: 68 c9 0d 00 00 push $0xdc9
8b6: 6a 01 push $0x1
8b8: e8 73 fd ff ff call 630 <printf>
p = sbrk(nu * sizeof(Header));
8bd: 89 34 24 mov %esi,(%esp)
8c0: e8 95 fc ff ff call 55a <sbrk>
if(p == (char*)-1)
8c5: 83 c4 10 add $0x10,%esp
8c8: 83 f8 ff cmp $0xffffffff,%eax
8cb: 74 33 je 900 <morecore+0x70>
return 0;
hp = (Header*)p;
hp->s.size = nu;
8cd: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
8d0: 83 ec 0c sub $0xc,%esp
8d3: 83 c0 08 add $0x8,%eax
8d6: 50 push %eax
8d7: e8 24 ff ff ff call 800 <free>
return freep;
8dc: a1 54 12 00 00 mov 0x1254,%eax
8e1: 83 c4 10 add $0x10,%esp
}
8e4: 8d 65 f8 lea -0x8(%ebp),%esp
8e7: 5b pop %ebx
8e8: 5e pop %esi
8e9: 5d pop %ebp
8ea: c3 ret
8eb: 90 nop
8ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
8f0: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
8f7: eb b4 jmp 8ad <morecore+0x1d>
8f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
return 0;
900: 31 c0 xor %eax,%eax
902: eb e0 jmp 8e4 <morecore+0x54>
904: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
90a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000910 <malloc>:
void*
malloc(uint nbytes)
{
910: 55 push %ebp
911: 89 e5 mov %esp,%ebp
913: 57 push %edi
914: 56 push %esi
915: 53 push %ebx
916: 83 ec 10 sub $0x10,%esp
919: 8b 75 08 mov 0x8(%ebp),%esi
Header *p, *prevp;
uint nunits;
printf(1, "nbytes:%d\n",nbytes);
91c: 56 push %esi
91d: 68 dc 0d 00 00 push $0xddc
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
922: 83 c6 07 add $0x7,%esi
printf(1, "nbytes:%d\n",nbytes);
925: 6a 01 push $0x1
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
927: c1 ee 03 shr $0x3,%esi
92a: 83 c6 01 add $0x1,%esi
printf(1, "nbytes:%d\n",nbytes);
92d: e8 fe fc ff ff call 630 <printf>
if((prevp = freep) == 0){
932: 8b 3d 54 12 00 00 mov 0x1254,%edi
938: 83 c4 10 add $0x10,%esp
93b: 85 ff test %edi,%edi
93d: 0f 84 d5 00 00 00 je a18 <malloc+0x108>
943: 8b 1f mov (%edi),%ebx
945: 8b 53 04 mov 0x4(%ebx),%edx
948: eb 0f jmp 959 <malloc+0x49>
94a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1,"prevp = freep == 0\n");
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
950: 8b 03 mov (%ebx),%eax
printf(1,"inside loop p->s.size = %d\n",p->s.size);
952: 89 df mov %ebx,%edi
954: 8b 50 04 mov 0x4(%eax),%edx
957: 89 c3 mov %eax,%ebx
959: 83 ec 04 sub $0x4,%esp
95c: 52 push %edx
95d: 68 fb 0d 00 00 push $0xdfb
962: 6a 01 push $0x1
964: e8 c7 fc ff ff call 630 <printf>
if(p->s.size >= nunits){
969: 8b 43 04 mov 0x4(%ebx),%eax
96c: 83 c4 10 add $0x10,%esp
96f: 39 f0 cmp %esi,%eax
971: 73 3d jae 9b0 <malloc+0xa0>
}
printf(1,"returning p+1\n");
freep = prevp;
return (void*)(p + 1);
}
if(p == freep){
973: 39 1d 54 12 00 00 cmp %ebx,0x1254
979: 75 d5 jne 950 <malloc+0x40>
printf(1, "calling morecore: 0x%x\n", p);
97b: 83 ec 04 sub $0x4,%esp
97e: 53 push %ebx
97f: 68 5f 0e 00 00 push $0xe5f
984: 6a 01 push $0x1
986: e8 a5 fc ff ff call 630 <printf>
if((p = morecore(nunits,0)) == 0)
98b: 31 d2 xor %edx,%edx
98d: 89 f0 mov %esi,%eax
98f: e8 fc fe ff ff call 890 <morecore>
994: 83 c4 10 add $0x10,%esp
997: 85 c0 test %eax,%eax
999: 89 c3 mov %eax,%ebx
99b: 75 b3 jne 950 <malloc+0x40>
return 0;
}}
}
99d: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
9a0: 31 c0 xor %eax,%eax
}
9a2: 5b pop %ebx
9a3: 5e pop %esi
9a4: 5f pop %edi
9a5: 5d pop %ebp
9a6: c3 ret
9a7: 89 f6 mov %esi,%esi
9a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
if(p->s.size == nunits){
9b0: 74 46 je 9f8 <malloc+0xe8>
printf(1,"p->s.size (%d) =! nunits(%d)\n",p->s.size,nunits);
9b2: 56 push %esi
9b3: 50 push %eax
9b4: 68 32 0e 00 00 push $0xe32
9b9: 6a 01 push $0x1
9bb: e8 70 fc ff ff call 630 <printf>
p->s.size -= nunits;
9c0: 8b 43 04 mov 0x4(%ebx),%eax
p->s.size = nunits;
9c3: 83 c4 10 add $0x10,%esp
p->s.size -= nunits;
9c6: 29 f0 sub %esi,%eax
9c8: 89 43 04 mov %eax,0x4(%ebx)
p += p->s.size;
9cb: 8d 1c c3 lea (%ebx,%eax,8),%ebx
p->s.size = nunits;
9ce: 89 73 04 mov %esi,0x4(%ebx)
printf(1,"returning p+1\n");
9d1: 83 ec 08 sub $0x8,%esp
9d4: 68 50 0e 00 00 push $0xe50
9d9: 6a 01 push $0x1
9db: e8 50 fc ff ff call 630 <printf>
freep = prevp;
9e0: 89 3d 54 12 00 00 mov %edi,0x1254
return (void*)(p + 1);
9e6: 83 c4 10 add $0x10,%esp
}
9e9: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
9ec: 8d 43 08 lea 0x8(%ebx),%eax
}
9ef: 5b pop %ebx
9f0: 5e pop %esi
9f1: 5f pop %edi
9f2: 5d pop %ebp
9f3: c3 ret
9f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1,"p->s.size == nunits == %d\n",nunits);
9f8: 83 ec 04 sub $0x4,%esp
9fb: 56 push %esi
9fc: 68 17 0e 00 00 push $0xe17
a01: 6a 01 push $0x1
a03: e8 28 fc ff ff call 630 <printf>
prevp->s.ptr = p->s.ptr;}
a08: 8b 03 mov (%ebx),%eax
a0a: 83 c4 10 add $0x10,%esp
a0d: 89 07 mov %eax,(%edi)
a0f: eb c0 jmp 9d1 <malloc+0xc1>
a11: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printf(1,"prevp = freep == 0\n");
a18: 83 ec 08 sub $0x8,%esp
base.s.size = 0;
a1b: bb 58 12 00 00 mov $0x1258,%ebx
printf(1,"prevp = freep == 0\n");
a20: 68 e7 0d 00 00 push $0xde7
a25: 6a 01 push $0x1
base.s.ptr = freep = prevp = &base;
a27: 89 df mov %ebx,%edi
printf(1,"prevp = freep == 0\n");
a29: e8 02 fc ff ff call 630 <printf>
base.s.ptr = freep = prevp = &base;
a2e: c7 05 54 12 00 00 58 movl $0x1258,0x1254
a35: 12 00 00
a38: c7 05 58 12 00 00 58 movl $0x1258,0x1258
a3f: 12 00 00
base.s.size = 0;
a42: 83 c4 10 add $0x10,%esp
a45: c7 05 5c 12 00 00 00 movl $0x0,0x125c
a4c: 00 00 00
a4f: 31 d2 xor %edx,%edx
a51: e9 03 ff ff ff jmp 959 <malloc+0x49>
a56: 8d 76 00 lea 0x0(%esi),%esi
a59: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000a60 <pmalloc>:
void *
pmalloc(void) {
Header *p, *prevp;
uint nunits = 512;
uint page_size = (4096 / 8) ;
if ((prevp = freep) == 0) {
a60: 8b 0d 54 12 00 00 mov 0x1254,%ecx
pmalloc(void) {
a66: 55 push %ebp
a67: 89 e5 mov %esp,%ebp
a69: 56 push %esi
a6a: 53 push %ebx
if ((prevp = freep) == 0) {
a6b: 85 c9 test %ecx,%ecx
a6d: 0f 84 95 00 00 00 je b08 <pmalloc+0xa8>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) {
a73: 8b 19 mov (%ecx),%ebx
if (p->s.size >= ((4096 / 8)*2)) {
a75: 8b 53 04 mov 0x4(%ebx),%edx
a78: 81 fa ff 03 00 00 cmp $0x3ff,%edx
a7e: 76 1d jbe a9d <pmalloc+0x3d>
a80: eb 3f jmp ac1 <pmalloc+0x61>
a82: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) {
a88: 8b 03 mov (%ebx),%eax
if (p->s.size >= ((4096 / 8)*2)) {
a8a: 8b 50 04 mov 0x4(%eax),%edx
a8d: 81 fa ff 03 00 00 cmp $0x3ff,%edx
a93: 77 30 ja ac5 <pmalloc+0x65>
a95: 8b 0d 54 12 00 00 mov 0x1254,%ecx
a9b: 89 c3 mov %eax,%ebx
freep = prevp;
return (void *) (p + 1);
}
if (p == freep) {
a9d: 39 cb cmp %ecx,%ebx
a9f: 75 e7 jne a88 <pmalloc+0x28>
if ((p = morecore(nunits, 1)) == 0) {
aa1: ba 01 00 00 00 mov $0x1,%edx
aa6: b8 00 02 00 00 mov $0x200,%eax
aab: e8 e0 fd ff ff call 890 <morecore>
ab0: 85 c0 test %eax,%eax
ab2: 89 c3 mov %eax,%ebx
ab4: 75 d2 jne a88 <pmalloc+0x28>
return 0;
}
}
}
}
ab6: 8d 65 f8 lea -0x8(%ebp),%esp
return 0;
ab9: 31 f6 xor %esi,%esi
}
abb: 89 f0 mov %esi,%eax
abd: 5b pop %ebx
abe: 5e pop %esi
abf: 5d pop %ebp
ac0: c3 ret
if (p->s.size >= ((4096 / 8)*2)) {
ac1: 89 d8 mov %ebx,%eax
ac3: 89 cb mov %ecx,%ebx
p->s.size = (p->s.size / page_size -1 ) * page_size -1;
ac5: 81 e2 00 fe ff ff and $0xfffffe00,%edx
set_flag((uint) (p + 1), PTE_1, 1);
acb: 83 ec 04 sub $0x4,%esp
p->s.size = (p->s.size / page_size -1 ) * page_size -1;
ace: 81 ea 01 02 00 00 sub $0x201,%edx
p += p->s.size;
ad4: 8d 34 d0 lea (%eax,%edx,8),%esi
p->s.size = (p->s.size / page_size -1 ) * page_size -1;
ad7: 89 50 04 mov %edx,0x4(%eax)
set_flag((uint) (p + 1), PTE_1, 1);
ada: 83 c6 08 add $0x8,%esi
p->s.size = nunits;
add: c7 46 fc 00 02 00 00 movl $0x200,-0x4(%esi)
set_flag((uint) (p + 1), PTE_1, 1);
ae4: 6a 01 push $0x1
ae6: 68 00 04 00 00 push $0x400
aeb: 56 push %esi
aec: e8 89 fa ff ff call 57a <set_flag>
freep = prevp;
af1: 89 1d 54 12 00 00 mov %ebx,0x1254
return (void *) (p + 1);
af7: 83 c4 10 add $0x10,%esp
}
afa: 8d 65 f8 lea -0x8(%ebp),%esp
afd: 89 f0 mov %esi,%eax
aff: 5b pop %ebx
b00: 5e pop %esi
b01: 5d pop %ebp
b02: c3 ret
b03: 90 nop
b04: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
base.s.size = 0;
b08: b9 58 12 00 00 mov $0x1258,%ecx
base.s.ptr = freep = prevp = &base;
b0d: c7 05 54 12 00 00 58 movl $0x1258,0x1254
b14: 12 00 00
b17: c7 05 58 12 00 00 58 movl $0x1258,0x1258
b1e: 12 00 00
base.s.size = 0;
b21: c7 05 5c 12 00 00 00 movl $0x0,0x125c
b28: 00 00 00
for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) {
b2b: 89 cb mov %ecx,%ebx
b2d: e9 6b ff ff ff jmp a9d <pmalloc+0x3d>
b32: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
b39: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000b40 <protect_page>:
// update_protected_pages(1);
// set_flag((uint) ap, PTE_W, 0);
// return 1;}
int
protect_page(void* ap){
b40: 55 push %ebp
b41: 89 e5 mov %esp,%ebp
b43: 53 push %ebx
b44: 83 ec 04 sub $0x4,%esp
b47: 8b 5d 08 mov 0x8(%ebp),%ebx
if((int)(ap-8) % PGSIZE != 0){
b4a: 8d 43 f8 lea -0x8(%ebx),%eax
b4d: a9 ff 0f 00 00 test $0xfff,%eax
b52: 75 3c jne b90 <protect_page+0x50>
return -1;
}
int flags = get_flags((uint)ap);
b54: 83 ec 0c sub $0xc,%esp
b57: 53 push %ebx
b58: e8 15 fa ff ff call 572 <get_flags>
if (flags & PTE_1) {
b5d: 83 c4 10 add $0x10,%esp
b60: f6 c4 04 test $0x4,%ah
b63: 74 2b je b90 <protect_page+0x50>
set_flag((uint) ap, PTE_W, 0);
b65: 83 ec 04 sub $0x4,%esp
b68: 6a 00 push $0x0
b6a: 6a 02 push $0x2
b6c: 53 push %ebx
b6d: e8 08 fa ff ff call 57a <set_flag>
update_protected_pages(1);
b72: c7 04 24 01 00 00 00 movl $0x1,(%esp)
b79: e8 04 fa ff ff call 582 <update_protected_pages>
return 1;
b7e: 83 c4 10 add $0x10,%esp
b81: b8 01 00 00 00 mov $0x1,%eax
}
return -1;
}
b86: 8b 5d fc mov -0x4(%ebp),%ebx
b89: c9 leave
b8a: c3 ret
b8b: 90 nop
b8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
b90: b8 ff ff ff ff mov $0xffffffff,%eax
b95: eb ef jmp b86 <protect_page+0x46>
b97: 89 f6 mov %esi,%esi
b99: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000ba0 <pfree>:
int pfree(void *ap){
ba0: 55 push %ebp
ba1: 89 e5 mov %esp,%ebp
ba3: 53 push %ebx
ba4: 83 ec 10 sub $0x10,%esp
ba7: 8b 5d 08 mov 0x8(%ebp),%ebx
int flags = get_flags((uint) ap);
baa: 53 push %ebx
bab: e8 c2 f9 ff ff call 572 <get_flags>
if (!(flags & PTE_W)) set_flag((uint) ap, PTE_W, 1);
bb0: 83 c4 10 add $0x10,%esp
bb3: a8 02 test $0x2,%al
bb5: 75 31 jne be8 <pfree+0x48>
bb7: 83 ec 04 sub $0x4,%esp
bba: 6a 01 push $0x1
bbc: 6a 02 push $0x2
bbe: 53 push %ebx
bbf: e8 b6 f9 ff ff call 57a <set_flag>
else
return -1;
free(ap);
bc4: 89 1c 24 mov %ebx,(%esp)
bc7: e8 34 fc ff ff call 800 <free>
update_protected_pages(0);
bcc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
bd3: e8 aa f9 ff ff call 582 <update_protected_pages>
return 1;
bd8: 83 c4 10 add $0x10,%esp
bdb: b8 01 00 00 00 mov $0x1,%eax
be0: 8b 5d fc mov -0x4(%ebp),%ebx
be3: c9 leave
be4: c3 ret
be5: 8d 76 00 lea 0x0(%esi),%esi
return -1;
be8: b8 ff ff ff ff mov $0xffffffff,%eax
bed: eb f1 jmp be0 <pfree+0x40>
| 35.677791 | 210 | 0.418075 |
b2b0c22941d172d8bf37224cba7a2b935e83bb38 | 467 | asm | Assembly | oeis/313/A313746.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/313/A313746.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/313/A313746.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A313746: Coordination sequence Gal.5.113.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by Jamie Morken(s3)
; 1,5,10,15,20,26,31,36,41,46,51,56,61,66,72,77,82,87,92,97,102,107,112,118,123,128,133,138,143,148,153,158,164,169,174,179,184,189,194,199,204,210,215,220,225,230,235,240,245,250
mov $1,$0
add $0,1
mul $1,45
add $1,$0
sub $1,6
div $1,9
add $1,1
mov $0,$1
| 35.923077 | 179 | 0.713062 |
cc813a92b083904c829363a6dbc12e005e9e78f8 | 12,161 | asm | Assembly | maps/NewBarkTown.asm | pokeachromicdevs/pokeoctober | db74bb68bbfceac07eec6d64674bc24fd4c0b67f | [
"blessing"
] | 1 | 2021-07-05T23:48:37.000Z | 2021-07-05T23:48:37.000Z | maps/NewBarkTown.asm | AtmaBuster/pokeoctober | 12652b84eb2df1a0ed2f654a0ffcfb78202e515f | [
"blessing"
] | 1 | 2020-12-16T01:11:20.000Z | 2020-12-16T22:53:56.000Z | maps/NewBarkTown.asm | AtmaBuster/pokeoctober | 12652b84eb2df1a0ed2f654a0ffcfb78202e515f | [
"blessing"
] | 1 | 2021-07-05T23:33:22.000Z | 2021-07-05T23:33:22.000Z | ; TODO: have the rival choose a starter and then battle you
object_const_def ; object_event constants
const NEWBARKTOWN_TEACHER
const NEWBARKTOWN_FISHER
const NEWBARKTOWN_SILVER
const NEWBARKTOWN_ELM
const NEWBARKTOWN_FISHER_2
const NEWBARKTOWN_SILVER_2
NewBarkTown_MapScripts:
db 3 ; scene scripts
scene_script .DummyScene0 ; SCENE_DEFAULT
scene_script .DummyScene1 ; SCENE_FINISHED
scene_script .SilentTownSilverBattleScript
db 1 ; callbacks
callback MAPCALLBACK_NEWMAP, .FlyPoint
.DummyScene0:
end
.DummyScene1:
end
.FlyPoint:
setflag ENGINE_FLYPOINT_NEW_BARK
clearevent EVENT_FIRST_TIME_BANKING_WITH_MOM
setevent EVENT_ELM_APPEARED_NEW_BARK_TOWN
return
.SilentTownSilverBattleScript:
end
NewBarkTown_RivalGreets:
applymovement NEWBARKTOWN_SILVER, RivalMeetsPlayer
turnobject PLAYER, RIGHT
special FadeOutMusic
playmusic MUSIC_RIVAL_ENCOUNTER
opentext
writetext NewBarkTownRivalText1
waitbutton
closetext
opentext
writetext NewBarkTownRivalText2
special NameMom
waitbutton
closetext
showemote EMOTE_SHOCK, NEWBARKTOWN_SILVER, 15
opentext
writetext NewBarkTownRivalText3
closetext
applymovement NEWBARKTOWN_SILVER, RivalGoesToLab
disappear NEWBARKTOWN_SILVER
setscene SCENE_TEACHER_STOPS
special FadeOutMusic
pause 15
special RestartMapMusic
setevent EVENT_RIVAL_NEW_BARK_TOWN
end
ElmStopsYouScene1:
checkevent EVENT_ELM_NEW_BARK_TOWN
iftrue .skip
setevent EVENT_ELM_NEW_BARK_TOWN
setmapscene ELMS_LAB, SCENE_ELMSLAB_MEETELM
playmusic MUSIC_SHOW_ME_AROUND
opentext
writetext Text_WaitPlayer
waitbutton
closetext
showemote EMOTE_SHOCK, PLAYER, 15
turnobject PLAYER, RIGHT
appear NEWBARKTOWN_ELM
applymovement NEWBARKTOWN_ELM, ElmStopsPlayer1
opentext
writetext Text_ItsDangerousToGoAlone
waitbutton
closetext
setevent EVENT_RIVAL_NEW_BARK_TOWN
follow NEWBARKTOWN_ELM, PLAYER
applymovement NEWBARKTOWN_ELM, ElmTakesPlayerToLab1
stopfollow
playsound SFX_ENTER_DOOR
disappear NEWBARKTOWN_ELM
applymovement PLAYER, PlayerEntersLab
playsound SFX_ENTER_DOOR
special FadeOutPalettes
warpfacing UP, ELMS_LAB, 4, 11
.skip
end
ElmStopsYouScene2:
checkevent EVENT_ELM_NEW_BARK_TOWN
iftrue .skip
setevent EVENT_ELM_NEW_BARK_TOWN
setmapscene ELMS_LAB, SCENE_ELMSLAB_MEETELM
playmusic MUSIC_SHOW_ME_AROUND
opentext
writetext Text_WaitPlayer
waitbutton
closetext
showemote EMOTE_SHOCK, PLAYER, 15
turnobject PLAYER, RIGHT
appear NEWBARKTOWN_ELM
applymovement NEWBARKTOWN_ELM, ElmStopsPlayer2
opentext
writetext Text_ItsDangerousToGoAlone
waitbutton
closetext
setevent EVENT_RIVAL_NEW_BARK_TOWN
follow NEWBARKTOWN_ELM, PLAYER
applymovement NEWBARKTOWN_ELM, ElmTakesPlayerToLab2
stopfollow
playsound SFX_ENTER_DOOR
disappear NEWBARKTOWN_ELM
applymovement PLAYER, PlayerEntersLab
playsound SFX_ENTER_DOOR
special FadeOutPalettes
setevent ProfElmScript
warpfacing UP, ELMS_LAB, 4, 11
.skip
end
NewBarkTownRivalScript:
faceplayer
opentext
writetext Text_GearIsImpressive
waitbutton
closetext
end
NewBarkTownElmScript:
opentext
writetext Text_Study101
waitbutton
closetext
end
NewBarkTownTeacherScript:
faceplayer
opentext
checkevent EVENT_TALKED_TO_MOM_AFTER_MYSTERY_EGG_QUEST
iftrue .CallMom
checkevent EVENT_GAVE_MYSTERY_EGG_TO_ELM
iftrue .TellMomYoureLeaving
checkevent EVENT_GOT_A_POKEMON_FROM_ELM
iftrue .MonIsAdorable
writetext Text_GearIsImpressive
waitbutton
closetext
end
.MonIsAdorable:
writetext Text_YourMonIsAdorable
waitbutton
closetext
end
.TellMomYoureLeaving:
writetext Text_TellMomIfLeaving
waitbutton
closetext
end
.CallMom:
writetext Text_CallMomOnGear
waitbutton
closetext
end
SilentTownSilverBattleScript:
moveobject NEWBARKTOWN_SILVER_2, 7, 14
appear NEWBARKTOWN_SILVER_2
applymovement NEWBARKTOWN_SILVER_2, MovementBattle
special FadeOutMusic
playmusic MUSIC_RIVAL_ENCOUNTER
turnobject PLAYER, LEFT
opentext
writetext TimeToBattle
waitbutton
closetext
checkevent EVENT_GOT_TOTODILE_FROM_ELM
iftrue .TOTODILE
checkevent EVENT_GOT_CHIKORITA_FROM_ELM
iftrue .CHIKORITA
winlosstext SilverEntranceWinText, SilverEntranceLossText
loadtrainer RIVAL1, RIVAL1_1_TOTODILE
writecode VAR_BATTLETYPE, BATTLETYPE_CANLOSE
startbattle
dontrestartmapmusic
reloadmap
iftrue .AfterVictorious
jump .AfterYourDefeat
.TOTODILE:
winlosstext SilverEntranceWinText, SilverEntranceLossText
loadtrainer RIVAL1, RIVAL1_1_CHIKORITA
writecode VAR_BATTLETYPE, BATTLETYPE_CANLOSE
startbattle
dontrestartmapmusic
reloadmap
iftrue .AfterVictorious
jump .AfterYourDefeat
.CHIKORITA:
winlosstext SilverEntranceWinText, SilverEntranceLossText
loadtrainer RIVAL1, RIVAL1_1_CYNDAQUIL
writecode VAR_BATTLETYPE, BATTLETYPE_CANLOSE
startbattle
dontrestartmapmusic
reloadmap
iftrue .AfterVictorious
jump .AfterYourDefeat
.AfterVictorious:
playmusic MUSIC_RIVAL_AFTER
opentext
writetext EntranceRivalText_YouWon
waitbutton
closetext
jump .FinishRival
.AfterYourDefeat:
playmusic MUSIC_RIVAL_AFTER
opentext
writetext EntranceRivalText_YouLost
waitbutton
closetext
.FinishRival:
applymovement ELMENTRANCE_SILVER, SilverAfterBattle
disappear NEWBARKTOWN_SILVER_2
special HealParty
playmapmusic
end
NewBarkTownFisherScript:
jumptextfaceplayer Text_ElmDiscoveredNewMon
NewBarkTownFisher2Script:
jumptextfaceplayer KantoRockText
NewBarkTownSign:
jumptext NewBarkTownSignText
NewBarkTownPlayersHouseSign:
jumptext NewBarkTownPlayersHouseSignText
NewBarkTownElmsLabSign:
jumptext NewBarkTownElmsLabSignText
NewBarkTownElmsHouseSign:
jumptext NewBarkTownElmsHouseSignText
SilverAfterBattle:
step UP
step UP
step UP
step UP
step_end
MovementBattle:
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step_end
ElmTakesPlayerToLab1:
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step DOWN
step DOWN
step DOWN
step DOWN
step DOWN
step DOWN
step DOWN
step DOWN
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step UP
step_end
ElmTakesPlayerToLab2:
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step DOWN
step DOWN
step DOWN
step DOWN
step DOWN
step DOWN
step DOWN
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step UP
step_end
ElmStopsPlayer1:
step UP
step LEFT
step LEFT
step LEFT
step LEFT
step LEFT
step_end
ElmStopsPlayer2:
step LEFT
step LEFT
step LEFT
step LEFT
step LEFT
step_end
RivalMeetsPlayer:
step UP
step UP
step UP
step UP
step UP
step LEFT
step_end
RivalGoesToLab:
step RIGHT
step DOWN
step DOWN
step DOWN
step DOWN
step DOWN
step_end
PlayerEntersLab:
step UP
step_end
Movement_TeacherRunsToYou1_NBT:
step LEFT
step LEFT
step LEFT
step LEFT
step_end
Movement_TeacherRunsToYou2_NBT:
step LEFT
step LEFT
step LEFT
step LEFT
step LEFT
turn_head DOWN
step_end
Movement_TeacherBringsYouBack1_NBT:
step RIGHT
step RIGHT
step RIGHT
step RIGHT
turn_head LEFT
step_end
Movement_TeacherBringsYouBack2_NBT:
step RIGHT
step RIGHT
step RIGHT
step RIGHT
step RIGHT
turn_head LEFT
step_end
Text_Study101:
text "…And if we spend"
line "just a few more"
para "days observing the"
line "#MON living in"
para "ROUTE 101…"
para "…"
para "He seems to be"
line "completely"
cont "occupied…"
done
Text_GearIsImpressive:
text "Wow, your #GEAR"
line "is impressive!"
para "Did your mom get"
line "it for you?"
done
Text_WaitPlayer:
text "Woah! Hold on!"
done
Text_ItsDangerousToGoAlone:
text "Hold your"
line "RAPIDASH!"
para "<PLAY_G>, don't"
line "you know that it's"
cont "a bad idea to just"
para "wander out into"
line "ROUTE 29 without"
para "a #MON? Wild"
line "#MON live in"
cont "the tall grass,"
cont "and who knows"
para "what else could"
line "happen to you out"
cont "in the wild!"
para "Come on, let's"
line "head to my LAB."
done
Text_YourMonIsAdorable:
text "Oh! Your #MON"
line "is adorable!"
cont "I wish I had one!"
done
Text_TellMomIfLeaving:
text "Hi, <PLAY_G>!"
line "Leaving again?"
para "You should tell"
line "your mom if you"
cont "are leaving."
done
Text_CallMomOnGear:
text "Call your mom on"
line "your #GEAR to"
para "let her know how"
line "you're doing."
done
Text_ElmDiscoveredNewMon:
text "Yo, <PLAYER>!"
para "I hear PROF.ELM"
line "discovered some"
cont "new #MON."
done
NewBarkTownRivalText1:
text "<PLAY_G>!"
para "I've been waiting"
line "at the LAB for"
cont "hours, and you're"
para "just coming out"
line "of your house?"
para "Man, are you not"
line "excited to get"
cont "your first"
para "#MON?"
para "Although, you"
line "might've had the"
cont "right idea to stay"
para "home for so long."
line "ELM's been gone,"
cont "and all that"
para "waiting in the"
line "LAB was boring!"
done
NewBarkTownRivalText2:
text "All that boredom's"
line "the only reason I"
cont "left to check on"
para "you!"
para "Anyways… "
para "Well, you, uhh…"
para "What is it that"
line "you call your"
cont "mother again?"
prompt
NewBarkTownRivalText3:
text "Bahaha!"
para "Don't make me"
line "laugh!"
para "Calling her"
line "something so"
cont "childish is"
cont "hilarious!"
para "Well, see ya!"
para "I'm gonna head"
line "back to ELM's!"
done
NewBarkTownSignText:
text "Forever peaceful"
line "SILENT TOWN"
done
NewBarkTownPlayersHouseSignText:
text "<PLAYER>'s House"
done
NewBarkTownElmsLabSignText:
text "ELM #MON LAB"
done
NewBarkTownElmsHouseSignText:
text "ELM'S HOUSE"
done
KantoRockText:
text "Hngh…"
para "Sorry kid, the"
line "route to KANTO"
cont "all blocked off"
para "until I can find a"
line "way to move this"
cont "rock out of the"
para "way."
done
SilverEntranceWinText:
text "Wow! I thought my"
line "#MON would have"
para "been the best!"
done
EntranceRivalText_YouLost:
text "<PLAY_G>! I'm"
line "so ready to show"
para "the world how"
line "great my #MON"
cont "is!"
para "I'll see you"
line "around soon!"
done
SilverEntranceLossText:
text "Alright! My"
line "#MON rules!"
done
EntranceRivalText_YouWon:
text "<PLAY_G>! I'm"
line "so ready to show"
para "the world how"
line "great my #MON"
cont "is!"
para "I'll see you"
line "around soon!"
done
TimeToBattle:
text "<PLAY_G>!"
para "You're not getting"
line "off that easy!"
para "ELM gave us these"
line "#MON, so now"
para "we gotta battle"
line "them!"
para "I'm not gonna hold"
line "back!"
done
NewBarkTown_MapEvents:
db 0, 0 ; filler
db 4 ; warp events
warp_event 13, 13, ELMS_LAB, 1
warp_event 5, 5, PLAYERS_HOUSE_1F, 1
warp_event 3, 13, PLAYERS_NEIGHBORS_HOUSE, 1
warp_event 11, 5, ELMS_HOUSE, 1
db 4 ; coord events
coord_event 1, 6, SCENE_TEACHER_STOPS, ElmStopsYouScene1
coord_event 1, 7, SCENE_TEACHER_STOPS, ElmStopsYouScene2
coord_event 5, 6, SCENE_DEFAULT, NewBarkTown_RivalGreets
coord_event 12, 14, SCENE_ELM_ENTRANCE_BATTLE, SilentTownSilverBattleScript
db 4 ; bg events
bg_event 10, 12, BGEVENT_READ, NewBarkTownSign
bg_event 3, 5, BGEVENT_READ, NewBarkTownPlayersHouseSign
bg_event 14, 13, BGEVENT_READ, NewBarkTownElmsLabSign
bg_event 9, 5, BGEVENT_READ, NewBarkTownElmsHouseSign
db 6 ; object events
object_event 9, 6, SPRITE_TEACHER, SPRITEMOVEDATA_SPINRANDOM_SLOW, 1, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, NewBarkTownTeacherScript, -1
object_event 13, 8, SPRITE_FISHER, SPRITEMOVEDATA_WALK_UP_DOWN, 0, 1, -1, -1, PAL_NPC_GREEN, OBJECTTYPE_SCRIPT, 0, NewBarkTownFisherScript, -1
object_event 7, 11, SPRITE_SILVER, SPRITEMOVEDATA_STANDING_UP, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, NewBarkTownRivalScript, EVENT_RIVAL_NEW_BARK_TOWN
object_event 7, 7, SPRITE_ELM, SPRITEMOVEDATA_STANDING_LEFT, 0, 0, -1, -1, PAL_NPC_BROWN, OBJECTTYPE_SCRIPT, 0, NewBarkTownElmScript, EVENT_ELM_APPEARED_NEW_BARK_TOWN
object_event 19, 8, SPRITE_FISHER, SPRITEMOVEDATA_STANDING_UP, 0, 1, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_SCRIPT, 0, NewBarkTownFisher2Script, -1
object_event 7, 14, SPRITE_SILVER, SPRITEMOVEDATA_STANDING_RIGHT, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, SilentTownSilverBattleScript, SCENE_ELM_ENTRANCE_BATTLE
| 19.091052 | 169 | 0.787271 |
512588270610b6a17c8394dac0d3853101608af1 | 1,157 | asm | Assembly | libsrc/_DEVELOPMENT/stdio/z80/output_helpers/__stdio_printf_c.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/stdio/z80/output_helpers/__stdio_printf_c.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/stdio/z80/output_helpers/__stdio_printf_c.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
SECTION code_clib
SECTION code_stdio
PUBLIC __stdio_printf_c
EXTERN __stdio_nextarg_hl
EXTERN __stdio_send_output_chars, __stdio_printf_padding_width_hl
__stdio_printf_c:
; %c converter called from vfprintf()
;
; enter : ix = FILE*
; hl = void *stack_param
; stack = buffer_digits, width, precision
;
; exit : carry set if stream error
pop de ; junk precision
call __stdio_nextarg_hl ; l = char
bit 2,(ix+5) ; left justify ?
jr nz, left_justify
right_justify:
ex (sp),hl ; hl = width
call width_padding ; satisfy width
pop de ; e = char
pop hl ; junk buffer_digits
ret c ; if stream error
output_char:
ld bc,1
jp __stdio_send_output_chars
left_justify:
ld e,l
call output_char
pop hl ; hl = width
pop de ; junk buffer_digits
ret c ; if stream error
width_padding:
ld a,h
or l
ret z
dec hl
jp __stdio_printf_padding_width_hl
| 19.610169 | 65 | 0.553155 |
f239465b4d4209aab0cbc70d23834fcca8f7cd0e | 1,689 | asm | Assembly | week1/fifo/src/shellcode.asm | LJP-TW/NYCU-Secure-Programming | 22f4a2a3894849548455981dd435e38b3ecf64f0 | [
"MIT"
] | 18 | 2022-01-20T15:10:30.000Z | 2022-03-09T07:22:34.000Z | week1/fifo/src/shellcode.asm | kddco/NYCU-Secure-Programming | 22f4a2a3894849548455981dd435e38b3ecf64f0 | [
"MIT"
] | null | null | null | week1/fifo/src/shellcode.asm | kddco/NYCU-Secure-Programming | 22f4a2a3894849548455981dd435e38b3ecf64f0 | [
"MIT"
] | 5 | 2022-01-21T04:44:49.000Z | 2022-03-19T19:51:07.000Z | global _start
section .text
_start:
mov rbp, rsp
; socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
mov rax, 41
mov rdi, 2
mov rsi, 2
mov rdx, 0x11
syscall
mov dword [rbp - 8], eax
; setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (void *) &broadcastPermission,
; sizeof(broadcastPermission))
mov rdi, rax
mov rax, 54
mov rsi, 0x1
mov rdx, 0x6
lea r10, [rbp - 0x10]
mov dword [rbp - 0x10], 1
mov r8, 4
syscall
; /* Broadcast sendString in datagram to clients every 3 seconds*/
LOOP:
; sendto(sock, sendString, sendStringLen, 0, (struct sockaddr *) &broadcastAddr, sizeof(broadcastAddr)))
mov byte [rbp - 0x30], 2
mov byte [rbp - 0x30 + 1], 0
mov byte [rbp - 0x30 + 2], 0x22
mov byte [rbp - 0x30 + 3], 0xad
mov byte [rbp - 0x30 + 4], 0xc0
mov byte [rbp - 0x30 + 5], 0xa8
mov byte [rbp - 0x30 + 6], 0x82
mov byte [rbp - 0x30 + 7], 1
mov byte [rbp - 0x30 + 8], 0
mov byte [rbp - 0x30 + 9], 0
mov byte [rbp - 0x30 + 10], 0
mov byte [rbp - 0x30 + 11], 0
mov byte [rbp - 0x30 + 12], 0
mov byte [rbp - 0x30 + 13], 0
mov byte [rbp - 0x30 + 14], 0
mov byte [rbp - 0x30 + 15], 0
xor rdi, rdi
mov edi, [rbp - 8]
lea rsi, [rsp + 0x18]
mov rdx, 24
mov r10, 0
lea r8, [rbp - 0x30]
mov r9, 16
mov rax, 44
syscall
; clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=3, tv_nsec=0}
mov rax, 230
mov rdi, 0
mov rsi, 0
lea rdx, [rbp - 0x20]
mov qword [rbp - 0x20], 3
mov qword [rbp - 0x20 + 8], 0
mov r10, 0
syscall
jmp LOOP
section .data
flag: db "NotFLAG{Hello_Baby_Reverser}", 0 | 26.390625 | 108 | 0.5672 |
47fa3c43397550bc9612e94fabc4da4cd5e38713 | 6,065 | asm | Assembly | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_1467.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_1467.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_1467.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 %r15
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0xbedc, %r12
nop
nop
nop
nop
nop
sub $3632, %r15
movl $0x61626364, (%r12)
nop
nop
nop
nop
add $64041, %r10
lea addresses_A_ht+0x1b67e, %r13
clflush (%r13)
nop
nop
nop
nop
cmp $49671, %rsi
movb (%r13), %dl
add $45107, %r15
lea addresses_D_ht+0x133e, %rsi
lea addresses_normal_ht+0x1bb3e, %rdi
nop
nop
nop
nop
nop
add %rdx, %rdx
mov $57, %rcx
rep movsq
nop
nop
nop
nop
dec %r10
lea addresses_A_ht+0x1efc2, %rsi
lea addresses_A_ht+0x111fe, %rdi
nop
nop
nop
nop
inc %r13
mov $52, %rcx
rep movsl
nop
nop
nop
nop
nop
sub $6503, %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r14
push %r8
push %rax
push %rbx
push %rdi
push %rsi
// Store
lea addresses_PSE+0x1617e, %rdi
nop
nop
nop
add $42727, %rbx
movb $0x51, (%rdi)
sub $23193, %r11
// Store
lea addresses_UC+0x68d2, %rax
nop
nop
nop
nop
nop
cmp %r8, %r8
mov $0x5152535455565758, %r11
movq %r11, %xmm4
vmovups %ymm4, (%rax)
nop
nop
nop
nop
add %r8, %r8
// Store
lea addresses_PSE+0x1d77e, %rax
nop
nop
nop
nop
nop
cmp %r14, %r14
mov $0x5152535455565758, %r11
movq %r11, (%rax)
nop
nop
xor %r11, %r11
// Store
lea addresses_D+0x933e, %r8
nop
nop
nop
nop
cmp $32715, %r14
mov $0x5152535455565758, %rbx
movq %rbx, %xmm6
vmovups %ymm6, (%r8)
nop
nop
nop
xor %rsi, %rsi
// Faulty Load
lea addresses_PSE+0xfb3e, %r14
clflush (%r14)
nop
dec %rsi
movb (%r14), %bl
lea oracles, %rax
and $0xff, %rbx
shlq $12, %rbx
mov (%rax,%rbx,1), %rbx
pop %rsi
pop %rdi
pop %rbx
pop %rax
pop %r8
pop %r14
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 1, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_UC', 'same': False, 'size': 32, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_PSE', 'same': False, 'size': 8, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_D', 'same': False, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 4, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 1, 'congruent': 5, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': True}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'OP': 'REPM'}
{'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
*/
| 34.265537 | 2,999 | 0.658862 |
94faa35747289274ff40dd5d4f597929b3e5b1f1 | 1,733 | asm | Assembly | libsrc/stdio/mz2500/generic_console.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null | libsrc/stdio/mz2500/generic_console.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | null | null | null | libsrc/stdio/mz2500/generic_console.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1 | 2019-12-03T23:28:20.000Z | 2019-12-03T23:28:20.000Z | ;
;
SECTION code_clib
PUBLIC generic_console_cls
PUBLIC generic_console_vpeek
PUBLIC generic_console_scrollup
PUBLIC generic_console_printc
PUBLIC generic_console_ioctl
PUBLIC generic_console_set_ink
PUBLIC generic_console_set_paper
PUBLIC generic_console_set_inverse
EXTERN __console_w
EXTERN CONSOLE_COLUMNS
EXTERN CONSOLE_ROWS
EXTERN conio_map_colour
INCLUDE "target/mz2500/def/svc.inc"
INCLUDE "ioctl.def"
generic_console_ioctl:
ex de,hl
ld c,(hl) ;bc = where we point to
inc hl
ld b,(hl)
cp IOCTL_GENCON_SET_MODE
jr nz,failure
ld a,c
ld b,@00000001
ld c,40
and a
jr z,setmode
ld b,@00000000
ld c,80
dec a
jr z,setmode
failure:
scf
ret
setmode:
ld a,c
ld (__console_w),a
ld a,b
rst $18
defb _TWID
call generic_console_cls
and a
ret
generic_console_set_inverse:
ret
generic_console_set_ink:
call conio_map_colour
and 7
ld c,a
ld hl,COLORA
ld a,(hl)
and @11111000
or c
ld (COLORA),a
ret
generic_console_set_paper:
ret
generic_console_cls:
xor a
ld hl,0
ld de,(__console_w)
rst $18
defb _TCLR
ret
generic_console_scrollup:
push de
push bc
xor a
rst $18
defb _TSCRL
pop bc
pop de
ret
; c = x
; b = y
; a = d = character to print
; e = raw
generic_console_printc:
ld a,c
ld (CURX),a
ld a,b
ld (CURY),a
ld a,d
rst $18
defb _CRT1C
ret
ret
;Entry: c = x,
; b = y
; e = rawmode
;Exit: nc = success
; a = character,
; c = failure
generic_console_vpeek:
ld l,c
ld h,b
ld c,1
rst $18
defb _TGET
ld a,(de)
and a
ret
SECTION data_clib
SECTION bss_clib
| 13.975806 | 59 | 0.646278 |
676c2c0f9abf923f5f573508e4e780ae1c2e07c6 | 198 | asm | Assembly | libsrc/_DEVELOPMENT/arch/sms/misc/c/sdcc_iy/sms_border.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/arch/sms/misc/c/sdcc_iy/sms_border.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/arch/sms/misc/c/sdcc_iy/sms_border.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ; void sms_border(uchar colour)
SECTION code_clib
SECTION code_arch
PUBLIC _sms_border
EXTERN asm_sms_border
_sms_border:
pop af
pop hl
push hl
push af
jp asm_sms_border
| 10.421053 | 31 | 0.722222 |
edcab329261677c25d54945353844e4323e8815d | 429 | asm | Assembly | programs/oeis/125/A125651.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/125/A125651.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/125/A125651.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A125651: Numbers k such that A125650(k) is a perfect square.
; 1,3,24,147,864,5043,29400,171363,998784,5821347,33929304,197754483,1152597600,6717831123,39154389144,228208503747,1330096633344,7752371296323,45184131144600,263352415571283,1534930362283104,8946229758127347
mul $0,2
mov $3,2
lpb $0,1
sub $0,1
add $1,1
add $3,1
mov $2,$3
mov $3,$1
add $3,$1
add $1,$3
sub $1,$2
add $2,2
trn $3,$2
lpe
add $1,1
| 22.578947 | 208 | 0.710956 |
b131877f1215740e581c4c53158f82c7c575bee8 | 15,430 | asm | Assembly | binutils-2.21.1/gcc-4.5.1/gcc/config/sh/lib1funcs-4-300.asm | cberner12/xv6 | 53c4dfef0d48287ca0d0f9d27eab7a6ed7fee845 | [
"MIT-0"
] | 51 | 2015-01-31T01:51:39.000Z | 2022-02-18T02:01:50.000Z | binutils-2.21.1/gcc-4.5.1/gcc/config/sh/lib1funcs-4-300.asm | cberner12/xv6 | 53c4dfef0d48287ca0d0f9d27eab7a6ed7fee845 | [
"MIT-0"
] | 7 | 2017-05-29T09:29:00.000Z | 2019-03-11T16:01:39.000Z | binutils-2.21.1/gcc-4.5.1/gcc/config/sh/lib1funcs-4-300.asm | cberner12/xv6 | 53c4dfef0d48287ca0d0f9d27eab7a6ed7fee845 | [
"MIT-0"
] | 12 | 2015-03-26T08:05:38.000Z | 2022-02-18T02:01:51.000Z | /* Copyright (C) 2004, 2006, 2009 Free Software Foundation, Inc.
This file 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, or (at your option) any
later version.
This file 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.
Under Section 7 of GPL version 3, you are granted additional
permissions described in the GCC Runtime Library Exception, version
3.1, as published by the Free Software Foundation.
You should have received a copy of the GNU General Public License and
a copy of the GCC Runtime Library Exception along with this program;
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
<http://www.gnu.org/licenses/>. */
/* libgcc routines for the STMicroelectronics ST40-300 CPU.
Contributed by J"orn Rennecke joern.rennecke@st.com. */
#include "lib1funcs.h"
#if !__SHMEDIA__
#ifdef L_div_table
#if defined (__SH3__) || defined (__SH3E__) || defined (__SH4__) || defined (__SH4_SINGLE__) || defined (__SH4_SINGLE_ONLY__) || defined (__SH4_NOFPU__)
/* This code used shld, thus is not suitable for SH1 / SH2. */
/* Signed / unsigned division without use of FPU, optimized for SH4-300.
Uses a lookup table for divisors in the range -128 .. +127, and
div1 with case distinction for larger divisors in three more ranges.
The code is lumped together with the table to allow the use of mova. */
#ifdef __LITTLE_ENDIAN__
#define L_LSB 0
#define L_LSWMSB 1
#define L_MSWLSB 2
#else
#define L_LSB 3
#define L_LSWMSB 2
#define L_MSWLSB 1
#endif
.global GLOBAL(udivsi3_i4i)
.global GLOBAL(sdivsi3_i4i)
FUNC(GLOBAL(udivsi3_i4i))
FUNC(GLOBAL(sdivsi3_i4i))
.balign 4
LOCAL(div_ge8m): ! 10 cycles up to here
rotcr r1 ! signed shift must use original sign from r4
div0s r5,r4
mov #24,r7
shld r7,r6
shad r0,r1
rotcl r6
div1 r5,r1
swap.w r5,r0 ! detect -0x80000000 : 0x800000
rotcl r6
swap.w r4,r7
div1 r5,r1
swap.b r7,r7
rotcl r6
or r7,r0
div1 r5,r1
swap.w r0,r7
rotcl r6
or r7,r0
div1 r5,r1
add #-0x80,r0
rotcl r6
extu.w r0,r0
div1 r5,r1
neg r0,r0
rotcl r6
swap.w r0,r0
div1 r5,r1
mov.l @r15+,r7
and r6,r0
rotcl r6
div1 r5,r1
shll2 r0
rotcl r6
exts.b r0,r0
div1 r5,r1
swap.w r0,r0
exts.w r0,r1
exts.b r6,r0
mov.l @r15+,r6
rotcl r0
rts
sub r1,r0
! 31 cycles up to here
.balign 4
LOCAL(udiv_ge64k): ! 3 cycles up to here
mov r4,r0
shlr8 r0
div0u
cmp/hi r0,r5
bt LOCAL(udiv_r8)
mov.l r5,@-r15
shll8 r5
! 7 cycles up to here
.rept 8
div1 r5,r0
.endr
extu.b r4,r1 ! 15 cycles up to here
extu.b r0,r6
xor r1,r0
xor r6,r0
swap.b r6,r6
.rept 8
div1 r5,r0
.endr ! 25 cycles up to here
extu.b r0,r0
mov.l @r15+,r5
or r6,r0
mov.l @r15+,r6
rts
rotcl r0 ! 28 cycles up to here
.balign 4
LOCAL(udiv_r8): ! 6 cycles up to here
mov.l r4,@-r15
shll16 r4
shll8 r4
!
shll r4
mov r0,r1
div1 r5,r1
mov r4,r0
rotcl r0
mov.l @r15+,r4
div1 r5,r1
! 12 cycles up to here
.rept 6
rotcl r0; div1 r5,r1
.endr
mov.l @r15+,r6 ! 24 cycles up to here
rts
rotcl r0
.balign 4
LOCAL(div_ge32k): ! 6 cycles up to here
mov.l r7,@-r15
swap.w r5,r6
exts.b r6,r7
exts.w r6,r6
cmp/eq r6,r7
extu.b r1,r6
bf/s LOCAL(div_ge8m)
cmp/hi r1,r4 ! copy sign bit of r4 into T
rotcr r1 ! signed shift must use original sign from r4
div0s r5,r4
shad r0,r1
shll8 r5
div1 r5,r1
mov r5,r7 ! detect r4 == 0x80000000 && r5 == 0x8000(00)
div1 r5,r1
shlr8 r7
div1 r5,r1
swap.w r4,r0
div1 r5,r1
swap.b r0,r0
div1 r5,r1
or r0,r7
div1 r5,r1
add #-80,r7
div1 r5,r1
swap.w r7,r0
div1 r5,r1
or r0,r7
extu.b r1,r0
xor r6,r1
xor r0,r1
exts.b r0,r0
div1 r5,r1
extu.w r7,r7
div1 r5,r1
neg r7,r7 ! upper 16 bit of r7 == 0 if r4 == 0x80000000 && r5 == 0x8000
div1 r5,r1
and r0,r7
div1 r5,r1
swap.w r7,r7 ! 26 cycles up to here.
div1 r5,r1
shll8 r0
div1 r5,r1
exts.w r7,r7
div1 r5,r1
add r0,r0
div1 r5,r1
sub r7,r0
extu.b r1,r1
mov.l @r15+,r7
rotcl r1
mov.l @r15+,r6
add r1,r0
mov #-8,r1
rts
shad r1,r5 ! 34 cycles up to here
.balign 4
GLOBAL(udivsi3_i4i):
mov.l r6,@-r15
extu.w r5,r6
cmp/eq r5,r6
mov #0x7f,r0
bf LOCAL(udiv_ge64k)
cmp/hi r0,r5
bf LOCAL(udiv_le128)
mov r4,r1
shlr8 r1
div0u
shlr r1
shll16 r6
div1 r6,r1
extu.b r4,r0 ! 7 cycles up to here
.rept 8
div1 r6,r1
.endr ! 15 cycles up to here
xor r1,r0 ! xor dividend with result lsb
.rept 6
div1 r6,r1
.endr
mov.l r7,@-r15 ! 21 cycles up to here
div1 r6,r1
extu.b r0,r7
div1 r6,r1
shll8 r7
extu.w r1,r0
xor r7,r1 ! replace lsb of result with lsb of dividend
div1 r6,r1
mov #0,r7
div1 r6,r1
!
div1 r6,r1
bra LOCAL(div_end)
div1 r6,r1 ! 28 cycles up to here
/* This is link-compatible with a GLOBAL(sdivsi3) call,
but we effectively clobber only r1, macl and mach */
/* Because negative quotients are calculated as one's complements,
-0x80000000 divided by the smallest positive number of a number
range (0x80, 0x8000, 0x800000) causes saturation in the one's
complement representation, and we have to suppress the
one's -> two's complement adjustment. Since positive numbers
don't get such an adjustment, it's OK to also compute one's -> two's
complement adjustment suppression for a dividend of 0. */
.balign 4
GLOBAL(sdivsi3_i4i):
mov.l r6,@-r15
exts.b r5,r6
cmp/eq r5,r6
mov #-1,r1
bt/s LOCAL(div_le128)
cmp/pz r4
addc r4,r1
exts.w r5,r6
cmp/eq r5,r6
mov #-7,r0
bf/s LOCAL(div_ge32k)
cmp/hi r1,r4 ! copy sign bit of r4 into T
rotcr r1
shll16 r6 ! 7 cycles up to here
shad r0,r1
div0s r5,r4
div1 r6,r1
mov.l r7,@-r15
div1 r6,r1
mov r4,r0 ! re-compute adjusted dividend
div1 r6,r1
mov #-31,r7
div1 r6,r1
shad r7,r0
div1 r6,r1
add r4,r0 ! adjusted dividend
div1 r6,r1
mov.l r8,@-r15
div1 r6,r1
swap.w r4,r8 ! detect special case r4 = 0x80000000, r5 = 0x80
div1 r6,r1
swap.b r8,r8
xor r1,r0 ! xor dividend with result lsb
div1 r6,r1
div1 r6,r1
or r5,r8
div1 r6,r1
add #-0x80,r8 ! r8 is 0 iff there is a match
div1 r6,r1
swap.w r8,r7 ! or upper 16 bits...
div1 r6,r1
or r7,r8 !...into lower 16 bits
div1 r6,r1
extu.w r8,r8
div1 r6,r1
extu.b r0,r7
div1 r6,r1
shll8 r7
exts.w r1,r0
xor r7,r1 ! replace lsb of result with lsb of dividend
div1 r6,r1
neg r8,r8 ! upper 16 bits of r8 are now 0xffff iff we want end adjm.
div1 r6,r1
and r0,r8
div1 r6,r1
swap.w r8,r7
div1 r6,r1
mov.l @r15+,r8 ! 58 insns, 29 cycles up to here
LOCAL(div_end):
div1 r6,r1
shll8 r0
div1 r6,r1
exts.w r7,r7
div1 r6,r1
add r0,r0
div1 r6,r1
sub r7,r0
extu.b r1,r1
mov.l @r15+,r7
rotcl r1
mov.l @r15+,r6
rts
add r1,r0
.balign 4
LOCAL(udiv_le128): ! 4 cycles up to here (or 7 for mispredict)
mova LOCAL(div_table_inv),r0
shll2 r6
mov.l @(r0,r6),r1
mova LOCAL(div_table_clz),r0
lds r4,mach
!
!
!
tst r1,r1
!
bt 0f
dmulu.l r1,r4
0: mov.b @(r0,r5),r1
clrt
!
!
sts mach,r0
addc r4,r0
rotcr r0
mov.l @r15+,r6
rts
shld r1,r0
.balign 4
LOCAL(div_le128): ! 3 cycles up to here (or 6 for mispredict)
mova LOCAL(div_table_inv),r0
shll2 r6
mov.l @(r0,r6),r1
mova LOCAL(div_table_clz),r0
neg r4,r6
bf 0f
mov r4,r6
0: lds r6,mach
tst r1,r1
bt 0f
dmulu.l r1,r6
0: div0s r4,r5
mov.b @(r0,r5),r1
bt/s LOCAL(le128_neg)
clrt
!
sts mach,r0
addc r6,r0
rotcr r0
mov.l @r15+,r6
rts
shld r1,r0
/* Could trap divide by zero for the cost of one cycle more mispredict penalty:
...
dmulu.l r1,r6
0: div0s r4,r5
bt/s LOCAL(le128_neg)
tst r5,r5
bt LOCAL(div_by_zero)
mov.b @(r0,r5),r1
sts mach,r0
addc r6,r0
...
LOCAL(div_by_zero):
trapa #
.balign 4
LOCAL(le128_neg):
bt LOCAL(div_by_zero)
mov.b @(r0,r5),r1
sts mach,r0
addc r6,r0
... */
.balign 4
LOCAL(le128_neg):
sts mach,r0
addc r6,r0
rotcr r0
mov.l @r15+,r6
shad r1,r0
rts
neg r0,r0
ENDFUNC(GLOBAL(udivsi3_i4i))
ENDFUNC(GLOBAL(sdivsi3_i4i))
/* This table has been generated by divtab-sh4.c. */
.balign 4
.byte -7
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -3
.byte -3
.byte -3
.byte -3
.byte -3
.byte -3
.byte -3
.byte -3
.byte -2
.byte -2
.byte -2
.byte -2
.byte -1
.byte -1
.byte 0
LOCAL(div_table_clz):
.byte 0
.byte 0
.byte -1
.byte -1
.byte -2
.byte -2
.byte -2
.byte -2
.byte -3
.byte -3
.byte -3
.byte -3
.byte -3
.byte -3
.byte -3
.byte -3
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -4
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -5
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
.byte -6
/* 1/-128 .. 1/127, normalized. There is an implicit leading 1 in bit 32,
or in bit 33 for powers of two. */
.balign 4
.long 0x0
.long 0x2040811
.long 0x4104105
.long 0x624DD30
.long 0x8421085
.long 0xA6810A7
.long 0xC9714FC
.long 0xECF56BF
.long 0x11111112
.long 0x135C8114
.long 0x15B1E5F8
.long 0x18118119
.long 0x1A7B9612
.long 0x1CF06ADB
.long 0x1F7047DD
.long 0x21FB7813
.long 0x24924925
.long 0x27350B89
.long 0x29E4129F
.long 0x2C9FB4D9
.long 0x2F684BDB
.long 0x323E34A3
.long 0x3521CFB3
.long 0x38138139
.long 0x3B13B13C
.long 0x3E22CBCF
.long 0x41414142
.long 0x446F8657
.long 0x47AE147B
.long 0x4AFD6A06
.long 0x4E5E0A73
.long 0x51D07EAF
.long 0x55555556
.long 0x58ED2309
.long 0x5C9882BA
.long 0x60581606
.long 0x642C8591
.long 0x68168169
.long 0x6C16C16D
.long 0x702E05C1
.long 0x745D1746
.long 0x78A4C818
.long 0x7D05F418
.long 0x81818182
.long 0x86186187
.long 0x8ACB90F7
.long 0x8F9C18FA
.long 0x948B0FCE
.long 0x9999999A
.long 0x9EC8E952
.long 0xA41A41A5
.long 0xA98EF607
.long 0xAF286BCB
.long 0xB4E81B4F
.long 0xBACF914D
.long 0xC0E07039
.long 0xC71C71C8
.long 0xCD856891
.long 0xD41D41D5
.long 0xDAE6076C
.long 0xE1E1E1E2
.long 0xE9131AC0
.long 0xF07C1F08
.long 0xF81F81F9
.long 0x0
.long 0x4104105
.long 0x8421085
.long 0xC9714FC
.long 0x11111112
.long 0x15B1E5F8
.long 0x1A7B9612
.long 0x1F7047DD
.long 0x24924925
.long 0x29E4129F
.long 0x2F684BDB
.long 0x3521CFB3
.long 0x3B13B13C
.long 0x41414142
.long 0x47AE147B
.long 0x4E5E0A73
.long 0x55555556
.long 0x5C9882BA
.long 0x642C8591
.long 0x6C16C16D
.long 0x745D1746
.long 0x7D05F418
.long 0x86186187
.long 0x8F9C18FA
.long 0x9999999A
.long 0xA41A41A5
.long 0xAF286BCB
.long 0xBACF914D
.long 0xC71C71C8
.long 0xD41D41D5
.long 0xE1E1E1E2
.long 0xF07C1F08
.long 0x0
.long 0x8421085
.long 0x11111112
.long 0x1A7B9612
.long 0x24924925
.long 0x2F684BDB
.long 0x3B13B13C
.long 0x47AE147B
.long 0x55555556
.long 0x642C8591
.long 0x745D1746
.long 0x86186187
.long 0x9999999A
.long 0xAF286BCB
.long 0xC71C71C8
.long 0xE1E1E1E2
.long 0x0
.long 0x11111112
.long 0x24924925
.long 0x3B13B13C
.long 0x55555556
.long 0x745D1746
.long 0x9999999A
.long 0xC71C71C8
.long 0x0
.long 0x24924925
.long 0x55555556
.long 0x9999999A
.long 0x0
.long 0x55555556
.long 0x0
.long 0x0
LOCAL(div_table_inv):
.long 0x0
.long 0x0
.long 0x0
.long 0x55555556
.long 0x0
.long 0x9999999A
.long 0x55555556
.long 0x24924925
.long 0x0
.long 0xC71C71C8
.long 0x9999999A
.long 0x745D1746
.long 0x55555556
.long 0x3B13B13C
.long 0x24924925
.long 0x11111112
.long 0x0
.long 0xE1E1E1E2
.long 0xC71C71C8
.long 0xAF286BCB
.long 0x9999999A
.long 0x86186187
.long 0x745D1746
.long 0x642C8591
.long 0x55555556
.long 0x47AE147B
.long 0x3B13B13C
.long 0x2F684BDB
.long 0x24924925
.long 0x1A7B9612
.long 0x11111112
.long 0x8421085
.long 0x0
.long 0xF07C1F08
.long 0xE1E1E1E2
.long 0xD41D41D5
.long 0xC71C71C8
.long 0xBACF914D
.long 0xAF286BCB
.long 0xA41A41A5
.long 0x9999999A
.long 0x8F9C18FA
.long 0x86186187
.long 0x7D05F418
.long 0x745D1746
.long 0x6C16C16D
.long 0x642C8591
.long 0x5C9882BA
.long 0x55555556
.long 0x4E5E0A73
.long 0x47AE147B
.long 0x41414142
.long 0x3B13B13C
.long 0x3521CFB3
.long 0x2F684BDB
.long 0x29E4129F
.long 0x24924925
.long 0x1F7047DD
.long 0x1A7B9612
.long 0x15B1E5F8
.long 0x11111112
.long 0xC9714FC
.long 0x8421085
.long 0x4104105
.long 0x0
.long 0xF81F81F9
.long 0xF07C1F08
.long 0xE9131AC0
.long 0xE1E1E1E2
.long 0xDAE6076C
.long 0xD41D41D5
.long 0xCD856891
.long 0xC71C71C8
.long 0xC0E07039
.long 0xBACF914D
.long 0xB4E81B4F
.long 0xAF286BCB
.long 0xA98EF607
.long 0xA41A41A5
.long 0x9EC8E952
.long 0x9999999A
.long 0x948B0FCE
.long 0x8F9C18FA
.long 0x8ACB90F7
.long 0x86186187
.long 0x81818182
.long 0x7D05F418
.long 0x78A4C818
.long 0x745D1746
.long 0x702E05C1
.long 0x6C16C16D
.long 0x68168169
.long 0x642C8591
.long 0x60581606
.long 0x5C9882BA
.long 0x58ED2309
.long 0x55555556
.long 0x51D07EAF
.long 0x4E5E0A73
.long 0x4AFD6A06
.long 0x47AE147B
.long 0x446F8657
.long 0x41414142
.long 0x3E22CBCF
.long 0x3B13B13C
.long 0x38138139
.long 0x3521CFB3
.long 0x323E34A3
.long 0x2F684BDB
.long 0x2C9FB4D9
.long 0x29E4129F
.long 0x27350B89
.long 0x24924925
.long 0x21FB7813
.long 0x1F7047DD
.long 0x1CF06ADB
.long 0x1A7B9612
.long 0x18118119
.long 0x15B1E5F8
.long 0x135C8114
.long 0x11111112
.long 0xECF56BF
.long 0xC9714FC
.long 0xA6810A7
.long 0x8421085
.long 0x624DD30
.long 0x4104105
.long 0x2040811
/* maximum error: 0.987342 scaled: 0.921875*/
#endif /* SH3 / SH4 */
#endif /* L_div_table */
#endif /* !__SHMEDIA__ */
| 16.467449 | 152 | 0.682761 |
1aed7063a00344c6b513be4220176880ceccd1e8 | 417 | asm | Assembly | programs/oeis/003/A003699.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/003/A003699.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/003/A003699.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A003699: Number of Hamiltonian cycles in C_4 X P_n.
; 1,6,22,82,306,1142,4262,15906,59362,221542,826806,3085682,11515922,42978006,160396102,598606402,2234029506,8337511622,31116016982,116126556306,433390208242,1617434276662,6036346898406,22527953316962,84075466369442,313773912160806,1171020182273782,4370306816934322
mov $1,1
mov $2,1
mov $3,1
lpb $0
sub $0,1
add $3,$1
add $2,$3
mov $1,$2
mul $1,2
lpe
| 29.785714 | 265 | 0.776978 |
5744fc2973a28b7a578142dca3db5e8ef6fcb59a | 76 | asm | Assembly | libsrc/graphics/g800/last_pos.asm | bahmanrafatjoo/z88dk | 001b7eab7fa2e94ee7210ff483c789e15e8d6a40 | [
"ClArtistic"
] | null | null | null | libsrc/graphics/g800/last_pos.asm | bahmanrafatjoo/z88dk | 001b7eab7fa2e94ee7210ff483c789e15e8d6a40 | [
"ClArtistic"
] | null | null | null | libsrc/graphics/g800/last_pos.asm | bahmanrafatjoo/z88dk | 001b7eab7fa2e94ee7210ff483c789e15e8d6a40 | [
"ClArtistic"
] | 1 | 2019-12-03T23:28:20.000Z | 2019-12-03T23:28:20.000Z | SECTION bss_clib
PUBLIC last_pos
last_pos:
defb 0,0
| 10.857143 | 28 | 0.565789 |
97ae618524018c624664c515e2863982cf56f818 | 4,983 | asm | Assembly | src/PJ/poco/poekit/pdracc/closestc.asm | AnimatorPro/Animator-Pro | 6d0b68cd94bb5cfde2cdd05e9a7c8ee1e1cb3cbb | [
"BSD-3-Clause"
] | 119 | 2015-01-10T15:13:50.000Z | 2022-01-24T04:54:34.000Z | src/PJ/poco/poekit/pdracc/closestc.asm | AnimatorPro/Animator-Pro | 6d0b68cd94bb5cfde2cdd05e9a7c8ee1e1cb3cbb | [
"BSD-3-Clause"
] | 6 | 2015-10-22T20:14:59.000Z | 2021-07-10T03:25:21.000Z | src/PJ/poco/poekit/pdracc/closestc.asm | AnimatorPro/Animator-Pro | 6d0b68cd94bb5cfde2cdd05e9a7c8ee1e1cb3cbb | [
"BSD-3-Clause"
] | 27 | 2015-04-24T22:55:30.000Z | 2022-01-21T13:54:00.000Z | ;*****************************************************************************
;* CLOSESTC.ASM - closestc and color_diff routines.
;*
;* These work exactly like the original PJ routines they're adapted
;* from, except that they use a 2k lookup table instead of multiplying
;* to get the squares of numbers from -255 to +256. Also, the closestc
;* routine has an early exit for an exact color match.
;*****************************************************************************
include stdmacro.i
_DATA segment
;-----------------------------------------------------------------------------
; the squares table - for negative and positive numbers.
; (we keep both negatives and positives to avoid needing a branching
; instruction inside the loops to turn negative diffs into positive).
;-----------------------------------------------------------------------------
align 4
IDX=-255 ; starting index
sqrneg:
rept 255
dd IDX*IDX ; squares of numbers from -255 thru -1
IDX=IDX+1
endm
sqrtab: ; index into table is from this point
rept 256
dd IDX*IDX ; squares of numbers from 0 thru 255
IDX=IDX+1
endm
_DATA ends
_TEXT segment
assume cs:CGROUP,ds:DGROUP
public color_dif
public closestc
;*****************************************************************************
;* int color_dif(Rgb3 *pcolor1, Rgb3 *pcolor2)
;*
;* return the sum of the squares of the differences of the rgb components.
;*****************************************************************************
align 4
color_dif proc near
Entry
Args #pcolor1,#pcolor2
Save esi,edi
mov esi,#pcolor1 ; load pointer to color 1
xor edx,edx ; clean out high order of edx.
mov edi,#pcolor2 ; load pointer to color 2
mov dl,bptr [esi] ; load red byte of color 1
movzx ecx,bptr [edi] ; load red byte of color 2
sub ecx,edx ; subtract them
mov eax,dptr [ecx*4+sqrtab] ; load the square of the difference
mov dl,bptr [esi+1] ; load green byte of color 1
movzx ecx,bptr [edi+1] ; load green byte of color 2
sub ecx,edx ; subtract them
add eax,dptr [ecx*4+sqrtab] ; accumulate square of the difference
mov dl,bptr [esi+2] ; load blue byte of color 1
movzx ecx,bptr [edi+2] ; load blue byte of color 2
sub ecx,edx ; subtract them
add eax,dptr [ecx*4+sqrtab] ; accumulate square of the difference
Restore esi,edi ; all done, return the sum of the
Exit ; squares of the differences.
color_dif endp
;*****************************************************************************
;* int closestc(Rgb3 *pcolor, Rgb3 *ptab, int tabcount)
;*
;* return the index of the closest match of an Rgb3 color within an
;* arbitrary-length table of Rgb3 colors. a zero-length table is legit
;* (FWIW), and results in a return value of 0.
;*****************************************************************************
align 4
closestc proc near
Entry
Lclvars #current,#closest
Args #pcolor,#ptab,#tabcount
Save ebx,esi,edi,ebp
xor eax,eax ; zero out #closest (return value)
mov #closest,eax ; and set #current (table index)
dec eax ; to -1 (it will get incr'd to zero
mov #current,eax ; the first time through the loop).
mov eax,#pcolor ; load pointer to color to be matched.
movzx ebx,bptr [eax] ; registerize the red, green, and
movzx ecx,bptr [eax+1] ; blue components as 32bit values,
movzx edx,bptr [eax+2] ; since they are refferred to a lot.
mov esi,#ptab ; load pointer to color table.
mov edi,7FFFFFFFh ; prime closeness-so-far to high value.
align 4
#loop:
inc dptr #current ; incr current-slot-in-table index.
dec dptr #tabcount ; decr loop counter, when it goes
js short #done ; negative we're all done.
movzx eax,bptr [esi] ; get red from current table slot,
sub eax,ebx ; subtract it from match-color red,
mov ebp,dptr [eax*4+sqrtab] ; get square of the difference.
movzx eax,bptr [esi+1] ; get green from current table slot,
sub eax,ecx ; subtract it from match-color green,
add ebp,dptr [eax*4+sqrtab] ; accumulate square of the difference.
movzx eax,bptr [esi+2] ; get blue from current table slot,
sub eax,edx ; subtract it from match-color blue,
add ebp,dptr [eax*4+sqrtab] ; accumulate square of the difference.
add esi,3 ; incr table pointer for next time.
cmp edi,ebp ; if closest-diff-so-far is less than
jbe short #loop ; diff we just calc'd, try next color,
mov eax,#current ; else we have closer color, remember
mov #closest,eax ; its index as the new closest color.
test ebp,ebp ; if the difference is zero (exact
jz short #done ; match) we can't do better, get out.
mov edi,ebp ; not an exact match, remember the new
jmp short #loop ; closest-diff-so-far and keep trying.
#done:
mov eax,#closest ; load index of closest color we found
Restore ebx,esi,edi,ebp ; for return to caller.
Exit
closestc endp
_TEXT ends
end
| 35.848921 | 79 | 0.605258 |
29364e7d45af11d9c342b94181db12f1273c5f5b | 343 | asm | Assembly | firmware/write_ffff.asm | HomebrewSiliconClub/hs32core-rtl | b545dbfadf7323eaab1c6a155f3652248a3b0344 | [
"Apache-2.0"
] | 5 | 2020-12-04T22:54:33.000Z | 2021-09-30T11:15:24.000Z | firmware/write_ffff.asm | HomebrewSiliconClub/hs32core-rtl | b545dbfadf7323eaab1c6a155f3652248a3b0344 | [
"Apache-2.0"
] | 1 | 2021-02-12T23:10:16.000Z | 2021-02-13T06:01:31.000Z | firmware/write_ffff.asm | HomebrewSiliconClub/hs32core-rtl | b545dbfadf7323eaab1c6a155f3652248a3b0344 | [
"Apache-2.0"
] | 1 | 2021-01-22T07:46:21.000Z | 2021-01-22T07:46:21.000Z | MOV r0, FF00h
MOV r1 <- 0FFFh
STR [r0+80h] <- r1
; LDR r1, [buffer-4]
MOV r1, 0010h
MOV r1, r1 shl 16
; r2 <- FFFF_FFFF
MOV r2, F0F0h
ADD r2, r2, 0F0Fh
MOV r2, r2 shl 16
ADD r2, r2, F0F0h
ADD r2, r2, 0F0Fh
; MOV r1, r1
STR [r1], r2
; MOV r1, r1
LDR r6, [r1]
; Write led
; MOV r1, r1
STR [r0+84h] <- r6
B 0
buffer: db 00h, 01h, 00h, 00h
| 11.827586 | 29 | 0.606414 |
385d5417722a490e0404a6801eae901b37b447a0 | 1,079 | asm | Assembly | Working Disassembly/Levels/AIZ/Misc Object Data/Map - Intro Waves.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/Levels/AIZ/Misc Object Data/Map - Intro Waves.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | null | null | null | Working Disassembly/Levels/AIZ/Misc Object Data/Map - Intro Waves.asm | TeamASM-Blur/Sonic-3-Blue-Balls-Edition | 7e8a2c5df02271615ff4cae529521e6b1560d6b1 | [
"Apache-2.0"
] | null | null | null | Map_22119A_: dc.w Frame_2211A6-Map_22119A_ ; ...
dc.w Frame_2211B4-Map_22119A_
dc.w Frame_2211D4-Map_22119A_
dc.w Frame_2211F4-Map_22119A_
dc.w Frame_221214-Map_22119A_
dc.w Frame_22122E-Map_22119A_
Frame_2211A6: dc.w 2
dc.b $C0, $B, 0, 0, 0, 8
dc.b $E0, $F, 0, $C, 0, 0
Frame_2211B4: dc.w 5
dc.b $A0, $F, 0,$1C, 0,$13
dc.b $C0, $B, 0,$2C, 0, 8
dc.b $C0, $B, 0,$38, 0,$20
dc.b $E0, $F, 0,$44, 0, 0
dc.b $E0, $F, 0,$54, 0,$20
Frame_2211D4: dc.w 5
dc.b $A0, $F, 0,$64, 0,$18
dc.b $C0, $F, 0,$74, 0, 8
dc.b $C0, $B, 0,$84, 0,$28
dc.b $E0, $F, 0,$90, 0, 0
dc.b $E0, $F, 0,$A0, 0,$20
Frame_2211F4: dc.w 5
dc.b $B0, $D, 0,$B0, 0,$18
dc.b $C0, $F, 0,$B8, 0, 8
dc.b $C0, $B, 0,$C8, 0,$28
dc.b $E0, $F, 0,$D4, 0, 0
dc.b $E0, $F, 0,$E4, 0,$20
Frame_221214: dc.w 4
dc.b $C0, $F, 0,$F4, 0, 0
dc.b $C0, $B, 1, 4, 0,$20
dc.b $E0, $F, 1,$10, 0, 0
dc.b $E0, $F, 1,$20, 0,$20
Frame_22122E: dc.w 3
dc.b $D0, $D, 1,$30, 0,$10
dc.b $E0, $F, 1,$38, 0, 0
dc.b $E0, $F, 1,$48, 0,$20
| 29.162162 | 48 | 0.497683 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.