max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
programs/oeis/056/A056546.asm | neoneye/loda | 22 | 164706 | ; A056546: a(n) = 5*n*a(n-1) + 1 with a(0)=1.
; 1,6,61,916,18321,458026,13740781,480927336,19237093441,865669204846,43283460242301,2380590313326556,142835418799593361,9284302221973568466,649901155538149792621,48742586665361234446576
add $0,1
mov $2,1
lpb $0
sub $0,1
add $1,$2
mul $2,5
mul $2,$0
lpe
mov $0,$1
|
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0_notsx.log_21829_1527.asm | ljhsiun2/medusa | 9 | 246042 | <filename>Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xa0_notsx.log_21829_1527.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x160c5, %rsi
lea addresses_D_ht+0x13e45, %rdi
nop
nop
xor %r9, %r9
mov $40, %rcx
rep movsb
sub $53892, %rax
lea addresses_WT_ht+0x3c5, %r12
nop
nop
sub %r15, %r15
mov (%r12), %edi
add %r12, %r12
lea addresses_D_ht+0x150c5, %r15
nop
nop
xor $58988, %r9
movl $0x61626364, (%r15)
nop
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_WT_ht+0x15a39, %r9
nop
nop
nop
add %r15, %r15
mov (%r9), %esi
nop
xor %r9, %r9
lea addresses_normal_ht+0x116f2, %rcx
nop
nop
nop
xor $48884, %rsi
mov $0x6162636465666768, %r9
movq %r9, %xmm3
and $0xffffffffffffffc0, %rcx
vmovntdq %ymm3, (%rcx)
nop
nop
nop
nop
add $14293, %rax
lea addresses_UC_ht+0x15125, %r15
nop
nop
nop
nop
nop
and %rdi, %rdi
vmovups (%r15), %ymm0
vextracti128 $0, %ymm0, %xmm0
vpextrq $0, %xmm0, %r12
and %r15, %r15
lea addresses_normal_ht+0x89a5, %rsi
lea addresses_WC_ht+0x1bbc, %rdi
nop
nop
nop
and $28276, %r11
mov $122, %rcx
rep movsq
nop
xor %r9, %r9
lea addresses_A_ht+0x12d1d, %rdi
nop
nop
nop
inc %r12
mov $0x6162636465666768, %rax
movq %rax, %xmm5
vmovups %ymm5, (%rdi)
nop
nop
nop
nop
nop
add $51870, %r12
lea addresses_A_ht+0x161c5, %r9
nop
nop
nop
xor $52894, %rcx
mov (%r9), %r11d
nop
inc %r15
lea addresses_WC_ht+0x56fd, %rsi
lea addresses_D_ht+0x14ef5, %rdi
nop
nop
nop
cmp %r9, %r9
mov $5, %rcx
rep movsq
nop
nop
nop
xor %r9, %r9
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %rbx
push %rcx
push %rdi
push %rsi
// Store
lea addresses_WT+0x115e5, %rbx
nop
nop
nop
nop
nop
dec %rdi
mov $0x5152535455565758, %r15
movq %r15, %xmm5
movups %xmm5, (%rbx)
nop
nop
nop
nop
and $19614, %r14
// REPMOV
lea addresses_WC+0x14fc5, %rsi
mov $0x306df70000000cc5, %rdi
nop
nop
nop
nop
and $55, %r12
mov $0, %rcx
rep movsb
cmp $44335, %r14
// Faulty Load
lea addresses_A+0xd7c5, %r8
nop
nop
nop
nop
xor $4212, %r15
mov (%r8), %r14d
lea oracles, %rbx
and $0xff, %r14
shlq $12, %r14
mov (%rbx,%r14,1), %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_WC', 'congruent': 11, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_NC', 'congruent': 7, 'same': False}}
[Faulty Load]
{'src': {'type': 'addresses_A', 'AVXalign': False, 'size': 4, 'NT': True, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 7, 'same': False}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 1}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 1}}
{'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 0}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 3, 'same': False}}
{'35': 21829}
35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35 35
*/
|
FormalAnalyzer/models/apps/HoneyImHome.als | Mohannadcse/IoTCOM_BehavioralRuleExtractor | 0 | 367 | <reponame>Mohannadcse/IoTCOM_BehavioralRuleExtractor
module app_HoneyImHome
open IoTBottomUp as base
open cap_runIn
open cap_now
open cap_presenceSensor
open cap_switch
open cap_location
open cap_userInput
one sig app_HoneyImHome extends IoTApp {
location : one cap_location,
people : some cap_presenceSensor,
lights : some cap_switch,
state : one cap_state,
newMode : one cap_location,
} {
rules = r
}
abstract sig cap_userInput_attr_sendPushMessage_val extends cap_userInput_attr_value_val {}
one sig cap_userInput_attr_sendPushMessage_val_Yes extends cap_userInput_attr_sendPushMessage_val {}
one sig cap_userInput_attr_sendPushMessage_val_No extends cap_userInput_attr_sendPushMessage_val {}
one sig cap_location_attr_mode_val_newMode extends cap_location_attr_mode_val {}{}
one sig cap_state extends cap_runIn {} {
attributes = cap_state_attr + cap_runIn_attr
}
abstract sig cap_state_attr extends Attribute {}
one sig cap_state_attr_hasRandomSchedule extends cap_state_attr {} {
values = cap_state_attr_hasRandomSchedule_val
}
abstract sig cap_state_attr_hasRandomSchedule_val extends AttrValue {}
one sig cap_state_attr_hasRandomSchedule_val_true extends cap_state_attr_hasRandomSchedule_val {}
one sig cap_state_attr_lastStatus extends cap_state_attr {} {
values = cap_state_attr_lastStatus_val
}
abstract sig cap_state_attr_lastStatus_val extends AttrValue {}
one sig cap_state_attr_lastStatus_val_on extends cap_state_attr_lastStatus_val {}
abstract sig r extends Rule {}
one sig r0 extends r {}{
triggers = r0_trig
conditions = r0_cond
commands = r0_comm
}
abstract sig r0_trig extends Trigger {}
one sig r0_trig0 extends r0_trig {} {
capabilities = app_HoneyImHome.people
attribute = cap_presenceSensor_attr_presence
no value
}
abstract sig r0_cond extends Condition {}
one sig r0_cond0 extends r0_cond {} {
capabilities = app_HoneyImHome.people
attribute = cap_presenceSensor_attr_presence
value = cap_presenceSensor_attr_presence_val_present
}
one sig r0_cond1 extends r0_cond {} {
capabilities = app_HoneyImHome.location
attribute = cap_location_attr_mode
value = cap_location_attr_mode_val - cap_location_attr_mode_val_newMode
}
abstract sig r0_comm extends Command {}
one sig r0_comm0 extends r0_comm {} {
capability = app_HoneyImHome.lights
attribute = cap_switch_attr_switch
value = cap_switch_attr_switch_val_on
}
one sig r0_comm1 extends r0_comm {} {
capability = app_HoneyImHome.state
attribute = cap_state_attr_lastStatus
value = cap_state_attr_lastStatus_val_on
}
/*
one sig r1 extends r {}{
no triggers
conditions = r1_cond
commands = r1_comm
}
abstract sig r1_cond extends Condition {}
one sig r1_cond0 extends r1_cond {} {
capabilities = app_HoneyImHome.state
attribute = cap_state_attr_riseTime
value = cap_state_attr_riseTime_val - cap_state_attr_riseTime_val_riseTime.time
}
one sig r1_cond1 extends r1_cond {} {
capabilities = app_HoneyImHome.state
attribute = cap_state_attr_setTime
value = cap_state_attr_setTime_val - cap_state_attr_setTime_val_setTime.time
}
abstract sig r1_comm extends Command {}
one sig r1_comm0 extends r1_comm {} {
capability = app_HoneyImHome.state
attribute = cap_riseTime_attr_riseTime
value = cap_riseTime_attr_riseTime_val_not_null
}
one sig r1_comm1 extends r1_comm {} {
capability = app_HoneyImHome.state
attribute = cap_setTime_attr_setTime
value = cap_setTime_attr_setTime_val_not_null
}
*/
/*
one sig r2 extends r {}{
no triggers
conditions = r2_cond
commands = r2_comm
}
abstract sig r2_cond extends Condition {}
one sig r2_cond0 extends r2_cond {} {
capabilities = app_HoneyImHome.state
attribute = cap_state_attr_riseTime
value = cap_state_attr_riseTime_val - cap_state_attr_riseTime_val_riseTime.time
}
one sig r2_cond1 extends r2_cond {} {
capabilities = app_HoneyImHome.state
attribute = cap_runIn_attr_runIn
value = cap_runIn_attr_runIn_val_on
}
one sig r2_cond2 extends r2_cond {} {
capabilities = app_HoneyImHome.state
attribute = cap_state_attr_setTime
value = cap_state_attr_setTime_val - cap_state_attr_setTime_val_setTime.time
}
abstract sig r2_comm extends Command {}
one sig r2_comm0 extends r2_comm {} {
capability = app_HoneyImHome.state
attribute = cap_riseTime_attr_riseTime
value = cap_riseTime_attr_riseTime_val_not_null
}
one sig r2_comm1 extends r2_comm {} {
capability = app_HoneyImHome.state
attribute = cap_setTime_attr_setTime
value = cap_setTime_attr_setTime_val_not_null
}
*/
one sig r3 extends r {}{
triggers = r3_trig
conditions = r3_cond
commands = r3_comm
}
abstract sig r3_trig extends Trigger {}
one sig r3_trig0 extends r3_trig {} {
capabilities = app_HoneyImHome.people
attribute = cap_presenceSensor_attr_presence
no value
}
abstract sig r3_cond extends Condition {}
one sig r3_cond0 extends r3_cond {} {
capabilities = app_HoneyImHome.people
attribute = cap_presenceSensor_attr_presence
value = cap_presenceSensor_attr_presence_val_present
}
one sig r3_cond1 extends r3_cond {} {
capabilities = app_HoneyImHome.location
attribute = cap_location_attr_mode
value = cap_location_attr_mode_val - cap_location_attr_mode_val_newMode
}
abstract sig r3_comm extends Command {}
one sig r3_comm0 extends r3_comm {} {
capability = app_HoneyImHome.location
attribute = cap_location_attr_mode
value = cap_location_attr_mode_val_newMode
}
|
programs/oeis/027/A027954.asm | karttu/loda | 1 | 85154 | <filename>programs/oeis/027/A027954.asm<gh_stars>1-10
; A027954: a(n) = T(2n+1, n+2), T given by A027948.
; 1,5,41,189,674,2098,6050,16703,44995,119575,315460,829060,2174596,5698329,14924829,39081553,102326310,267905078,701397990,1836299475,4807512695,12586252715,32951261576,86267550344,225851410184,591286703533,1548008726545,4052739505253,10610209821610,27777889995450,72723460204330,190392490661095,498454011826731,1304969544871359,3416454622844364,8944394323723788
mul $0,2
mov $2,$0
cmp $2,0
add $0,$2
cal $0,14166 ; Apply partial sum operator 4 times to Fibonacci numbers.
mov $1,$0
|
driver_scripts/chromium_idle.scpt | eti-p-doray/chrome_safari_power | 0 | 3784 | <gh_stars>0
tell application " Chromium"
if it is running then
activate
set bounds of front window to {0, 0, 1920, 1080}
delay 3600
activate
end if
end tell |
data/mapHeaders/ViridianMart.asm | AmateurPanda92/pokemon-rby-dx | 9 | 26760 | <reponame>AmateurPanda92/pokemon-rby-dx<filename>data/mapHeaders/ViridianMart.asm
ViridianMart_h:
db MART ; tileset
db VIRIDIAN_MART_HEIGHT, VIRIDIAN_MART_WIDTH ; dimensions (y, x)
dw ViridianMart_Blocks ; blocks
dw ViridianMart_TextPointers ; texts
dw ViridianMart_Script ; scripts
db 0 ; connections
dw ViridianMart_Object ; objects
|
examples/arinc653-threads/sample-ada/cpu/part1/main.adb | BaldLee/pok | 73 | 20967 | -- POK header
--
-- The following file is a part of the POK project. Any modification should
-- be made according to the POK licence. You CANNOT use this file or a part
-- of a file for your own project.
--
-- For more information on the POK licence, please see our LICENCE FILE
--
-- Please follow the coding guidelines described in doc/CODING_GUIDELINES
--
-- Copyright (c) 2007-2021 POK team
package body Main is
procedure Printf (String : in Interfaces.C.char_array);
pragma Import (C, Printf, "printf");
procedure Compute is
begin
loop
Printf ("beep ");
end loop;
end Compute;
procedure Main is
Ret : Return_Code_Type;
Attr : Process_Attribute_Type;
Id : Process_Id_Type;
begin
Attr.Period := 1000;
Attr.Deadline := Soft;
Attr.Time_Capacity := 1;
Attr.Stack_Size := 4096;
Attr.Entry_Point := Compute'Address;
Create_Process (Attr, Id, Ret);
Set_Partition_Mode (Normal, Ret);
end Main;
end Main;
|
basic/src/main/antlr4/com/khubla/antlr/jvmBasic.g4 | diegozaccai/grammars-v4 | 1 | 1919 | grammar jvmBasic;
/*
[The "BSD licence"]
Copyright (c) 2012 <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
*/
// a program is a collection of lines
prog : line+ ;
// a line starts with an INT and ends with a CR
line : (linenumber ((amprstmt (COLON amprstmt?)*) | (COMMENT | REM)) (CR | EOF)) | CR;
amperoper: AMPERSAND;
linenumber: NUMBER;
amprstmt: (amperoper? statement) | (COMMENT | REM);
statement : (LOAD | SAVE | TRACE| NOTRACE | FLASH | INVERSE| GR| NORMAL | SHLOAD | CLEAR | RUN | STOP | TEXT | HOME | HGR | HGR2)| endstmt| returnstmt| restorestmt |amptstmt| popstmt | liststmt| storestmt| getstmt | recallstmt |instmt| prstmt |onerrstmt| hlinstmt|vlinstmt|colorstmt| speedstmt |scalestmt|rotstmt| hcolorstmt| himemstmt| lomemstmt | printstmt1 |pokestmt | plotstmt| ongotostmt |ongosubstmt| ifstmt | forstmt | inputstmt | tabstmt | dimstmt | gotostmt | gosubstmt | callstmt |readstmt| hplotstmt | vplotstmt | vtabstmnt| htabstmnt|waitstmt |datastmt| xdrawstmt | drawstmt |defstmt| letstmt | includestmt;
vardecl : var ( LPAREN exprlist RPAREN)*;
printstmt1: (PRINT | QUESTION) printlist?;
printlist : expression (COMMA | SEMICOLON)? printlist*;
getstmt : GET exprlist;
letstmt : LET? variableassignment;
variableassignment : vardecl EQ exprlist;
relop :lte | gte | neq | (EQ | GT | LT);
gte : GTE | (GT EQ) | (EQ GT);
lte : LTE | (LT EQ) | (EQ LT);
neq : NEQ;
ifstmt : IF expression THEN? (statement | linenumber);
forstmt : FOR vardecl EQ expression TO expression (STEP expression)? statement NEXT vardecl?;
inputstmt : INPUT (STRINGLITERAL (COMMA| SEMICOLON))? varlist;
readstmt: READ varlist;
dimstmt : DIM varlist;
gotostmt: GOTO linenumber;
gosubstmt: GOSUB linenumber;
pokestmt: POKE expression COMMA expression;
callstmt: CALL exprlist;
hplotstmt: HPLOT (expression COMMA expression)? (TO expression COMMA expression)*;
vplotstmt: VPLOT (expression COMMA expression)? (TO expression COMMA expression)*;
plotstmt: PLOT expression COMMA expression;
ongotostmt : ON expression GOTO linenumber (COMMA linenumber)*;
ongosubstmt : ON expression GOSUB linenumber (COMMA linenumber)*;
vtabstmnt : VTAB expression;
htabstmnt : HTAB expression;
himemstmt: HIMEM COLON expression;
lomemstmt: LOMEM COLON expression;
datastmt: DATA datum (COMMA datum?)*;
datum: NUMBER | STRINGLITERAL | FLOAT;
waitstmt: WAIT expression COMMA expression (COMMA expression)?;
xdrawstmt: XDRAW expression (AT expression COMMA expression)?;
drawstmt: DRAW expression (AT expression COMMA expression)?;
defstmt: DEF FN var LPAREN var RPAREN EQ expression;
tabstmt: TAB LPAREN expression RPAREN;
speedstmt: SPEED EQ expression;
rotstmt: ROT EQ expression;
scalestmt: SCALE EQ expression;
colorstmt: COLOR EQ expression;
hcolorstmt: HCOLOR EQ expression;
hlinstmt: HLIN expression COMMA expression AT expression;
vlinstmt: VLIN expression COMMA expression AT expression;
onerrstmt: ONERR GOTO linenumber;
prstmt: PRNUMBER NUMBER;
instmt: INNUMBER NUMBER;
storestmt: STORE vardecl;
recallstmt: RECALL vardecl;
liststmt: LIST expression?;
popstmt : POP (expression COMMA expression)?;
amptstmt: AMPERSAND expression;
includestmt : INCLUDE expression;
endstmt: END;
returnstmt: RETURN;
restorestmt: RESTORE;
// expressions and such
func : (NUMBER | STRINGLITERAL | FLOAT) | vardecl | chrfunc | sqrfunc | lenfunc | strfunc | ascfunc| scrnfunc | midfunc | pdlfunc | peekfunc | intfunc | spcfunc | frefunc | posfunc | usrfunc |leftfunc | valfunc | rightfunc|fnfunc|sinfunc | cosfunc |tanfunc|atnfunc|rndfunc|sgnfunc|expfunc|logfunc|absfunc | (LPAREN expression RPAREN);
signExpression : NOT? ((PLUS|MINUS))* func;
exponentExpression : signExpression (EXPONENT signExpression)*;
multiplyingExpression : exponentExpression ((TIMES|DIV) exponentExpression)*;
addingExpression : multiplyingExpression ((PLUS|MINUS) multiplyingExpression)*;
relationalExpression : addingExpression ((relop) addingExpression)*;
expression: func | (relationalExpression ((AND|OR) relationalExpression)*);
// lists
var: varname varsuffix?;
varname : LETTERS (LETTERS |NUMBER)*;
varsuffix:(DOLLAR | PERCENT);
varlist : vardecl (COMMA vardecl)*;
exprlist : expression (COMMA expression)*;
// functions
sqrfunc : SQR LPAREN expression RPAREN;
chrfunc : CHR LPAREN expression RPAREN;
lenfunc : LEN LPAREN expression RPAREN;
ascfunc : ASC LPAREN expression RPAREN;
midfunc : MID LPAREN expression COMMA expression COMMA expression RPAREN;
pdlfunc : PDL LPAREN expression RPAREN;
peekfunc: PEEK LPAREN expression RPAREN;
intfunc : INTF LPAREN expression RPAREN;
spcfunc: SPC LPAREN expression RPAREN;
frefunc : FRE LPAREN expression RPAREN;
posfunc: POS LPAREN expression RPAREN;
usrfunc: USR LPAREN expression RPAREN;
leftfunc: LEFT LPAREN expression COMMA expression RPAREN;
rightfunc: RIGHT LPAREN expression COMMA expression RPAREN;
strfunc : STR LPAREN expression RPAREN;
fnfunc: FN var LPAREN expression RPAREN;
valfunc: VAL LPAREN expression RPAREN;
scrnfunc: SCRN LPAREN expression COMMA expression RPAREN;
sinfunc : SIN LPAREN expression RPAREN;
cosfunc : COS LPAREN expression RPAREN;
tanfunc : TAN LPAREN expression RPAREN;
atnfunc : ATN LPAREN expression RPAREN;
rndfunc : RND LPAREN expression RPAREN;
sgnfunc : SGN LPAREN expression RPAREN;
expfunc : EXP LPAREN expression RPAREN;
logfunc : LOG LPAREN expression RPAREN;
absfunc : ABS LPAREN expression RPAREN;
DOLLAR: '$';
PERCENT: '%';
RETURN: 'RETURN';
PRINT: 'PRINT';
GOTO : 'GOTO';
GOSUB : 'GOSUB';
IF : 'IF';
NEXT : 'NEXT';
THEN : 'THEN';
REM : 'REM';
CHR : 'CHR$';
MID : 'MID$';
LEFT: 'LEFT$';
RIGHT: 'RIGHT$';
STR : 'STR$';
LPAREN : '(';
RPAREN : ')';
PLUS : '+';
MINUS : '-';
TIMES : '*';
DIV : '/';
CLEAR : 'CLEAR';
GTE : '>: ';
LTE : '<: ';
GT : '>';
LT : '<';
NEQ: '< >';
COMMA : ',';
LIST : 'LIST';
RUN : 'RUN';
END : 'END';
LET : 'LET';
EQ : '=';
FOR : 'FOR';
TO : 'TO';
STEP : 'STEP';
INPUT : 'INPUT';
SEMICOLON : ';';
DIM : 'DIM';
SQR : 'SQR';
COLON : ':';
TEXT : 'TEXT';
HGR : 'HGR';
HGR2 : 'HGR2';
LEN : 'LEN';
CALL : 'CALL';
ASC : 'ASC';
HPLOT : 'HPLOT';
VPLOT : 'VPLOT';
PRNUMBER : 'PR#';
INNUMBER : 'IN#';
VTAB : 'VTAB';
HTAB : 'HTAB';
HOME : 'HOME';
ON : 'ON';
PDL : 'PDL';
PLOT : 'PLOT';
PEEK : 'PEEK';
POKE : 'POKE';
INTF : 'INT';
STOP: 'STOP';
HIMEM : 'HIMEM';
LOMEM : 'LOMEM';
FLASH : 'FLASH';
INVERSE : 'INVERSE';
NORMAL : 'NORMAL';
ONERR : 'ONERR';
SPC : 'SPC';
FRE : 'FRE';
POS : 'POS';
USR : 'USR';
TRACE : 'TRACE';
NOTRACE : 'NOTRACE';
AND : 'AND';
OR : 'OR';
DATA : 'DATA';
WAIT : 'WAIT';
READ : 'READ';
XDRAW : 'XDRAW';
DRAW : 'DRAW';
AT : 'AT';
DEF : 'DEF';
FN : 'FN';
VAL : 'VAL';
TAB : 'TAB';
SPEED : 'SPEED';
ROT : 'ROT';
SCALE : 'SCALE';
COLOR : 'COLOR';
HCOLOR : 'HCOLOR';
HLIN : 'HLIN';
VLIN : 'VLIN';
SCRN : 'SCRN';
POP : 'POP';
SHLOAD : 'SHLOAD';
SIN : 'SIN';
COS : 'COS';
TAN : 'TAN';
ATN : 'ATN';
RND : 'RND';
SGN : 'SGN';
EXP : 'EXP';
LOG : 'LOG';
ABS : 'ABS';
STORE : 'STORE';
RECALL : 'RECALL';
GET : 'GET';
EXPONENT: '^';
AMPERSAND : '&';
GR : 'GR';
NOT : 'NOT';
RESTORE : 'RESTORE';
SAVE : 'SAVE';
LOAD : 'LOAD';
QUESTION : '?';
INCLUDE : 'INCLUDE';
COMMENT: REM ~[\r\n]*;
STRINGLITERAL : '"' ~["\r\n]* '"';
LETTERS :('a'..'z' |'A'..'Z' )+;
NUMBER : ('0'..'9')+ ( ('e' | 'E') NUMBER)*;
FLOAT : ('0'..'9')* '.' ('0'..'9')+ ( ('e' | 'E') ('0'..'9')+)*;
CR : [\r\n]+;
WS : [ \t]+ -> channel(HIDDEN);
|
AdaToolsTests/Both.ads | gitter-badger/Ada-tools | 0 | 23303 | <filename>AdaToolsTests/Both.ads
with Ada.Text_IO, Spec;
use Ada.Text_IO, Spec;
package Both with Ada_2012 is
--@description Just a simple test package
--@version 1.0
type TestInt is range 0 .. 1;
type TestMod is mod 8;
type TestFloat is digits 8;
type TestFloatRange is digits 8 range 0.0 .. 12.0;
type TestFixed is delta 0.01 range 0.0 .. 8.0;
type TestDecimal is delta 0.1 digits 8;
type TestDecimalRange is delta 0.1 digits 8 range 0.0 .. 10.0;
end Both; |
examples/Sort.agda | johnyob/agda-union | 0 | 16854 | <gh_stars>0
{-# OPTIONS --overlapping-instances #-}
module Sort where
open import Data.Nat using (ℕ)
open import Data.Fin using (Fin)
open import Data.List using (List; _∷_; [])
open import Data.Variant using (Variants; inj; `_)
-- instance search methods
open import Data.List.Membership.Propositional.Instances
using (⦃here⦄; ⦃there⦄)
open import Data.List.Relation.Binary.Subset.Propositional.Instances
using (⦃[]⊆xs⦄; ⦃x∈ys-xs⊆ys⇒x∷xs⊆ys⦄; ⦅_⊆_⦆)
open import Data.Union.Relation.Binary.Subtype.Instances
using (⦃refl⦄; ⦃generalize⦄; ⦃function⦄; ⌊_⌋)
-- ----------------------------------------------------------------------
-- Example (Injections)
data Sort : Set where
term type : Sort
_ : Variants Sort (term ∷ [])
_ = ` term
_-Bounds : List Sort → Set
𝒮 -Bounds = Variants Sort 𝒮 → ℕ
Index : {𝒮 : List Sort} → Variants Sort 𝒮 → (𝒮 -Bounds) → Set
Index 𝓈 Γ = Fin (Γ 𝓈)
term-sorts : List Sort
term-sorts = term ∷ type ∷ []
infix 9 #_
data Term : term-sorts -Bounds → Set where
#_ : ∀ {Γ} → Index (` term) Γ → Term Γ
-- ----------------------------------------------------------------------
-- Example (Subtyping)
type-sorts : List Sort
type-sorts = type ∷ []
infix 9 ~_
data Type : type-sorts -Bounds → Set where
~_ : ∀ {Γ} → Index (` type) Γ → Type Γ
it : ∀ {a} {A : Set a} → {{A}} → A
it {{x}} = x
_ : ⦅ type-sorts ⊆ term-sorts ⦆
_ = it
_ : term-sorts -Bounds → Set
_ = ⌊ Type ⌋
infixl 7 _[_]
data Term′ : term-sorts -Bounds → Set where
#_ : ∀ {Γ} → Index (` term) Γ → Term′ Γ
_[_] : ∀ {Γ} → Term′ Γ → ⌊ Type ⌋ Γ → Term′ Γ |
include/sf-window-keyboard.ads | Fabien-Chouteau/ASFML | 0 | 21560 | --//////////////////////////////////////////////////////////
-- SFML - Simple and Fast Multimedia Library
-- Copyright (C) 2007-2018 <NAME> (<EMAIL>)
-- This software is provided 'as-is', without any express or implied warranty.
-- In no event will the authors be held liable for any damages arising from the use of this software.
-- Permission is granted to anyone to use this software for any purpose,
-- including commercial applications, and to alter it and redistribute it freely,
-- subject to the following restrictions:
-- 1. The origin of this software must not be misrepresented;
-- you must not claim that you wrote the original software.
-- If you use this software in a product, an acknowledgment
-- in the product documentation would be appreciated but is not required.
-- 2. Altered source versions must be plainly marked as such,
-- and must not be misrepresented as being the original software.
-- 3. This notice may not be removed or altered from any source distribution.
--//////////////////////////////////////////////////////////
--//////////////////////////////////////////////////////////
package Sf.Window.Keyboard is
--//////////////////////////////////////////////////////////
--//////////////////////////////////////////////////////////
--//////////////////////////////////////////////////////////
--//////////////////////////////////////////////////////////
--//////////////////////////////////////////////////////////
--/ @brief Key codes
--/
--//////////////////////////////////////////////////////////
--/< Unhandled key
--/< The A key
--/< The B key
--/< The C key
--/< The D key
--/< The E key
--/< The F key
--/< The G key
--/< The H key
--/< The I key
--/< The J key
--/< The K key
--/< The L key
--/< The M key
--/< The N key
--/< The O key
--/< The P key
--/< The Q key
--/< The R key
--/< The S key
--/< The T key
--/< The U key
--/< The V key
--/< The W key
--/< The X key
--/< The Y key
--/< The Z key
--/< The 0 key
--/< The 1 key
--/< The 2 key
--/< The 3 key
--/< The 4 key
--/< The 5 key
--/< The 6 key
--/< The 7 key
--/< The 8 key
--/< The 9 key
--/< The Escape key
--/< The left Control key
--/< The left Shift key
--/< The left Alt key
--/< The left OS specific key: window (Windows and Linux), apple (MacOS X), ...
--/< The right Control key
--/< The right Shift key
--/< The right Alt key
--/< The right OS specific key: window (Windows and Linux), apple (MacOS X), ...
--/< The Menu key
--/< The [ key
--/< The ] key
--/< The ; key
--/< The , key
--/< The . key
--/< The ' key
--/< The / key
--/< The @ key
--/< The ~ key
--/< The = key
--/< The - key (minus, usually from numpad)
--/< The Space key
--/< The Enter/Return key
--/< The Backspace key
--/< The Tabulation key
--/< The Page up key
--/< The Page down key
--/< The End key
--/< The Home key
--/< The Insert key
--/< The Delete key
--/< +
--/< -
--/< *
--/< /
--/< Left arrow
--/< Right arrow
--/< Up arrow
--/< Down arrow
--/< The numpad 0 key
--/< The numpad 1 key
--/< The numpad 2 key
--/< The numpad 3 key
--/< The numpad 4 key
--/< The numpad 5 key
--/< The numpad 6 key
--/< The numpad 7 key
--/< The numpad 8 key
--/< The numpad 9 key
--/< The F1 key
--/< The F2 key
--/< The F3 key
--/< The F4 key
--/< The F5 key
--/< The F6 key
--/< The F7 key
--/< The F8 key
--/< The F8 key
--/< The F10 key
--/< The F11 key
--/< The F12 key
--/< The F13 key
--/< The F14 key
--/< The F15 key
--/< The Pause key
--/< Keep last -- the total number of keyboard keys
type sfKeyCode is new sfUint32;
sfKeyUnknown : constant sfKeyCode := -1;
sfKeyA : constant sfKeyCode := 0;
sfKeyB : constant sfKeyCode := 1;
sfKeyC : constant sfKeyCode := 2;
sfKeyD : constant sfKeyCode := 3;
sfKeyE : constant sfKeyCode := 4;
sfKeyF : constant sfKeyCode := 5;
sfKeyG : constant sfKeyCode := 6;
sfKeyH : constant sfKeyCode := 7;
sfKeyI : constant sfKeyCode := 8;
sfKeyJ : constant sfKeyCode := 9;
sfKeyK : constant sfKeyCode := 10;
sfKeyL : constant sfKeyCode := 11;
sfKeyM : constant sfKeyCode := 12;
sfKeyN : constant sfKeyCode := 13;
sfKeyO : constant sfKeyCode := 14;
sfKeyP : constant sfKeyCode := 15;
sfKeyQ : constant sfKeyCode := 16;
sfKeyR : constant sfKeyCode := 17;
sfKeyS : constant sfKeyCode := 18;
sfKeyT : constant sfKeyCode := 19;
sfKeyU : constant sfKeyCode := 20;
sfKeyV : constant sfKeyCode := 21;
sfKeyW : constant sfKeyCode := 22;
sfKeyX : constant sfKeyCode := 23;
sfKeyY : constant sfKeyCode := 24;
sfKeyZ : constant sfKeyCode := 25;
sfKeyNum0 : constant sfKeyCode := 26;
sfKeyNum1 : constant sfKeyCode := 27;
sfKeyNum2 : constant sfKeyCode := 28;
sfKeyNum3 : constant sfKeyCode := 29;
sfKeyNum4 : constant sfKeyCode := 30;
sfKeyNum5 : constant sfKeyCode := 31;
sfKeyNum6 : constant sfKeyCode := 32;
sfKeyNum7 : constant sfKeyCode := 33;
sfKeyNum8 : constant sfKeyCode := 34;
sfKeyNum9 : constant sfKeyCode := 35;
sfKeyEscape : constant sfKeyCode := 36;
sfKeyLControl : constant sfKeyCode := 37;
sfKeyLShift : constant sfKeyCode := 38;
sfKeyLAlt : constant sfKeyCode := 39;
sfKeyLSystem : constant sfKeyCode := 40;
sfKeyRControl : constant sfKeyCode := 41;
sfKeyRShift : constant sfKeyCode := 42;
sfKeyRAlt : constant sfKeyCode := 43;
sfKeyRSystem : constant sfKeyCode := 44;
sfKeyMenu : constant sfKeyCode := 45;
sfKeyLBracket : constant sfKeyCode := 46;
sfKeyRBracket : constant sfKeyCode := 47;
sfKeySemicolon : constant sfKeyCode := 48;
sfKeyComma : constant sfKeyCode := 49;
sfKeyPeriod : constant sfKeyCode := 50;
sfKeyQuote : constant sfKeyCode := 51;
sfKeySlash : constant sfKeyCode := 52;
sfKeyBackslash : constant sfKeyCode := 53;
sfKeyTilde : constant sfKeyCode := 54;
sfKeyEqual : constant sfKeyCode := 55;
sfKeyHyphen : constant sfKeyCode := 56;
sfKeySpace : constant sfKeyCode := 57;
sfKeyEnter : constant sfKeyCode := 58;
sfKeyBack : constant sfKeyCode := 59;
sfKeyTab : constant sfKeyCode := 60;
sfKeyPageUp : constant sfKeyCode := 61;
sfKeyPageDown : constant sfKeyCode := 62;
sfKeyEnd : constant sfKeyCode := 63;
sfKeyHome : constant sfKeyCode := 64;
sfKeyInsert : constant sfKeyCode := 65;
sfKeyDelete : constant sfKeyCode := 66;
sfKeyAdd : constant sfKeyCode := 67;
sfKeySubtract : constant sfKeyCode := 68;
sfKeyMultiply : constant sfKeyCode := 69;
sfKeyDivide : constant sfKeyCode := 70;
sfKeyLeft : constant sfKeyCode := 71;
sfKeyRight : constant sfKeyCode := 72;
sfKeyUp : constant sfKeyCode := 73;
sfKeyDown : constant sfKeyCode := 74;
sfKeyNumpad0 : constant sfKeyCode := 75;
sfKeyNumpad1 : constant sfKeyCode := 76;
sfKeyNumpad2 : constant sfKeyCode := 77;
sfKeyNumpad3 : constant sfKeyCode := 78;
sfKeyNumpad4 : constant sfKeyCode := 79;
sfKeyNumpad5 : constant sfKeyCode := 80;
sfKeyNumpad6 : constant sfKeyCode := 81;
sfKeyNumpad7 : constant sfKeyCode := 82;
sfKeyNumpad8 : constant sfKeyCode := 83;
sfKeyNumpad9 : constant sfKeyCode := 84;
sfKeyF1 : constant sfKeyCode := 85;
sfKeyF2 : constant sfKeyCode := 86;
sfKeyF3 : constant sfKeyCode := 87;
sfKeyF4 : constant sfKeyCode := 88;
sfKeyF5 : constant sfKeyCode := 89;
sfKeyF6 : constant sfKeyCode := 90;
sfKeyF7 : constant sfKeyCode := 91;
sfKeyF8 : constant sfKeyCode := 92;
sfKeyF9 : constant sfKeyCode := 93;
sfKeyF10 : constant sfKeyCode := 94;
sfKeyF11 : constant sfKeyCode := 95;
sfKeyF12 : constant sfKeyCode := 96;
sfKeyF13 : constant sfKeyCode := 97;
sfKeyF14 : constant sfKeyCode := 98;
sfKeyF15 : constant sfKeyCode := 99;
sfKeyPause : constant sfKeyCode := 100;
sfKeyCount : constant sfKeyCode := 101;
-- Deprecated values:
sfKeyDash : sfKeyCode renames sfKeyHyphen; --< \deprecated Use Hyphen instead
sfKeyReturn : sfKeyCode renames sfKeyEnter; --< \deprecated Use Enter instead
--//////////////////////////////////////////////////////////
--/ @brief Check if a key is pressed
--/
--/ @param key Key to check
--/
--/ @return sfTrue if the key is pressed, sfFalse otherwise
--/
--//////////////////////////////////////////////////////////
function isKeyPressed (key : sfKeyCode) return sfBool;
--//////////////////////////////////////////////////////////
--/ @brief Show or hide the virtual keyboard.
--/
--/ Warning: the virtual keyboard is not supported on all systems.
--/ It will typically be implemented on mobile OSes (Android, iOS)
--/ but not on desktop OSes (Windows, Linux, ...).
--/
--/ If the virtual keyboard is not available, this function does nothing.
--/
--/ @param visible True to show, false to hide
--/
--//////////////////////////////////////////////////////////
procedure setVirtualKeyboardVisible (visible : sfBool);
private
pragma Import (C, isKeyPressed, "sfKeyboard_isKeyPressed");
pragma Import (C, setVirtualKeyboardVisible, "sfKeyboard_setVirtualKeyboardVisible");
end Sf.Window.Keyboard;
|
C/Mips(Assembly)_C/Lab3/Ex3_1d.asm | paulolima18/ProgrammingMesh | 3 | 86990 | <filename>C/Mips(Assembly)_C/Lab3/Ex3_1d.asm
.data
end: .word 0xffff0010
end1: .word 0xffff0011
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)
la $s4,end1
lw $s4,0($s4)
li $s1,16
reset:
li $t1,0
la $s2,chr
lw $s3,0($s2)
la $t3,chr
lw $s5,0($t3)
loop:
beq $t1,$s1,reset
sb $s3,0($s0)
sb $s5,0($s4)
addi $t1,$t1,1
addi $s2,$s2,4
addi $t3,$t3,4
lw $s3,0($s2)
lw $s5,0($t3)
j loop
loop1:
|
libsrc/oz/ozserial/ozsetrxhandshaking.asm | meesokim/z88dk | 0 | 240674 | <reponame>meesokim/z88dk
;
; Sharp OZ family functions
;
; ported from the OZ-7xx SDK by by <NAME>
; by <NAME> - Oct. 2003
;
; Serial libraries
; buffered serial input
;
; ------
; $Id: ozsetrxhandshaking.asm,v 1.2 2015/01/19 01:33:04 pauloscustodio Exp $
;
PUBLIC ozsetrxhandshaking
EXTERN serial_int
EXTERN SerialBuffer
EXTERN ozrxhandshaking
EXTERN ozrxxoff
ozsetrxhandshaking:
pop hl
pop de
push de
ld a,e
or a
jr z,load_it
ld a,0
load_it:
ld (ozrxhandshaking),a
xor a
ld (ozrxxoff),a
jp (hl)
|
oeis/052/A052614.asm | neoneye/loda-programs | 11 | 28690 | <gh_stars>10-100
; A052614: E.g.f. 1/((1-x)(1-x^4)).
; Submitted by <NAME>
; 1,1,2,6,48,240,1440,10080,120960,1088640,10886400,119750400,1916006400,24908083200,348713164800,5230697472000,104613949440000,1778437140480000,32011868528640000,608225502044160000
mov $1,$0
div $0,4
add $0,1
lpb $1
mul $0,$1
sub $1,1
lpe
|
oeis/020/A020577.asm | neoneye/loda-programs | 11 | 15563 | <filename>oeis/020/A020577.asm
; A020577: Expansion of 1/((1-6x)(1-7x)(1-12x)).
; Submitted by <NAME>(s2)
; 1,25,427,6229,83779,1076341,13459699,165601573,2017494787,24431946517,294797887891,3549239159557,42674698231075,512696237681653,6156632228705203,73909998565124581,887135686636037443,10647155093273691349,127776650654729658835,1533395943964613455045,18401287936488804366691,220819233437210393121205,2649857380263641744767987,31798475406013743182013349,381583017510496552219359619,4579005427024568094808412821,54948129813166811594511843859,659378011603596069409287605893,7912539322303255359302285125027
add $0,1
mov $3,1
lpb $0
sub $0,1
add $2,$3
add $1,$2
mul $1,6
mul $2,12
mul $3,7
lpe
mov $0,$1
div $0,6
|
libsrc/graphics/px8/xordraw.asm | jpoikela/z88dk | 640 | 163989 | <filename>libsrc/graphics/px8/xordraw.asm<gh_stars>100-1000
;
; Z88 Graphics Functions - Small C+ stubs
;
; Written around the Interlogic Standard Library
;
; PX8 variant by <NAME>
;
;
SECTION code_clib
PUBLIC xordraw
PUBLIC _xordraw
EXTERN do_draw
.xordraw
._xordraw
ld a,3
jp do_draw
|
vic20/charset.asm | edadma/mos6502 | 4 | 100709 | <gh_stars>1-10
charset
;same as ASCII
;> d 32 63
db $00, $00, $00, $00, $00, $00, $00, $00
db $08, $08, $08, $08, $00, $00, $08, $00
db $24, $24, $24, $00, $00, $00, $00, $00
db $24, $24, $7E, $24, $7E, $24, $24, $00
db $08, $1E, $28, $1C, $0A, $3C, $08, $00
db $00, $62, $64, $08, $10, $26, $46, $00
db $30, $48, $48, $30, $4A, $44, $3A, $00
db $04, $08, $10, $00, $00, $00, $00, $00
db $04, $08, $10, $10, $10, $08, $04, $00
db $20, $10, $08, $08, $08, $10, $20, $00
db $08, $2A, $1C, $3E, $1C, $2A, $08, $00
db $00, $08, $08, $3E, $08, $08, $00, $00
db $00, $00, $00, $00, $00, $08, $08, $10
db $00, $00, $00, $7E, $00, $00, $00, $00
db $00, $00, $00, $00, $00, $18, $18, $00
db $00, $02, $04, $08, $10, $20, $40, $00
db $3C, $42, $46, $5A, $62, $42, $3C, $00
db $08, $18, $28, $08, $08, $08, $3E, $00
db $3C, $42, $02, $0C, $30, $40, $7E, $00
db $3C, $42, $02, $1C, $02, $42, $3C, $00
db $04, $0C, $14, $24, $7E, $04, $04, $00
db $7E, $40, $78, $04, $02, $44, $38, $00
db $1C, $20, $40, $7C, $42, $42, $3C, $00
db $7E, $42, $04, $08, $10, $10, $10, $00
db $3C, $42, $42, $3C, $42, $42, $3C, $00
db $3C, $42, $42, $3E, $02, $04, $38, $00
db $00, $00, $08, $00, $00, $08, $00, $00
db $00, $00, $08, $00, $00, $08, $08, $10
db $0E, $18, $30, $60, $30, $18, $0E, $00
db $00, $00, $7E, $00, $7E, $00, $00, $00
db $70, $18, $0C, $06, $0C, $18, $70, $00
db $3C, $42, $02, $0C, $10, $00, $10, $00
;@ 64
;> d 0
db $1C, $22, $4A, $56, $4C, $20, $1E, $00
;A Z
;> d 1 26
db $18, $24, $42, $7E, $42, $42, $42, $00
db $7C, $22, $22, $3C, $22, $22, $7C, $00
db $1C, $22, $40, $40, $40, $22, $1C, $00
db $78, $24, $22, $22, $22, $24, $78, $00
db $7E, $40, $40, $78, $40, $40, $7E, $00
db $7E, $40, $40, $78, $40, $40, $40, $00
db $1C, $22, $40, $4E, $42, $22, $1C, $00
db $42, $42, $42, $7E, $42, $42, $42, $00
db $1C, $08, $08, $08, $08, $08, $1C, $00
db $0E, $04, $04, $04, $04, $44, $38, $00
db $42, $44, $48, $70, $48, $44, $42, $00
db $40, $40, $40, $40, $40, $40, $7E, $00
db $42, $66, $5A, $5A, $42, $42, $42, $00
db $42, $62, $52, $4A, $46, $42, $42, $00
db $18, $24, $42, $42, $42, $24, $18, $00
db $7C, $42, $42, $7C, $40, $40, $40, $00
db $18, $24, $42, $42, $4A, $24, $1A, $00
db $7C, $42, $42, $7C, $48, $44, $42, $00
db $3C, $42, $40, $3C, $02, $42, $3C, $00
db $3E, $08, $08, $08, $08, $08, $08, $00
db $42, $42, $42, $42, $42, $42, $3C, $00
db $42, $42, $42, $24, $24, $18, $18, $00
db $42, $42, $42, $5A, $5A, $66, $42, $00
db $42, $42, $24, $18, $24, $42, $42, $00
db $22, $22, $22, $1C, $08, $08, $08, $00
db $7E, $02, $04, $18, $20, $40, $7E, $00
;[ 91
;> d 27
db $3C, $20, $20, $20, $20, $20, $3C, $00
;\ 92 missing
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
;] 93
;> d 29
db $3C, $04, $04, $04, $04, $04, $3C, $00
;^ 94 missing
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
;_ 95 missing
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
;` 96 missing
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
;a z
;> d 257 282
db $00, $00, $38, $04, $3C, $44, $3A, $00
db $40, $40, $5C, $62, $42, $62, $5C, $00
db $00, $00, $3C, $42, $40, $42, $3C, $00
db $02, $02, $3A, $46, $42, $46, $3A, $00
db $00, $00, $3C, $42, $7E, $40, $3C, $00
db $0C, $12, $10, $7C, $10, $10, $10, $00
db $00, $00, $3A, $46, $46, $3A, $02, $3C
db $40, $40, $5C, $62, $42, $42, $42, $00
db $08, $00, $18, $08, $08, $08, $1C, $00
db $04, $00, $0C, $04, $04, $04, $44, $38
db $40, $40, $44, $48, $50, $68, $44, $00
db $18, $08, $08, $08, $08, $08, $1C, $00
db $00, $00, $76, $49, $49, $49, $49, $00
db $00, $00, $5C, $62, $42, $42, $42, $00
db $00, $00, $3C, $42, $42, $42, $3C, $00
db $00, $00, $5C, $62, $62, $5C, $40, $40
db $00, $00, $3A, $46, $46, $3A, $02, $02
db $00, $00, $5C, $62, $40, $40, $40, $00
db $00, $00, $3E, $40, $3C, $02, $7C, $00
db $10, $10, $7C, $10, $10, $12, $0C, $00
db $00, $00, $42, $42, $42, $46, $3A, $00
db $00, $00, $42, $42, $42, $24, $18, $00
db $00, $00, $41, $49, $49, $49, $36, $00
db $00, $00, $42, $24, $18, $24, $42, $00
db $00, $00, $42, $42, $46, $3A, $02, $3C
db $00, $00, $7E, $04, $18, $20, $7E, $00
;{ 123 missing
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
;| 124 missing
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
;} 125 missing
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
;~ 126 missing
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
; 127
db $00, $00, $00, $00, $00, $00, $00, $00
end |
alloy4fun_models/trashltl/models/16/6GWvFmLpHjBBCR6Qd.als | Kaixi26/org.alloytools.alloy | 0 | 2134 | <filename>alloy4fun_models/trashltl/models/16/6GWvFmLpHjBBCR6Qd.als<gh_stars>0
open main
pred id6GWvFmLpHjBBCR6Qd_prop17 {
always all f : Trash | after f not in Trash
}
pred __repair { id6GWvFmLpHjBBCR6Qd_prop17 }
check __repair { id6GWvFmLpHjBBCR6Qd_prop17 <=> prop17o } |
notes/FOT/FOTC/Program/Min/MinBC-SL.agda | asr/fotc | 11 | 9477 | <gh_stars>10-100
------------------------------------------------------------------------------
-- Example of a partial function using the Bove-Capretta method
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
-- From: <NAME> and <NAME>. Nested general recursion and
-- partiality in type theory. vol 2152 LNCS. 2001.
module FOT.FOTC.Program.Min.MinBC-SL where
open import Data.Nat renaming ( suc to succ )
open import Relation.Binary.PropositionalEquality
------------------------------------------------------------------------------
data minAcc : (ℕ → ℕ) → Set where
minacc0 : (f : ℕ → ℕ) → f 0 ≡ 0 → minAcc f
minacc1 : (f : ℕ → ℕ) → f 0 ≢ 0 → minAcc (λ n → f (succ n)) → minAcc f
min : (f : ℕ → ℕ) → minAcc f → ℕ
min f (minacc0 .f q) = 0
min f (minacc1 .f q h) = succ (min (λ n → f (succ n)) h)
|
Bank_G/4_chosof.asm | ndf-zz/fv1testing | 0 | 240381 | <filename>Bank_G/4_chosof.asm
; FV-1 Testing
;
; Program: cho sof,... test
;
; POT0: Frequency
;
; Check the Sin/Cos CHO outputs on SIN LFO
;
skp run,main
wlds SIN0,0x0,0x7fff ; LFO preparation
main: or 0x7fffff ; load maxval
cho sof,SIN0,SIN|REG,0.0 ; fetch sin component and reg
wrax DACL,0.0 ; output to DACL
or 0x7fffff ; load maxval
cho sof,SIN0,COS,0.0 ; fetch cos component
wrax DACR,0.0 ; output to DACR
ldax POT0 ; fetch freq control
wrax SIN0_RATE,0.0 ; save to LFO rate
|
SchmoeTools/Scripting/ProTools.applescript | osheroff/schmoe-tools | 0 | 2698 | script ProToolsApplescript
property parent: class "NSObject"
on list_position(this_item, this_list)
repeat with i from 1 to the count of this_list
if item i of this_list is this_item then return i
end repeat
return 0
end list_position
on changeTool(targetIndex, matchText, toolTitles, keyCode)
tell application "System Events"
global curIndex, smartToolOn
if the (title of first item of (processes whose frontmost is true)) is not "Pro Tools" then
return
end if
tell group "Cursor Tool Cluster" of (first window whose name starts with "Edit:") of process "Pro Tools"
tell (first button whose name is "Smart Tool")
if exists
set smartToolOn to (value is "selected")
-- Object Grabber tool doesn't work with smart tool mode, so we just switch to it.
if keyCode is 100 and targetIndex is 3
set smartToolOn to false
end if
else
return
end if
end tell
-- bugger me, the value of selected is wrong for the loop/TCE tool - they always
-- report themselves as selected. so we have to hit F6 to get to the tool, always,
-- and then cycle around if it was already selected
tell application "System Events"
key code keyCode
end tell
tell (first button whose name contains matchText)
if not exists then
return
end if
set curIndex to my list_position(title, toolTitles)
if curIndex is 0
display notification "error, could not find " & title & " in " & toolTitles
return
end if
end tell -- button
end tell -- pro tools
set nKeyPresses to targetIndex - curIndex
-- wrap around
if nKeyPresses < 0 then
set nKeyPresses to nKeyPresses + 3
end if
repeat nKeyPresses times
key code keyCode
end repeat
if smartToolOn then
-- go back to smart tool
key code 26 using {command down}
end if
end tell -- system events
end changeTool
on changeTrim(targetIndex)
my changeTool(targetIndex, "Trim Tool", { "Trim Tool", "Time Compression/Expansion Trim tool", "Loop Trim Tool" }, 97)
end changeTrim
on changeGrabber(targetIndex)
my changeTool(targetIndex, "Grabber Tool", { "Grabber Tool (Time)", "Grabber Tool (Separation)", "Grabber Tool (Object)" }, 100)
end changeGrabber
on trimTool()
my changeTrim(1)
end trimTool
on tceTool()
my changeTrim(2)
end tceTool
on loopTool()
my changeTrim(3)
end
on grabberTool()
my changeGrabber(1)
end
on separationTool()
my changeGrabber(2)
end
on objectTool()
my changeGrabber(3)
end
end script
|
src/04,A165-PlaceNextDialogPassChar.Old.asm | JixunMoe/ContraNES1TranslationPatch | 1 | 87694 | PlaceNextDialogPassChar:
; 012175
; 04:A165:C6 47 DEC $0047 = #$06
; 04:A167:D0 69 BNE $A1D2
; 04:A169:A9 06 LDA #$06
.org $A165
jmp $AC60
|
libsrc/_DEVELOPMENT/math/float/math32/lm32/c/sdcc/frexp_callee.asm | jpoikela/z88dk | 640 | 161378 |
SECTION code_fp_math32
PUBLIC _frexp_callee
EXTERN cm32_sdcc_frexp_callee
defc _frexp_callee = cm32_sdcc_frexp_callee
|
src/Selective/Examples/PingPong.agda | Zalastax/thesis | 1 | 13476 | module Selective.Examples.PingPong where
open import Selective.ActorMonad public
open import Prelude
-- An example including three actors: spawner, pinger, ponger
--
-- Spawner is the actor that starts it all.
-- Spawner spawns both pinger and ponger.
-- Then spawner send the reference of ponger to pinger,
-- and the reference of pinger to ponger.
--
-- Pinger is an actor that can receive Bool messages.
-- Pinger counts the number of 'false' messages it receives, until it receives a 'true'
--
-- Ponger is an actor that can receive Nat messages.
-- Ponger keeps sending 'false' until it receives a message containing 10.
Spawnbox : InboxShape
Spawnbox = []
ℕ₁ : Set₁
ℕ₁ = Lift (lsuc lzero) ℕ
Bool₁ : Set₁
Bool₁ = Lift (lsuc lzero) Bool
mutual
PingValues = [ Bool ]ˡ
PongValues = [ ℕ ]ˡ
PingRefs : TypingContext
PingRefs = [ ⊠-of-values PongValues ]ˡ
PongRefs : TypingContext
PongRefs = [ ⊠-of-values PingValues ]ˡ
PongReferenceMessage : MessageType
PongReferenceMessage = [ ReferenceType (⊠-of-values PongValues) ]ˡ
BoolMessage : MessageType
BoolMessage = [ ValueType Bool ]ˡ
Pingbox : InboxShape
Pingbox = BoolMessage ∷ [ PongReferenceMessage ]ˡ
PingReferenceMessage : MessageType
PingReferenceMessage = [ ReferenceType (⊠-of-values PingValues) ]ˡ
NatMessage : MessageType
NatMessage = [ ValueType ℕ ]ˡ
Pongbox : InboxShape
Pongbox = NatMessage ∷ [ PingReferenceMessage ]ˡ
constPingrefs : {A : Set₁} → (A → TypingContext)
constPingrefs _ = PingRefs
pingMainActor : (i : Size) (A : Set₁) → Set₂
pingMainActor i A = ∞ActorM i Pingbox A PingRefs constPingrefs
pinger : ∀ {i} → ∞ActorM (↑ i) Pingbox ⊤₁ [] constPingrefs
pinger .force = waitForPong ∞>> pingMain 0
where
waitForPong : ∀ {i} → ∞ActorM i Pingbox ⊤₁ [] constPingrefs
waitForPong = selective-receive (λ {
(Msg Z _) → false
; (Msg (S Z) _) → true
; (Msg (S (S ())) _)
}) >>= λ {
record { msg = (Msg Z _) ; msg-ok = () }
; record { msg = (Msg (S Z) _) ; msg-ok = refl } → return _
; record { msg = (Msg (S (S ())) x₁) }
}
waitForPingValue : ∀ {i Γ} → ∞ActorM i Pingbox Bool₁ Γ (λ _ → Γ)
waitForPingValue = selective-receive (λ {
(Msg Z _) → true
; (Msg (S Z) _) → false
; (Msg (S (S ())) _)
}) >>= λ {
record { msg = (Msg Z (b ∷ [])) ; msg-ok = refl } → return b
; record { msg = (Msg (S Z) _) ; msg-ok = () }
; record { msg = (Msg (S (S ())) x₁) }
}
pingMain : ∀ {i} → ℕ → pingMainActor i ⊤₁
pingMain n .force = waitForPingValue ∞>>= λ
{ (lift false) → (Z ![t: Z ] ([ lift n ]ᵃ)) >> pingMain (suc n)
; (lift true) → return _}
constPongrefs : {A : Set₁} → (A → TypingContext)
constPongrefs _ = PongRefs
pongMainActor : (i : Size) (A : Set₁) → Set₂
pongMainActor i A = ∞ActorM i Pongbox A PongRefs constPongrefs
ponger : ∀ {i} → ∞ActorM (↑ i) Pongbox ⊤₁ [] constPongrefs
ponger .force = waitForPing ∞>> ((Z ![t: Z ] ([ lift false ]ᵃ)) >> pongMain)
where
waitForPing : ∀ {i} → ∞ActorM i Pongbox ⊤₁ [] constPongrefs
waitForPing = selective-receive (λ {
(Msg Z _) → false
; (Msg (S Z) _) → true
; (Msg (S (S ())) _)
}) >>= λ {
record { msg = (Msg Z _) ; msg-ok = () }
; record { msg = (Msg (S Z) x₁) ; msg-ok = refl } → return _
; record { msg = (Msg (S (S ())) x₁) }
}
waitForPongValue : ∀ {i Γ} → ∞ActorM i Pongbox ℕ₁ Γ (λ _ → Γ)
waitForPongValue = selective-receive (λ {
(Msg Z _) → true
; (Msg (S Z) _) → false
; (Msg (S (S ())) _)
}) >>= λ {
record { msg = (Msg Z (n ∷ [])) ; msg-ok = refl } → return n
; record { msg = (Msg (S Z) x₁) ; msg-ok = () }
; record { msg = (Msg (S (S ())) x₁) }
}
pongMain : ∀ {i} → pongMainActor i ⊤₁
pongMain .force = waitForPongValue ∞>>= λ {
(lift 10) → Z ![t: Z ] [ lift true ]ᵃ
; (lift n) → Z ![t: Z ] [ lift false ]ᵃ >> pongMain
}
spawner : ∀ {i} → ∞ActorM i Spawnbox ⊤₁ [] (λ _ → Pingbox ∷ [ Pongbox ]ˡ)
spawner = do
spawn∞ ponger
spawn∞ pinger
Z ![t: S Z ] [ [ S Z ]>: [ Z ]ᵐ ]ᵃ
S Z ![t: S Z ] [ [ Z ]>: [ Z ]ᵐ ]ᵃ
|
source/required/s-addima.adb | ytomino/drake | 33 | 442 | function System.Address_Image (A : Address)
return Storage_Elements.Formatting.Address_String
is
pragma Suppress (All_Checks);
begin
return Storage_Elements.Formatting.Image (A);
end System.Address_Image;
|
examples/src/taskwork.adb | sonneveld/adazmq | 0 | 21961 | -- Task worker
-- Connects PULL socket to tcp://localhost:5557
-- Collects workloads from ventilator via that socket
-- Connects PUSH socket to tcp://localhost:5558
-- Sends results to sink via that socket
with Ada.Command_Line;
with Ada.Text_IO;
with GNAT.Formatted_String;
with ZMQ;
procedure TaskWork is
use type GNAT.Formatted_String.Formatted_String;
function Main return Ada.Command_Line.Exit_Status
is
begin
declare
Context : ZMQ.Context_Type := ZMQ.New_Context;
-- Socket to receive messages on
Receiver : constant ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_PULL);
-- Socket to send messages to
Sender : constant ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_PUSH);
begin
Receiver.Connect ("tcp://localhost:5557");
Sender.Connect ("tcp://localhost:5558");
-- Process tasks forever
loop
declare
Buf : constant String := Receiver.Recv;
begin
Ada.Text_IO.Put (Buf &"."); -- Show progress
Ada.Text_IO.Flush;
delay Duration'Value (Buf) / 1000.0; -- Do the work
Sender.Send ("");
end;
end loop;
Receiver.Close;
Sender.Close;
Context.Term;
end;
return 0;
end Main;
begin
Ada.Command_Line.Set_Exit_Status (Main);
end TaskWork;
|
src/stars/tests/tests/pseudoOps/not_test.asm | kevintmcdonnell/stars | 9 | 8781 | .text
main:
li $t0, 0x0f0f0f0f
not $a0, $t0
li $v0, 34
syscall
li $a0, ' '
li $v0, 11
syscall
li $t0, 0xf0f0f0f0
not $a0, $t0
li $v0, 34
syscall |
programs/float.asm | shoaib-jamal/MichalOS | 14 | 167714 | <gh_stars>10-100
%include "michalos.inc"
start:
finit ; Initialize the FPU
fstcw [tmpword]
or byte [tmpword + 1], 1100b ; Disable rounding
fldcw [tmpword]
fldpi ; ST0 = Pi
call .print_float
fdecstp
fldz ; ST0 = Pi
call .print_float
fdecstp
fld1 ; ST0 = Pi
call .print_float
fdecstp
fldlg2 ; ST0 = Pi
call .print_float
fdecstp
fldln2 ; ST0 = Pi
call .print_float
fdecstp
call os_wait_for_key
ret
.print_float:
fst qword [backup] ; Remember the test value for later
; Get the digits before the decimal point
mov di, buffer + 299
std ; The digits will be backwards
mov cx, 300
.loop:
fst qword [tmp] ; ST0 = Pi
fild word [mul10] ; ST0 = 10, ST1 = Pi
fld qword [tmp] ; ST0 = Pi, ST1 = 10, ST2 = Pi
fprem ; ST0 = Pi % 10, ST1 = 10, ST2 = Pi
fistp word [tmpword]; ST0 = 10, ST1 = Pi
fstp qword [tmp] ; ST0 = Pi
fidiv word [mul10] ; ST0 = Pi / 10
mov ax, [tmpword]
stosb
loop .loop
; And now after the decimal point
mov di, buffer + 300
cld
fstp qword [tmp]
fld qword [backup]
mov cx, 300
.loop2:
fimul word [mul10]
fst qword [tmp]
fild word [mul10]
fld qword [tmp]
fprem
fistp word [tmpword]
fstp qword [tmp]
mov ax, [tmpword]
stosb
loop .loop2
; And now, print the digits
mov si, buffer
mov cx, 600
test byte [backup + 7], 80h ; Negative?
jz .prefixloop
mov al, '-'
call os_putchar
; First, skip all of the prefix zeroes
.prefixloop:
lodsb
cmp al, 0
jne .print
loop .prefixloop
; No digits were found, so it's zero
.print:
push cx
; Print the first digit
add al, '0'
call os_putchar
mov al, '.'
call os_putchar
mov cx, 14 ; Print the next 14 digits
.print_loop:
lodsb
add al, '0'
call os_putchar
loop .print_loop
mov al, 'e'
call os_putchar
pop cx
sub cx, 301
mov ax, cx
call os_sint_to_string
mov si, ax
call os_print_string
.exit:
call os_print_newline
ret
tmp dq 0.0
backup dq 0.0
tmpword dw 0
mul10 dw 10
buffer:
|
source/xml/dom/matreshka-dom_documents.adb | svn2github/matreshka | 0 | 398 | <filename>source/xml/dom/matreshka-dom_documents.adb
------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- XML Processor --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014, <NAME> <<EMAIL>> --
-- 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 the <NAME>, IE 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 --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Containers.Hashed_Maps;
with Ada.Tags.Generic_Dispatching_Constructor;
with League.Strings.Hash;
with Matreshka.DOM_Attributes;
with Matreshka.DOM_Elements;
with Matreshka.DOM_Texts;
package body Matreshka.DOM_Documents is
procedure Split_Qualified_Name
(Qualified_Name : League.Strings.Universal_String;
Prefix : out League.Strings.Universal_String;
Local_Name : out League.Strings.Universal_String);
-- Splits qualified name into prefix and local name parts.
type Qualified_Name is record
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
end record;
function Hash (Item : Qualified_Name) return Ada.Containers.Hash_Type;
-- Hash function to be used with standard containers.
package Qualified_Name_Maps is
new Ada.Containers.Hashed_Maps
(Qualified_Name, Ada.Tags.Tag, Hash, "=", Ada.Tags."=");
Attribute_Registry : Qualified_Name_Maps.Map;
Element_Registry : Qualified_Name_Maps.Map;
------------------
-- Constructors --
------------------
package body Constructors is
----------------
-- Initialize --
----------------
procedure Initialize (Self : not null access Document_Node'Class) is
begin
Matreshka.DOM_Nodes.Constructors.Initialize (Self, Self);
end Initialize;
end Constructors;
----------------------
-- Create_Attribute --
----------------------
function Create_Attribute
(Self : not null access Document_Node'Class;
Namespace_URI : League.Strings.Universal_String;
Prefix : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String)
return not null XML.DOM.Attributes.DOM_Attribute_Access
is
function Constructor is
new Ada.Tags.Generic_Dispatching_Constructor
(Matreshka.DOM_Attributes.Abstract_Attribute_L2_Node,
Matreshka.DOM_Attributes.Attribute_L2_Parameters,
Matreshka.DOM_Attributes.Create);
Parameters : aliased Matreshka.DOM_Attributes.Attribute_L2_Parameters
:= (Document => Self,
Namespace_URI => Namespace_URI,
Prefix => Prefix,
Local_Name => Local_Name);
Position : Qualified_Name_Maps.Cursor;
Tag : Ada.Tags.Tag;
Node : Matreshka.DOM_Nodes.Node_Access;
begin
Position :=
Attribute_Registry.Find
((Parameters.Namespace_URI, Parameters.Local_Name));
if Qualified_Name_Maps.Has_Element (Position) then
Tag := Qualified_Name_Maps.Element (Position);
else
Tag := Matreshka.DOM_Attributes.Attribute_L2_Node'Tag;
end if;
Node :=
new Matreshka.DOM_Attributes.Abstract_Attribute_L2_Node'Class'
(Constructor (Tag, Parameters'Access));
return XML.DOM.Attributes.DOM_Attribute_Access (Node);
end Create_Attribute;
-------------------------
-- Create_Attribute_NS --
-------------------------
overriding function Create_Attribute_NS
(Self : not null access Document_Node;
Namespace_URI : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String)
return not null XML.DOM.Attributes.DOM_Attribute_Access
is
Prefix : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Node : constant not null Matreshka.DOM_Nodes.Node_Access
:= new Matreshka.DOM_Attributes.Attribute_L2_Node;
begin
Split_Qualified_Name (Qualified_Name, Prefix, Local_Name);
return Self.Create_Attribute (Namespace_URI, Prefix, Local_Name);
end Create_Attribute_NS;
--------------------
-- Create_Element --
--------------------
function Create_Element
(Self : not null access Document_Node'Class;
Namespace_URI : League.Strings.Universal_String;
Prefix : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String)
return not null XML.DOM.Elements.DOM_Element_Access
is
function Constructor is
new Ada.Tags.Generic_Dispatching_Constructor
(Matreshka.DOM_Elements.Abstract_Element_Node,
Matreshka.DOM_Elements.Element_L2_Parameters,
Matreshka.DOM_Elements.Create);
Parameters : aliased Matreshka.DOM_Elements.Element_L2_Parameters
:= (Document => Self,
Namespace_URI => Namespace_URI,
Prefix => Prefix,
Local_Name => Local_Name);
Position : Qualified_Name_Maps.Cursor;
Tag : Ada.Tags.Tag;
Node : Matreshka.DOM_Nodes.Node_Access;
begin
Position :=
Element_Registry.Find
((Parameters.Namespace_URI, Parameters.Local_Name));
if Qualified_Name_Maps.Has_Element (Position) then
Tag := Qualified_Name_Maps.Element (Position);
else
Tag := Matreshka.DOM_Elements.Element_Node'Tag;
end if;
Node :=
new Matreshka.DOM_Elements.Abstract_Element_Node'Class'
(Constructor (Tag, Parameters'Access));
return XML.DOM.Elements.DOM_Element_Access (Node);
end Create_Element;
-----------------------
-- Create_Element_NS --
-----------------------
overriding function Create_Element_NS
(Self : not null access Document_Node;
Namespace_URI : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String)
return not null XML.DOM.Elements.DOM_Element_Access
is
Prefix : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
begin
Split_Qualified_Name (Qualified_Name, Prefix, Local_Name);
return Self.Create_Element (Namespace_URI, Prefix, Local_Name);
end Create_Element_NS;
----------------------
-- Create_Text_Node --
----------------------
overriding function Create_Text_Node
(Self : not null access Document_Node;
Data : League.Strings.Universal_String)
return not null XML.DOM.Texts.DOM_Text_Access
is
Node : constant not null Matreshka.DOM_Nodes.Node_Access
:= new Matreshka.DOM_Texts.Text_Node;
begin
Matreshka.DOM_Texts.Constructors.Initialize
(Matreshka.DOM_Texts.Text_Node'Class (Node.all)'Access, Self, Data);
return XML.DOM.Texts.DOM_Text_Access (Node);
end Create_Text_Node;
----------------
-- Enter_Node --
----------------
overriding procedure Enter_Node
(Self : not null access Document_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
Visitor.Enter_Document
(XML.DOM.Documents.DOM_Document_Access (Self), Control);
end Enter_Node;
----------------
-- Error_Code --
----------------
overriding function Error_Code
(Self : not null access constant Document_Node)
return XML.DOM.Error_Code is
begin
return Self.Diagnosis;
end Error_Code;
------------------
-- Error_String --
------------------
overriding function Error_String
(Self : not null access constant Document_Node)
return League.Strings.Universal_String is
begin
return League.Strings.Empty_Universal_String;
end Error_String;
-------------------
-- Get_Node_Name --
-------------------
overriding function Get_Node_Name
(Self : not null access constant Document_Node)
return League.Strings.Universal_String
is
pragma Unreferenced (Self);
begin
return League.Strings.To_Universal_String ("#document");
end Get_Node_Name;
-------------------
-- Get_Node_Type --
-------------------
overriding function Get_Node_Type
(Self : not null access constant Document_Node)
return XML.DOM.Node_Type
is
pragma Unreferenced (Self);
begin
return XML.DOM.Document_Node;
end Get_Node_Type;
------------------------
-- Get_Owner_Document --
------------------------
overriding function Get_Owner_Document
(Self : not null access constant Document_Node)
return XML.DOM.Documents.DOM_Document_Access
is
pragma Unreferenced (Self);
begin
return null;
end Get_Owner_Document;
----------
-- Hash --
----------
function Hash (Item : Qualified_Name) return Ada.Containers.Hash_Type is
use type Ada.Containers.Hash_Type;
begin
return
League.Strings.Hash (Item.Namespace_URI)
+ League.Strings.Hash (Item.Local_Name);
end Hash;
----------------
-- Leave_Node --
----------------
overriding procedure Leave_Node
(Self : not null access Document_Node;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
Visitor.Leave_Document
(XML.DOM.Documents.DOM_Document_Access (Self), Control);
end Leave_Node;
------------------------
-- Register_Attribute --
------------------------
procedure Register_Attribute
(Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Tag : Ada.Tags.Tag) is
begin
Attribute_Registry.Insert ((Namespace_URI, Local_Name), Tag);
end Register_Attribute;
----------------------
-- Register_Element --
----------------------
procedure Register_Element
(Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Tag : Ada.Tags.Tag) is
begin
Element_Registry.Insert ((Namespace_URI, Local_Name), Tag);
end Register_Element;
--------------------------
-- Split_Qualified_Name --
--------------------------
procedure Split_Qualified_Name
(Qualified_Name : League.Strings.Universal_String;
Prefix : out League.Strings.Universal_String;
Local_Name : out League.Strings.Universal_String)
is
Delimiter : constant Natural := Qualified_Name.Index (':');
begin
if Delimiter = 0 then
Prefix := League.Strings.Empty_Universal_String;
Local_Name := Qualified_Name;
else
Prefix := Qualified_Name.Head (Delimiter - 1);
Local_Name := Qualified_Name.Tail_From (Delimiter + 1);
end if;
end Split_Qualified_Name;
----------------
-- Visit_Node --
----------------
overriding procedure Visit_Node
(Self : not null access Document_Node;
Iterator : in out XML.DOM.Visitors.Abstract_Iterator'Class;
Visitor : in out XML.DOM.Visitors.Abstract_Visitor'Class;
Control : in out XML.DOM.Visitors.Traverse_Control) is
begin
Iterator.Visit_Document
(Visitor, XML.DOM.Documents.DOM_Document_Access (Self), Control);
end Visit_Node;
end Matreshka.DOM_Documents;
|
mat/src/parser/mat-expressions-parser_io.ads | stcarrez/mat | 7 | 11270 | -----------------------------------------------------------------------
-- mat-expressions-parser_io -- Input IO for Lex parser
-- Copyright (C) 2014, 2015 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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.
-----------------------------------------------------------------------
with MAT.Expressions.Lexer_dfa;
with Ada.Text_IO;
package MAT.Expressions.Parser_IO is
use MAT.Expressions.Lexer_dfa;
user_output_file : Ada.Text_IO.File_Type;
NULL_IN_INPUT : exception;
AFLEX_INTERNAL_ERROR : exception;
UNEXPECTED_LAST_MATCH : exception;
PUSHBACK_OVERFLOW : exception;
AFLEX_SCANNER_JAMMED : exception;
type eob_action_type is (EOB_ACT_RESTART_SCAN,
EOB_ACT_END_OF_FILE,
EOB_ACT_LAST_MATCH);
YY_END_OF_BUFFER_CHAR : constant Character := ASCII.NUL;
-- number of characters read into yy_ch_buf
yy_n_chars : Integer;
-- true when we've seen an EOF for the current input file
yy_eof_has_been_seen : Boolean;
procedure Set_Input (Content : in String);
procedure YY_INPUT (Buf : out MAT.Expressions.Lexer_dfa.unbounded_character_array;
Result : out Integer;
Max_Size : in Integer);
function yy_get_next_buffer return eob_action_type;
function Input_Line return Ada.Text_IO.Count;
function yywrap return Boolean;
procedure Open_Input (Fname : in String);
end MAT.Expressions.Parser_IO;
|
programs/oeis/339/A339765.asm | neoneye/loda | 22 | 18950 | <reponame>neoneye/loda
; A339765: a(n) = 2*floor(n*phi) - 3*n, where phi = (1+sqrt(5))/2.
; -1,0,-1,0,1,0,1,0,1,2,1,2,3,2,3,2,3,4,3,4,3,4,5,4,5,6,5,6,5,6,7,6,7,8,7,8,7,8,9,8,9,8,9,10,9,10,11,10,11,10,11,12,11,12,11,12,13,12,13,14,13,14,13,14,15,14,15,16,15,16,15,16,17,16,17,16
mov $1,$0
seq $0,73869 ; a(n) = Sum_{i=0..n} A002251(i)/(n+1).
mul $0,2
sub $0,$1
sub $0,1
|
Task/Time-a-function/Ada/time-a-function.ada | LaudateCorpus1/RosettaCodeData | 1 | 8771 | with Ada.Calendar; use Ada.Calendar;
with Ada.Text_Io; use Ada.Text_Io;
procedure Query_Performance is
type Proc_Access is access procedure(X : in out Integer);
function Time_It(Action : Proc_Access; Arg : Integer) return Duration is
Start_Time : Time := Clock;
Finis_Time : Time;
Func_Arg : Integer := Arg;
begin
Action(Func_Arg);
Finis_Time := Clock;
return Finis_Time - Start_Time;
end Time_It;
procedure Identity(X : in out Integer) is
begin
X := X;
end Identity;
procedure Sum (Num : in out Integer) is
begin
for I in 1..1000 loop
Num := Num + I;
end loop;
end Sum;
Id_Access : Proc_Access := Identity'access;
Sum_Access : Proc_Access := Sum'access;
begin
Put_Line("Identity(4) takes" & Duration'Image(Time_It(Id_Access, 4)) & " seconds.");
Put_Line("Sum(4) takes:" & Duration'Image(Time_It(Sum_Access, 4)) & " seconds.");
end Query_Performance;
|
alloy4fun_models/trashltl/models/17/d3PCNeheCQ37uMCdj.als | Kaixi26/org.alloytools.alloy | 0 | 817 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idd3PCNeheCQ37uMCdj_prop18 {
always (all f:Protected | f in Protected releases f in Trash)
}
pred __repair { idd3PCNeheCQ37uMCdj_prop18 }
check __repair { idd3PCNeheCQ37uMCdj_prop18 <=> prop18o } |
programs/oeis/053/A053044.asm | neoneye/loda | 22 | 15916 | ; A053044: a(n) is the number of iterations of the Euler totient function to reach 1, starting at n!.
; 0,1,2,4,6,8,10,13,15,18,21,24,27,30,33,37,41,44,47,51,54,58,62,66,70,74,77,81,85,89,93,98,102,107,111,115,119,123,127,132,137,141,145,150,154,159,164,169,173,178,183,188,193,197,202,207,211,216,221,226,231,236,240,246,251,256,261,267,272,277,282,287,292,297,302,307,312,317,322,328,332,338,344,349,355,360,365,371,377,382,387,393,398,404,409,415,421,426,431,437
lpb $0
mov $2,$0
sub $0,1
seq $2,64415 ; a(1) = 0, a(n) = iter(n) if n is even, a(n) = iter(n)-1 if n is odd, where iter(n) = A003434(n) = smallest number of iterations of Euler totient function phi needed to reach 1.
add $1,$2
lpe
mov $0,$1
|
oeis/153/A153597.asm | neoneye/loda-programs | 11 | 9652 | <reponame>neoneye/loda-programs<filename>oeis/153/A153597.asm
; A153597: a(n) = ((6 + sqrt(3))^n - (6 - sqrt(3))^n)/(2*sqrt(3)).
; Submitted by <NAME>(s1)
; 1,12,111,936,7569,59940,469503,3656016,28378593,219894588,1702241487,13170376440,101870548209,787824155988,6092161780959,47107744223904,364251591915201,2816463543593580,21777259989921327,168383822940467784,1301956295618209617,10066809390383078532,77837154929196025023,601841149267710708720,4653467678549059678881,35980854216754262758812,278205817208932183702671,2151101617354295533391256,16632427440356784338506929,128602775911589659460171700,994363205407302030351331743,7688466859805165602030314816
mov $1,2
mov $3,1
lpb $0
sub $0,1
mul $1,3
mov $2,$3
mul $3,6
add $3,$1
mul $1,2
add $1,$2
lpe
mov $0,$3
|
programs/oeis/160/A160927.asm | jmorken/loda | 1 | 164187 | ; A160927: a(n) = n + reversal(n-1).
; 1,3,5,7,9,11,13,15,17,19,12,23,34,45,56,67,78,89,100,111,23,34,45,56,67,78,89,100,111,122,34,45,56,67,78,89,100,111,122,133,45,56,67,78,89,100,111,122,133,144,56,67,78,89,100,111,122,133,144,155,67,78,89,100
mov $2,$0
cal $0,4086 ; Read n backwards (referred to as R(n) in many sequences).
add $0,$2
mov $1,$0
add $1,1
|
oeis/001/A001094.asm | neoneye/loda-programs | 11 | 176988 | ; A001094: a(n) = n + n*(n-1)*(n-2)*(n-3).
; 0,1,2,3,28,125,366,847,1688,3033,5050,7931,11892,17173,24038,32775,43696,57137,73458,93043,116300,143661,175582,212543,255048,303625,358826,421227,491428,570053,657750,755191,863072,982113,1113058,1256675,1413756,1585117,1771598,1974063,2193400,2430521,2686362,2961883,3258068,3575925,3916486,4280807,4669968,5085073,5527250,5997651,6497452,7027853,7590078,8185375,8815016,9480297,10182538,10923083,11703300,12524581,13388342,14296023,15249088,16249025,17297346,18395587,19545308,20748093,22005550
mov $1,$0
bin $1,4
mul $1,24
add $0,$1
|
Transynther/x86/_processed/NC/_ht_st_zr_un_/i3-7100_9_0xca_notsx.log_21829_803.asm | ljhsiun2/medusa | 9 | 4427 | .global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x5557, %rsi
lea addresses_UC_ht+0xe497, %rdi
nop
nop
nop
nop
inc %r14
mov $112, %rcx
rep movsl
sub $22537, %r14
lea addresses_WC_ht+0x14897, %r14
nop
nop
nop
nop
xor $61446, %rbx
mov (%r14), %bp
nop
nop
nop
nop
nop
dec %rsi
lea addresses_D_ht+0x17439, %rdi
nop
nop
xor %r13, %r13
movw $0x6162, (%rdi)
nop
nop
nop
nop
nop
and %rbp, %rbp
lea addresses_D_ht+0x4bd7, %r14
nop
nop
nop
nop
nop
and $36627, %rsi
mov $0x6162636465666768, %rdi
movq %rdi, (%r14)
cmp %rbp, %rbp
lea addresses_WC_ht+0x870e, %rcx
nop
nop
dec %r13
movb $0x61, (%rcx)
nop
nop
add $61519, %r14
lea addresses_D_ht+0x16197, %rbx
nop
nop
inc %r14
mov (%rbx), %edi
nop
nop
and %r13, %r13
lea addresses_D_ht+0xcb37, %r13
nop
nop
nop
nop
inc %rbp
mov $0x6162636465666768, %rdi
movq %rdi, (%r13)
nop
nop
nop
nop
and %rbx, %rbx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %r9
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_US+0x6497, %rsi
mov $0x24cb270000000097, %rdi
sub %r15, %r15
mov $113, %rcx
rep movsb
nop
nop
nop
nop
nop
inc %r10
// Faulty Load
mov $0x24cb270000000097, %r10
clflush (%r10)
nop
nop
xor %r14, %r14
mov (%r10), %r9
lea oracles, %rcx
and $0xff, %r9
shlq $12, %r9
mov (%rcx,%r9,1), %r9
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_US', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_NC', 'congruent': 0, 'same': True}}
[Faulty Load]
{'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_NC', 'size': 8, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_UC_ht', 'congruent': 10, 'same': False}}
{'src': {'same': True, 'congruent': 7, 'NT': False, 'type': 'addresses_WC_ht', 'size': 2, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False}}
{'src': {'same': True, 'congruent': 8, 'NT': False, 'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False}}
{'aa': 142, '9a': 134, 'ec': 169, '66': 137, '16': 141, 'a2': 102, 'e6': 127, '8c': 123, '2e': 166, 'fc': 137, 'd0': 169, '30': 139, '7c': 140, '52': 145, '6e': 152, 'e0': 145, '24': 171, 'be': 119, '72': 152, 'b8': 152, '3a': 145, '3e': 161, 'c6': 144, '0a': 159, '62': 130, '38': 161, 'de': 146, '7a': 130, '42': 134, '26': 164, '34': 139, 'b6': 131, '48': 157, '20': 168, '3c': 164, '88': 161, 'ba': 154, '58': 134, 'fe': 132, 'f0': 160, '1a': 40, '6a': 143, '08': 190, 'c8': 43, '0e': 197, 'bc': 150, '5e': 124, '7e': 142, 'a0': 53, '60': 164, '28': 193, '76': 128, '70': 150, '5a': 157, 'd2': 171, '46': 166, 'b0': 144, '32': 134, '68': 59, 'f4': 67, 'c2': 120, '6d': 1, 'f6': 121, '90': 141, '04': 200, '96': 141, '14': 214, '92': 149, 'e4': 172, '10': 188, '5c': 145, '6c': 166, 'ce': 173, '12': 189, '0c': 181, '1c': 172, 'cc': 155, 'f2': 148, 'e2': 55, '44': 37, '00': 4141, 'b2': 131, '8e': 139, 'd6': 53, '40': 169, '18': 132, 'ea': 113, '06': 157, '56': 155, 'ca': 158, 'a4': 159, 'fa': 111, 'c4': 178, '2a': 137, '54': 154, 'e8': 52, '80': 164, '8a': 68, '9c': 122, '84': 154, '1e': 165, 'c0': 38, '4a': 118, '74': 153, '82': 148, 'da': 48, 'b4': 154, 'd8': 143, '64': 129, '78': 151, '4e': 144, '2c': 172, 'a8': 160, 'a6': 152, '9e': 156, '50': 47, 'd4': 155, '86': 150, '02': 141, '98': 153, '22': 57, '4c': 126, 'ae': 134, 'ac': 133, 'f8': 147, '94': 135, '36': 141, 'ee': 151, 'dc': 162}
ca 64 2a 9a 00 ca fe a4 86 8e 52 0c 00 88 36 4a 3e ce 78 34 00 00 9a 4e 72 f2 88 4a bc 48 0c 30 0a 90 00 40 20 14 fa 00 a6 00 e6 84 d8 00 d4 5c a2 bc d0 0e ea 12 ec d2 f0 cc 7a 0c 9a 56 b8 72 9a 00 00 00 9c 0a 18 00 00 28 46 42 ec 96 b6 bc 42 00 06 5a 10 08 ca 32 18 00 4c 84 d4 12 00 3c 00 00 00 ee b4 d8 00 6c 0c 00 18 00 b2 a6 a8 0e 00 90 1c 2c 00 26 36 00 9a 14 fe 28 94 d0 74 50 74 4c ee 40 66 96 00 00 00 ae 9e ae 0a b0 00 00 8e f0 f6 7a c6 a6 dc 1e 9e 46 ee b8 e4 36 14 90 00 00 bc 9e 4c 18 b8 6c 00 d2 8c d2 00 00 ec 00 94 80 52 92 16 00 64 8c 00 00 7a 58 d6 4c 4a 48 46 00 9c ec b4 2a 00 00 ae 00 38 26 30 d2 e8 6a 92 6c 00 00 80 28 18 be fc 00 6c 38 00 3e c4 28 00 d4 c6 32 60 5a 00 46 64 00 cc 62 12 20 3a 00 ca c4 ce 14 00 90 16 d4 74 12 9c 00 9e 9c 12 62 b2 d0 6d 4c 04 7a 7a be 4e 00 00 00 52 20 c2 20 a4 00 4a da 36 7e 00 2c 00 ca 30 04 00 20 3e 50 ac e2 18 3c 00 6c 84 0e 36 e0 ec 66 94 00 7e 30 58 cc 72 20 bc 06 00 5e a6 c6 2e 4e f8 e8 e4 c4 5a 72 00 84 00 32 12 f2 bc a4 b4 d8 6a 6e bc 76 82 38 5c 00 00 54 c4 9a a8 40 8c f0 00 26 d2 00 5e 3a c6 ca f4 42 00 00 2a 18 a8 fe 7a 00 42 00 00 1e 90 02 32 fc a4 84 aa 88 e4 4a 78 34 f0 ec 84 80 5a 54 88 9a a4 60 16 b4 00 00 f8 4e 82 b4 a4 6e e4 2e c0 9a f6 00 00 f6 02 80 fe ce 66 a6 00 94 00 10 4c 26 d2 24 a4 f2 c6 0e 00 36 9c e0 a8 b6 36 30 0a 00 1c d4 d4 00 00 00 8e 40 06 58 00 6a 52 0a 70 d2 f6 3c 3c aa 16 30 c6 14 d4 4a 9c 8a 2c 18 00 ee f2 38 f0 3e 00 f2 00 00 6e 5a 34 9c ce 00 16 00 2c b2 ce 3a 00 1a 34 90 8c 00 08 04 1e 00 02 00 00 6c 98 b2 f0 34 4e 62 fe 4a fc 06 1e 00 82 ce cc c8 26 24 fe a8 be f0 04 00 14 38 00 b0 b0 04 2a 28 78 e6 90 5a 1c 6e 00 48 4c 0c 08 36 d8 c6 0e 10 b4 36 5a 18 72 00 d4 86 46 04 00 00 7a 76 56 fe 28 72 6c 7e c2 1c 00 28 60 8e 00 32 96 82 04 00 5e cc 22 1e b4 42 36 7e 24 90 00 b8 e4 bc b2 7e fe be 08 06 00 78 00 00 9e 14 34 00 5c 40 60 0a e2 92 04 3c 72 00 00 c6 32 00 9a 78 60 de 42 6a 7c 6a 8a 2e ee d4 5c ee 0a 2c 00 3e 00 a6 18 9a ba d2 74 ca e4 4e a4 00 d2 0a 6c 00 30 ac b4 1c 7a 00 5e 18 00 7a ae 54 e4 e4 00 04 58 60 78 58 ba e0 38 cc 82 0a 2c 6c 12 9a 56 58 8a 4c 72 16 c6 ce 36 5c c6 00 58 3a 86 00 5c ee 02 12 6c 02 1e 9a 26 00 72 d4 fe 28 4e 00 10 d0 ec 00 00 4a 00 5a b6 24 3c ce 76 48 3e f0 82 2a ac 00 b2 4c c0 a6 74 00 bc 96 48 4e 10 ce 00 6e 56 ae ce 9e 00 00 00 00 bc 72 68 16 00 36 ca 00 00 80 00 0a b6 84 42 00 48 ec 0c a8 06 00 ec 42 88 00 20 00 7c 70 28 08 00 00 00 c0 fe 00 98 18 4e 0a 98 ba ee de 00 00 00 38 26 d2 2c 00 00 8e 02 00 aa 00 e0 00 42 36 5a b4 dc 70 f0 38 3e f8 de ca 80 00 36 ba 86 06 6a ea dc 00 00 00 f0 00 00 a0 50 2e ac 56 00 58 76 9c 84 5e d0 48 9c 40 00 00 dc d2 16 94 00 60 d6 20 76 d4 d2 3c 6c 56 38 7c 88 ba 30 00 7a 7e e0 28 90 18 00 90 96 ea 16 00 62 d4 4e 0e ba 0c 00 ca 3c 20 c6 50 26 82 9a 74 30 00 64 12 00 d4 ee 7c 04 24 90 5a 78 ba 02 82 24 d0 ce a8 b2 9e 6a 76 00 00 24 f8 d2 dc 9e 1c 62 5e 00 0e ca 16 00 1c a6 00 96 00 28 58 98 00 a6 fe e0 f8 88 6a 14 00 b6 4e 0a 02 58 00 00 b0 e8 4a 82 1e 30 00 be 40 00 d4 1e 4c 3c 00 5a 08 b2 1c
*/
|
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_tag_tag_h.ads | persan/A-gst | 1 | 28773 | <gh_stars>1-10
pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
with glib;
with glib;
with glib.Values;
with System;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h;
-- limited with GStreamer.GST_Low_Level.glib_2_0_glib_glist_h;
limited with GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h;
with GLIB; -- with GStreamer.GST_Low_Level.glibconfig_h;
with System;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_tag_tag_h is
GST_TAG_MUSICBRAINZ_TRACKID : aliased constant String := "musicbrainz-trackid" & ASCII.NUL; -- gst/tag/tag.h:36
GST_TAG_MUSICBRAINZ_ARTISTID : aliased constant String := "musicbrainz-artistid" & ASCII.NUL; -- gst/tag/tag.h:42
GST_TAG_MUSICBRAINZ_ALBUMID : aliased constant String := "musicbrainz-albumid" & ASCII.NUL; -- gst/tag/tag.h:48
GST_TAG_MUSICBRAINZ_ALBUMARTISTID : aliased constant String := "musicbrainz-albumartistid" & ASCII.NUL; -- gst/tag/tag.h:54
GST_TAG_MUSICBRAINZ_TRMID : aliased constant String := "musicbrainz-trmid" & ASCII.NUL; -- gst/tag/tag.h:60
-- unsupported macro: GST_TAG_MUSICBRAINZ_SORTNAME GST_TAG_ARTIST_SORTNAME
GST_TAG_CMML_STREAM : aliased constant String := "cmml-stream" & ASCII.NUL; -- gst/tag/tag.h:79
GST_TAG_CMML_HEAD : aliased constant String := "cmml-head" & ASCII.NUL; -- gst/tag/tag.h:86
GST_TAG_CMML_CLIP : aliased constant String := "cmml-clip" & ASCII.NUL; -- gst/tag/tag.h:92
GST_TAG_CDDA_CDDB_DISCID : aliased constant String := "discid" & ASCII.NUL; -- gst/tag/tag.h:101
GST_TAG_CDDA_CDDB_DISCID_FULL : aliased constant String := "discid-full" & ASCII.NUL; -- gst/tag/tag.h:108
GST_TAG_CDDA_MUSICBRAINZ_DISCID : aliased constant String := "musicbrainz-discid" & ASCII.NUL; -- gst/tag/tag.h:115
GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL : aliased constant String := "musicbrainz-discid-full" & ASCII.NUL; -- gst/tag/tag.h:122
GST_TAG_CAPTURING_SHUTTER_SPEED : aliased constant String := "capturing-shutter-speed" & ASCII.NUL; -- gst/tag/tag.h:131
GST_TAG_CAPTURING_FOCAL_RATIO : aliased constant String := "capturing-focal-ratio" & ASCII.NUL; -- gst/tag/tag.h:143
GST_TAG_CAPTURING_FOCAL_LENGTH : aliased constant String := "capturing-focal-length" & ASCII.NUL; -- gst/tag/tag.h:152
GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO : aliased constant String := "capturing-digital-zoom-ratio" & ASCII.NUL; -- gst/tag/tag.h:161
GST_TAG_CAPTURING_ISO_SPEED : aliased constant String := "capturing-iso-speed" & ASCII.NUL; -- gst/tag/tag.h:170
GST_TAG_CAPTURING_EXPOSURE_PROGRAM : aliased constant String := "capturing-exposure-program" & ASCII.NUL; -- gst/tag/tag.h:190
GST_TAG_CAPTURING_EXPOSURE_MODE : aliased constant String := "capturing-exposure-mode" & ASCII.NUL; -- gst/tag/tag.h:204
GST_TAG_CAPTURING_EXPOSURE_COMPENSATION : aliased constant String := "capturing-exposure-compensation" & ASCII.NUL; -- gst/tag/tag.h:213
GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE : aliased constant String := "capturing-scene-capture-type" & ASCII.NUL; -- gst/tag/tag.h:228
GST_TAG_CAPTURING_GAIN_ADJUSTMENT : aliased constant String := "capturing-gain-adjustment" & ASCII.NUL; -- gst/tag/tag.h:244
GST_TAG_CAPTURING_WHITE_BALANCE : aliased constant String := "capturing-white-balance" & ASCII.NUL; -- gst/tag/tag.h:263
GST_TAG_CAPTURING_CONTRAST : aliased constant String := "capturing-contrast" & ASCII.NUL; -- gst/tag/tag.h:277
GST_TAG_CAPTURING_SATURATION : aliased constant String := "capturing-saturation" & ASCII.NUL; -- gst/tag/tag.h:291
GST_TAG_CAPTURING_SHARPNESS : aliased constant String := "capturing-sharpness" & ASCII.NUL; -- gst/tag/tag.h:305
GST_TAG_CAPTURING_FLASH_FIRED : aliased constant String := "capturing-flash-fired" & ASCII.NUL; -- gst/tag/tag.h:317
GST_TAG_CAPTURING_FLASH_MODE : aliased constant String := "capturing-flash-mode" & ASCII.NUL; -- gst/tag/tag.h:331
GST_TAG_CAPTURING_METERING_MODE : aliased constant String := "capturing-metering-mode" & ASCII.NUL; -- gst/tag/tag.h:350
GST_TAG_CAPTURING_SOURCE : aliased constant String := "capturing-source" & ASCII.NUL; -- gst/tag/tag.h:366
GST_TAG_IMAGE_HORIZONTAL_PPI : aliased constant String := "image-horizontal-ppi" & ASCII.NUL; -- gst/tag/tag.h:375
GST_TAG_IMAGE_VERTICAL_PPI : aliased constant String := "image-vertical-ppi" & ASCII.NUL; -- gst/tag/tag.h:383
-- unsupported macro: GST_TYPE_TAG_IMAGE_TYPE (gst_tag_image_type_get_type ())
GST_TAG_ID3V2_HEADER_SIZE : constant := 10; -- gst/tag/tag.h:453
-- arg-macro: procedure gst_tag_get_language_code (lang_code)
-- gst_tag_get_language_code_iso_639_1(lang_code)
-- GStreamer
-- * Copyright (C) 2003 <NAME> <<EMAIL>>
-- * Copyright (C) 2006-2011 <NAME> <tim centricular net>
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
-- Tag names
--*
-- * GST_TAG_MUSICBRAINZ_TRACKID
-- *
-- * MusicBrainz track ID
--
--*
-- * GST_TAG_MUSICBRAINZ_ARTISTID
-- *
-- * MusicBrainz artist ID
--
--*
-- * GST_TAG_MUSICBRAINZ_ALBUMID
-- *
-- * MusicBrainz album ID
--
--*
-- * GST_TAG_MUSICBRAINZ_ALBUMARTISTID
-- *
-- * MusicBrainz album artist ID
--
--*
-- * GST_TAG_MUSICBRAINZ_TRMID
-- *
-- * MusicBrainz track TRM ID
--
-- FIXME 0.11: remove GST_TAG_MUSICBRAINZ_SORTNAME
--*
-- * GST_TAG_MUSICBRAINZ_SORTNAME
-- *
-- * MusicBrainz artist sort name
-- *
-- * Deprecated. Use GST_TAG_ARTIST_SORTNAME instead.
--
--*
-- * GST_TAG_CMML_STREAM
-- *
-- * Annodex CMML stream element tag
--
--*
-- * GST_TAG_CMML_HEAD
-- *
-- * Annodex CMML head element tag
--
--*
-- * GST_TAG_CMML_CLIP
-- *
-- * Annodex CMML clip element tag
--
-- CDDA tags
--*
-- * GST_TAG_CDDA_CDDB_DISCID:
-- *
-- * CDDB disc id in its short form (e.g. 'aa063d0f')
--
--*
-- * GST_TAG_CDDA_CDDB_DISCID_FULL:
-- *
-- * CDDB disc id including all details
--
--*
-- * GST_TAG_CDDA_MUSICBRAINZ_DISCID:
-- *
-- * Musicbrainz disc id (e.g. 'ahg7JUcfR3vCYBphSDIogOOWrr0-')
--
--*
-- * GST_TAG_CDDA_MUSICBRAINZ_DISCID_FULL:
-- *
-- * Musicbrainz disc id details
--
--*
-- * GST_TAG_CAPTURING_SHUTTER_SPEED:
-- *
-- * Shutter speed used when capturing an image, in seconds. (fraction)
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_FOCAL_RATIO:
-- *
-- * Focal ratio (f-number) used when capturing an image. (double)
-- *
-- * The value stored is the denominator of the focal ratio (f-number).
-- * For example, if this tag value is 2, the focal ratio is f/2.
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_FOCAL_LENGTH:
-- *
-- * Focal length used when capturing an image, in mm. (double)
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_DIGITAL_ZOOM_RATIO:
-- *
-- * Digital zoom ratio used when capturing an image. (double)
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_ISO_SPEED:
-- *
-- * ISO speed used when capturing an image. (integer)
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_EXPOSURE_PROGRAM:
-- *
-- * Type of exposure control used when capturing an image. (string)
-- *
-- * The allowed values are:
-- * "undefined"
-- * "manual"
-- * "normal" - automatically controlled
-- * "aperture-priority" - user selects aperture value
-- * "shutter-priority" - user selects shutter speed
-- * "creative" - biased towards depth of field
-- * "action" - biased towards fast shutter speed
-- * "portrait" - closeup, leaving background out of focus
-- * "landscape" - landscape photos, background in focus
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_EXPOSURE_MODE:
-- *
-- * Exposure mode used when capturing an image. (string)
-- *
-- * The allowed values are:
-- * "auto-exposure"
-- * "manual-exposure"
-- * "auto-bracket"
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_EXPOSURE_COMPENSATION:
-- *
-- * Exposure compensation using when capturing an image in EV. (double)
-- *
-- * Since: 0.10.33
--
--*
-- * GST_TAG_CAPTURING_SCENE_CAPTURE_TYPE:
-- *
-- * Scene mode used when capturing an image. (string)
-- *
-- * The allowed values are:
-- * "standard"
-- * "landscape"
-- * "portrait"
-- * "night-scene"
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_GAIN_ADJUSTMENT:
-- *
-- * Gain adjustment applied to an image. (string)
-- *
-- * The allowed values are:
-- * "none"
-- * "low-gain-up"
-- * "high-gain-up"
-- * "low-gain-down"
-- * "high-gain-down"
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_WHITE_BALANCE:
-- *
-- * White balance mode used when capturing an image. (string)
-- *
-- * The allowed values are:
-- * "auto"
-- * "manual"
-- * "daylight"
-- * "cloudy"
-- * "tungsten"
-- * "fluorescent"
-- * "fluorescent h" (newer daylight-calibrated fluorescents)
-- * "flash"
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_CONTRAST:
-- *
-- * Direction of contrast processing applied when capturing an image. (string)
-- *
-- * The allowed values are:
-- * "normal"
-- * "soft"
-- * "hard"
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_SATURATION:
-- *
-- * Direction of saturation processing applied when capturing an image. (string)
-- *
-- * The allowed values are:
-- * "normal"
-- * "low-saturation"
-- * "high-saturation"
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_SHARPNESS:
-- *
-- * Direction of sharpness processing applied when capturing an image. (string)
-- *
-- * The allowed values are:
-- * "normal"
-- * "soft"
-- * "hard"
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_FLASH_FIRED:
-- *
-- * If flash was fired during the capture of an image. (boolean)
-- *
-- * Note that if this tag isn't present, it should not be assumed that
-- * the flash did not fire. It should be treated as unknown.
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_FLASH_MODE:
-- *
-- * The flash mode selected during the capture of an image. (string)
-- *
-- * The allowed values are:
-- * "auto"
-- * "always"
-- * "never"
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_METERING_MODE:
-- *
-- * Defines the way a camera determines the exposure. (string)
-- *
-- * The allowed values are:
-- * "unknown"
-- * "average"
-- * "center-weighted-average"
-- * "spot"
-- * "multi-spot"
-- * "pattern"
-- * "partial"
-- * "other"
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_CAPTURING_SOURCE:
-- *
-- * Indicates the source of capture. The device/medium used to do the
-- * capture. (string)
-- *
-- * Allowed values are:
-- * "dsc" (= digital still camera)
-- * "transparent-scanner"
-- * "reflex-scanner"
-- * "other"
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_IMAGE_HORIZONTAL_PPI:
-- *
-- * Media (image/video) intended horizontal pixel density in ppi. (double)
-- *
-- * Since: 0.10.31
--
--*
-- * GST_TAG_IMAGE_VERTICAL_PPI:
-- *
-- * Media (image/video) intended vertical pixel density in ppi. (double)
-- *
-- * Since: 0.10.31
--
-- additional information for image tags
--*
-- * GstTagImageType:
-- * @GST_TAG_IMAGE_TYPE_NONE : No image type. Can be used to
-- * tell functions such as gst_tag_image_data_to_image_buffer() that no
-- * image type should be set. (Since: 0.10.20)
-- * @GST_TAG_IMAGE_TYPE_UNDEFINED : Undefined/other image type
-- * @GST_TAG_IMAGE_TYPE_FRONT_COVER : Cover (front)
-- * @GST_TAG_IMAGE_TYPE_BACK_COVER : Cover (back)
-- * @GST_TAG_IMAGE_TYPE_LEAFLET_PAGE : Leaflet page
-- * @GST_TAG_IMAGE_TYPE_MEDIUM : Medium (e.g. label side of CD)
-- * @GST_TAG_IMAGE_TYPE_LEAD_ARTIST : Lead artist/lead performer/soloist
-- * @GST_TAG_IMAGE_TYPE_ARTIST : Artist/performer
-- * @GST_TAG_IMAGE_TYPE_CONDUCTOR : Conductor
-- * @GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA : Band/orchestra
-- * @GST_TAG_IMAGE_TYPE_COMPOSER : Composer
-- * @GST_TAG_IMAGE_TYPE_LYRICIST : Lyricist/text writer
-- * @GST_TAG_IMAGE_TYPE_RECORDING_LOCATION : Recording location
-- * @GST_TAG_IMAGE_TYPE_DURING_RECORDING : During recording
-- * @GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE : During performance
-- * @GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE : Movie/video screen capture
-- * @GST_TAG_IMAGE_TYPE_FISH : A fish as funny as the ID3v2 spec
-- * @GST_TAG_IMAGE_TYPE_ILLUSTRATION : Illustration
-- * @GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO : Band/artist logotype
-- * @GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO : Publisher/studio logotype
-- *
-- * Type of image contained in an image tag (specified as field in
-- * the image buffer's caps structure)
-- *
-- * Since: 0.10.9
--
-- Note: keep in sync with register_tag_image_type_enum()
subtype GstTagImageType is int;
GST_TAG_IMAGE_TYPE_NONE : constant GstTagImageType := -1;
GST_TAG_IMAGE_TYPE_UNDEFINED : constant GstTagImageType := 0;
GST_TAG_IMAGE_TYPE_FRONT_COVER : constant GstTagImageType := 1;
GST_TAG_IMAGE_TYPE_BACK_COVER : constant GstTagImageType := 2;
GST_TAG_IMAGE_TYPE_LEAFLET_PAGE : constant GstTagImageType := 3;
GST_TAG_IMAGE_TYPE_MEDIUM : constant GstTagImageType := 4;
GST_TAG_IMAGE_TYPE_LEAD_ARTIST : constant GstTagImageType := 5;
GST_TAG_IMAGE_TYPE_ARTIST : constant GstTagImageType := 6;
GST_TAG_IMAGE_TYPE_CONDUCTOR : constant GstTagImageType := 7;
GST_TAG_IMAGE_TYPE_BAND_ORCHESTRA : constant GstTagImageType := 8;
GST_TAG_IMAGE_TYPE_COMPOSER : constant GstTagImageType := 9;
GST_TAG_IMAGE_TYPE_LYRICIST : constant GstTagImageType := 10;
GST_TAG_IMAGE_TYPE_RECORDING_LOCATION : constant GstTagImageType := 11;
GST_TAG_IMAGE_TYPE_DURING_RECORDING : constant GstTagImageType := 12;
GST_TAG_IMAGE_TYPE_DURING_PERFORMANCE : constant GstTagImageType := 13;
GST_TAG_IMAGE_TYPE_VIDEO_CAPTURE : constant GstTagImageType := 14;
GST_TAG_IMAGE_TYPE_FISH : constant GstTagImageType := 15;
GST_TAG_IMAGE_TYPE_ILLUSTRATION : constant GstTagImageType := 16;
GST_TAG_IMAGE_TYPE_BAND_ARTIST_LOGO : constant GstTagImageType := 17;
GST_TAG_IMAGE_TYPE_PUBLISHER_STUDIO_LOGO : constant GstTagImageType := 18; -- gst/tag/tag.h:440
function gst_tag_image_type_get_type return GLIB.GType; -- gst/tag/tag.h:443
pragma Import (C, gst_tag_image_type_get_type, "gst_tag_image_type_get_type");
--*
-- * GST_TAG_ID3V2_HEADER_SIZE:
-- *
-- * ID3V2 header size considered minimum input for some functions such as
-- * gst_tag_list_from_id3v2_tag() and gst_tag_get_id3v2_tag_size() for example.
-- *
-- * Since: 0.10.36
--
-- functions for vorbis comment manipulation
function gst_tag_from_vorbis_tag (vorbis_tag : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:457
pragma Import (C, gst_tag_from_vorbis_tag, "gst_tag_from_vorbis_tag");
function gst_tag_to_vorbis_tag (gst_tag : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:458
pragma Import (C, gst_tag_to_vorbis_tag, "gst_tag_to_vorbis_tag");
procedure gst_vorbis_tag_add
(list : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList;
tag : access GLIB.gchar;
value : access GLIB.gchar); -- gst/tag/tag.h:459
pragma Import (C, gst_vorbis_tag_add, "gst_vorbis_tag_add");
function gst_tag_to_vorbis_comments (list : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList; tag : access GLIB.gchar) return access GStreamer.GST_Low_Level.glib_2_0_glib_glist_h.GList; -- gst/tag/tag.h:463
pragma Import (C, gst_tag_to_vorbis_comments, "gst_tag_to_vorbis_comments");
-- functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back
function gst_tag_list_from_vorbiscomment_buffer
(buffer : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer;
id_data : access GLIB.guint8;
id_data_length : GLIB.guint;
vendor_string : System.Address) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList; -- gst/tag/tag.h:467
pragma Import (C, gst_tag_list_from_vorbiscomment_buffer, "gst_tag_list_from_vorbiscomment_buffer");
function gst_tag_list_to_vorbiscomment_buffer
(list : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList;
id_data : access GLIB.guint8;
id_data_length : GLIB.guint;
vendor_string : access GLIB.gchar) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/tag/tag.h:471
pragma Import (C, gst_tag_list_to_vorbiscomment_buffer, "gst_tag_list_to_vorbiscomment_buffer");
-- functions for ID3 tag manipulation
-- FIXME 0.11: inconsistent API naming: gst_tag_list_new_from_id3v1(), gst_tag_list_from_*_buffer(),
-- * gst_tag_list_from_id3v2_tag(). Also, note gst.tag.list_xyz() namespace vs. gst.tag_list_xyz(),
-- * which is a bit confusing and possibly doesn't map too well
function gst_tag_id3_genre_count return GLIB.guint; -- gst/tag/tag.h:482
pragma Import (C, gst_tag_id3_genre_count, "gst_tag_id3_genre_count");
function gst_tag_id3_genre_get (id : GLIB.guint) return access GLIB.gchar; -- gst/tag/tag.h:483
pragma Import (C, gst_tag_id3_genre_get, "gst_tag_id3_genre_get");
function gst_tag_list_new_from_id3v1 (data : access GLIB.guint8) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList; -- gst/tag/tag.h:484
pragma Import (C, gst_tag_list_new_from_id3v1, "gst_tag_list_new_from_id3v1");
function gst_tag_from_id3_tag (id3_tag : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:486
pragma Import (C, gst_tag_from_id3_tag, "gst_tag_from_id3_tag");
function gst_tag_from_id3_user_tag (c_type : access GLIB.gchar; id3_user_tag : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:487
pragma Import (C, gst_tag_from_id3_user_tag, "gst_tag_from_id3_user_tag");
function gst_tag_to_id3_tag (gst_tag : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:489
pragma Import (C, gst_tag_to_id3_tag, "gst_tag_to_id3_tag");
function gst_tag_list_add_id3_image
(tag_list : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList;
image_data : access GLIB.guint8;
image_data_len : GLIB.guint;
id3_picture_type : GLIB.guint) return GLIB.gboolean; -- gst/tag/tag.h:491
pragma Import (C, gst_tag_list_add_id3_image, "gst_tag_list_add_id3_image");
function gst_tag_list_from_id3v2_tag (buffer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList; -- gst/tag/tag.h:496
pragma Import (C, gst_tag_list_from_id3v2_tag, "gst_tag_list_from_id3v2_tag");
function gst_tag_get_id3v2_tag_size (buffer : access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return GLIB.guint; -- gst/tag/tag.h:498
pragma Import (C, gst_tag_get_id3v2_tag_size, "gst_tag_get_id3v2_tag_size");
-- functions to convert GstBuffers with xmp packets contents to GstTagLists and back
function gst_tag_list_from_xmp_buffer (buffer : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList; -- gst/tag/tag.h:501
pragma Import (C, gst_tag_list_from_xmp_buffer, "gst_tag_list_from_xmp_buffer");
function gst_tag_list_to_xmp_buffer (list : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList; read_only : GLIB.gboolean) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/tag/tag.h:502
pragma Import (C, gst_tag_list_to_xmp_buffer, "gst_tag_list_to_xmp_buffer");
function gst_tag_list_to_xmp_buffer_full
(list : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList;
read_only : GLIB.gboolean;
schemas : System.Address) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/tag/tag.h:504
pragma Import (C, gst_tag_list_to_xmp_buffer_full, "gst_tag_list_to_xmp_buffer_full");
function gst_tag_xmp_list_schemas return System.Address; -- gst/tag/tag.h:506
pragma Import (C, gst_tag_xmp_list_schemas, "gst_tag_xmp_list_schemas");
-- functions related to exif
function gst_tag_list_to_exif_buffer
(taglist : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList;
byte_order : GLIB.gint;
base_offset : GLIB.guint32) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/tag/tag.h:509
pragma Import (C, gst_tag_list_to_exif_buffer, "gst_tag_list_to_exif_buffer");
function gst_tag_list_to_exif_buffer_with_tiff_header (taglist : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/tag/tag.h:513
pragma Import (C, gst_tag_list_to_exif_buffer_with_tiff_header, "gst_tag_list_to_exif_buffer_with_tiff_header");
function gst_tag_list_from_exif_buffer
(buffer : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer;
byte_order : GLIB.gint;
base_offset : GLIB.guint32) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList; -- gst/tag/tag.h:515
pragma Import (C, gst_tag_list_from_exif_buffer, "gst_tag_list_from_exif_buffer");
function gst_tag_list_from_exif_buffer_with_tiff_header (buffer : access constant GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gsttaglist_h.GstTagList; -- gst/tag/tag.h:519
pragma Import (C, gst_tag_list_from_exif_buffer_with_tiff_header, "gst_tag_list_from_exif_buffer_with_tiff_header");
-- other tag-related functions
function gst_tag_parse_extended_comment
(ext_comment : access GLIB.gchar;
key : System.Address;
lang : System.Address;
value : System.Address;
fail_if_no_key : GLIB.gboolean) return GLIB.gboolean; -- gst/tag/tag.h:524
pragma Import (C, gst_tag_parse_extended_comment, "gst_tag_parse_extended_comment");
function gst_tag_freeform_string_to_utf8
(data : access GLIB.gchar;
size : GLIB.gint;
env_vars : System.Address) return access GLIB.gchar; -- gst/tag/tag.h:530
pragma Import (C, gst_tag_freeform_string_to_utf8, "gst_tag_freeform_string_to_utf8");
function gst_tag_image_data_to_image_buffer
(image_data : access GLIB.guint8;
image_data_len : GLIB.guint;
image_type : GstTagImageType) return access GStreamer.GST_Low_Level.gstreamer_0_10_gst_gstbuffer_h.GstBuffer; -- gst/tag/tag.h:534
pragma Import (C, gst_tag_image_data_to_image_buffer, "gst_tag_image_data_to_image_buffer");
-- FIXME 0.11: get rid of this awkward register/init function, see tags.c
procedure gst_tag_register_musicbrainz_tags; -- gst/tag/tag.h:539
pragma Import (C, gst_tag_register_musicbrainz_tags, "gst_tag_register_musicbrainz_tags");
-- language tag related functions
function gst_tag_get_language_codes return System.Address; -- gst/tag/tag.h:544
pragma Import (C, gst_tag_get_language_codes, "gst_tag_get_language_codes");
function gst_tag_get_language_name (language_code : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:546
pragma Import (C, gst_tag_get_language_name, "gst_tag_get_language_name");
function gst_tag_get_language_code_iso_639_1 (lang_code : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:548
pragma Import (C, gst_tag_get_language_code_iso_639_1, "gst_tag_get_language_code_iso_639_1");
function gst_tag_get_language_code_iso_639_2B (lang_code : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:550
pragma Import (C, gst_tag_get_language_code_iso_639_2B, "gst_tag_get_language_code_iso_639_2B");
function gst_tag_get_language_code_iso_639_2T (lang_code : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:552
pragma Import (C, gst_tag_get_language_code_iso_639_2T, "gst_tag_get_language_code_iso_639_2T");
--*
-- * gst_tag_get_language_code:
-- * @lang_code: ISO-639 language code (e.g. "deu" or "ger" or "de")
-- *
-- * Convenience macro wrapping gst_tag_get_language_code_iso_639_1().
-- *
-- * Since: 0.10.26
--
-- functions to deal with (mostly) Creative Commons licenses
--*
-- * GstTagLicenseFlags:
-- * @GST_TAG_LICENSE_PERMITS_REPRODUCTION: making multiple copies
-- * is allowed
-- * @GST_TAG_LICENSE_PERMITS_DISTRIBUTION: distribution, public display
-- * and public performance are allowed
-- * @GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS: distribution of derivative
-- * works is allowed
-- * @GST_TAG_LICENSE_PERMITS_SHARING: commercial derivatives are allowed,
-- * but only non-commercial distribution is allowed
-- * @GST_TAG_LICENSE_REQUIRES_NOTICE: copyright and license notices
-- * must be kept intact
-- * @GST_TAG_LICENSE_REQUIRES_ATTRIBUTION: credit must be given to
-- * copyright holder and/or author
-- * @GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE: derivative works must be
-- * licensed under the same terms or compatible terms as the original work
-- * @GST_TAG_LICENSE_REQUIRES_SOURCE_CODE: source code (the preferred
-- * form for making modifications) must be provided when exercising some
-- * rights granted by the license
-- * @GST_TAG_LICENSE_REQUIRES_COPYLEFT: derivative and combined works
-- * must be licensed under specified terms, similar to those of the original
-- * work
-- * @GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT: derivative works must be
-- * licensed under specified terms, with at least the same conditions as
-- * the original work; combinations with the work may be licensed under
-- * different terms
-- * @GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE: exercising rights for
-- * commercial purposes is prohibited
-- * @GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE: use in a
-- * non-developing country is prohibited
-- * @GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE: this license was created
-- * by the Creative Commons project
-- * @GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE: this license was
-- * created by the Free Software Foundation (FSF)
-- *
-- * See http://creativecommons.org/ns for more information.
-- *
-- * Since: 0.10.36
--
subtype GstTagLicenseFlags is unsigned;
GST_TAG_LICENSE_PERMITS_REPRODUCTION : constant GstTagLicenseFlags := 1;
GST_TAG_LICENSE_PERMITS_DISTRIBUTION : constant GstTagLicenseFlags := 2;
GST_TAG_LICENSE_PERMITS_DERIVATIVE_WORKS : constant GstTagLicenseFlags := 4;
GST_TAG_LICENSE_PERMITS_SHARING : constant GstTagLicenseFlags := 8;
GST_TAG_LICENSE_REQUIRES_NOTICE : constant GstTagLicenseFlags := 256;
GST_TAG_LICENSE_REQUIRES_ATTRIBUTION : constant GstTagLicenseFlags := 512;
GST_TAG_LICENSE_REQUIRES_SHARE_ALIKE : constant GstTagLicenseFlags := 1024;
GST_TAG_LICENSE_REQUIRES_SOURCE_CODE : constant GstTagLicenseFlags := 2048;
GST_TAG_LICENSE_REQUIRES_COPYLEFT : constant GstTagLicenseFlags := 4096;
GST_TAG_LICENSE_REQUIRES_LESSER_COPYLEFT : constant GstTagLicenseFlags := 8192;
GST_TAG_LICENSE_PROHIBITS_COMMERCIAL_USE : constant GstTagLicenseFlags := 65536;
GST_TAG_LICENSE_PROHIBITS_HIGH_INCOME_NATION_USE : constant GstTagLicenseFlags := 131072;
GST_TAG_LICENSE_CREATIVE_COMMONS_LICENSE : constant GstTagLicenseFlags := 16777216;
GST_TAG_LICENSE_FREE_SOFTWARE_FOUNDATION_LICENSE : constant GstTagLicenseFlags := 33554432; -- gst/tag/tag.h:625
function gst_tag_get_licenses return System.Address; -- gst/tag/tag.h:627
pragma Import (C, gst_tag_get_licenses, "gst_tag_get_licenses");
function gst_tag_get_license_flags (license_ref : access GLIB.gchar) return GstTagLicenseFlags; -- gst/tag/tag.h:629
pragma Import (C, gst_tag_get_license_flags, "gst_tag_get_license_flags");
function gst_tag_get_license_nick (license_ref : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:631
pragma Import (C, gst_tag_get_license_nick, "gst_tag_get_license_nick");
function gst_tag_get_license_title (license_ref : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:633
pragma Import (C, gst_tag_get_license_title, "gst_tag_get_license_title");
function gst_tag_get_license_version (license_ref : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:635
pragma Import (C, gst_tag_get_license_version, "gst_tag_get_license_version");
function gst_tag_get_license_description (license_ref : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:637
pragma Import (C, gst_tag_get_license_description, "gst_tag_get_license_description");
function gst_tag_get_license_jurisdiction (license_ref : access GLIB.gchar) return access GLIB.gchar; -- gst/tag/tag.h:639
pragma Import (C, gst_tag_get_license_jurisdiction, "gst_tag_get_license_jurisdiction");
function gst_tag_license_flags_get_type return GLIB.GType; -- gst/tag/tag.h:641
pragma Import (C, gst_tag_license_flags_get_type, "gst_tag_license_flags_get_type");
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_tag_tag_h;
|
Source/eu.modelwriter.core.alloyinecore/src/test/resources/kodkod/myaddressbook.als | ModelWriter/AlloyInEcore | 2 | 993 | <filename>Source/eu.modelwriter.core.alloyinecore/src/test/resources/kodkod/myaddressbook.als
model appendixA/addressBook2
sig Addr, Name { }
sig Book {
addr: Name -> (Name + Addr)
}
/*
----------------
x: m e
----------------
r: A m -> n B
all a: A | n a.r
all b: B | m r.b
----------------
r: A -> (B m -> n C)
all a: A | a.r in B m -> n C
----------------
r: (A m -> n B) -> C
all c: C | r.c in A m -> n B
----------------
*/
--addr: Book -> (Name lone -> Addr)
pred show1 {
all b: Book | b.addr in Name lone -> Addr
}
//r: (A m -> n B) -> C
pred show2 {
all b: Book | b.addr in Name lone -> Addr
}
run show1 for 3
|
alloy4fun_models/trashltl/models/9/v3vXGQ6FCKkxE4o4y.als | Kaixi26/org.alloytools.alloy | 0 | 2173 | open main
pred idv3vXGQ6FCKkxE4o4y_prop10 {
always (all f:File | always (f in Protected implies f in Protected))
}
pred __repair { idv3vXGQ6FCKkxE4o4y_prop10 }
check __repair { idv3vXGQ6FCKkxE4o4y_prop10 <=> prop10o } |
programs/oeis/168/A168381.asm | karttu/loda | 1 | 94725 | ; A168381: a(n) = 4*n + 2*(-1)^n.
; 2,10,10,18,18,26,26,34,34,42,42,50,50,58,58,66,66,74,74,82,82,90,90,98,98,106,106,114,114,122,122,130,130,138,138,146,146,154,154,162,162,170,170,178,178,186,186,194,194,202,202,210,210,218,218,226,226,234,234,242,242,250,250,258,258,266,266,274,274,282,282,290,290,298,298,306,306,314,314,322,322,330,330,338,338,346,346,354,354,362,362,370,370,378,378,386,386,394,394,402,402,410,410,418,418,426,426,434,434,442,442,450,450,458,458,466,466,474,474,482,482,490,490,498,498,506,506,514,514,522,522,530,530,538,538,546,546,554,554,562,562,570,570,578,578,586,586,594,594,602,602,610,610,618,618,626,626,634,634,642,642,650,650,658,658,666,666,674,674,682,682,690,690,698,698,706,706,714,714,722,722,730,730,738,738,746,746,754,754,762,762,770,770,778,778,786,786,794,794,802,802,810,810,818,818,826,826,834,834,842,842,850,850,858,858,866,866,874,874,882,882,890,890,898,898,906,906,914,914,922,922,930,930,938,938,946,946,954,954,962,962,970,970,978,978,986,986,994,994,1002
mov $1,1
add $1,$0
div $1,2
mul $1,8
add $1,2
|
alloy4fun_models/trashltl/models/4/zM9zsaztinr4kcoDb.als | Kaixi26/org.alloytools.alloy | 0 | 1524 | open main
pred idzM9zsaztinr4kcoDb_prop5 {
eventually some Trash
}
pred __repair { idzM9zsaztinr4kcoDb_prop5 }
check __repair { idzM9zsaztinr4kcoDb_prop5 <=> prop5o } |
oeis/333/A333174.asm | neoneye/loda-programs | 11 | 84031 | ; A333174: a(n) = Sum_{k=0..n} r_4(k^2 + 1), where r_4(k) is the number of ways of writing k as a sum of 4 squares (A000118).
; Submitted by <NAME>(s4)
; 8,32,80,224,368,704,1008,1752,2424,3432,4248,5736,7176,9768,11352,14088,16152,20472,23944,28312,31528,37576,42280,50056,54680,62216,67640,78296,85880,96008,103784,116552,126968,142808,152888,167624,178008,197880,212616,230904,243720,264624,281616,309888,326688,351024,368784,405072,427248,456096,476928,508176,534192,574800,598144,637024,662128,714544,746896,788704,819840,864528,901488,958800,993648,1044384,1079248,1144048,1191472,1248640,1292560,1353088,1406656,1491328,1535152,1605712,1653232
lpb $0
mov $2,$0
sub $0,1
seq $2,193433 ; Sum of the divisors of n^2+1.
add $1,$2
lpe
mov $0,$1
mul $0,8
add $0,8
|
languages/7/examples/test_problem.adb | c3333/sphereengine-languages | 5 | 18139 | <gh_stars>1-10
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Test is
subtype Small is Integer range 0..99;
Input : Small;
begin
loop
Get(Input);
if Input = 42 then
exit;
else
Put (Input);
New_Line;
end if;
end loop;
end;
|
alloy4fun_models/trashltl/models/11/LspevonRq6xsfYjBR.als | Kaixi26/org.alloytools.alloy | 0 | 3099 | open main
pred idLspevonRq6xsfYjBR_prop12 {
always all f:File | eventually f in Trash implies (f in Trash until f not in Trash)
}
pred __repair { idLspevonRq6xsfYjBR_prop12 }
check __repair { idLspevonRq6xsfYjBR_prop12 <=> prop12o } |
bahamut/source/menu-saves.asm | higan-emu/bahamut-lagoon-translation-kit | 2 | 245462 | <gh_stars>1-10
namespace menu {
seek(codeCursor)
//code used by both game loading and saving
namespace saves {
enqueue pc
seek($ee55bb); jsl hookDMA; jmp $5629 //expand chapter name DMA transfer size
//All Slots
seek($eed577); string.skip() //"Chapter" text
seek($eed5d5); string.skip() //"Time" text
seek($eefa1f); jsl bonusDungeon //"Bonus Dungeon#" integer
seek($eed5a9); string.hook(exPlay) //"Ex-Play" text
seek($eef9fc); string.skip() //"Bonus Dungeon" text
seek($eefa18); lda #$0000 //"Bonus Dungeon" position
//Slot 1
seek($eed280); dw 22, 3 //X,Y cursor position
seek($eed3d2); string.hook(noData) //"No Data" text
seek($eed47e); jsl chapter.slot1 //"Chapter#" integer
seek($eed488); jsl time.slot1; nop #2 //"Time" timestamp
seek($eed3cc); lda #$0086 //"No Data" position
seek($eed476); lda #$0086 //"Chapter#" position
seek($eed482); lda #$0096 //"Time" position
seek($eed46a); lda #$009e //"Ex-Play" position
seek($eed456); lda #$00c6 //"Chapter Name" position
seek($eef8de); lda #$0086 //"Bonus Dungeon Name" position
seek($eed4a0); lda #$2400 //"Chapter Name" tiledata position
seek($eef919); lda #$2400 //"Bonus Dungeon" tiledata position
seek($eed45c); lda #$0140; jsl writeChapterNameTilemap //"Chapter" text
seek($eef8ff); lda #$0140; jsl writeChapterNameTilemap //"Bonus Dungeon" text
//Slot 2
seek($eed284); dw 22,43 //X,Y cursor position
seek($eed3eb); string.hook(noData) //"No Data" text
seek($eed4da); jsl chapter.slot2 //"Chapter#" integer
seek($eed4e4); jsl time.slot2; nop #2 //"Time" timestamp
seek($eed3e5); lda #$01c6 //"No Data" position
seek($eed4d2); lda #$01c6 //"Chapter#" position
seek($eed4de); lda #$01d6 //"Time" position
seek($eed4c6); lda #$01de //"Ex-Play" position
seek($eed4b2); lda #$0206 //"Chapter Name" position
seek($eef935); lda #$01c6 //"Bonus Dungeon Name" position
seek($eed4fc); lda #$2800 //"Chapter Name" tiledata position
seek($eef970); lda #$2800 //"Bonus Dungeon" tiledata position
seek($eed4b8); lda #$0180; jsl writeChapterNameTilemap //"Chapter" text
seek($eef956); lda #$0180; jsl writeChapterNameTilemap //"Bonus Dungeon" text
//Slot 3
seek($eed288); dw 22,83 //X,Y cursor position
seek($eed404); string.hook(noData) //"No Data" text
seek($eed536); jsl chapter.slot3 //"Chapter#" integer
seek($eed540); jsl time.slot3; nop #2 //"Time" timestamp
seek($eed3fe); lda #$0306 //"No Data" position
seek($eed52e); lda #$0306 //"Chapter#" position
seek($eed53a); lda #$0316 //"Time" position
seek($eed522); lda #$031e //"Ex-Play" position
seek($eed50e); lda #$0346 //"Chapter Name" position
seek($eef98c); lda #$0306 //"Bonus Dungeon Name" position
seek($eed558); lda #$2c00 //"Chapter Name" tiledata position
seek($eef9c7); lda #$2c00 //"Bonus Dungeon" tiledata position
seek($eed514); lda #$01c0; jsl writeChapterNameTilemap //"Chapter" text
seek($eef9ad); lda #$01c0; jsl writeChapterNameTilemap //"Bonus Dungeon" text
//Menu
seek($eed29c); string.hook(save) //"Save?" text
seek($eed2bf); string.hook(done) //"Continue playing?" text
seek($eed2e2); string.hook(load) //"Begin sortie?" text
seek($eed300); string.hook(yes) //"Yes" text
seek($eed30f); string.hook(no) //"No" text
seek($eed28f); lda #$0446 //"Save?" position
seek($eed2b2); lda #$0446 //"Continue playing?" position
seek($eed2d5); lda #$0446 //"Begin sortie?" position
seek($eed2fa); lda #$04c8 //"Yes" position
seek($eed309); lda #$0548 //"No" option
seek($eed33a); adc #$008b //Y cursor offset
seek($eed34e); jml clearText; nop //clear text hook
seek($eed362); lda #$0406 //clear offset
seek($eed368); ldx #$0010 //clear width
seek($eed36b); ldy #$0006 //clear height
dequeue pc
//chapterSlot{1-3} and timeSlot{1-3} are intentionally not double-buffered here,
//because the large-font chapter title strings are not double-buffered either.
//if they were double-buffered, they would be updated a frame later than the titles.
//this would make saving progress feel laggier when updating the onscreen text.
allocator.bpp4()
allocator.create( 8,1,chapterSlot1)
allocator.create( 8,1,chapterSlot2)
allocator.create( 8,1,chapterSlot3)
allocator.create(12,3,bonusDungeon)
allocator.create( 8,1,exPlay)
allocator.create(10,1,timeSlot1)
allocator.create(10,1,timeSlot2)
allocator.create(10,1,timeSlot3)
allocator.create( 8,1,noData)
allocator.create(16,1,save)
allocator.create(16,1,done)
allocator.create(16,1,load)
allocator.create( 4,1,yes)
allocator.create( 4,1,no)
if allocator.bank1 > $140 {
error "small tiledata overlaps large tiledata area"
}
function hookDMA {
lda $001a00; tax
lda #$8000; sta $000006,x //$2115 = VRAM write mode
lda $34; sta $000003,x //$2116 = VRAM target address
lda #$0800; sta $000005,x //$4305 = DMA transfer length
lda #$7e00; sta $000001,x //$4302 = DMA source bank
lda #$7800; sta $000000,x //$4300 = DMA source address
txa; add #$0008; sta $001a00 //seek to next entry in the list
rtl
}
//the original game did not clear the large text when exiting menus.
//this would leave the question prompt onscreen without the menu.
//this hook detects when the menu is cancelled and clears the text area manually.
//------
//eed34e bit #$0c00
//eed351 beq $d362
//------
function clearText {
bit #$0c00; beq +; jml $eed353; +
jsl largeText.clearSprites; jml $eed362
}
//originally chapter names were limited to a width of 120 pixels.
//the screen has been rearranged to allow for up to 240 pixels of text.
//the original tilemap writing function only supported the left two RAM segments,
//so it is replaced with this routine that can write all four segments properly.
function writeChapterNameTilemap {
//A => starting tilemap character index
enter; ldb #$7e
ora.w tilemap.attributes
pha; lda.w tilemap.address; tax; pla
//write top-left quadrant
ldy #$0010
-;sta.w tilemap.location,x; inc
inx #2; dey; bne -
//write top-right quadrant
ldy #$0010; add #$0010
-;sta.w tilemap.location,x; inc
inx #2; dey; bne -
//write bottom-left quadrant
ldy #$0010; sub #$0020
-;sta.w tilemap.location,x; inc
inx #2; dey; bne -
//write bottom-right quadrant
ldy #$0010; add #$0010
-;sta.w tilemap.location,x; inc
inx #2; dey; bne -
leave; rtl
}
//A => chapter#
//X => tilemap index
function chapter {
enter
tilemap.setColorPalette(0)
and #$00ff; mul(8); tay
lda #$0008; write.bpp4(lists.chapters.bph4)
leave; rtl
slot1:; enter; pha; allocator.index(chapterSlot1); pla; jsl chapter; leave; rtl
slot2:; enter; pha; allocator.index(chapterSlot2); pla; jsl chapter; leave; rtl
slot3:; enter; pha; allocator.index(chapterSlot3); pla; jsl chapter; leave; rtl
}
//X => tilemap index
//$3065c8 => hour
//$3065c9 => minute
//$3065ca => second
function time {
variable(2, index)
variable(2, hour)
variable(2, minute)
variable(2, second)
enter
tilemap.setColorPalette(0)
phx; lda index; tax
lda $3065c8,x; and #$00ff; sta hour
lda $3065c9,x; and #$00ff; sta minute
lda $3065ca,x; and #$00ff; sta second
ldx #$0000
lda hour; cmp.w #100; jcs digits_3
digits_2:
append.alignSkip(9)
append.literal("Time")
append.alignLeft()
append.alignSkip(32)
lda hour
append.integer02()
append.literal(":")
lda minute
append.integer02()
append.literal(":")
lda second
append.integer02()
jmp render
digits_3:
append.alignSkip(6)
append.literal("Time")
append.alignLeft()
append.alignSkip(29)
lda hour
append.integer_3()
append.literal(":")
lda minute
append.integer02()
append.literal(":")
lda second
append.integer02()
jmp render
render:
lda #$000a; render.small.bpp4(); render.small.bpp4.to.bph4()
lda #$000a; plx; write.bpp4()
leave; rtl
slot1:; enter; lda #$0000; sta index; allocator.index(timeSlot1); jsl time; leave; rtl
slot2:; enter; lda #$05c8; sta index; allocator.index(timeSlot2); jsl time; leave; rtl
slot3:; enter; lda #$0b90; sta index; allocator.index(timeSlot3); jsl time; leave; rtl
}
//A => bonus dungeon# (1-3)
function bonusDungeon {
enter; dec //strings are zero-indexed
tilemap.setColorPalette(0)
mul(12); add.w #strings.bph4.bonusDungeon1; tay
lda #$000c; allocator.index(bonusDungeon); write.bpp4(lists.strings.bph4)
leave; rtl
}
function exPlay {
enter
tilemap.setColorPalette(0)
ldy.w #strings.bph4.exPlay
lda #$0008; allocator.index(exPlay); write.bpp4(lists.strings.bph4)
leave; rtl
}
function noData {
enter
tilemap.setColorPalette(0)
ldy.w #strings.bph4.noData
lda #$0008; allocator.index(noData); write.bpp4(lists.strings.bph4)
leave; rtl
}
function save {
enter
ldy.w #strings.bpp4.overwriteSave
lda #$0010; allocator.index(save); write.bpp4(lists.strings.bpp4)
leave; rtl
}
function done {
enter
ldy.w #strings.bpp4.continuePlaying
lda #$0010; allocator.index(done); write.bpp4(lists.strings.bpp4)
leave; rtl
}
function load {
enter
ldy.w #strings.bpp4.beginSortie
lda #$0010; allocator.index(load); write.bpp4(lists.strings.bpp4)
leave; rtl
}
function yes {
enter
ldy.w #strings.bpp4.yes
lda #$0004; allocator.index(yes); write.bpp4(lists.strings.bpp4)
leave; rtl
}
function no {
enter
ldy.w #strings.bpp4.no
lda #$0004; allocator.index(no); write.bpp4(lists.strings.bpp4)
leave; rtl
}
}
codeCursor = pc()
}
|
oeis/326/A326934.asm | neoneye/loda-programs | 11 | 91121 | <gh_stars>10-100
; A326934: Table of A(n,k) read by antidiagonals, where A(n,k)=(n*k) mod (n+1).
; Submitted by <NAME>
; 1,0,2,1,1,3,0,0,2,4,1,2,1,3,5,0,1,0,2,4,6,1,0,3,1,3,5,7,0,2,2,0,2,4,6,8,1,1,1,4,1,3,5,7,9,0,0,0,3,0,2,4,6,8,10,1,2,3,2,5,1,3,5,7,9,11,0,1,2,1,4,0,2,4,6,8,10,12,1,0,1,0,3,6,1,3
lpb $0
add $1,1
sub $0,$1
lpe
add $0,2
add $1,2
mod $1,$0
sub $0,$1
sub $0,1
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_382.asm | ljhsiun2/medusa | 9 | 81542 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r14
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x15d83, %rcx
nop
cmp %rbp, %rbp
movw $0x6162, (%rcx)
nop
nop
nop
nop
nop
add $9633, %rdx
lea addresses_normal_ht+0xe2bf, %rsi
lea addresses_WC_ht+0x6beb, %rdi
nop
nop
nop
nop
nop
add %rbp, %rbp
mov $89, %rcx
rep movsl
nop
nop
nop
add $56171, %rcx
lea addresses_WC_ht+0x1368b, %r11
nop
nop
nop
cmp $48999, %r14
mov $0x6162636465666768, %rsi
movq %rsi, %xmm3
movups %xmm3, (%r11)
nop
dec %rsi
lea addresses_WC_ht+0x8c23, %rsi
lea addresses_WC_ht+0x1dc43, %rdi
clflush (%rsi)
nop
nop
add $26245, %r10
mov $32, %rcx
rep movsw
nop
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_WC_ht+0x113eb, %r14
nop
nop
nop
dec %r11
mov (%r14), %ecx
nop
sub $8962, %r14
lea addresses_A_ht+0xfc17, %rsi
lea addresses_normal_ht+0x1aae1, %rdi
nop
nop
nop
add $53286, %r10
mov $13, %rcx
rep movsw
nop
nop
nop
and $34543, %r14
lea addresses_WT_ht+0x1a12b, %r10
nop
cmp $26000, %rbp
movl $0x61626364, (%r10)
sub %rcx, %rcx
lea addresses_normal_ht+0x173eb, %r10
clflush (%r10)
nop
nop
nop
and $46640, %rbp
mov (%r10), %rsi
add $48586, %r10
lea addresses_normal_ht+0x1e3eb, %rsi
lea addresses_WC_ht+0x371b, %rdi
xor $25140, %r14
mov $92, %rcx
rep movsq
nop
nop
and %rsi, %rsi
lea addresses_A_ht+0x15c7b, %rdx
nop
nop
nop
nop
nop
and $64579, %r14
mov (%rdx), %r11
nop
cmp $23263, %rdi
lea addresses_A_ht+0x18bd3, %rdx
nop
nop
nop
nop
and %r11, %r11
movups (%rdx), %xmm2
vpextrq $0, %xmm2, %rcx
nop
nop
xor %r11, %r11
lea addresses_UC_ht+0xcb7b, %r11
nop
nop
nop
cmp %rsi, %rsi
mov $0x6162636465666768, %rbp
movq %rbp, (%r11)
nop
nop
nop
nop
nop
and $12964, %rsi
lea addresses_WT_ht+0x172f7, %r10
nop
nop
nop
sub %rcx, %rcx
movw $0x6162, (%r10)
nop
nop
dec %r14
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r14
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %rax
push %rbx
push %rcx
push %rsi
// Store
lea addresses_PSE+0xbdcb, %rsi
clflush (%rsi)
nop
nop
nop
nop
add %r11, %r11
mov $0x5152535455565758, %rcx
movq %rcx, (%rsi)
nop
nop
and $6435, %rbx
// Faulty Load
lea addresses_UC+0x3eb, %rbx
nop
sub %rsi, %rsi
mov (%rbx), %rcx
lea oracles, %rbx
and $0xff, %rcx
shlq $12, %rcx
mov (%rbx,%rcx,1), %rcx
pop %rsi
pop %rcx
pop %rbx
pop %rax
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
oeis/059/A059508.asm | neoneye/loda-programs | 11 | 10030 | ; A059508: Transform of A059502 applied to sequence 5,6,7,...
; Submitted by <NAME>
; 5,11,29,79,216,590,1609,4381,11911,32339,87690,237496,642509,1736399,4688081,12645655,34080924,91775426,246948241,663999649,1784138875,4790751131,12856028814,34478744044,92416515221,247578328595,662904739589,1774087170271,4745624342496,12688637290934,33911574260185,90594094245541,241923448014319,645786459655139,1723213820986386,4596578463552160,12256914060379229,32672617729464791,87065908672943801,231941562912273319,617703174387667620,1644584688599197226,4377356682131535649,11647986001611776809
lpb $0
sub $0,1
add $1,2
add $4,$2
add $2,$3
add $4,$1
add $1,$3
add $4,8
add $1,$4
add $3,$2
add $2,1
add $3,1
lpe
mov $0,$1
div $0,2
add $0,5
|
third_party/universal-ctags/ctags/Units/parser-ada.r/ada-generic-in-package.d/input_2.ads | f110/wing | 1 | 2181 | <filename>third_party/universal-ctags/ctags/Units/parser-ada.r/ada-generic-in-package.d/input_2.ads<gh_stars>1-10
package input_2 is
type Generator is null record;
generic
type Unsigned is mod <>;
type Real is digits <>;
with function Random (G: Generator) return Unsigned is <>;
function Random (G: Generator) return Real;
end input_2; |
Assembly/init.asm | CaitSith2/Enemizer | 2 | 240527 | OnInitFileSelect:
{
LDA.b #$10 : STA $BC
LDA !RANDOM_SPRITE_FLAG : BEQ .continue
JSL GetRandomInt : AND #$1F : !ADD #$60 : STA $BC
.continue
LDA #$00 : STA !SOUNDFX_LOADED
JSL $00893D;Restore the previous code
RTL
}
|
programs/oeis/138/A138342.asm | jmorken/loda | 1 | 162466 | ; A138342: First differences of A007088.
; 1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,8889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,88889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,8889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,888889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,8889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,88889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,8889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,8888889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,8889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,88889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,8889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,888889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,8889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,88889,1,9,1,89,1,9,1,889,1,9,1,89,1,9,1,8889,1,9,1,89,1,9,1,889,1,9
add $0,1
gcd $0,1073741824
lpb $0
div $0,2
add $1,10
mul $1,10
lpe
div $1,1000
mul $1,8
add $1,1
|
Managers/modemanager.asm | SavagePencil/SMSFramework | 0 | 88888 | <gh_stars>0
.IFNDEF __MODE_MANAGER_ASM__
.DEFINE __MODE_MANAGER_ASM__
.STRUCT sApplicationMode
; The video interrupt handler is special, for optimization purposes:
; 1. It is a JUMP TARGET rather than a subroutine. You'll have to provide your own RET.
; 2. We need the tightest loops for handling HBLANKs.
VideoInterruptJumpTarget DW ; Called when a video interrupt (V/HBlank) occurs.
OnNMI DW ; Called when a non-maskable interrupt (NMI) comes in.
OnActive DW ; Called when this mode is made active (pushed, old one above popped, etc.)
OnInactive DW ; Called when this mode goes inactive (popped, new mode pushed on, etc.)
OnUpdate DW ; Called when the application wants to update.
OnRenderPrep DW ; Called when the application is prepping things for render.
OnEvent DW ; Called when a generic event occurs.
.ENDST
.DEFINE MODEMANAGER_MAX_MODE_DEPTH 4 ; Max #/modes allowed
.STRUCT sModeManager
CurrMode DW ; Cache of pointer to current mode
CurrVideoInterruptJumpTarget DW ; Where are we jumping to on video interrupt?
TopOfStack DW ; Pointer to current top of stack
Stack DSW MODEMANAGER_MAX_MODE_DEPTH ; Stack entires
.ENDST
.RAMSECTION "Mode Manager" SLOT 3
gModeManager INSTANCEOF sModeManager
.ENDS
.SECTION "Mode Manager Routines" FREE
; Constants for mode going ACTIVE
.ENUMID 0 EXPORT
.ENUMID MODE_MADE_ACTIVE ; You replaced what was on the top of the stack. No push/pop.
.ENUMID MODE_PUSHED_ON ; You were pushed onto the top of the stack, making you active.
.ENUMID MODE_OTHER_POPPED_OFF ; Someone else was popped off, making you active.
; Constants for mode going INACTIVE.
.ENUMID 0 EXPORT
.ENUMID MODE_MADE_INACTIVE ; You were replaced by something on the top of the stack. No push/pop.
.ENUMID MODE_POPPED_OFF ; You were popped off the top of the stack, making you inactive.
.ENUMID MODE_OTHER_POPPED_ON ; Someone else was popped on, making you inactive.
;==============================================================================
; ModeManager_Init
; Initializes the global ModeManager.
; INPUTS: DE: Initial mode to switch to.
; OUTPUTS: None
; Does not preserve any registers.
;==============================================================================
ModeManager_Init:
; Curr Mode is just a copy of the top of the stack.
ld hl, gModeManager.CurrMode
ld (hl), e
inc hl
ld (hl), d
; Top of stack is the initial mode passed in.
ld hl, gModeManager.Stack
ld (gModeManager.TopOfStack), hl
ld (hl), e
inc hl
ld (hl), d
inc hl
; Fill the rest of the stack with 0xFFFFs
ld b, ( MODEMANAGER_MAX_MODE_DEPTH - 1 ) * 2
-:
ld (hl), $FF
inc hl
djnz -
; Get the mode into IX
ld ix, (gModeManager.CurrMode)
; Prep the video interrupt in a global.
ld l, (ix + sApplicationMode.VideoInterruptJumpTarget + 0)
ld h, (ix + sApplicationMode.VideoInterruptJumpTarget + 1)
ld (gModeManager.CurrVideoInterruptJumpTarget), hl
; Now call the OnActiveStateChanged for this mode.
ld l, (ix + sApplicationMode.OnActive)
ld h, (ix + sApplicationMode.OnActive + 1)
ld a, MODE_PUSHED_ON
jp (hl)
;==============================================================================
; ModeManager_SetMode
; Replaces the current top of stack with the new one. Deactivates the old
; one and activates the new one.
; INPUTS: DE: New mode.
; OUTPUTS: None
; Does not preserve any registers.
;==============================================================================
ModeManager_SetMode:
; Hang onto the new mode.
push de
; Tell the old active mode they are now inactive.
ld ix, (gModeManager.CurrMode)
ld l, (ix + sApplicationMode.OnInactive + 0)
ld h, (ix + sApplicationMode.OnInactive + 1)
ld a, MODE_MADE_INACTIVE
call CallHL ; Execute the function, then return here.
; Record the new mode.
pop ix
ld (gModeManager.CurrMode), ix
; Prep the video interrupt in a global.
ld l, (ix + sApplicationMode.VideoInterruptJumpTarget + 0)
ld h, (ix + sApplicationMode.VideoInterruptJumpTarget + 1)
ld (gModeManager.CurrVideoInterruptJumpTarget), hl
; Tell the new mode that they are now active.
ld l, (ix + sApplicationMode.OnActive + 0)
ld h, (ix + sApplicationMode.OnActive + 1)
ld a, MODE_MADE_ACTIVE
jp (hl)
;==============================================================================
; ModeManager_PushMode
; Pushes a new mode onto the stack. Lets the previous top deactivate, then
; activates the new top. Barfs if stack depth goes too far.
; INPUTS: DE: New mode.
; OUTPUTS: None
; Does not preserve any registers.
;==============================================================================
ModeManager_PushMode:
; Hang onto the new mode.
push de
; Tell the old active mode that they are inactive; someone
; else got pushed on top of them.
ld ix, (gModeManager.CurrMode)
ld l, (ix + sApplicationMode.OnInactive + 0)
ld h, (ix + sApplicationMode.OnInactive + 1)
ld a, MODE_OTHER_POPPED_ON
call CallHL ; Execute the function, then return here.
; Update the new top of stack.
ld hl, (gModeManager.TopOfStack)
inc hl
inc hl
ld (gModeManager.TopOfStack), hl
; Set the new mode on the stack, then on the cache.
pop de ; Get new mode
; Store to stack
ld (hl), e
inc hl
ld (hl), d
; Store to cache
ex de, hl
ld (gModeManager.CurrMode), hl
; Get it into IX
ld ix, (gModeManager.CurrMode)
; Prep the video interrupt in a global.
ld l, (ix + sApplicationMode.VideoInterruptJumpTarget + 0)
ld h, (ix + sApplicationMode.VideoInterruptJumpTarget + 1)
ld (gModeManager.CurrVideoInterruptJumpTarget), hl
; Now call the OnActiveStateChanged for the new mode.
ld l, (ix + sApplicationMode.OnActive + 0)
ld h, (ix + sApplicationMode.OnActive + 1)
ld a, MODE_PUSHED_ON
jp (hl)
;==============================================================================
; ModeManager_PopMode
; Pops the top mode from the stack. Lets the previous top deactivate, then
; activates the new top. Barfs if stack depth goes too far.
; INPUTS: None
; OUTPUTS: None
; Does not preserve any registers.
;==============================================================================
ModeManager_PopMode:
; Tell the old active mode that they are inactive; they
; just got popped off.
ld ix, (gModeManager.CurrMode)
ld l, (ix + sApplicationMode.OnInactive + 0)
ld h, (ix + sApplicationMode.OnInactive + 1)
ld a, MODE_POPPED_OFF
call CallHL ; Execute the function, then return here.
; Clear out the old mode and decrement the top of stack
ld hl, (gModeManager.TopOfStack)
inc hl ; Get to high byte
ld (hl), $FF
dec hl ; Low byte
ld (hl), $FF
dec hl
dec hl
ld (gModeManager.TopOfStack), hl
; Make this one the cached one.
ld a, (hl)
inc hl
ld h, (hl)
ld l, a
ld (gModeManager.CurrMode), hl
; Get the new mode into IX
ld ix, (gModeManager.CurrMode)
; Prep the video interrupt in a global.
ld l, (ix + sApplicationMode.VideoInterruptJumpTarget + 0)
ld h, (ix + sApplicationMode.VideoInterruptJumpTarget + 1)
ld (gModeManager.CurrVideoInterruptJumpTarget), hl
; Now call the OnActiveStateChanged for the new mode.
ld l, (ix + sApplicationMode.OnActive + 0)
ld h, (ix + sApplicationMode.OnActive + 1)
ld a, MODE_OTHER_POPPED_OFF
jp (hl)
;==============================================================================
; ModeManager_OnNMI
; Called when an NMI occurs
; INPUTS: None
; OUTPUTS: None
; Does not preserve any registers.
;==============================================================================
ModeManager_OnNMI:
ld ix, (gModeManager.CurrMode)
ld l, (ix + sApplicationMode.OnNMI + 0)
ld h, (ix + sApplicationMode.OnNMI + 1)
jp (hl)
;==============================================================================
; ModeManager_OnUpdate
; Called when the current mode needs to update
; INPUTS: None
; OUTPUTS: None
; Does not preserve any registers.
;==============================================================================
ModeManager_OnUpdate:
ld ix, (gModeManager.CurrMode)
ld l, (ix + sApplicationMode.OnUpdate + 0)
ld h, (ix + sApplicationMode.OnUpdate + 1)
jp (hl)
;==============================================================================
; ModeManager_OnRenderPrep
; Called when the current mode needs to prep for render
; INPUTS: None
; OUTPUTS: None
; Does not preserve any registers.
;==============================================================================
ModeManager_OnRenderPrep:
ld ix, (gModeManager.CurrMode)
ld l, (ix + sApplicationMode.OnRenderPrep + 0)
ld h, (ix + sApplicationMode.OnRenderPrep + 1)
jp (hl)
;==============================================================================
; ModeManager_OnEvent
; Called when an event happened that the current mode may want to handle
; INPUTS: None
; OUTPUTS: None
; Does not preserve any registers.
;==============================================================================
ModeManager_OnEvent:
ld ix, (gModeManager.CurrMode)
ld l, (ix + sApplicationMode.OnEvent + 0)
ld h, (ix + sApplicationMode.OnEvent + 1)
jp (hl)
.ENDS
.ENDIF ;__MODE_MANAGER_ASM__ |
elf-progs/print.asm | Luigi30/68k-sbc | 0 | 175926 | idnt "print.c"
|
bios_source/bios.asm | alblue/8086tiny | 26 | 244450 | <reponame>alblue/8086tiny<filename>bios_source/bios.asm
; BIOS source for 8086tiny IBM PC emulator. Compiles with NASM.
; Copyright 2013, <NAME> (<EMAIL>) - http://www.megalith.co.uk/8086tiny
;
; Revision 1.20
;
; This work is licensed under the MIT License. See included LICENSE.TXT.
cpu 8086
; Defines
%define biosbase 0x000f ; BIOS loads at segment 0xF000
; Here we define macros for some custom instructions that help the emulator talk with the outside
; world. They are described in detail in the hint.html file, which forms part of the emulator
; distribution.
%macro extended_putchar_al 0
db 0x0f
db 0x00
%endmacro
%macro extended_get_rtc 0
db 0x0f
db 0x01
%endmacro
%macro extended_read_disk 0
db 0x0f
db 0x02
%endmacro
%macro extended_write_disk 0
db 0x0f
db 0x03
%endmacro
org 100h ; BIOS loads at offset 0x0100
main:
jmp bios_entry
; Here go pointers to the different data tables used for instruction decoding
dw rm_mode12_reg1 ; Table 0: R/M mode 1/2 "register 1" lookup
dw biosbase
dw rm_mode12_reg2 ; Table 1: R/M mode 1/2 "register 2" lookup
dw biosbase
dw rm_mode12_disp ; Table 2: R/M mode 1/2 "DISP multiplier" lookup
dw biosbase
dw rm_mode12_dfseg ; Table 3: R/M mode 1/2 "default segment" lookup
dw biosbase
dw rm_mode0_reg1 ; Table 4: R/M mode 0 "register 1" lookup
dw biosbase
dw rm_mode0_reg2 ; Table 5: R/M mode 0 "register 2" lookup
dw biosbase
dw rm_mode0_disp ; Table 6: R/M mode 0 "DISP multiplier" lookup
dw biosbase
dw rm_mode0_dfseg ; Table 7: R/M mode 0 "default segment" lookup
dw biosbase
dw xlat_ids ; Table 8: Translation of raw opcode index ("Raw ID") to function number ("Xlat'd ID")
dw biosbase
dw 0 ; Table 9: (Defunct)
dw biosbase
dw 0 ; Table 10: (Defunct)
dw biosbase
dw 0 ; Table 11: (Defunct)
dw biosbase
dw 0 ; Table 12: (Defunct)
dw biosbase
dw 0 ; Table 13: (Defunct)
dw biosbase
dw ex_data ; Table 14: Translation of Raw ID to Extra Data
dw biosbase
dw std_szp ; Table 15: Translation of Raw ID to SZP flags set yes/no
dw biosbase
dw std_ao ; Table 16: Translation of Raw ID to AO flags set yes/no
dw biosbase
dw std_o0c0 ; Table 17: Translation of Raw ID to OF=0 CF=0 set yes/no
dw biosbase
dw base_size ; Table 18: Translation of Raw ID to base instruction size (bytes)
dw biosbase
dw i_w_adder ; Table 19: Translation of Raw ID to i_w size adder yes/no
dw biosbase
dw i_mod_adder ; Table 20: Translation of Raw ID to i_mod size adder yes/no
dw biosbase
dw jxx_dec_a ; Table 21: Jxx decode table A
dw biosbase
dw jxx_dec_b ; Table 22: Jxx decode table B
dw biosbase
dw jxx_dec_c ; Table 23: Jxx decode table C
dw biosbase
dw jxx_dec_d ; Table 24: Jxx decode table D
dw biosbase
dw flags_mult ; Table 25: FLAGS multipliers
dw biosbase
dw daa_rslt_ca00 ; Table 26: DAA result, CF = 0, AF = 0
dw biosbase
dw daa_cf_ca00_ca01_das_cf_ca00 ; Table 27: DAA CF out, CF = 0, AF = 0
dw biosbase
dw daa_af_ca00_ca10_das_af_ca00_ca10 ; Table 28: DAA AF out, CF = 0, AF = 0
dw biosbase
dw daa_rslt_ca01 ; Table 29: DAA result, CF = 0, AF = 1
dw biosbase
dw daa_cf_ca00_ca01_das_cf_ca00 ; Table 30: DAA CF out, CF = 0, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 31: DAA AF out, CF = 0, AF = 1
dw biosbase
dw daa_rslt_ca10 ; Table 32: DAA result, CF = 1, AF = 0
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 33: DAA CF out, CF = 1, AF = 0
dw biosbase
dw daa_af_ca00_ca10_das_af_ca00_ca10 ; Table 34: DAA AF out, CF = 1, AF = 0
dw biosbase
dw daa_rslt_ca11 ; Table 35: DAA result, CF = 1, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 36: DAA CF out, CF = 1, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 37: DAA AF out, CF = 1, AF = 1
dw biosbase
dw das_rslt_ca00 ; Table 38: DAS result, CF = 0, AF = 0
dw biosbase
dw daa_cf_ca00_ca01_das_cf_ca00 ; Table 39: DAS CF out, CF = 0, AF = 0
dw biosbase
dw daa_af_ca00_ca10_das_af_ca00_ca10 ; Table 40: DAS AF out, CF = 0, AF = 0
dw biosbase
dw das_rslt_ca01 ; Table 41: DAS result, CF = 0, AF = 1
dw biosbase
dw das_cf_ca01 ; Table 42: DAS CF out, CF = 0, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 43: DAS AF out, CF = 0, AF = 1
dw biosbase
dw das_rslt_ca10 ; Table 44: DAS result, CF = 1, AF = 0
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 45: DAS CF out, CF = 1, AF = 0
dw biosbase
dw daa_af_ca00_ca10_das_af_ca00_ca10 ; Table 46: DAS AF out, CF = 1, AF = 0
dw biosbase
dw das_rslt_ca11 ; Table 47: DAS result, CF = 1, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 48: DAS CF out, CF = 1, AF = 1
dw biosbase
dw daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 ; Table 49: DAS AF out, CF = 1, AF = 1
dw biosbase
dw parity ; Table 50: Parity flag loop-up table (256 entries)
dw biosbase
dw i_opcodes ; Table 51: 8-bit opcode lookup table
dw biosbase
; These values (BIOS ID string, BIOS date and so forth) go at the very top of memory
biosstr db '8086tiny BIOS Revision 1.10!', 0, 0 ; Why not?
mem_top db 0xea, 0, 0x01, 0, 0xf0, '01/11/14', 0, 0xfe, 0
bios_entry:
; Set up initial stack to F000:F000
mov sp, 0xf000
mov ss, sp
push cs
pop es
push ax
; The emulator requires a few control registers in memory to always be zero for correct
; instruction decoding (in particular, register look-up operations). These are the
; emulator's zero segment (ZS) and always-zero flag (XF). Because the emulated memory
; space is uninitialised, we need to be sure these values are zero before doing anything
; else. The instructions we need to use to set them must not rely on look-up operations.
; So e.g. MOV to memory is out but string operations are fine.
cld
xor ax, ax
mov di, 24
stosw ; Set ZS = 0
mov di, 49
stosb ; Set XF = 0
; Now we can do whatever we want!
; Set up Hercules graphics support. We start with the adapter in text mode
push dx
mov dx, 0x3b8
mov al, 0
out dx, al ; Set Hercules support to text mode
mov dx, 0 ; The IOCCC version of the emulator also uses I/O port 0 as a graphics mode flag
out dx, al
mov dx, 0x3b4
mov al, 1 ; Hercules CRTC "horizontal displayed" register select
out dx, al
mov dx, 0x3b5
mov al, 0x2d ; 0x2D = 45 (* 16) = 720 pixels wide (GRAPHICS_X)
out dx, al
mov dx, 0x3b4
mov al, 6 ; Hercules CRTC "vertical displayed" register select
out dx, al
mov dx, 0x3b5
mov al, 0x57 ; 0x57 = 87 (* 4) = 348 pixels high (GRAPHICS_Y)
out dx, al
pop dx
pop ax
; Check cold boot/warm boot. We initialise disk parameters on cold boot only
cmp byte [cs:boot_state], 0 ; Cold boot?
jne boot
mov byte [cs:boot_state], 1 ; Set flag so next boot will be warm boot
; First, set up the disk subsystem. Only do this on the very first startup, when
; the emulator sets up the CX/AX registers with disk information.
; Compute the cylinder/head/sector count for the HD disk image, if present.
; Total number of sectors is in CX:AX, or 0 if there is no HD image. First,
; we put it in DX:CX.
mov dx, cx
mov cx, ax
mov [cs:hd_secs_hi], dx
mov [cs:hd_secs_lo], cx
cmp cx, 0
je maybe_no_hd
mov word [cs:num_disks], 2
jmp calc_hd
maybe_no_hd:
cmp dx, 0
je no_hd
mov word [cs:num_disks], 2
jmp calc_hd
no_hd:
mov word [cs:num_disks], 1
calc_hd:
mov ax, cx
mov word [cs:hd_max_track], 1
mov word [cs:hd_max_head], 1
cmp dx, 0 ; More than 63 total sectors? If so, we have more than 1 track.
ja sect_overflow
cmp ax, 63
ja sect_overflow
mov [cs:hd_max_sector], ax
jmp calc_heads
sect_overflow:
mov cx, 63 ; Calculate number of tracks
div cx
mov [cs:hd_max_track], ax
mov word [cs:hd_max_sector], 63
calc_heads:
mov dx, 0 ; More than 1024 tracks? If so, we have more than 1 head.
mov ax, [cs:hd_max_track]
cmp ax, 1024
ja track_overflow
jmp calc_end
track_overflow:
mov cx, 1024
div cx
mov [cs:hd_max_head], ax
mov word [cs:hd_max_track], 1024
calc_end:
; Convert number of tracks into maximum track (0-based) and then store in INT 41
; HD parameter table
mov ax, [cs:hd_max_head]
mov [cs:int41_max_heads], al
mov ax, [cs:hd_max_track]
mov [cs:int41_max_cyls], ax
mov ax, [cs:hd_max_sector]
mov [cs:int41_max_sect], al
dec word [cs:hd_max_track]
dec word [cs:hd_max_head]
; Main BIOS entry point. Zero the flags, and set up registers.
boot: mov ax, 0
push ax
popf
push cs
push cs
pop ds
pop ss
mov sp, 0xf000
; Set up the IVT. First we zero out the table
cld
mov ax, 0
mov es, ax
mov di, 0
mov cx, 512
rep stosw
; Then we load in the pointers to our interrupt handlers
mov di, 0
mov si, int_table
mov cx, [itbl_size]
rep movsb
; Set pointer to INT 41 table for hard disk
mov cx, int41
mov word [es:4*0x41], cx
mov cx, 0xf000
mov word [es:4*0x41 + 2], cx
; Set up last 16 bytes of memory, including boot jump, BIOS date, machine ID byte
mov ax, 0xffff
mov es, ax
mov di, 0x0
mov si, mem_top
mov cx, 16
rep movsb
; Set up the BIOS data area
mov ax, 0x40
mov es, ax
mov di, 0
mov si, bios_data
mov cx, 0x100
rep movsb
; Clear video memory
mov ax, 0xb800
mov es, ax
mov di, 0
mov cx, 80*25
mov ax, 0x0700
rep stosw
; Set up some I/O ports, between 0 and FFF. Most of them we set to 0xFF, to indicate no device present
mov dx, 0
mov al, 0xFF
next_out:
inc dx
cmp dx, 0x40 ; We deal with the PIT channel 0 later
je next_out
cmp dx, 0x3B8 ; We deal with the Hercules port later, too
je next_out
out dx, al
cmp dx, 0xFFF
jl next_out
mov dx, 0x3DA ; CGA refresh port
mov al, 0
out dx, al
mov dx, 0x3BA ; Hercules detection port
mov al, 0
out dx, al
mov dx, 0x3B8 ; Hercules video mode port
mov al, 0
out dx, al
mov dx, 0x3BC ; LPT1
mov al, 0
out dx, al
mov dx, 0x40 ; PIT channel 0
mov al, 0
out dx, al
mov dx, 0x62 ; PPI - needed for memory parity checks
mov al, 0
out dx, al
; Read boot sector from FDD, and load it into 0:7C00
mov ax, 0
mov es, ax
mov ax, 0x0201
mov dx, 0 ; Read from FDD
mov cx, 1
mov bx, 0x7c00
int 13h
; Jump to boot sector
jmp 0:0x7c00
; ************************* INT 7h handler - keyboard driver
int7: ; Whenever the user presses a key, INT 7 is called by the emulator.
; ASCII character of the keystroke is at 0040:this_keystroke
push ds
push es
push ax
push bx
push bp
push cs
pop ds
mov bx, 0x40 ; Set segment to BIOS data area segment (0x40)
mov es, bx
; Tail of the BIOS keyboard buffer goes in BP. This is where we add new keystrokes
mov bp, [es:kbbuf_tail-bios_data]
; First, copy zero keystroke to BIOS keyboard buffer - if we have an extended code then we
; don't translate to a keystroke. If not, then this zero will later be overwritten
; with the actual ASCII code of the keystroke.
mov byte [es:bp], 0
; Retrieve the keystroke
mov al, [es:this_keystroke-bios_data]
cmp al, 0x7f ; Linux code for backspace - change to 8
jne after_check_bksp
mov al, 8
mov byte [es:this_keystroke-bios_data], 8
after_check_bksp:
cmp al, 0x01 ; Ctrl+A pressed - this is the sequence for "next key is Alt+"
jne i2_not_alt
mov byte [es:keyflags1-bios_data], 8 ; Alt flag down
mov byte [es:keyflags2-bios_data], 2 ; Alt flag down
mov al, 0x38 ; Simulated Alt by Ctrl+A prefix?
out 0x60, al
int 9
mov byte [es:next_key_alt-bios_data], 1
jmp i2_dne
i2_not_alt:
cmp al, 0x06 ; Ctrl+F pressed - this is the sequence for "next key is Fxx"
jne i2_not_fn
mov byte [es:next_key_fn-bios_data], 1
jmp i2_dne
i2_not_fn:
cmp byte [es:notranslate_flg-bios_data], 1 ; If no translation mode is on, just pass through the scan code.
mov byte [es:notranslate_flg-bios_data], 0
je after_translate
cmp al, 0xe0 ; Some OSes return scan codes after 0xE0 for things like cursor moves. So, if we find it, set a flag saying the next code received should not be translated.
mov byte [es:notranslate_flg-bios_data], 1
; je after_translate
je i2_dne ; Don't add the 0xE0 to the keyboard buffer
mov byte [es:notranslate_flg-bios_data], 0
cmp al, 0x1b ; ESC key pressed. Either this a "real" escape, or it is UNIX cursor keys. In either case, we do nothing now, except set a flag
jne i2_escnext
; If the last key pressed was ESC, then we need to stuff it
cmp byte [es:escape_flag-bios_data], 1
jne i2_sf
; Stuff an ESC character
mov byte [es:bp], 0x1b ; ESC ASCII code
mov byte [es:bp+1], 0x01 ; ESC scan code
; ESC keystroke is in the buffer now
add word [es:kbbuf_tail-bios_data], 2
call kb_adjust_buf ; Wrap the tail around the head if the buffer gets too large
mov al, 0x01
call keypress_release
i2_sf:
mov byte [es:escape_flag-bios_data], 1
jmp i2_dne
i2_escnext:
; Check if the last key was an escape character
cmp byte [es:escape_flag-bios_data], 1
jne i2_noesc
; It is, so check if this key is a ] character
cmp al, '[' ; [ key pressed
je i2_esc
; It isn't, so stuff an ESC character plus this key
mov byte [es:bp], 0x1b ; ESC ASCII code
mov byte [es:bp+1], 0x01 ; ESC scan code
; ESC keystroke is in the buffer now
add bp, 2
add word [es:kbbuf_tail-bios_data], 2
call kb_adjust_buf ; Wrap the tail around the head if the buffer gets too large
mov al, 0x01
call keypress_release
; Now actually process this key
mov byte [es:escape_flag-bios_data], 0
mov al, [es:this_keystroke-bios_data]
jmp i2_noesc
i2_esc:
; Last + this characters are ESC ] - do nothing now, but set escape flag
mov byte [es:escape_flag-bios_data], 2
jmp i2_dne
i2_noesc:
cmp byte [es:escape_flag-bios_data], 2
jne i2_regular_key
; No shifts or Alt for cursor keys
mov byte [es:keyflags1-bios_data], 0
mov byte [es:keyflags2-bios_data], 0
; Last + this characters are ESC ] xxx - cursor key, so translate and stuff it
cmp al, 'A'
je i2_cur_up
cmp al, 'B'
je i2_cur_down
cmp al, 'D'
je i2_cur_left
cmp al, 'C'
je i2_cur_right
i2_cur_up:
mov al, 0x48 ; Translate UNIX code to cursor key scancode
jmp after_translate
i2_cur_down:
mov al, 0x50 ; Translate UNIX code to cursor key scancode
jmp after_translate
i2_cur_left:
mov al, 0x4b ; Translate UNIX code to cursor key scancode
jmp after_translate
i2_cur_right:
mov al, 0x4d ; Translate UNIX code to cursor key scancode
jmp after_translate
i2_regular_key:
mov byte [es:notranslate_flg-bios_data], 0
mov bx, a2shift_tbl ; ASCII to shift code table
xlat
; Now, AL is 1 if shift is down, 0 otherwise. If shift is down, put a shift down scan code
; in port 0x60. Then call int 9. Otherwise, put a shift up scan code in, and call int 9.
push ax
; Put shift flags in BIOS, 0040:0017. Add 8 to shift flags if Alt is down.
mov ah, [es:next_key_alt-bios_data]
cpu 186
shl ah, 3
cpu 8086
add al, ah
mov [es:keyflags1-bios_data], al
cpu 186
shr ah, 2
cpu 8086
mov [es:keyflags2-bios_data], ah
pop ax
test al, 1
jz i2_n
mov al, 0x36 ; Right shift down
out 0x60, al
int 9
i2_n:
mov al, [es:this_keystroke-bios_data]
mov [es:bp], al
mov bx, a2scan_tbl ; ASCII to scan code table
xlat
cmp byte [es:next_key_fn-bios_data], 1 ; Fxx?
jne after_translate
mov byte [es:bp], 0 ; Fxx key, so zero out ASCII code
add al, 0x39
after_translate:
mov byte [es:escape_flag-bios_data], 0
mov byte [es:escape_flag_last-bios_data], 0
; Now, AL contains the scan code of the key. Put it in the buffer
mov [es:bp+1], al
; New keystroke + scancode is in the buffer now. If the key is actually
; an Alt+ key we use an ASCII code of 0 instead of the real value.
cmp byte [es:next_key_alt-bios_data], 1
jne skip_ascii_zero
mov byte [es:bp], 0
skip_ascii_zero:
add word [es:kbbuf_tail-bios_data], 2
call kb_adjust_buf ; Wrap the tail around the head if the buffer gets too large
; Output key down/key up event (scancode in AL) to keyboard port
call keypress_release
; If scan code is not 0xE0, then also send right shift up
cmp al, 0xe0
je i2_dne
mov al, 0xb6 ; Right shift up
out 0x60, al
int 9
check_alt:
mov al, byte [es:next_key_alt-bios_data]
mov byte [es:next_key_alt-bios_data], 0
mov byte [es:next_key_fn-bios_data], 0
cmp al, 1
je endalt
jmp i2_dne
endalt:
mov al, 0xb8 ; Left Alt up
out 0x60, al
int 9
i2_dne:
pop bp
pop bx
pop ax
pop es
pop ds
iret
; ************************* INT 8h handler - timer
int8:
; See if there is an ESC waiting from a previous INT 2h. If so, put it in the keyboard buffer
; (because by now - 1/18.2 secs on - we know it can't be part of an escape key sequence).
; Also handle CGA refresh register. Also release any keys that are still marked as down.
push ax
push bx
push dx
push bp
push es
push cx
push di
push ds
push si
call vmem_driver_entry ; CGA text mode driver - documented later
mov bx, 0x40
mov es, bx
; Increment 32-bit BIOS timer tick counter, once every 8 calls
cmp byte [cs:int8_call_cnt], 8
jne skip_timer_increment
add word [es:0x6C], 1
adc word [es:0x6E], 0
mov byte [cs:int8_call_cnt], 0
skip_timer_increment:
inc byte [cs:int8_call_cnt]
; A Hercules graphics adapter flips bit 7 of I/O port 3BA, every now and then, apparently!
mov dx, 0x3BA
in al, dx
xor al, 0x80
out dx, al
; We now need to convert the data in I/O port 0x3B8 (Hercules settings) to a new format in
; I/O port 0, which we use in the IOCCC version of the emulator for code compactness.
; Basically this port will contain 0 if the Hercules graphics is disabled, 2 otherwise. Note,
; this is not used in 8086tiny.
mov dx, 0x3B8
in al, dx
test al, 2
jnz herc_gfx_mode
; Hercules is in text mode, so set I/O port 0 to 0
mov al, 0
jmp io_init_continue
herc_gfx_mode:
mov al, 2
io_init_continue:
mov dx, 0
out dx, al
; See if we have any keys down. If so, release them
cmp byte [es:key_now_down-bios_data], 0
je i8_no_key_down
mov al, [es:key_now_down-bios_data]
mov byte [es:key_now_down-bios_data], 0
add al, 0x80
out 0x60, al
int 9
i8_no_key_down:
; See if we have a waiting ESC flag
cmp byte [es:escape_flag-bios_data], 1
jne i8_end
; Did we have one last two cycles as well?
cmp byte [es:escape_flag_last-bios_data], 1
je i8_stuff_esc
inc byte [es:escape_flag_last-bios_data]
jmp i8_end
i8_stuff_esc:
; Yes, clear the ESC flag and put it in the keyboard buffer
mov byte [es:escape_flag-bios_data], 0
mov byte [es:escape_flag_last-bios_data], 0
mov bp, [es:kbbuf_tail-bios_data]
mov byte [es:bp], 0x1b ; ESC ASCII code
mov byte [es:bp+1], 0x01 ; ESC scan code
; ESC keystroke is in the buffer now
add word [es:kbbuf_tail-bios_data], 2
call kb_adjust_buf ; Wrap the tail around the head if the buffer gets too large
; Push out ESC keypress/release
mov al, 0x01
call keypress_release
i8_end:
; Now, reset emulated PIC
; mov al, 0
; mov dx, 0x20
; out dx, al
pop si
pop ds
pop di
pop cx
pop es
pop bp
pop dx
pop bx
pop ax
int 0x1c
iret
; ************************* INT 10h handler - video services
int10:
cmp ah, 0x00 ; Set video mode
je int10_set_vm
cmp ah, 0x01 ; Set cursor shape
je int10_set_cshape
cmp ah, 0x02 ; Set cursor position
je int10_set_cursor
cmp ah, 0x03 ; Get cursur position
je int10_get_cursor
cmp ah, 0x06 ; Scroll up window
je int10_scrollup
cmp ah, 0x07 ; Scroll down window
je int10_scrolldown
cmp ah, 0x08 ; Get character at cursor
je int10_charatcur
cmp ah, 0x09 ; Write char and attribute
je int10_write_char_attrib
cmp ah, 0x0e ; Write character at cursor position
je int10_write_char
cmp ah, 0x0f ; Get video mode
je int10_get_vm
;cmp ah, 0x12 ; Feature check (EGA)
;je int10_ega_features
;cmp ah, 0x1a ; Feature check
;je int10_features
iret
int10_set_vm:
push dx
push cx
push bx
cmp al, 7 ; If an app tries to set Hercules text mode 7, actually set mode 3 (we do not support mode 7's video memory buffer at B000:0)
je int10_set_vm_3
cmp al, 2 ; Same for text mode 2 (mono)
je int10_set_vm_3
jmp int10_set_vm_continue
int10_set_vm_3:
mov al, 3
int10_set_vm_continue:
mov [cs:vidmode], al
mov bh, 7 ; Black background, white foreground
call clear_screen ; ANSI clear screen
cmp byte [cs:vidmode], 6
je set6
mov al, 0x30
jmp svmn
set6:
mov al, 0x3f
svmn:
; Take Hercules adapter out of graphics mode when resetting video mode via int 10
push ax
mov dx, 0x3B8
mov al, 0
out dx, al
pop ax
pop bx
pop cx
pop dx
iret
int10_set_cshape:
push ds
push ax
push cx
mov ax, 0x40
mov ds, ax
mov byte [cursor_visible-bios_data], 1 ; Show cursor
and ch, 01100000b
cmp ch, 00100000b
jne cur_visible
mov byte [cursor_visible-bios_data], 0 ; Hide cursor
cur_visible:
mov al, 0x1B
extended_putchar_al
mov al, '['
extended_putchar_al
mov al, '?'
extended_putchar_al
mov al, '2'
extended_putchar_al
mov al, '5'
extended_putchar_al
mov al, 'l'
sub al, [cursor_visible-bios_data]
sub al, [cursor_visible-bios_data]
sub al, [cursor_visible-bios_data]
sub al, [cursor_visible-bios_data]
extended_putchar_al
pop cx
pop ax
pop ds
iret
int10_set_cursor:
push es
push ax
mov ax, 0x40
mov es, ax
cmp dh, 24
jb skip_set_cur_row_max
mov dh, 24
skip_set_cur_row_max:
cmp dl, 79
jb skip_set_cur_col_max
mov dl, 79
skip_set_cur_col_max:
mov al, 0x1B ; ANSI
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, dh ; Row number
mov [es:curpos_y-bios_data], al
inc al
call puts_decimal_al
mov al, ';' ; ANSI
extended_putchar_al
mov al, dl ; Column number
mov [es:curpos_x-bios_data], al
inc al
call puts_decimal_al
mov al, 'H' ; Set cursor position command
extended_putchar_al
pop ax
pop es
iret
int10_get_cursor: ; We don't really support this - just a placeholder
push es
push ax
mov ax, 0x40
mov es, ax
mov cx, 0x0607
mov dl, [es:curpos_x-bios_data]
mov dh, [es:curpos_y-bios_data]
pop ax
pop es
iret
int10_scrollup:
push bx
push cx
push bp
push ax
mov bp, bx ; Convert from CGA to ANSI
mov cl, 12
ror bp, cl
and bp, 7
mov bl, byte [cs:bp+colour_table]
add bl, 10
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bl ; Background colour
call puts_decimal_al
mov al, 'm' ; Set cursor position command
extended_putchar_al
pop ax
pop bp
pop cx
pop bx
cmp al, 0 ; Clear window
jne cls_partial
cmp cx, 0 ; Start of screen
jne cls_partial
cmp dl, 0x4f ; Clearing columns 0-79
jne cls_partial
cmp dl, 0x18 ; Clearing rows 0-24 (or more)
jl cls_partial
call clear_screen
iret
cls_partial:
push ax
push bx
; mov bx, 0
mov bl, al ; Number of rows to scroll are now in bl
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
cmp ch, 0 ; Start row 1? Maybe full screen
je cls_maybe_fs
jmp cls_not_fs
cls_maybe_fs:
cmp dh, 24 ; End row 25? Full screen for sure
je cls_fs
cls_not_fs:
mov al, ch ; Start row
inc al
call puts_decimal_al
mov al, ';' ; ANSI
extended_putchar_al
mov al, dh ; End row
inc al
call puts_decimal_al
cls_fs:
mov al, 'r' ; Set scrolling window
extended_putchar_al
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
cmp bl, 1
jne cls_fs_multiline
mov al, 'M'
jmp cs_fs_ml_out
cls_fs_multiline:
mov al, bl ; Number of rows
call puts_decimal_al
mov al, 'S' ; Scroll up
cs_fs_ml_out:
extended_putchar_al
pop ax
pop bx
; Update "actual" cursor position with expected value - different ANSI terminals do different things
; to the cursor position when you scroll
push ax
push bx
push dx
push es
mov ax, 0x40
mov es, ax
mov ah, 2
mov bh, 0
mov dh, [es:curpos_y-bios_data]
mov dl, [es:curpos_x-bios_data]
int 10h
pop es
pop dx
pop bx
pop ax
;push es
;mov ax, 0x40
;mov es, ax
;sub byte [es:curpos_y-bios_data], bl
;cmp byte [es:curpos_y-bios_data], 0
;jnl int10_scroll_up_vmem_update
;mov byte [es:curpos_y-bios_data], 0
int10_scroll_up_vmem_update:
;pop es
; Now, we need to update video memory
push bx
push ax
push ds
push es
push cx
push dx
push si
push di
push bx
mov bx, 0xb800
mov es, bx
mov ds, bx
pop bx
cls_vmem_scroll_up_next_line:
cmp bl, 0
je cls_vmem_scroll_up_done
cls_vmem_scroll_up_one:
push bx
push dx
mov ax, 0
mov al, ch ; Start row number is now in AX
mov bx, 80
mul bx
add al, cl
adc ah, 0 ; Character number is now in AX
mov bx, 2
mul bx ; Memory location is now in AX
pop dx
pop bx
mov di, ax
mov si, ax
add si, 2*80 ; In a moment we will copy CX words from DS:SI to ES:DI
mov ax, 0
add al, dl
adc ah, 0
inc ax
sub al, cl
sbb ah, 0 ; AX now contains the number of characters from the row to copy
cmp ch, dh
jae cls_vmem_scroll_up_one_done
;jne vmem_scroll_up_copy_next_row
;push cx
;mov cx, ax
;mov ah, 0x47
;mov al, 0
;cld
;rep stosw
;pop cx
;jmp cls_vmem_scroll_up_one_done
vmem_scroll_up_copy_next_row:
push cx
mov cx, ax ; CX is now the length (in words) of the row to copy
cld
rep movsw ; Scroll the line up
pop cx
inc ch ; Move onto the next row
jmp cls_vmem_scroll_up_one
cls_vmem_scroll_up_one_done:
push cx
mov cx, ax ; CX is now the length (in words) of the row to copy
mov ah, bh ; Attribute for new line
mov al, 0 ; Write 0 to video memory for new characters
cld
rep stosw
pop cx
dec bl ; Scroll whole text block another line
jmp cls_vmem_scroll_up_next_line
cls_vmem_scroll_up_done:
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '0' ; Reset attributes
extended_putchar_al
mov al, 'm'
extended_putchar_al
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
;int 8 ; Force display update after scroll
pop di
pop si
pop dx
pop cx
pop es
pop ds
pop ax
pop bx
; pop bx
; pop ax
iret
int10_scrolldown:
push bx
push cx
push bp
push ax
mov bp, bx ; Convert from CGA to ANSI
mov cl, 12
ror bp, cl
and bp, 7
mov bl, byte [cs:bp+colour_table]
add bl, 10
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bl ; Background colour
call puts_decimal_al
mov al, 'm' ; Set cursor position command
extended_putchar_al
pop ax
pop bp
pop cx
pop bx
cmp al, 0 ; Clear window
jne cls_partial_down
cmp cx, 0 ; Start of screen
jne cls_partial_down
cmp dl, 0x4f ; Clearing columns 0-79
jne cls_partial_down
cmp dl, 0x18 ; Clearing rows 0-24 (or more)
jl cls_partial_down
call clear_screen
iret
cls_partial_down:
push ax
push bx
mov bx, 0
mov bl, al ; Number of rows to scroll are now in bl
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
cmp ch, 0 ; Start row 1? Maybe full screen
je cls_maybe_fs_down
jmp cls_not_fs_down
cls_maybe_fs_down:
cmp dh, 24 ; End row 25? Full screen for sure
je cls_fs_down
cls_not_fs_down:
mov al, ch ; Start row
inc al
call puts_decimal_al
mov al, ';' ; ANSI
extended_putchar_al
mov al, dh ; End row
inc al
call puts_decimal_al
cls_fs_down:
mov al, 'r' ; Set scrolling window
extended_putchar_al
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bl ; Number of rows
call puts_decimal_al
mov al, 'T' ; Scroll down
extended_putchar_al
; Update "actual" cursor position with expected value - different ANSI terminals do different things
; to the cursor position when you scroll
push ax
push bx
push dx
push es
mov ax, 0x40
mov es, ax
mov ah, 2
mov bh, 0
mov dh, [es:curpos_y-bios_data]
mov dl, [es:curpos_x-bios_data]
int 10h
pop es
pop dx
pop bx
pop ax
;push es
;mov ax, 0x40
;mov es, ax
;add byte [es:curpos_y-bios_data], bl
;cmp byte [es:curpos_y-bios_data], 25
;jna int10_scroll_down_vmem_update
;mov byte [es:curpos_y-bios_data], 25
int10_scroll_down_vmem_update:
;pop es
; Now, we need to update video memory
push ds
push es
push cx
push dx
push si
push di
push bx
mov bx, 0xb800
mov es, bx
mov ds, bx
pop bx
cls_vmem_scroll_down_next_line:
cmp bl, 0
je cls_vmem_scroll_down_done
cls_vmem_scroll_down_one:
push bx
push dx
mov ax, 0
mov al, dh ; End row number is now in AX
mov bx, 80
mul bx
add al, cl
adc ah, 0 ; Character number is now in AX
mov bx, 2
mul bx ; Memory location (start of final row) is now in AX
pop dx
pop bx
mov di, ax
mov si, ax
sub si, 2*80 ; In a moment we will copy CX words from DS:SI to ES:DI
mov ax, 0
add al, dl
adc ah, 0
inc ax
sub al, cl
sbb ah, 0 ; AX now contains the number of characters from the row to copy
cmp ch, dh
jae cls_vmem_scroll_down_one_done
push cx
mov cx, ax ; CX is now the length (in words) of the row to copy
rep movsw ; Scroll the line down
pop cx
dec dh ; Move onto the next row
jmp cls_vmem_scroll_down_one
cls_vmem_scroll_down_one_done:
push cx
mov cx, ax ; CX is now the length (in words) of the row to copy
mov ah, bh ; Attribute for new line
mov al, 0 ; Write 0 to video memory for new characters
rep stosw
pop cx
dec bl ; Scroll whole text block another line
jmp cls_vmem_scroll_down_next_line
cls_vmem_scroll_down_done:
pop di
pop si
pop dx
pop cx
pop es
pop ds
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '0' ; Reset attributes
extended_putchar_al
mov al, 'm'
extended_putchar_al
pop bx
pop ax
iret
int10_charatcur:
; This returns the character at the cursor. It is completely dysfunctional,
; and only works at all if the character has previously been written following
; an int 10/ah = 2 call to set the cursor position. Added just to support
; GWBASIC.
push ds
push es
push bx
mov bx, 0x40
mov es, bx
mov bx, 0xb000
mov ds, bx
mov bx, 0
add bl, [es:curpos_x-bios_data]
add bl, [es:curpos_x-bios_data]
mov ah, 0
mov al, [bx]
pop bx
pop es
pop ds
iret
i10_unsup:
iret
int10_write_char:
; First we kind of write the character to "video memory". This is so that
; we can later retrieve it using the get character at cursor function,
; which GWBASIC uses.
push ds
push es
push bx
mov bx, 0x40
mov es, bx
mov bx, 0xb000
mov ds, bx
mov bx, 0
mov bl, [es:curpos_x-bios_data]
shl bx, 1
mov [bx], al
cmp al, 0x08
jne int10_write_char_inc_x
dec byte [es:curpos_x-bios_data]
cmp byte [es:curpos_x-bios_data], 0
jg int10_write_char_done
mov byte [es:curpos_x-bios_data], 0
jmp int10_write_char_done
int10_write_char_inc_x:
cmp al, 0x0A ; New line?
je int10_write_char_newline
cmp al, 0x0D ; Carriage return?
jne int10_write_char_not_cr
mov byte [es:curpos_x-bios_data],0
jmp int10_write_char_done
int10_write_char_not_cr:
inc byte [es:curpos_x-bios_data]
cmp byte [es:curpos_x-bios_data], 80
jge int10_write_char_newline
jmp int10_write_char_done
int10_write_char_newline:
mov byte [es:curpos_x-bios_data], 0
inc byte [es:curpos_y-bios_data]
cmp byte [es:curpos_y-bios_data], 25
jb int10_write_char_done
mov byte [es:curpos_y-bios_data], 24
push cx
push dx
mov bx, 0x0701
mov cx, 0
mov dx, 0x184f
pushf
push cs
call int10_scroll_up_vmem_update
pop dx
pop cx
int10_write_char_done:
pop bx
pop es
pop ds
extended_putchar_al
iret
int10_write_char_attrib:
; First we write the character to a fake "video memory" location. This is so that
; we can later retrieve it using the get character at cursor function, which
; GWBASIC uses in this way to see what has been typed.
push ds
push es
push cx
push bp
push bx
push bx
mov bx, 0x40
mov es, bx
mov bx, 0xb000
mov ds, bx
mov bx, 0
mov bl, [es:curpos_x-bios_data]
shl bx, 1
mov [bx], al
pop bx
push bx
push ax
mov bh, bl
and bl, 7 ; Foreground colour now in bl
mov bp, bx ; Convert from CGA to ANSI
and bp, 0xff
mov bl, byte [cs:bp+colour_table]
and bh, 8 ; Bright attribute now in bh
cpu 186
shr bh, 3
cpu 8086
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bh ; Bright attribute
call puts_decimal_al
mov al, ';'
extended_putchar_al
mov al, bl ; Foreground colour
call puts_decimal_al
mov al, 'm' ; Set cursor position command
extended_putchar_al
pop ax
pop bx
push bx
push ax
mov bh, bl
shr bl, 1
shr bl, 1
shr bl, 1
shr bl, 1
and bl, 7 ; Background colour now in bl
mov bp, bx ; Convert from CGA to ANSI
and bp, 0xff
mov bl, byte [cs:bp+colour_table]
add bl, 10
rol bh, 1
and bh, 1 ; Bright attribute now in bh (not used right now)
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bl ; Background colour
call puts_decimal_al
mov al, 'm' ; Set cursor position command
extended_putchar_al
pop ax
pop bx
push ax
out_another_char:
extended_putchar_al
dec cx
cmp cx, 0
jne out_another_char
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '0' ; Reset attributes
extended_putchar_al
mov al, 'm'
extended_putchar_al
cmp al, 0x08
jne int10_write_char_attrib_inc_x
dec byte [es:curpos_x-bios_data]
cmp byte [es:curpos_x-bios_data], 0
jg int10_write_char_attrib_done
mov byte [es:curpos_x-bios_data], 0
jmp int10_write_char_attrib_done
int10_write_char_attrib_inc_x:
cmp al, 0x0A ; New line?
je int10_write_char_attrib_newline
cmp al, 0x0D ; Carriage return?
jne int10_write_char_attrib_not_cr
mov byte [es:curpos_x-bios_data],0
jmp int10_write_char_attrib_done
int10_write_char_attrib_not_cr:
inc byte [es:curpos_x-bios_data]
cmp byte [es:curpos_x-bios_data], 80
jge int10_write_char_attrib_newline
jmp int10_write_char_attrib_done
int10_write_char_attrib_newline:
mov byte [es:curpos_x-bios_data], 0
inc byte [es:curpos_y-bios_data]
cmp byte [es:curpos_y-bios_data], 25
jb int10_write_char_attrib_done
mov byte [es:curpos_y-bios_data], 24
push cx
push dx
mov bl, 1
mov cx, 0
mov dx, 0x184f
pushf
push cs
call int10_scroll_up_vmem_update
pop dx
pop cx
int10_write_char_attrib_done:
pop ax
pop bx
pop bp
pop cx
pop es
pop ds
iret
int10_get_vm:
mov ah, 80 ; Number of columns
mov al, [cs:vidmode]
mov bh, 0
iret
;int10_ega_features:
; cmp bl, 0x10
; jne i10_unsup
;
; mov bx, 0
; mov cx, 0x0005
; iret
;
; int10_features:
;
; ; Signify we have CGA display
;
; mov al, 0x1a
; mov bx, 0x0202
; iret
; ************************* INT 11h - get equipment list
int11:
mov ax, [cs:equip]
iret
; ************************* INT 12h - return memory size
int12:
mov ax, 0x280 ; 640K conventional memory
iret
; ************************* INT 13h handler - disk services
int13:
cmp ah, 0x00 ; Reset disk
je int13_reset_disk
cmp ah, 0x01 ; Get last status
je int13_last_status
cmp dl, 0x80 ; Hard disk being queried?
jne i13_diskok
; Now, need to check an HD is installed
cmp word [cs:num_disks], 2
jge i13_diskok
; No HD, so return an error
mov ah, 15 ; Report no such drive
jmp reach_stack_stc
i13_diskok:
cmp ah, 0x02 ; Read disk
je int13_read_disk
cmp ah, 0x03 ; Write disk
je int13_write_disk
cmp ah, 0x04 ; Verify disk
je int13_verify
cmp ah, 0x05 ; Format track - does nothing here
je int13_format
cmp ah, 0x08 ; Get drive parameters (hard disk)
je int13_getparams
cmp ah, 0x10 ; Check if drive ready (hard disk)
je int13_hdready
cmp ah, 0x15 ; Get disk type
je int13_getdisktype
cmp ah, 0x16 ; Detect disk change
je int13_diskchange
mov ah, 1 ; Invalid function
jmp reach_stack_stc
iret
int13_reset_disk:
jmp reach_stack_clc
int13_last_status:
mov ah, [cs:disk_laststatus]
je ls_no_error
stc
iret
ls_no_error:
clc
iret
int13_read_disk:
push dx
cmp dl, 0 ; Floppy 0
je i_flop_rd
cmp dl, 0x80 ; HD
je i_hd_rd
pop dx
mov ah, 1
jmp reach_stack_stc
i_flop_rd:
mov dl, 1 ; Floppy disk file handle is stored at j[1] in emulator
jmp i_rd
i_hd_rd:
mov dl, 0 ; Hard disk file handle is stored at j[0] in emulator
i_rd:
push si
push bp
; Convert head/cylinder/sector number to byte offset in disk image
call chs_to_abs
; Now, SI:BP contains the absolute sector offset of the block. We then multiply by 512 to get the offset into the disk image
mov ah, 0
cpu 186
shl ax, 9
extended_read_disk
shr ax, 9
cpu 8086
mov ah, 0x02 ; Put read code back
cmp al, 0
je rd_error
; Read was successful. Now, check if we have read the boot sector. If so, we want to update
; our internal table of sectors/track to match the disk format
cmp dx, 1 ; FDD?
jne rd_noerror
cmp cx, 1 ; First sector?
jne rd_noerror
push ax
mov al, [es:bx+24] ; Number of SPT in floppy disk BPB
cmp al, 0 ; If disk is unformatted, do not update the table
jne rd_update_spt
pop ax
jmp rd_noerror
rd_update_spt:
mov [cs:int1e_spt], al
pop ax
rd_noerror:
clc
mov ah, 0 ; No error
jmp rd_finish
rd_error:
stc
mov ah, 4 ; Sector not found
rd_finish:
pop bp
pop si
pop dx
mov [cs:disk_laststatus], ah
jmp reach_stack_carry
int13_write_disk:
push dx
cmp dl, 0 ; Floppy 0
je i_flop_wr
cmp dl, 0x80 ; HD
je i_hd_wr
pop dx
mov ah, 1
jmp reach_stack_stc
i_flop_wr:
mov dl, 1 ; Floppy disk file handle is stored at j[1] in emulator
jmp i_wr
i_hd_wr:
mov dl, 0 ; Hard disk file handle is stored at j[0] in emulator
i_wr:
push si
push bp
push cx
push di
; Convert head/cylinder/sector number to byte offset in disk image
call chs_to_abs
; Signal an error if we are trying to write beyond the end of the disk
cmp dl, 0 ; Hard disk?
jne wr_fine ; No - no need for disk sector valid check - NOTE: original submission was JNAE which caused write problems on floppy disk
; First, we add the number of sectors we are trying to write from the absolute
; sector number returned by chs_to_abs. We need to have at least this many
; sectors on the disk, otherwise return a sector not found error.
mov cx, bp
mov di, si
mov ah, 0
add cx, ax
adc di, 0
cmp di, [cs:hd_secs_hi]
ja wr_error
jb wr_fine
cmp cx, [cs:hd_secs_lo]
ja wr_error
wr_fine:
mov ah, 0
cpu 186
shl ax, 9
extended_write_disk
shr ax, 9
cpu 8086
mov ah, 0x03 ; Put write code back
cmp al, 0
je wr_error
clc
mov ah, 0 ; No error
jmp wr_finish
wr_error:
stc
mov ah, 4 ; Sector not found
wr_finish:
pop di
pop cx
pop bp
pop si
pop dx
mov [cs:disk_laststatus], ah
jmp reach_stack_carry
int13_verify:
mov ah, 0
jmp reach_stack_clc
int13_getparams:
cmp dl, 0
je i_gp_fl
cmp dl, 0x80
je i_gp_hd
mov ah, 0x01
mov [cs:disk_laststatus], ah
jmp reach_stack_stc
i_gp_fl:
mov ax, 0
mov bx, 4
mov cx, 0x4f12
mov dx, 0x0101
mov byte [cs:disk_laststatus], 0
jmp reach_stack_clc
i_gp_hd:
mov ax, 0
mov bx, 0
mov dl, 1
mov dh, [cs:hd_max_head]
mov cx, [cs:hd_max_track]
ror ch, 1
ror ch, 1
add ch, [cs:hd_max_sector]
xchg ch, cl
mov byte [cs:disk_laststatus], 0
jmp reach_stack_clc
int13_hdready:
cmp byte [cs:num_disks], 2 ; HD present?
jne int13_hdready_nohd
cmp dl, 0x80 ; Checking first HD?
jne int13_hdready_nohd
mov ah, 0
jmp reach_stack_clc
int13_hdready_nohd:
jmp reach_stack_stc
int13_format:
mov ah, 0
jmp reach_stack_clc
int13_getdisktype:
cmp dl, 0 ; Floppy
je gdt_flop
cmp dl, 0x80 ; HD
je gdt_hd
mov ah, 15 ; Report no such drive
mov [cs:disk_laststatus], ah
jmp reach_stack_stc
gdt_flop:
mov ah, 1
jmp reach_stack_clc
gdt_hd:
mov ah, 3
mov cx, [cs:hd_secs_hi]
mov dx, [cs:hd_secs_lo]
jmp reach_stack_clc
int13_diskchange:
mov ah, 0 ; Disk not changed
jmp reach_stack_clc
; ************************* INT 14h - serial port functions
int14:
cmp ah, 0
je int14_init
iret
int14_init:
mov ax, 0
iret
; ************************* INT 15h - get system configuration
int15: ; Here we do not support any of the functions, and just return
; a function not supported code - like the original IBM PC/XT does.
; cmp ah, 0xc0
; je int15_sysconfig
; cmp ah, 0x41
; je int15_waitevent
; cmp ah, 0x4f
; je int15_intercept
; cmp ah, 0x88
; je int15_getextmem
; Otherwise, function not supported
mov ah, 0x86
jmp reach_stack_stc
; int15_sysconfig: ; Return address of system configuration table in ROM
;
; mov bx, 0xf000
; mov es, bx
; mov bx, rom_config
; mov ah, 0
;
; jmp reach_stack_clc
;
; int15_waitevent: ; Events not supported
;
; mov ah, 0x86
;
; jmp reach_stack_stc
;
; int15_intercept: ; Keyboard intercept
;
; jmp reach_stack_stc
;
; int15_getextmem: ; Extended memory not supported
;
; mov ah,0x86
;
; jmp reach_stack_stc
; ************************* INT 16h handler - keyboard
int16:
cmp ah, 0x00 ; Get keystroke (remove from buffer)
je kb_getkey
cmp ah, 0x01 ; Check for keystroke (do not remove from buffer)
je kb_checkkey
cmp ah, 0x02 ; Check shift flags
je kb_shiftflags
cmp ah, 0x12 ; Check shift flags
je kb_extshiftflags
iret
kb_getkey:
push es
push bx
push cx
push dx
sti
mov bx, 0x40
mov es, bx
kb_gkblock:
mov cx, [es:kbbuf_tail-bios_data]
mov bx, [es:kbbuf_head-bios_data]
mov dx, [es:bx]
; Wait until there is a key in the buffer
cmp cx, bx
je kb_gkblock
add word [es:kbbuf_head-bios_data], 2
call kb_adjust_buf
mov ah, dh
mov al, dl
pop dx
pop cx
pop bx
pop es
iret
kb_checkkey:
push es
push bx
push cx
push dx
sti
mov bx, 0x40
mov es, bx
mov cx, [es:kbbuf_tail-bios_data]
mov bx, [es:kbbuf_head-bios_data]
mov dx, [es:bx]
; Check if there is a key in the buffer. ZF is set if there is none.
cmp cx, bx
mov ah, dh
mov al, dl
pop dx
pop cx
pop bx
pop es
retf 2 ; NEED TO FIX THIS!!
kb_shiftflags:
push es
push bx
mov bx, 0x40
mov es, bx
mov al, [es:keyflags1-bios_data]
pop bx
pop es
iret
kb_extshiftflags:
push es
push bx
mov bx, 0x40
mov es, bx
mov al, [es:keyflags1-bios_data]
mov ah, al
pop bx
pop es
iret
; ************************* INT 17h handler - printer
int17:
cmp ah, 0x01
je int17_initprint ; Initialise printer
iret
int17_initprint:
mov ah, 0
iret
; ************************* INT 19h = reboot
int19:
jmp boot
; ************************* INT 1Ah - clock
int1a:
cmp ah, 0
je int1a_getsystime ; Get ticks since midnight (used for RTC time)
cmp ah, 2
je int1a_gettime ; Get RTC time (not actually used by DOS)
cmp ah, 4
je int1a_getdate ; Get RTC date
cmp ah, 0x0f
je int1a_init ; Initialise RTC
iret
int1a_getsystime:
push ax
push bx
push ds
push es
push cs
push cs
pop ds
pop es
mov bx, timetable
extended_get_rtc
mov ax, 182 ; Clock ticks in 10 seconds
mul word [tm_sec]
mov bx, 10
mov dx, 0
div bx ; AX now contains clock ticks in seconds counter
mov [tm_sec], ax
mov ax, 1092 ; Clock ticks in a minute
mul word [tm_min] ; AX now contains clock ticks in minutes counter
mov [tm_min], ax
mov ax, 65520 ; Clock ticks in an hour
mul word [tm_hour] ; DX:AX now contains clock ticks in hours counter
add ax, [tm_sec] ; Add seconds in to AX
adc dx, 0 ; Carry into DX if necessary
add ax, [tm_min] ; Add minutes in to AX
adc dx, 0 ; Carry into DX if necessary
push dx
push ax
pop dx
pop cx
pop es
pop ds
pop bx
pop ax
mov al, 0
iret
int1a_gettime:
; Return the system time in BCD format. DOS doesn't use this, but we need to return
; something or the system thinks there is no RTC.
push ds
push es
push ax
push bx
push cs
push cs
pop ds
pop es
mov bx, timetable
extended_get_rtc
mov ax, 0
mov cx, [tm_hour]
call hex_to_bcd
mov bh, al ; Hour in BCD is in BH
mov ax, 0
mov cx, [tm_min]
call hex_to_bcd
mov bl, al ; Minute in BCD is in BL
mov ax, 0
mov cx, [tm_sec]
call hex_to_bcd
mov dh, al ; Second in BCD is in DH
mov dl, 0 ; Daylight saving flag = 0 always
mov cx, bx ; Hour:minute now in CH:CL
pop bx
pop ax
pop es
pop ds
jmp reach_stack_clc
int1a_getdate:
; Return the system date in BCD format.
push ds
push es
push bx
push ax
push cs
push cs
pop ds
pop es
mov bx, timetable
extended_get_rtc
mov ax, 0x1900
mov cx, [tm_year]
call hex_to_bcd
mov cx, ax
push cx
mov ax, 1
mov cx, [tm_mon]
call hex_to_bcd
mov dh, al
mov ax, 0
mov cx, [tm_mday]
call hex_to_bcd
mov dl, al
pop cx
pop ax
pop bx
pop es
pop ds
jmp reach_stack_clc
int1a_init:
jmp reach_stack_clc
; ************************* INT 1Ch - the other timer interrupt
int1c:
iret
; ************************* INT 1Eh - diskette parameter table
int1e:
db 0xdf ; Step rate 2ms, head unload time 240ms
db 0x02 ; Head load time 4 ms, non-DMA mode 0
db 0x25 ; Byte delay until motor turned off
db 0x02 ; 512 bytes per sector
int1e_spt db 0xff ; 18 sectors per track (1.44MB)
db 0x1B ; Gap between sectors for 3.5" floppy
db 0xFF ; Data length (ignored)
db 0x54 ; Gap length when formatting
db 0xF6 ; Format filler byte
db 0x0F ; Head settle time (1 ms)
db 0x08 ; Motor start time in 1/8 seconds
; ************************* INT 41h - hard disk parameter table
int41:
int41_max_cyls dw 0
int41_max_heads db 0
dw 0
dw 0
db 0
db 11000000b
db 0
db 0
db 0
dw 0
int41_max_sect db 0
db 0
; ************************* ROM configuration table
rom_config dw 16 ; 16 bytes following
db 0xfe ; Model
db 'A' ; Submodel
db 'C' ; BIOS revision
db 0b00100000 ; Feature 1
db 0b00000000 ; Feature 2
db 0b00000000 ; Feature 3
db 0b00000000 ; Feature 4
db 0b00000000 ; Feature 5
db 0, 0, 0, 0, 0, 0
; Internal state variables
num_disks dw 0 ; Number of disks present
hd_secs_hi dw 0 ; Total sectors on HD (high word)
hd_secs_lo dw 0 ; Total sectors on HD (low word)
hd_max_sector dw 0 ; Max sector number on HD
hd_max_track dw 0 ; Max track number on HD
hd_max_head dw 0 ; Max head number on HD
drive_tracks_temp dw 0
drive_sectors_temp dw 0
drive_heads_temp dw 0
drive_num_temp dw 0
boot_state db 0
cga_refresh_reg db 0
; Default interrupt handlers
int0:
int1:
int2:
int3:
int4:
int5:
int6:
int9:
inta:
intb:
intc:
intd:
inte:
intf:
int18:
int1b:
int1d:
iret
; ************ Function call library ************
; Hex to BCD routine. Input is AX in hex (can be 0), and adds CX in hex to it, forming a BCD output in AX.
hex_to_bcd:
push bx
jcxz h2bfin
h2bloop:
inc ax
; First process the low nibble of AL
mov bh, al
and bh, 0x0f
cmp bh, 0x0a
jne c1
add ax, 0x0006
; Then the high nibble of AL
c1:
mov bh, al
and bh, 0xf0
cmp bh, 0xa0
jne c2
add ax, 0x0060
; Then the low nibble of AH
c2:
mov bh, ah
and bh, 0x0f
cmp bh, 0x0a
jne c3
add ax, 0x0600
c3:
loop h2bloop
h2bfin:
pop bx
ret
; Takes a number in AL (from 0 to 99), and outputs the value in decimal using extended_putchar_al.
puts_decimal_al:
push ax
aam
add ax, 0x3030 ; '00'
xchg ah, al ; First digit is now in AL
cmp al, 0x30
je pda_2nd ; First digit is zero, so print only 2nd digit
extended_putchar_al ; Print first digit
pda_2nd:
xchg ah, al ; Second digit is now in AL
extended_putchar_al ; Print second digit
pop ax
ret
; Keyboard adjust buffer head and tail. If either head or the tail are at the end of the buffer, reset them
; back to the start, since it is a circular buffer.
kb_adjust_buf:
push ax
push bx
; Check to see if the head is at the end of the buffer (or beyond). If so, bring it back
; to the start
mov ax, [es:kbbuf_end_ptr-bios_data]
cmp [es:kbbuf_head-bios_data], ax
jnge kb_adjust_tail
mov bx, [es:kbbuf_start_ptr-bios_data]
mov [es:kbbuf_head-bios_data], bx
kb_adjust_tail:
; Check to see if the tail is at the end of the buffer (or beyond). If so, bring it back
; to the start
mov ax, [es:kbbuf_end_ptr-bios_data]
cmp [es:kbbuf_tail-bios_data], ax
jnge kb_adjust_done
mov bx, [es:kbbuf_start_ptr-bios_data]
mov [es:kbbuf_tail-bios_data], bx
kb_adjust_done:
pop bx
pop ax
ret
; Convert CHS disk position (in CH, CL and DH) to absolute sector number in BP:SI
; Floppy disks have 512 bytes per sector, 9/18 sectors per track, 2 heads. DH is head number (1 or 0), CH bits 5..0 is
; sector number, CL7..6 + CH7..0 is 10-bit cylinder/track number. Hard disks have 512 bytes per sector, but a variable
; number of tracks and heads.
chs_to_abs:
push ax
push bx
push cx
push dx
mov [cs:drive_num_temp], dl
; First, we extract the track number from CH and CL.
push cx
mov bh, cl
mov cl, 6
shr bh, cl
mov bl, ch
; Multiply track number (now in BX) by the number of heads
cmp byte [cs:drive_num_temp], 1 ; Floppy disk?
push dx
mov dx, 0
xchg ax, bx
jne chs_hd
shl ax, 1 ; Multiply by 2 (number of heads on FD)
push ax
xor ax, ax
mov al, [cs:int1e_spt]
mov [cs:drive_sectors_temp], ax ; Retrieve sectors per track from INT 1E table
pop ax
jmp chs_continue
chs_hd:
mov bp, [cs:hd_max_head]
inc bp
mov [cs:drive_heads_temp], bp
mul word [cs:drive_heads_temp] ; HD, so multiply by computed head count
mov bp, [cs:hd_max_sector] ; We previously calculated maximum HD track, so number of tracks is 1 more
mov [cs:drive_sectors_temp], bp
chs_continue:
xchg ax, bx
pop dx
xchg dh, dl
mov dh, 0
add bx, dx
mov ax, [cs:drive_sectors_temp]
mul bx
; Now we extract the sector number (from 1 to 63) - for some reason they start from 1
pop cx
mov ch, 0
and cl, 0x3F
dec cl
add ax, cx
adc dx, 0
mov bp, ax
mov si, dx
; Now, SI:BP contains offset into disk image file (FD or HD)
pop dx
pop cx
pop bx
pop ax
ret
; Clear screen using ANSI codes. Also clear video memory with attribute in BH
clear_screen:
push ax
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, 'r' ; Set scrolling window
extended_putchar_al
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '0' ; Reset attributes
extended_putchar_al
mov al, 'm' ; Reset attributes
extended_putchar_al
push bx
push cx
push bp
push ax
push es
mov bp, bx ; Convert from CGA to ANSI
mov cl, 12
ror bp, cl
and bp, 7
mov bl, byte [cs:bp+colour_table]
add bl, 10
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bl ; Background colour
call puts_decimal_al
mov al, 'm' ; Set cursor position command
extended_putchar_al
mov ax, 0x40
mov es, ax
mov byte [es:curpos_x-bios_data], 0
mov byte [es:curpos_y-bios_data], 0
pop es
pop ax
pop bp
pop cx
pop bx
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '2' ; Clear screen
extended_putchar_al
mov al, 'J'
extended_putchar_al
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '1' ; Cursor row 1
extended_putchar_al
mov al, ';'
extended_putchar_al
mov al, '1' ; Cursor column 1
extended_putchar_al
mov al, 'H' ; Set cursor
extended_putchar_al
push es
push di
push cx
cld
mov ax, 0xb800
mov es, ax
mov di, 0
mov al, 0
mov ah, bh
mov cx, 80*25
rep stosw
pop cx
pop di
pop es
pop ax
ret
; Pushes a key press, followed by a key release, event to I/O port 0x60 and calls
; INT 9.
keypress_release:
push ax
cmp byte [es:key_now_down-bios_data], 0
je kpr_no_key_down
mov al, [es:key_now_down-bios_data]
add al, 0x80
out 0x60, al
int 9
pop ax
push ax
kpr_no_key_down:
mov [es:key_now_down-bios_data], al
out 0x60, al
int 9
pop ax
ret
; Reaches up into the stack before the end of an interrupt handler, and sets the carry flag
reach_stack_stc:
xchg bp, sp
or word [bp+4], 1
xchg bp, sp
iret
; Reaches up into the stack before the end of an interrupt handler, and clears the carry flag
reach_stack_clc:
xchg bp, sp
and word [bp+4], 0xfffe
xchg bp, sp
iret
; Reaches up into the stack before the end of an interrupt handler, and returns with the current
; setting of the carry flag
reach_stack_carry:
jc reach_stack_stc
jmp reach_stack_clc
; This is the VMEM driver, to support direct video memory access in 80x25 colour CGA mode.
; It scans through CGA video memory at address B800:0, and if there is anything there (i.e.
; applications are doing direct video memory writes), converts the buffer to a sequence of
; ANSI terminal codes to render the screen output.
;
; Note: this destroys all registers. It is the responsibility of the caller to save/restore
; them.
vmem_driver_entry:
cmp byte [cs:in_update], 1
je just_finish ; If we are already in the middle of an update, just pass INT 8 on. Needed for re-entrancy.
inc byte [cs:int8_ctr]
cmp byte [cs:int8_ctr], 5 ; Only do this once every 5 timer ticks
je gmode_test
just_finish:
ret
gmode_test:
mov dx, 0x3b8 ; Do not update if in Hercules graphics mode
in al, dx
test al, 2
jz vram_zero_check
ret
vram_zero_check: ; Check if video memory is blank - if so, do nothing
mov byte [cs:int8_ctr], 0
mov byte [cs:in_update], 1
sti
cld
mov bx, 0xb800
mov es, bx
mov cx, 0x7d0
mov ax, 0x0700
mov di, 0
repz scasw
cmp cx, 0
jne vram_update ; CX != 0 so something has been written to video RAM
mov byte [cs:in_update], 0
ret
vram_update:
mov bx, 0x40
mov ds, bx
mov byte [cs:int_curpos_x], 0xff
mov byte [cs:int_curpos_y], 0xff
cmp byte [cursor_visible-bios_data], 0
je dont_hide_cursor
mov al, 0x1B
extended_putchar_al
mov al, '['
extended_putchar_al
mov al, '?'
extended_putchar_al
mov al, '2'
extended_putchar_al
mov al, '5'
extended_putchar_al
mov al, 'l'
extended_putchar_al
dont_hide_cursor:
mov byte [cs:last_attrib], 0xff
mov bx, 0xb800
mov ds, bx
; Set up the initial cursor coordinates. Since the first thing we do is increment the cursor
; position, this initial position is actually off the screen
mov bp, -1 ; Row number
mov si, 79 ; Column number
mov di, -2 ; Combined offset
disp_loop:
; Advance to next column
add di, 2
inc si
cmp si, 80
jne cont
; Column is 80, so set to 0 and advance a line
mov si, 0
inc bp
; Bottom of the screen reached already? If so, we're done
cmp bp, 25
je restore_cursor
cont:
cmp byte [di], 0 ; Ignore null characters in video memory
je disp_loop
mov ax, bp
mov bx, si
mov dh, al
mov dl, bl
ansi_set_cur_pos:
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, dh ; Row number
inc al
call puts_decimal_al
mov al, ';' ; ANSI
extended_putchar_al
mov al, dl ; Column number
inc al
call puts_decimal_al
mov al, 'H' ; Set cursor position command
extended_putchar_al
skip_set_cur_pos:
mov [cs:int_curpos_y], dh
mov [cs:int_curpos_x], dl
mov bl, [di+1]
cmp bl, [cs:last_attrib]
je skip_attrib
mov [cs:last_attrib], bl
push bx
mov bh, bl
and bl, 7 ; Foreground colour now in bl
push bp
mov bp, bx ; Convert from CGA to ANSI
and bp, 7
mov bl, byte [cs:bp+colour_table]
pop bp
and bh, 8 ; Bright attribute now in bh
cpu 186
shr bh, 3
cpu 8086
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, bh ; Bright attribute
call puts_decimal_al
mov al, ';'
extended_putchar_al
mov al, bl ; Foreground colour
call puts_decimal_al
mov al, ';'
extended_putchar_al
pop bx
cpu 186
shr bl, 4
cpu 8086
and bl, 7 ; Background colour now in bl
push bp
mov bp, bx ; Convert from CGA to ANSI
and bp, 7
mov bl, byte [cs:bp+colour_table]
pop bp
add bl, 10
mov al, bl ; Background colour
call puts_decimal_al
mov al, 'm' ; Set cursor attribute command
extended_putchar_al
skip_attrib:
mov al, [di]
cmp al, 7 ; Convert BEL character to 0xFE
jne check_space1
mov al, 0xFE
check_space1:
cmp al, 4 ; Convert DIAMOND character to 0xFE
jne just_show_it
mov al, 0xFE
just_show_it:
extended_putchar_al
jmp disp_loop
restore_cursor:
mov bx, 0x40
mov ds, bx
mov ah, 2
mov bh, 0
mov dh, [curpos_y-bios_data]
mov dl, [curpos_x-bios_data]
int 10h
mov al, 0x1B ; Escape
extended_putchar_al
mov al, '[' ; ANSI
extended_putchar_al
mov al, '0' ; Reset attributes
extended_putchar_al
mov al, 'm'
extended_putchar_al
cmp byte [cursor_visible-bios_data], 0
je vmem_done
mov al, 0x1B
extended_putchar_al
mov al, '['
extended_putchar_al
mov al, '?'
extended_putchar_al
mov al, '2'
extended_putchar_al
mov al, '5'
extended_putchar_al
mov al, 'h'
extended_putchar_al
vmem_done:
mov byte [cs:in_update], 0
ret
; ****************************************************************************************
; That's it for the code. Now, the data tables follow.
; ****************************************************************************************
; Standard PC-compatible BIOS data area - to copy to 40:0
bios_data:
com1addr dw 0
com2addr dw 0
com3addr dw 0
com4addr dw 0
lpt1addr dw 0
lpt2addr dw 0
lpt3addr dw 0
lpt4addr dw 0
equip dw 0b0000000100100001
db 0
memsize dw 0x280
db 0
db 0
keyflags1 db 0
keyflags2 db 0
db 0
kbbuf_head dw kbbuf-bios_data
kbbuf_tail dw kbbuf-bios_data
kbbuf: times 32 db 'X'
drivecal db 0
diskmotor db 0
motorshutoff db 0x07
disk_laststatus db 0
times 7 db 0
vidmode db 0x03
vid_cols dw 80
page_size dw 0x1000
dw 0
curpos_x db 0
curpos_y db 0
times 7 dw 0
cur_v_end db 7
cur_v_start db 6
disp_page db 0
crtport dw 0x3d4
db 10
db 0
times 5 db 0
clk_dtimer dd 0
clk_rollover db 0
ctrl_break db 0
soft_rst_flg dw 0x1234
db 0
num_hd db 0
db 0
db 0
dd 0
dd 0
kbbuf_start_ptr dw 0x001e
kbbuf_end_ptr dw 0x003e
vid_rows db 25 ; at 40:84
db 0
db 0
vidmode_opt db 0 ; 0x70
db 0 ; 0x89
db 0 ; 0x51
db 0 ; 0x0c
db 0
db 0
db 0
db 0
db 0
db 0
db 0
db 0
db 0
db 0
db 0
kb_mode db 0
kb_led db 0
db 0
db 0
db 0
db 0
db 0
db 0
db 0
key_now_down db 0
next_key_fn db 0
cursor_visible db 1
escape_flag_last db 0
next_key_alt db 0
escape_flag db 0
notranslate_flg db 0
this_keystroke db 0
db 0
ending: times (0xff-($-com1addr)) db 0
; Keyboard scan code tables
a2scan_tbl db 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x0F, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x39, 0x02, 0x28, 0x04, 0x05, 0x06, 0x08, 0x28, 0x0A, 0x0B, 0x09, 0x0D, 0x33, 0x0C, 0x34, 0x35, 0x0B, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x27, 0x27, 0x33, 0x0D, 0x34, 0x35, 0x03, 0x1E, 0x30, 0x2E, 0x20, 0x12, 0x21, 0x22, 0x23, 0x17, 0x24, 0x25, 0x26, 0x32, 0x31, 0x18, 0x19, 0x10, 0x13, 0x1F, 0x14, 0x16, 0x2F, 0x11, 0x2D, 0x15, 0x2C, 0x1A, 0x2B, 0x1B, 0x07, 0x0C, 0x29, 0x1E, 0x30, 0x2E, 0x20, 0x12, 0x21, 0x22, 0x23, 0x17, 0x24, 0x25, 0x26, 0x32, 0x31, 0x18, 0x19, 0x10, 0x13, 0x1F, 0x14, 0x16, 0x2F, 0x11, 0x2D, 0x15, 0x2C, 0x1A, 0x2B, 0x1B, 0x29, 0x0E
a2shift_tbl db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0
; Interrupt vector table - to copy to 0:0
int_table dw int0
dw 0xf000
dw int1
dw 0xf000
dw int2
dw 0xf000
dw int3
dw 0xf000
dw int4
dw 0xf000
dw int5
dw 0xf000
dw int6
dw 0xf000
dw int7
dw 0xf000
dw int8
dw 0xf000
dw int9
dw 0xf000
dw inta
dw 0xf000
dw intb
dw 0xf000
dw intc
dw 0xf000
dw intd
dw 0xf000
dw inte
dw 0xf000
dw intf
dw 0xf000
dw int10
dw 0xf000
dw int11
dw 0xf000
dw int12
dw 0xf000
dw int13
dw 0xf000
dw int14
dw 0xf000
dw int15
dw 0xf000
dw int16
dw 0xf000
dw int17
dw 0xf000
dw int18
dw 0xf000
dw int19
dw 0xf000
dw int1a
dw 0xf000
dw int1b
dw 0xf000
dw int1c
dw 0xf000
dw int1d
dw 0xf000
dw int1e
itbl_size dw $-int_table
; Colour table for converting CGA video memory colours to ANSI colours
colour_table db 30, 34, 32, 36, 31, 35, 33, 37
; Internal variables for VMEM driver
int8_ctr db 0
in_update db 0
last_attrib db 0
int_curpos_x db 0
int_curpos_y db 0
; Int 8 call counter - used for timer slowdown
int8_call_cnt db 0
; Now follow the tables for instruction decode helping
; R/M mode tables
rm_mode0_reg1 db 3, 3, 5, 5, 6, 7, 12, 3
rm_mode0_reg2 db 6, 7, 6, 7, 12, 12, 12, 12
rm_mode0_disp db 0, 0, 0, 0, 0, 0, 1, 0
rm_mode0_dfseg db 11, 11, 10, 10, 11, 11, 11, 11
rm_mode12_reg1 db 3, 3, 5, 5, 6, 7, 5, 3
rm_mode12_reg2 db 6, 7, 6, 7, 12, 12, 12, 12
rm_mode12_disp db 1, 1, 1, 1, 1, 1, 1, 1
rm_mode12_dfseg db 11, 11, 10, 10, 11, 11, 10, 11
; Opcode decode tables
xlat_ids db 0, 1, 2, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 47, 17, 17, 18, 19, 20, 19, 21, 22, 21, 22, 23, 53, 24, 25, 26, 25, 25, 26, 25, 26, 27, 28, 27, 28, 27, 29, 27, 29, 48, 30, 31, 32, 53, 33, 34, 35, 36, 37, 37, 38, 39, 40, 19, 41, 42, 43, 44, 53, 53, 45, 46, 46, 46, 46, 46, 46, 52, 52, 12
i_opcodes db 17, 17, 17, 17, 8, 8, 49, 50, 18, 18, 18, 18, 9, 9, 51, 64, 19, 19, 19, 19, 10, 10, 52, 53, 20, 20, 20, 20, 11, 11, 54, 55, 21, 21, 21, 21, 12, 12, 56, 57, 22, 22, 22, 22, 13, 13, 58, 59, 23, 23, 23, 23, 14, 14, 60, 61, 24, 24, 24, 24, 15, 15, 62, 63, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 31, 31, 48, 48, 25, 25, 25, 25, 26, 26, 26, 26, 32, 32, 32, 32, 32, 32, 32, 32, 65, 66, 67, 68, 69, 70, 71, 72, 27, 27, 27, 27, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 94, 94, 39, 39, 73, 74, 40, 40, 0, 0, 41, 41, 75, 76, 77, 78, 28, 28, 28, 28, 79, 80, 81, 82, 47, 47, 47, 47, 47, 47, 47, 47, 29, 29, 29, 29, 42, 42, 43, 43, 30, 30, 30, 30, 44, 44, 45, 45, 83, 0, 46, 46, 84, 85, 7, 7, 86, 87, 88, 89, 90, 91, 6, 6
ex_data db 21, 0, 0, 1, 0, 0, 0, 21, 0, 1, 2, 3, 4, 5, 6, 7, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 0, 0, 43, 0, 0, 0, 0, 0, 0, 1, 2, 1, 0, 0, 1, 0, 0, 1, 1, 0, 3, 0, 8, 8, 9, 10, 10, 11, 11, 8, 27, 9, 39, 10, 2, 11, 0, 36, 0, 0, 0, 0, 0, 0, 255, 0, 16, 22, 0, 255, 48, 2, 255, 255, 40, 11, 1, 2, 40, 80, 81, 92, 93, 94, 95, 0, 21, 1
std_szp db 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
std_ao db 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0
std_o0c0 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
base_size db 2, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 0, 2, 0, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 0, 1, 1, 1, 1, 1, 2, 2, 0, 0, 0, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3
i_w_adder db 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
i_mod_adder db 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
flags_mult db 0, 2, 4, 6, 7, 8, 9, 10, 11
jxx_dec_a db 48, 40, 43, 40, 44, 41, 49, 49
jxx_dec_b db 49, 49, 49, 43, 49, 49, 49, 43
jxx_dec_c db 49, 49, 49, 49, 49, 49, 44, 44
jxx_dec_d db 49, 49, 49, 49, 49, 49, 48, 48
daa_rslt_ca00 db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, 133, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101
daa_cf_ca00_ca01_das_cf_ca00 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
daa_af_ca00_ca10_das_af_ca00_ca10 db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1
daa_rslt_ca01 db 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101
daa_af_ca01_cf_ca10_cf_ca11_af_ca11_das_af_ca01_cf_ca10_cf_ca11_af_ca11 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
daa_rslt_ca10 db 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, 133, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 160, 161, 162, 163, 164, 165, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 176, 177, 178, 179, 180, 181, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 192, 193, 194, 195, 196, 197, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 208, 209, 210, 211, 212, 213, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 224, 225, 226, 227, 228, 229, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 240, 241, 242, 243, 244, 245, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101
daa_rslt_ca11 db 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101
das_rslt_ca00 db 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 116, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 116, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 148, 149, 150, 151, 152, 153
das_rslt_ca01 db 154, 155, 156, 157, 158, 159, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153
das_cf_ca01 db 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
das_rslt_ca10 db 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 164, 165, 166, 167, 168, 169, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 180, 181, 182, 183, 184, 185, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 196, 197, 198, 199, 200, 201, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 212, 213, 214, 215, 216, 217, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 228, 229, 230, 231, 232, 233, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 244, 245, 246, 247, 248, 249, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 116, 117, 118, 119, 120, 121, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 148, 149, 150, 151, 152, 153
das_rslt_ca11 db 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153
parity db 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1
; This is the format of the 36-byte tm structure, returned by the emulator's RTC query call
timetable:
tm_sec equ $
tm_min equ $+4
tm_hour equ $+8
tm_mday equ $+12
tm_mon equ $+16
tm_year equ $+20
tm_wday equ $+24
tm_yday equ $+28
tm_dst equ $+32 |
programs/oeis/137/A137797.asm | karttu/loda | 1 | 87822 | <reponame>karttu/loda
; A137797: a(n) = 2*( (n+1) mod 5 ) - 2*( (n+1) mod 2 ).
; 0,4,4,8,-2,2,2,6,6,0,0,4,4,8,-2,2,2,6,6,0,0,4,4,8,-2,2,2,6,6,0,0,4,4,8,-2,2,2,6,6,0,0,4,4,8,-2,2,2,6,6,0,0,4,4,8,-2,2,2,6,6,0,0,4,4,8,-2,2,2,6,6,0,0,4,4,8,-2,2,2,6,6
mov $1,$0
sub $0,$0
sub $0,5
add $1,3
mov $2,$1
add $1,8
mod $1,$0
mod $2,2
sub $1,$2
mul $1,2
|
45/qb/ir/txtmgr.asm | minblock/msdos | 0 | 4665 | <gh_stars>0
;==========================================================================
;
;Module: txtmgr.asm - Text Management Functions
;System: Quick BASIC Interpreter
;
;=========================================================================
.xlist
include version.inc
TXTMGR_ASM = ON
includeOnce architec
includeOnce context
includeOnce heap
includeOnce lister
includeOnce names
includeOnce opcodes
includeOnce parser
includeOnce pcode
includeOnce qbimsgs
includeOnce rtps
includeOnce scanner
includeOnce txtmgr
includeOnce txtint
includeOnce ui
includeOnce util
includeOnce variable
.list
assumes ds,DATA
assumes ss,DATA
assumes es,NOTHING
;-----------------------------------------------------------------------
; Scoping of legal statements:
;
; Some statements are invalid in protected-direct mode (i.e. only
; valid in a program or unprotected-direct-mode). These are
; caught by the parser's NtStatement() function which checks
; a list of statements which ARE legal in protected direct mode
; (a much smaller list than those which are illegal).
;
; Some statements are invalid in direct mode (i.e. only valid within
; a program). Those which can be identified by Reserved Word are
; caught by the parser's NtStatement() function which checks the
; 'no_direct' flag as set in file 'bnf.prs'.
; Those which can be identified by opcode are caught by TxtDirect()
; when it finds entries for them in the table tOpDirect[].
;
; Some statements are only valid at module level. This includes
; DECLARE, DEF FNxxx, which are caught by the parser, and
; END DEF, DATA which are caught by TxtChange.
;
; Some statements are only valid within a SUB/FUNCTION. This includes
; SUB/FUNCTION which is caught by the parser, and
; END SUB/FUNCTION which is caught by TxtChange.
;
; Some opcodes are only valid after the defintion line of a SUB/FUNCTION.
; These are caught by TxtChange. Those which can precede a SUB/FUNCTION
; include opBol, opBolSp, opBolInclude, opStRem, opQuoteRem,
; opStDefType, opStInclude
; (and op_Static, op_Dynamic in QB4 and the like [4]).
;
;-----------------------------------------------------------------------
; Typical text table:
; ------------------
; opBol:...
; txdCur.otxLabLink---------->opBolLab(x)
; opBol:...
; :
; opBol:...
; opEndProg:...
; opEot
; txdCur.bdlText.cbLogical--->
;
;
; Text table with active Watch expressions:
; ----------------------------------------
; opBol:...
; :
; opBol:...
; opEndProg
; <exp>:opWatchExp
; <exp>:opWatchStop
; <exp>:opWatchExp
; opEot
; txdCur.bdlText.cbLogical--->
;
;----------------------------------------------------------------------------
sBegin DATA
extrn fMergeInSub:byte ;non-zero if MERGING into SUB/FUNCTION
;only valid when FLoadActive is TRUE
extrn b$SdBuf1:word ; SD to b$Buf1 (from runtime)
;see comments in txtint.inc for bigEditState flag values, and TxtStartBigEdit
;for further details.
;
DbPub bigEditState
bigEditState DB BIG_EDIT_FALSE
cForDel DB 0 ;1+num of FOR stmts deleted by TxtDelete
cForStepDel DB 0 ;1+num of FOR ... STEP stmts deleted
;bdlTxtScrap holds deleted pcode in case the user wants to back out of the
;edit (for Edit & Continue).
;
PUBLIC bdlTxtScrap
bdlTxtScrap BDL <0,NOT_OWNER,0,0> ;initializes status field to NOT_OWNER
;fFillScrap is FALSE if TxtDelete should not copy deleted text to bdTxtScrap
; (see comments for Big Edit)
;
fFillScrap DB 0
;otxScrapStart & otxScrapEnd represent the offsets into the current text table
;where pcode was deleted and copied into bdTxtScrap
;
otxScrap DW 0
;otxBigIns and cbBigIns identify all pcode inserted since the BigEdit
;started. If the user wants to back out of the BigEdit, they represent
;the text which needs to be deleted.
;
otxBigIns DW 0
cbBigIns DW 0
;fBindStatic is input parm to TxtBindPrs
;
fBindStatic DB 0
;bindErrCode is result parm of TxtBindPrs
;
bindErrCode DW 0
;text mgr flags - FTM_xxx
PUBLIC flagsTm
flagsTm DB 0
flagsTm2 DB 0 ;must immediately follow flagsTm
FTM2_PrsRefDeleted EQU 01h
externB fLoadInclude
sEnd DATA
sBegin CODE
;Table of all the opcodes that contain oPrs operands
;The order of entries in this table is VERY important
;
tOpPrsDef LABEL WORD
opTabStart PRSDEF
opTabEntry PRSDEF,opStDeclare
opTabEntry PRSDEF,opStSub
opTabEntry PRSDEF,opStFunction
opTabEntry PRSDEF,opStDefFn
PRSDEF_DefineMax EQU PRSDEF_opStDefFn
opTabEntry PRSDEF,opStCall
opTabEntry PRSDEF,opStCallS
opTabEntry PRSDEF,opStCallLess
opTabEntry PRSDEF,opEot
;These opcodes are of special interest BEFORE they are deleted:
; Reasons why we have to descan to RUDE when certain opcodes are deleted:
; opStSub, opStFunction, opStDefFn :
; MakeVariable would be called again to evaluate the parm list, and
; would give duplicate definition errors for each parm.
;
; If line containing opStDimTo, opStRedimTo, opShared, opStShared,
; opStStatic, opAsType, opAsTypeExp, or opAsTypeFixed
; (or opCmdAsType in EB) is edited, the variable
; manager would give a duplicate definition error when new edited line
; is inserted.
;
; If a break point is being toggled on the current line, then edit and
; continue is allowable, as only the opBreakPoint will be inserted
; on the line.
;
tOpPreDel LABEL WORD
opTabStart PREDEL
; opBol and opBolLab are in this list as TxtFind terminators
; They will keep us from Searching to opEot if no other interesting
; opcodes are found after the otx range deleted. This significantly
; speeds up edits for generic programs with large text tables.
opTabEntry PREDEL,opBol
opTabEntry PREDEL,opBolLab
PREDEL_BolMax EQU PREDEL_opBolLab
opTabEntry PREDEL,op_Include
PREDEL_IncludeMax EQU PREDEL_op_Include
;The following opcodes cause rude-edit when deleted
opTabEntry PREDEL,opStDefType
PREDEL_rudeMin EQU PREDEL_opStDefType
; opStDeclare is included here to ensure that variable tables get
; recreated in case a DECLARE for a quicklib function is deleted.
; e.g. DECLARE FUNCTION FOO () : x = foo where foo is in a qlb.
; deleting the DECLARE will cause a variable named foo to be defined.
opTabEntry PREDEL,opStDeclare
opTabEntry PREDEL,opStSub
opTabEntry PREDEL,opStFunction
opTabEntry PREDEL,opStDefFn
opTabEntry PREDEL,opEndSingleDef
opTabEntry PREDEL,opStEndDef
opTabEntry PREDEL,opStConst
opTabEntry PREDEL,opStCommon
opTabEntry PREDEL,opAVtRf
opTabEntry PREDEL,opStReDimTo
opTabEntry PREDEL,opShared
opTabEntry PREDEL,opStShared
opTabEntry PREDEL,op_Static
opTabEntry PREDEL,op_Dynamic
opTabEntry PREDEL,opStStatic
opTabEntry PREDEL,opStType
opTabEntry PREDEL,opStEndType
opTabEntry PREDEL,opAsType
opTabEntry PREDEL,opAsTypeExp
opTabEntry PREDEL,opAsTypeFixed
opTabEntry PREDEL,opNoList1
;Scanner inserts opNoList1 in a statement whenever the stack
; contains a return address into that statement. Deleting
; an opNoList1 means we're deleting a return address - Cant Continue.
; opNoList1 could just be AskCantCont instead of AskRudeEdit,
; but its not worth the extra code to let users print variables
; after deleting a return address, and other than that,
; AskCantCont is identical to AskRudeEdit
opTabEntry PREDEL,opStOptionBase0
opTabEntry PREDEL,opStOptionBase1
opTabEntry PREDEL,opEot
;These opcodes are of special interest AFTER they have been deleted:
;
tOpDel LABEL WORD
opTabStart DEL
opTabEntry DEL,opLab
opTabEntry DEL,opLabSp
opTabEntry DEL,opBolLab
DEL_bolMin EQU DEL_opBolLab
opTabEntry DEL,opBolLabSp
DEL_labMax EQU DEL_opBolLabSp
opTabEntry DEL,opBol
opTabEntry DEL,opBolSp
opTabEntry DEL,opBolInclude
opTabEntry DEL,opBolIncludeSp
DEL_bolInclMin EQU DEL_opBolInclude
DEL_bolMax EQU DEL_opBolIncludeSp
opTabEntry DEL,opStFor
opTabEntry DEL,opStForStep
DEL_forMax EQU DEL_opStForStep
opTabEntry DEL,opWatchExp
opTabEntry DEL,opWatchStop
DEL_watchMax EQU DEL_opWatchStop
opTabEntry DEL,opAsType
opTabEntry DEL,opStEndProc
opTabEntry DEL,opStCommon
opTabEntry DEL,opAVtRf
opTabEntry DEL,opBreakPoint
DEL_NonSubRefMax EQU DEL_opBreakPoint
;Remaining entries in table are all the opcodes that could contain references
; to SUBs. We need to look for these in order to correctly reset the SUB
; name space bit.
opTabEntry DEL,opStDeclare
opTabEntry DEL,opStSub
opTabEntry DEL,opStCall
opTabEntry DEL,opStCallS
opTabEntry DEL,opStCallLess
opTabEntry DEL,opEot
;These opcodes are of special interest BEFORE they are inserted
; NOTE: if any entries in this table change, update PiDispatch
;
tOpPreIns LABEL WORD
opTabStart PI
opTabEntry PI,op_Static
opTabEntry PI,op_Dynamic
opTabEntry PI,op_Include
opTabEntry PI,opStSub
opTabEntry PI,opStFunction
opTabEntry PI,opStEndProc
opTabEntry PI,opEndSingleDef
opTabEntry PI,opStEndDef
opTabEntry PI,opStData
opTabEntry PI,opStShared
opTabEntry PI,opStDefType
opTabEntry PI,opStCommon
opTabEntry PI,opStEndType
opTabEntry PI,opStFor
opTabEntry PI,opStForStep
opTabEntry PI,opStConst
opTabEntry PI,opShared
opTabEntry PI,opStOptionBase0
opTabEntry PI,opStOptionBase1
opTabEntry PI,opElemRef
opTabEntry PI,opEot
;These opcodes are of special interest AFTER they are inserted
; NOTE: if any entries in this table change, update AiDispatch
;
tOpAftins LABEL WORD
opTabStart AFTINS
opTabEntry AFTINS,opBolInclude
opTabEntry AFTINS,opBolIncludeSp
AFTINS_bolInclMax EQU AFTINS_opBolIncludeSp
opTabEntry AFTINS,opBol
opTabEntry AFTINS,opBolSp
opTabEntry AFTINS,opBolLab
AFTINS_dispMin EQU AFTINS_opBolLab
opTabEntry AFTINS,opBolLabSp
AFTINS_bolMax EQU AFTINS_opBolLabSp
opTabEntry AFTINS,opLab
opTabEntry AFTINS,opLabSp
opTabEntry AFTINS,opStFunction
opTabEntry AFTINS,opStSub
opTabEntry AFTINS,opStDeclare
opTabEntry AFTINS,opStCall
opTabEntry AFTINS,opStCallS
opTabEntry AFTINS,opStCallLess
opTabEntry AFTINS,opStEndProc
opTabEntry AFTINS,opEndSingleDef
opTabEntry AFTINS,opStEndDef
opTabEntry AFTINS,opStData
opTabEntry AFTINS,opStRestore1
opTabEntry AFTINS,opEot
;List of opcodes which are legal in SUB/FUNCTION window before
;the procedure's definition
;
tOpPreProc LABEL WORD
opTabStart PREPROC
opTabEntry PREPROC,opBol
opTabEntry PREPROC,opBolSp
opTabEntry PREPROC,opBolInclude
opTabEntry PREPROC,opBolIncludeSp
PREPROC_bolMax EQU PREPROC_opBolIncludeSp
opTabEntry PREPROC,opStDefType
opTabEntry PREPROC,opStRem
opTabEntry PREPROC,opQuoteRem
opTabEntry PREPROC,op_Static
opTabEntry PREPROC,op_Dynamic
opTabEntry PREPROC,opNoType ;for SUB x.y
opTabEntry PREPROC,opReParse
opTabEntry PREPROC,opStEndProc ;only if SUB opStSub or
; opStFunction precedes it.
opTabEntry PREPROC,opStSub
PREPROC_SubOrFuncMin EQU PREPROC_opStSub
opTabEntry PREPROC,opStFunction
opTabEntry PREPROC,opEot
tOpEndProc LABEL WORD
opTabStart ENDPROC
opTabEntry ENDPROC,opStEndProc
opTabEntry ENDPROC,opEot
sEnd CODE
;--------------------------------------------------------------------
; Functions which keep track of where the current "defining" reference
; to a Prs is. If there are any references to a prs in any loaded pcode,
; we keep track of the "most powerful" or "defining" reference in
; prs.oRsDef, prs.otxDef.
;
; A SUB/FUNCTION/DEF FN statement is the "most powerful" possible
; definition for a prs entry.
; If no SUB/FUNCTION/DEF FN statements refer to a prs, the next most
; powerful definition is a DECLARE statement.
; If no DECLARE statements refer to a prs, the only remaining possible
; definition is a CALL statement.
;
; When all pcode references to a prs have been deleted,
; and the prs has no text table, PrsFree is called to remove the entry.
;
; The management of "defining" references happens in two stages during
; an edit. When a "defining" reference is deleted, prs.otxDef is set
; to undefined by UndefPrs. At the end of the edit operation, RedefOrDelPrs
; is called to search for a new "defining" reference, or free the prs.
;
; This is done in two stages as a speed optimization for text edits.
; This will help speed up the cases where you are discarding text
; tables, or terminating ASCII load because of an out of memory error.
; This way we accumulate and process all prs defining reference changes
; at one time.
;
; Call Trees
; ==========
;
; Deleting a defining reference
; -----------------------------
; MrsDiscard PrsDiscard
; \ /
; \ /
; TxtDiscard ParseLine
; | |
; TxtDelete ParseUndo MakeProc (when renaming a sub/function)
; | | |
; ForEachPrsInPlaceCP(UpdatePrs) | |
; | | |
; +------+----+
; |
; UndefPrs
;
; End of edit - find new defining reference
; -----------------------------------------
; TxtChange LoadFile
; | |
; | |
; | |
; | MrsDiscard PrsDiscard
; | | \ / |
; | | PrsDiscard1 |
; | | |
; +-------------+------------------+
; |
; ChkAllUndefPrs
; |
; --------
; | |
; |
; ForEachCP(TryToDefPrs)
;
;--------------------------------------------------------------------
sBegin DATA
;** the static structure uPrs is defined in SetPrsDefn header
DPRS_ST STRUC
DPRS_oRs DW 1 DUP (?)
DPRS_oMrs DW 1 DUP (?)
DPRS_otx DW 1 DUP (?)
DPRS_flags DB 1 DUP (?)
DPRS_ST ENDS
dprs DB size DPRS_ST DUP (?)
;** the static structure uPrs is defined in UpdatePrs's header
UPRS_ST STRUC
UPRS_oRsEdit DW 1 DUP(?)
UPRS_otxEdit DW 1 DUP(?)
UPRS_cbDel DW 1 DUP(?)
UPRS_cbIns DW 1 DUP(?)
UPRS_oPrsDel DW 1 DUP (?)
UPRS_fPrsDelFound DW 1 DUP (?)
UPRS_fNoRefSameMod DW 1 DUP (?)
UPRS_oMrsRefDel DW 1 DUP (?)
UPRS_ST ENDS
uprs DB size UPRS_ST DUP (?)
sEnd DATA
sBegin CP
assumes cs,CP
;**************************************************************
; void SetPrsDefn
; Purpose:
; Called when a prs reference is inserted in pcode. If this is the
; "most powerful" definition we've seen so far for the current prs,
; the the prs entry is changed to remember this text offset
; as the "defining" reference.
;
; Entry:
; dprs.DPRS_oRs,oMrs,otx identify where in the pcode
; the reference lives.
; dprs.DPRS_flags = FP_DEFINED if this is for a SUB/FUNCTION/DEF FN stmt.
; = FP_DECLARED if this is for a DECLARE stmt.
; = 0 if this is for a CALL stmt.
; grs.oPrsCur identifies the prs being referenced.
;
;**************************************************************
SetPrsDefn PROC NEAR
test [dprs.DPRS_flags],FP_DEFINED
jne SpNewDef ;brif reference is SUB,FUNC,DEF FN stmt
test [prsCur.PRS_flags],FP_DEFINED
jne SpNoNewDef ;brif prs is already defined by SUB,...
test [dprs.DPRS_flags],FP_DECLARED
jne SpNewDef ;brif reference is DECLARE
test [prsCur.PRS_flags],FP_DECLARED
jne SpNoNewDef ;brif prs is already declared
SpNewDef:
;Got a SUB, FUNCTION or DEF FN OR
; a DECLARE for prs with no definition OR
; a CALL to an as yet undeclared, undefined SUB.
; This is the "most powerful" reference seen so far,
; make this text reference the new owner of the prs entry.
; We need to set prsCur.oMrs even though in most cases, it
; is redundant given prsCur.oRsDef. The case where it is
; valuable info is for DECLAREd prs's with no text tables.
; If it were not set here, there would be cases when ForEachPrsInMrs
; would not pick up this prs
mov ax,[dprs.DPRS_oRs]
mov [prsCur.PRS_oRsDef],ax
mov ax,[dprs.DPRS_otx]
mov [prsCur.PRS_otxDef],ax
mov al,[dprs.DPRS_flags]
or [prsCur.PRS_flags],al
test [txdCur.TXD_flags],FTX_mrs
je SpNoNewDef ;brif prs has text table
;If we didn't, commenting out
;a SUB stmt would move the prs to
;another module.
mov ax,[dprs.DPRS_oMrs]
mov [prsCur.PRS_oMrs],ax
cmp [prsCur.PRS_procType],PT_DEFFN
jne SpNoNewDef ;brif not a DEF FN
mov [prsCur.PRS_oRsDef],ax ;for DEF FNs, the oRsDef is the
; module's text table.
SpNoNewDef:
ret
SetPrsDefn ENDP
;**************************************************************
; boolean TryToDefPrs()
; Purpose:
; Called to see if current text table contains any references
; to prs uprs.UPRS_oPrsDel.
;
; Entry:
; uprs.UPRS_oPrsDel is the prs whose reference has been deleted
;uprs.UPRS_oMrsRefDel is the mrs from which the reference was deleted
;uprs.UPRS_fNoRefSameMod: if TRUE then TryToDefPrs must search for
; a reference to oPrsDel in text tables of module oMrsDel.
;dprs.DPRS_flags: if set to 0 then TryToDefPrs must search for any
; ref's to oPrsDel.
; Exit:
;uprs.UPRD_fNoRefSameMod is set to FALSE if it is TRUE on entry and
; the text table being searched is in module uprs.UPRS_oMrsRefDel
; and a ref to procedure uprs.UPRS_oPrsDel is found.
; uprs.UPRS_fPrsDelFound = TRUE if any other references were found
; if a "defining" reference is found (i.e. anything but a CALL),
; dprs.DPRS_oRs,otx are set to identify the text table and text
; offset for the new "defining" reference.
;dprs.DPRS_flags is set to FP_DECLARED if a DECLARE for the deleted
; Prs is found.
;FALSE is returned when no more searching is required, i.e. when
; dprs.DPRS_flags = FP_DECLARED and uprs.UPRS_fNoRefSameMod
; is FALSE.
;
;
;**************************************************************
TryToDefPrs PROC NEAR
push si ;save caller's si,di
push di
cmp [txdCur.TXD_ScanState],SS_SUBRUDE
je JE_TryDone ;
mov di,[uprs.UPRS_fNoRefSameMod]
or di,di
jz TrySearch ;brif already found another ref
; to the proc in the module with
; the deleted reference
mov di,[uprs.UPRS_oMrsRefDel] ;di = oMrs of module from which
; a reference was deleted
sub di,[grs.GRS_oMrsCur] ;di = 0 iff the text table is in
; the same module as the text tbl
; from which a ref was deleted
jz TrySearch ;brif in same module as deleted ref
test [dprs.DPRS_flags],FP_DECLARED
jnz TryDone ;exit if we don't need to search
; this text table for a declare
TrySearch:
call TxtDescanCP ;descan current txt tbl to SS_PARSE
sub ax,ax
push ax
PUSHI ax,<CODEOFFSET tOpPrsDef>
call TxtFindOp ;ax = offset to 1st opcode in cur text
; table with prs operand
;dl = [txtFindIndex]
TryLoop:
mov si,ax ;si = otxCur
cmp dl,PRSDEF_opEot
JE_TryDone:
je TryDone ;brif done with text table
add ax,4 ;advance to oPrs operand
cmp dl,PRSDEF_opStDefFn
jne TryNotDefFn ;brif ref is not a DEF FN
inc ax ;skip DEF FN's link field
inc ax
TryNotDefFn:
call GetWOtx ;ax = oPrs of reference (ax)
cmp ax,[uprs.UPRS_oPrsDel]
jne TryNext ;brif not ref to prs of interest
mov [uprs.UPRS_fNoRefSameMod],di ;set flag indicating whether
; or not another ref was found
; in module of deleted ref
test [dprs.DPRS_flags],FP_DECLARED
jnz TryExit1 ;brif not searching for defining ref
mov [uprs.UPRS_fPrsDelFound],sp
;tell caller we found a reference
;remember where new reference is in static dprs struct
mov ax,[grs.GRS_oRsCur]
mov [dprs.DPRS_oRs],ax
mov ax,[grs.GRS_oMrsCur]
mov [dprs.DPRS_oMrs],ax
mov [dprs.DPRS_otx],si ;save otxCur
cmp [txtFindIndex],PRSDEF_DefineMax
ja TryNext ;brif reference was a CALL
;Since this is only called when the current "defining"
;reference has been deleted, we know we're never going
;to find a SUB or FUNCTION pcode. A DECLARE is the
;strongest definition we can hope to find, so there's
;no need to search any further
test [mrsCur.MRS_flags2],FM2_INCLUDE ;is this an INCLUDE mrs?
jne TryNext ;force it to a "weak" owner
mov [dprs.DPRS_flags],FP_DECLARED
TryExit1:
xchg ax,di ;ax = 0 iff no longer need to search
jmp SHORT TryExit
TryNext:
;if we've just seen a CALL ref, keep searching for DECLARE
push si
PUSHI ax,<CODEOFFSET tOpPrsDef>
call TxtFindNextOp
jmp SHORT TryLoop
TryDone:
mov ax,sp ;return TRUE (non zero)
TryExit:
pop di ;restore caller's di
pop si ;restore caller's si
ret
TryToDefPrs ENDP
;**************************************************************
; FreeAllUndefinedPrs, ChkAllUndefPrs, ChkAllUndefPrsSaveRs
; Purpose:
; FreeAllUndefinedPrs has two purposes:
; (1) It is called to check all prs's to see
; if the the "defining" text reference to a prs has
; been marked as deleted. If so, it calls RedefOrDelPrs
; to search for a new "definition" if none are found, then
; the Prs is released via PrsFree.
; (2) It is called to check all prs's to see
; if the last reference to the prs has been deleted from the
; module being editted.
; ChkAllUndefPrs differs from FreeAllUndefPrs in that it
; knows that searching only needs to be performed when a
; reference is deleted.
;
; FreeAllUndefinedPrs is called to Free prs entries created
; by undefined direct mode references.
;
; The FTM_PrsDefDeleted bit of flagsTm is used to
; to determine if we need to search for a new "defining"
; reference for the prs.
;
; Entry:
; flagsTm.FTM_PrsDefDeleted set if we need to search
; for a new "defining" reference.
;
; Exit:
; Deleted prs entries with no new definitions are freed
; Deleted prs entries with new definitions have otxDef
; and oRsDef set to the new definition.
;**************************************************************
PUBLIC ChkAllUndefPrsSaveRs
ChkAllUndefPrsSaveRs PROC NEAR
push [grs.GRS_oRsCur] ;preserve current oRs
call ChkAllUndefPrs ;check all undefed prs entries
call RsActivateCP ;Reactivate current oRs
ret
ChkAllUndefPrsSaveRs ENDP
PUBLIC ChkAllUndefPrs
ChkAllUndefPrs PROC NEAR
test WORD PTR [flagsTm],FTM_PrsDefDeleted OR FTM2_PrsRefDeleted*100h
;have any definitions been deleted?
jne FreeAllUndefinedPrs ;brif so - Redef or Del all UNDEFINED
; prs entries
ret
ChkAllUndefPrs ENDP
PUBLIC FreeAllUndefinedPrs
FreeAllUndefinedPrs PROC NEAR
push si
push di
mov ax,[grs.GRS_oMrsCur]
mov [uprs.UPRS_oMrsRefDel],ax ;store mrs of deleted text
mov si,UNDEFINED
FreeAllUndef_Cont:
cCall PrsDeActivate ; ensure all proc.s are in Rs table
FreeAllUndef_Cont1:
mov di,si
FreeAllUndef_Cont2:
mov ax,di
call GetNextPrs ; PTRRS:ax points to first prs
; ax == UNDEFINED ==> no prs's
inc ax
jnz FAU_DontExit
jmp FreeAllUndef_Exit
FAU_DontExit:
dec ax
mov si,ax ; cache, so we don't end up starting
; from the beginning of the prs
; chain each time we free a prs
mov bx,ax
RS_BASE add,bx ; bx = oPrs
; assign cx = 0 if no reference to the Prs has been deleted otw non-zero
xor cx,cx
test PTRRS[bx.PRS_flags2],FP_RefDeleted ;[38]
jz NoRefDeleted ;brif no reference has been deleted
and PTRRS[bx.PRS_flags2],NOT FP_RefDeleted ;[38]clear flag
not cx ;set cx = non-0 since ref was deleted
NoRefDeleted:
mov [uprs.UPRS_fNoRefSameMod],cx ;initialize fNoRefSameMod
; to TRUE if we must search for
; a ref to the Prs in the module
; assign ax = 0 if otxDef is defined otw non-zero
mov al,1 ;assume otxDef is undefined
cmp PTRRS[bx.PRS_otxDef],UNDEFINED
je otxDefUnDefined ;brif otxDef is UnDefined
jcxz FreeAllUndef_Cont1 ;brif otxDef is Defined and
; no ref to the prs has been
; deleted -- nothing to do
xor ax,ax ;set ax = 0 since otxDef is defined
otxDefUnDefined:
push cx ;preserve condition flag
push ax ;preserve condition flag
push si ; pass to PrsActivateCP
call PrsActivateCP ;activate prs which may be freed
pop cx ;cx = 0 iff otxDef is defined
pop ax ;ax = 0 iff no ref to proc was del'd
jcxz DontSearchForDeclare ;brif otxDef of proc is defined
xor dx,dx ;assume that we will need to search
; for a new defining ref
test [flagsTm],FTM_PrsDefDeleted
jnz SearchForRef ;brif a defining ref has been del'd
or ax,ax ;ax = 0 if no ref to proc was del'd
jz ChkDeletePrs ;This branch is taken if no ref to
; this proc has been deleted and
; no defining ref has been deleted
DontSearchForDeclare:
mov dl,FP_DECLARED
SearchForRef:
mov [dprs.DPRS_flags],dl ;set dprs.flags to FP_DECLARED
; if we don't need to search for
; a new defining ref otw set to 0
mov [uprs.UPRS_fPrsDelFound],dx ;set fPrsDelFound to 0 if we
; are searching for a defining ref
mov dx,[grs.GRS_oPrsCur] ;set up global specifying which proc
mov [uprs.UPRS_oPrsDel],dx ; we are searching for references to
push cx ;preserve condition flag
;Note that we search even text mrs's because the reference
;to the prs may be within an INCLUDE mrs. It is tempting to
;make INCLUDE mrs's be FM2_NoPcode mrs's, but doing so would
;prevent the ability to select the 'View/Include File' menu
;item when an INCLUDE mrs is active, because the $INCLUDE
;lines would not have been parsed.
;This leads to the situation that an INCLUDE mrs can be
;the owner of a prs. This keeps the prs from being deleted until
;all references to the prs are gone. However, we must also insure
;that the include mrs does not become an owner of a prs when other
;"stronger" definitions exist. Therefore, all prs references from
;an include mrs will be treated as the "weakest" possible owners.
mov bx,CPOFFSET TryToDefPrs
mov al,FE_PcodeMrs+FE_TextMrs+FE_CallMrs+FE_PcodePrs+FE_SaveRs
call ForEachCP
cmp [uprs.UPRS_fNoRefSameMod],FALSE
je GotRefInSameModule ;brif another ref in module found
;We have not found another reference to the Prs in the module from which
;the ref was deleted. Clear the NMSP_sub name table bit of the sub's oNam
;in that module so that it can be used now as a variable name.
push [grs.GRS_oRsCur] ;save current oRs for reactivation
push [uprs.UPRS_oMrsRefDel]
call MrsActivateCP ;activate the module
cCall FieldsOfPrs,<si> ;ax = oNam of proc
xchg bx,ax ;pass bx = oNam of proc
mov al,NMSP_SUB ;pass al = flag to clear
call ResetONamMask ;clear sub bit of oNam of Mrs
call RsActivateCP ;reactivate the Rs we were searching
GotRefInSameModule:
pop cx ;cx = 0 iff otxDef is defined
jcxz J1_FreeAllUndef_Cont ;brif otxDef is defined - i.e. we
; were only searching for another
; ref in module of deletion
cmp [uprs.UPRS_fPrsDelFound],0 ;was a new defining reference found
je ChkDeletePrs ;brif didn't find new "defining" ref
;found new "defining" reference
call SetPrsDefn ;parms are in static struct dprs
J1_FreeAllUndef_Cont:
jmp FreeAllUndef_Cont ;[37] go on to next prs
ChkDeletePrs:
;Prs has no "defining" reference
;If prs has no text table, release it via PrsFree
; By the time this function has been called by PrsDiscard,
; any text table that this prs might have owned will have
; been released.
test [txdCur.TXD_flags],FTX_mrs ;does this prs have a text table?
je J1_FreeAllUndef_Cont ; brif so, will eventually be freed
; by PrsDiscard
call PrsFree ;free the prs
DbAssertRel [grs.GRS_oPrsCur],z,UNDEFINED,CP,<FreeAllUndefinedPrs err>
jmp FreeAllUndef_Cont2 ;[37] go on to look for next prs,
; starting from last prs that
; we did not free ...
FreeAllUndef_Exit:
pop di
pop si
and WORD PTR[flagsTm],NOT(FTM_PrsDefDeleted+FTM2_PrsRefDeleted*100h)
;all Prs entries are clean
ret
FreeAllUndefinedPrs ENDP
;**************************************************************
; UndefPrs(ax:oPrsDelete)
; Purpose:
; This function is called whenever the "defining"
; text reference to a prs is deleted. It clears
; the prs definition flags and sets prs.otxDef to
; undefined.
;
; NOTE: The caller is responsible for calling ChkAllUndefPrs
; to search for a new defining reference, or release
; the prs entry if no more references to the prs exist.
; NOTE: Some callers expect no heap movement from this routine.
;
; Entry:
; ax is the oPrs whose reference is being deleted
;
; Exit:
; prs.otxDef = UNDEFINED
; prs definition flags are cleared.
; restores caller's active register set.
;
;**************************************************************
PUBLIC UndefPrs
UndefPrs PROC NEAR
push [grs.GRS_oRsCur] ;save caller's active register set
push ax ;pass to PrsActivateCP
call PrsActivateCP ;activate prs which may be freed
or [flagsTm],FTM_PrsDefDeleted ;we have deleted a defining reference
mov [prsCur.PRS_otxDef],UNDEFINED ;remember that current "defining"
;reference has been deleted
Msk EQU NOT (FP_DEFINED OR FP_DECLARED OR FP_CDECL)
and [prsCur.PRS_flags],Msk ;turn off these flag bits
;SetPrsDefn will be called to turn
;one or more back on if another ref
;is found in the pcode
call RsActivateCP ;activate caller's register set
; oRs parm is already on stack
ret
UndefPrs ENDP
;**************************************************************
; boolean UpdatePrs()
; Purpose:
; This is called after text has been inserted into, or deleted
; from any text table. It is called for each prs which could be
; declared in this text table (even if by CALL <compiled sub>),
; If the prs's "defining" reference is in this text table:
; If the reference was deleted by the edit:
; Set its Otx field to UNDEFINED
; a new defining reference will be searched for at completion
; of the current edit operation
; else if the "defining" reference was moved by the edit:
; its otx field is updated
; This function will flag many prs entries if the
; deleted text included many DECLAREs, where the DECLARE was the
; only remaining reference.
;
; NOTE: to drastically improve text edit performance, this routine
; gets called by ForEachPrsInPlaceCP, which marches through the
; prs table without activating the PRS. Thus, this routine MUST
; NOT cause heap movement which would invalidate the pointer
; used to march the prs table.
;
; Entry:
; si = ptr to prs entry being examined
; uprs.UPRS_oRsEdit = text table in which edit occurred
; uprs.UPRS_otxEdit = text offset where text was inserted/deleted
; uprs.UPRS_cbDel = number of bytes deleted
; uprs.UPRS_cbIns = number of bytes inserted
;
;**************************************************************
DbPub UpdatePrs
UpdatePrs PROC NEAR
GETRS_SEG es,dx,<SIZE,LOAD> ;[11]
mov dx,PTRRS[si.PRS_otxDef] ; dx = text offset to prs's "defining"
; reference
inc dx ;test for UNDEFINED
je UpExit ;brif prs has no references
dec dx ;restore dx = otxDef
mov ax,PTRRS[si.PRS_oRsDef]
cmp BPTRRS[si.PRS_procType],PT_DEFFN
jne UpdNotDefFn ;brif not a DEF FN
mov ax,PTRRS[si.PRS_oMrs] ; DEF FNs live in a module's text table
UpdNotDefFn:
cmp ax,[uprs.UPRS_oRsEdit]
jne UpExit ;brif not text table being edited
;prs is currently defined by reference in edited text table
mov ax,[uprs.UPRS_otxEdit]
cmp dx,ax
jb UpExit ;brif reference unaffected by edit
add ax,[uprs.UPRS_cbDel]
cmp ax,dx
jbe UpMoved ;brif defining ref moved by edit
;Defining reference has been deleted.
;Mark Prs to indicate that defining reference has been deleted.
mov ax,si ;ax = ptr to prs entry
RS_BASE sub,ax ;ax=oPrs for entry, parm to UndefPrs
call UndefPrs ;Mark Prs as "defining" reference as
;deleted
jmp SHORT UpExit
;defining reference has been moved up or down in memory
UpMoved:
mov ax,[uprs.UPRS_cbIns]
sub ax,[uprs.UPRS_cbDel]
add PTRRS[si.PRS_otxDef],ax ; update otx based on edit
UpExit:
or ax,sp ; return ax != 0 and NZ
ret
UpdatePrs ENDP
;**************************************************************
; boolean NEAR TxtDelete(otxDelFirst, otxDelLast)
; Purpose:
; Delete some text from the current text table.
; Doesn't update linked lists if ASCII load is active.
;
; NOTE:
; If a Prs's "defining" reference is being deleted, this function
; will cause the prs to be marked as UNDEFINED. It is up to
; the caller to insure that orphaned "New" defining references
; the prs do not exist by calling ChkAllUndefPrs if the possibility
; of deleting a "defining" reference has occurred during the
; edit operation.
;
; Entry:
; Same as for TxtChange:
;
; Exit:
; Same as for TxtChange
; [cForDel] = 1 + number of FOR statements deleted
; [cForStepDel] = 1 + number of FOR...STEP statements deleted
; Condition codes are set based on value in ax
;
;**************************************************************
cProc TxtDelete,<PUBLIC,NEAR,NODATA>,<si,di>
parmW otxDelFirst
parmW otxDelLast
localW otxNext
localW otxTop
localW otxBottom
localW oTyp
localW cbDel
cBegin
DbAssertRelB [txdCur.TXD_scanState],ne,SS_EXECUTE,CP,<TxtDelete err 1>
DbChk Otx,otxDelFirst ;error if > txdCur.bdlText.cbLogical
DbChk Otx,otxDelLast ;error if > txdCur.bdlText.cbLogical
DbAssertRel [otxDelFirst],be,[otxDelLast],CP,<TxtDelete err 2>
mov di,[otxDelFirst]
mov al,[bigEditState]
cmp al,BIG_EDIT_CANCEL
jne DelNoCancel
jmp DelGoodExit ;backout of BigEdit if user CANCELed
DelNoCancel:
cmp [txdCur.TXD_SCANSTATE],SS_SUBRUDE
jne DelNotSubRude ;
jmp DelNoThreads ;don't need to examine text before
; deletion if no oPrs's in code
DelNotSubRude: ;
cmp al,BIG_EDIT_FALSE
jne DelInBigEdit ;brif in a BigEdit
mov [cForDel],1
mov [cForStepDel],1
DelInBigEdit:
;-------------------------------------------------------------------
;Examine the block of pcode being deleted opcode by
;opcode, looking for a RUDE EDIT
;
mov cx,[otxDelLast]
sub cx,di ;compute cb to be deleted
mov [cbDel],cx
jcxz DelPreDone ;brif no text to delete, destroy scrap
test [mrsCur.MRS_flags2],FM2_Include OR FM2_NoPcode
jne DelNotTextMrs ;brif document/include file is active
cmp [b$cNonQBIFrames],0 ;nonzero when non-QBI frames are on
; the stack. Any edit at this point
; could invalidate return addresses on
; the stack. At this point we have
; decided to askcantcont instead of
; trying to fix up the return addresses
; on the stack.
;are non qbi return addresses on stack?
jne DelAskCantCont ;brif so, check for possible back out
DelNotTextMrs:
test [mrsCur.MRS_flags2],FM2_Include
je DelNotIncl1 ;brif not editing an include file
DelAskCantCont:
call AskCantCont_CP ;ask user "Want to back out?"
je J1_DelBackOut ;return FALSE if user wants to back out
DelNotIncl1:
push di ;pass [otxDelFirst]
PUSHI ax,<CODEOFFSET tOpPreDel>
call TxtFindOp ;find 1st opcode of interest
;ax = offset to 1st opcode of interest
;dl = [txtFindIndex]
DelPreLoop:
cmp ax,[otxDelLast]
jae DelPreDone ;brif no significant opcodes were in
;deleted range
xchg si,ax ;si = text offset to current opcode
;opBol and opBolLab are in the PREDEL list to keep us from unnecessarily
; searching all the way to opEot for innocuous edits of large "simple"
; txt tables. This can significantly speed up simple edits.
cmp dl,PREDEL_BolMax ;is this just a Bol?
jbe J1_DelPreNext ;brif so, search for next opcode.
cmp dl,PREDEL_IncludeMax
jbe DelInclude ;brif INCLUDE (or $INCLUDE [QB4])
;It must be PREDEL_rudeMin or greater - rude edit
push dx ;save txtfindindex in case AskRudeEdit
;calls TxtFind
call AskRudeEdit ;see if user wants to back out of edit
pop ax ;al = txtfindindex
je J1_DelBackOut ;return FALSE if user wants to
; back out of edit
FloadActive ;don't descan if Loading
jne DelPreNext
cmp al,PREDEL_opStDefType
jne DelPreNext ;brif not DEFINT..DEFSTR stmt
call SystemDescanCP ;implicit parms in DECLARE, SUB,
; FUNCTION stmts need to be rechecked
; by the scanner
DelPreNext:
push si
PUSHI ax,<CODEOFFSET tOpPreDel>
call TxtFindNextOp ;find next opcode of interest
jmp SHORT DelPreLoop
DelInclude:
push si ;pass otx
call OtxNoInclude ;ax = otx to opBol/opEot for next line
; which has no $INCLUDE
cmp ax,[otxDelLast] ;is end of $INCLUDE pcode beyond
; requested delete?
jbe J1_DelPreNext ;brif not
mov [otxDelLast],ax ;delete all included lines as well
sub ax,di ;ax = new cbDel
mov [cbDel],ax
J1_DelPreNext:
jmp SHORT DelPreNext
J1_DelBackOut:
jmp DelBackOut ;return FALSE - user wants to
; back out of edit
;-------------------------------------------------------------------
; If fFillScrap and bdTxtScrap is empty,
; fFillScrap = FALSE
; copy deleted text to bdTxtScrap
; otxScrap = otxDelFirst
; If cbBigIns > 0, cbBigIns -= cbDel
;
;Note that cbDel may actually be zero but that we still create the scrap
;because we may subsequently be called during a big edit with fFillScrap
;TRUE but we don't want to fill the scrap.
DelPreDone:
cmp [fFillScrap],FALSE
je DelNoCopy ;brif no need to copy text to scrap
cmp [bdlTxtScrap.BDL_status],NOT_OWNER
jne DelNoCopy ;brif scrap is already in use
mov [fFillScrap],FALSE ;reset one-shot flip-flop
mov [otxScrap],di ;remember text offset of deleted text
; CALL TxtCopyScrap(otxDelFirst, 0, cbDel, FALSE) [9]
push di ;push otxDelFirst
xor ax,ax
push ax ;offset of where to copy into Scrap
push [cbDel]
push ax ;push FALSE meaning don't delete text
call TxtCopyScrap ;ax = 0 if out of memory
jnz CopiedOK ;brif buffer allocated successfully
call AskRudeEdit ;Give user a chance to back out of edit
; if CONT is currently possible.
je J1_DelBackOut ;return FALSE if user wants to
; back out of edit
jmp SHORT DelNoCopy
CopiedOK:
;-------------------------------------------------------------------
;NOTE: At this point, the user CANNOT back out of the edit.
; All actions from this point on are irreversible.
;
;Examine the block of pcode being deleted opcode by
;opcode, taking special action for each opcode of interest.
;
; Register usage for loop: si = otxCur, di = otxDelFirst
;
DelNoCopy:
cmp [cbDel],0 ;was any text deleted?
jne DelAfterDel ;brif so
; - look for special deleted opcodes
jmp DelGoodExit ;no pcode deleted - exit
DelAfterDel:
push di ;pass [otxDelFirst]
PUSHI ax,<CODEOFFSET tOpDel>
call TxtFindOp ;ax = offset to 1st interesting opcode
;ax = offset to 1st opcode of interest
;dl = [txtFindIndex]
DelLoop:
cmp ax,[otxDelLast]
jae J1_DelDone ;brif reached end of deleted range
xchg si,ax ;si = offset to current opcode (otxCur)
xchg ax,dx ;al = [txtFindIndex]
cmp al,DEL_bolMax
ja DelNotBol ;brif not a label or bol opcode
cmp al,DEL_labMax
ja DelNotLab ;brif not a label definition opcode
lea ax,[si+4] ;ax = text offset to oNam field
call GetWOtx ;ax = oNam for label
xchg bx,ax ;pass oNam in bx
mov al,NM_fLineNumLabel ;pass mask to reset in al
call ResetONamMask ;reset bit that says the label by
; this name is defined
DelNotLab:
mov al,[txtFindIndex]
cmp al,DEL_bolMin
jb J1_DelNext ;brif not a begin of line opcode
dec [txdCur.TXD_cLines] ;decrement text table's line count
cmp al,DEL_bolInclMin
jb J1_DelNext ;brif not included line
dec [txdCur.TXD_cLinesIncl] ;decrement text table's INCLUDE line cnt
jmp SHORT J1_DelNext
DelNotBol:
cmp al,DEL_NonSubRefMax
jle DelNotSubRef ;brif not a procedure reference
DbAssertRelb [txdCur.TXD_SCANSTATE],ne,SS_SUBRUDE,CP,<TxtDelete: tbl in SUBRUDE>
lea ax,[si+4]
call GetWOtx ;ax = oPrs referenced
call pPrsOPrs ;es:bx points to Rs
cmp PTRRS[bx.PRS_procType],PT_SUB
jne J1_DelNext ;brif not a sub Prs
or PTRRS[bx.PRS_flags2],FP_RefDeleted ;[38]set flag indicating that
; a ref has been deleted
or [flagsTm2],FTM2_PrsRefDeleted ;set flag indicating
; that a Prs Ref has been deleted
jmp SHORT J1_DelNext
J1_DelDone:
DJMP jmp SHORT DelDone
DelNotSubRef:
cmp al,DEL_forMax
ja DelNotFor ;brif FOR pcode not being deleted
.errnz DEL_forMax - DEL_opStForStep
je DelForStep ;brif deleted a FOR STEP
inc [cForDel]
jmp SHORT J1_DelNext
DelForStep:
inc [cForStepDel]
jmp SHORT J1_DelNext
DelNotFor:
cmp al,DEL_watchMax
ja NotDelWatch ;brif WATCH pcode not being deleted
call WatchDeleted ;reduce number of lines allocated to
; watch window, remember to redraw
; DebugScreen
J1_DelNext:
jmp SHORT DelNext
NotDelWatch:
cmp al,DEL_opStEndProc
jne DelNotEndProc ;brif not END DEF/SUB/FUNCTION
;user is deleting an END SUB or END FUNCTION
and [prsCur.PRS_flags],NOT FP_ENDPROC
jmp SHORT DelNext
DelNotEndProc:
cmp al,DEL_opAVtRf ;[1]
je DoResetCommon ; brif deleting a DIM statement
cmp al,DEL_opStCommon
jne DelNotCommon ;brif not COMMON
DoResetCommon:
DbAssertRelB cChansOpen,e,0,CP,<TxtDelete: Tried to delete COMMON while load is active>
call ResetCommon ;Eliminate all common type tables
call SystemDescanCP ;scanner will rebuild common tables
jmp SHORT DelNext ; for each txt tbl next scan
DelNotCommon:
cmp al,DEL_opBreakPoint
jne DelNotBreakPoint ;brif no Break Point set on this line
or [flagsTm],FTM_BpDeleted ;we deleted a break point
jmp SHORT DelNext
DelNotBreakPoint:
DbAssertRelB cChansOpen,e,0,CP,<TxtDelete: Tried to delete AS usrtyp while load is active>
DbAssertRelB al,e,DEL_opAsType,CP,<TxtDelete err 3>
;DELETING AS <usertyp>
;remember to call PreScanAsChg before scanning program
mov ax,si ;pass text offset in ax
mov bx,di ;pass otxDelFirst in bx
mov cx,[otxDelLast] ;pass otxDelLast in cx
call ChkLastAsText ;if last instance of 'x AS user-type'
; in module, reset x's NM_fAs name
; table bit and set module's
; FM_asChg bit so we'll call
; PreScanAsChg before scanner
DelNext:
push si
PUSHI ax,<CODEOFFSET tOpDel>
call TxtFindNextOp
jmp DelLoop
DelDone:
mov cx,[cbDel]
cmp [cbBigIns],0
je DelNotBig
sub [cbBigIns],cx
DelNotBig:
FloadActive ;don't update linked lists if Loading
jne DelNoThreads
push di ;pass otxDelFirst
push cx ;pass cbMove
call TxtDelThread ;update linked lists for delete
DelNoThreads:
mov si,[otxDelLast]
push si ;pass otxDelLast
push di ;pass otxDelFirst
call TxtMoveDown ;Actually delete text from text table
sub si,di ;si = cbDel
test [flagsTM],FTM_SaveProcHdr
jne DelGoodExit ;brif SaveProcHdr was in critical
; section. A temp txt table is active,
; which is NOT oRsCur.
;Update program counter and any other runtime text pointers
push di ;pass otxDelFirst
sub ax,ax
push ax ;pass cbIns (0)
push si ;pass cbDel
push ax ;fTestOnly = FALSE
call UpdatePcs
;pass information about the edit to UpdatePrs in static struct updPrs
mov ax,[grs.GRS_oRsCur]
mov [uprs.UPRS_oRsEdit],ax
mov [uprs.UPRS_otxEdit],di ;save otxDelFirst
mov [uprs.UPRS_cbDel],si
mov [uprs.UPRS_cbIns],0
mov bx,CPOFFSET UpdatePrs
call ForEachPrsInPlaceCPSav ;Preserve callers oRs
DelGoodExit:
mov ax,sp ;return TRUE (non zero)
DelExit:
or ax,ax ;set condition codes for caller
cEnd
;-------------------------------------------------------------------
; If delete would prevent continuing, & user wants to back out of edit,
; if bigEditState != BIG_EDIT_FALSE, then bigEditState = BIG_EDIT_CANCEL
; return without changing anything
;
DelBackOut:
cmp [bigEditState],BIG_EDIT_FALSE
je DelNotBigEdit ;brif not in a BigEdit
mov [bigEditState],BIG_EDIT_CANCEL
DelNotBigEdit:
sub ax,ax ;return FALSE
jmp SHORT DelExit
;**************************************************************
; ushort FAR TxtChange(otxDelFirst, otxDelLast, fNoInsert)
;
; Purpose:
; The editor or ASCII Loader calls TxtChange() to
; replace zero or more lines with zero or 1 line of text
; in the current text table. If no new text is to be inserted,
; but only deleted, call TxtChange with fNoInsert <> 0.
; TxtDescan() should be called before this, to ensure that
; the text table is descanned to SS_PARSE state.
;
; Note: This function need not worry about the case where the
; user is trying to insert something between a line with $INCLUDE
; and an included line below it, because the user interface
; does not allow ANY editting while 'View/Include Files' is active.
;
; Entry:
; grs.oMrsCur, grs.oPrsCur have their usual meaning
; ps.bdpSrc contains source line to be inserted
; parm1: ushort otxDelFirst - text table offset to opBol
; opcode for 1st line to delete. It also indicates where
; new line is to be inserted.
; parm2: ushort otxDelLast - text table offset to opBol
; opcode beyond last line to delete
; parm3: ushort fNoInsert - non-zero if no pcode should be inserted
; (i.e. only text deletion should occur
;
; Exit:
; If no errors were encountered,
; the return value = txtErr.errCode = 0.
; Else if an error occurred which we will overlook at entry time,
; but which must be considered fatal when we are going through
; each module's ReParse list in preparation to execute the program,
; return value = 0,
; txtErr.errCode = an offset into the QBI Message Table
; (MSG_xxx) or, if high bit is set, ps.bdpError contains the
; parser-built ASCII error message,
; The text is inserted in text table in an opReParse opcode.
; txtErr.fDirect is set to FALSE,
; txtErr.oMrs identifies the module with the error,
; txtErr.oPrs identifies the procedure (if any) with the error,
; txtErr.otx is an offset into the text table where the error
; was detected (otxDelFirst).
; txtErr.oSrcErr contains the column offset into the source line
; to the offending token.
; Else if its a really serious error (like out-of-memory or syntax error),
; all txtErr fields are set as above, and return value = txtErr.errCode
;
; Major Steps of Algorithm:
; Delete the pcode to be replaced (taking some special action for
; some opcodes being deleted), giving user a chance to
; back out of edit if edit would prevent continuing.
; Parse line to be inserted, checking for variable manager/syntax errors,
; again giving user a chance to back out of the edit
; Scan pcode to be inserted for rude edits, again giving user a chance
; to back out of the edit. This pcode scan can result in calling
; CantCont(), ModuleRudeEdit(), SystemDescan().
; If statement contains variable mgr/syntax errors, change pcode to
; be inserted to an opReParse, which has the actual ASCII source
; as an operand.
; Insert the new pcode (taking some special action for some opcodes
; being inserted).
;
;**************************************************************
cProc TxtChange,<PUBLIC,FAR,NODATA>,<si,di>
parmW otxDelFirst
parmW otxDelLast
parmW fNoInsert
localW fInclude
localW cbIns
localW result
localW otxMrsDelFirst
localW oRsPreParse
localW oPrsPreParse
localW otxEndProc
localB flagsPrsPreParse
localB flagsTc
FTC_GotEndProc EQU 1
FTC_GotEnterProc EQU 2
cBegin
DbAssertRelB [txdCur.TXD_scanState],ne,SS_EXECUTE,CP,<TxtChange err1>
DbChk Otx,otxDelFirst ;error if > txdCur.bdlText.cbLogical
DbChk Otx,otxDelLast ;error if > txdCur.bdlText.cbLogical
mov si,[otxDelFirst]
sub ax,ax
mov [txtErr.TXER_errCode],ax
mov [ps.PS_errCode],ax
mov [result],ax
;We need to init these vars in case we don't call ParseLine.
;(i.e. maybe the caller is only deleting text)
mov [flagsTc],al ;default local flags to 0
mov [fInclude],ax ;assume we'll see no $INCLUDE directive
mov ax,[grs.GRS_oPrsCur]
mov [oPrsPreParse],ax
cmp [bigEditState],BIG_EDIT_ACTIVE
je BigEditActive ;BpDeleted set by first BigEdit Call
; to TxtChange.
and [flagsTm],NOT FTM_BpDeleted ;clear BP deleted flag
BigEditActive:
cmp [bigEditState],BIG_EDIT_CANCEL
jne TcNotBECancel ;brif not backing out of BigEdit
jmp TcRet ;backout of BigEdit if user CANCELed
TcNotBECancel:
FLoadActive
je TcNotLoading ;brif not loading a file
jmp TcLoading1 ;brif LOADing a file - makes ASCII
; load MUCH faster.
;We're not loading, make sure there is enough memory for the
;inserted and deleted text, otherwise, it would be possible for
;Search/Change to loose an existing line entirely - too rude.
;We loosely approximate size of pcode being inserted as 200.
;Don't check it for edits of immediate (FM2_File=0), since that
;could prevent users from executing a SYSTEM statement in
;the immediate window.
TcNotLoading:
test [mrsCur.MRS_flags2],FM2_File
je NotOmErr ;brif not editing a file
cmp [fNoInsert],0 ;is there any text to parse and insert?
jne NotOmErr ;brif not - no need to reserve space
; otherwise, user could get out of
; memory, and not be able to delete
; any text to recover - locked up.
PUSHI ax,200d
call TxtFree
jne NotOmErr
jmp TcOmErr
NotOmErr:
;********************* start of revision [56]
;No edits on pcode tables are allowed if there is a return address to
;the direct mode buffer and the direct mode buffer contains a label reference
mov al,[grs.GRS_flags]
and al,FG_RetDir+FG_OtxInDir
cmp al,FG_RetDir+FG_OtxInDir
jne @F ;brif NOT (RetDir & OtxInDir)
test [mrsCur.MRS_flags2],FM2_NoPcode
jnz @F ;brif this not a pcode buffer
call AskCantCont_CP ;ask user if he wants to continue
djmp jz TcRetGoDirect ;brif user wants to backout
@@:
;*********************** end of revision [56]
;we're not loading, set DEFtypes etc. based on insert point.
;if in module, traverse DEF-FN chain to otxDelFirst
;and if we're inside a DEF-FN, PrsActivate that prs
mov bx,si ;bx = otxDelFirst
cmp [bigEditState],BIG_EDIT_ACTIVE
jne TcFindPrs ;If not in a big edit, use passed
; otxDelFirst.
;If a big edit is active, we need to stop searching the DEF FN chain
; at otxBigIns, since txt change gets called multiple times for a
; big edit. If we didn't do this, splitting a line immediately
; prior to a DEF FN could cause us to search a Bogus DEF FN chain.
mov ax,[otxBigIns] ;get oTx for start of big edit
.errnz UNDEFINED+1
inc ax ;UNDEFINED if first call to txtchg
je TcFindPrs ;brif so, use oTxDelFirst
dec ax ;get back otxBigIns
xchg ax,bx ;bx = oTxBigIns
TcFindPrs:
push bx ;pass offset to 1st byte of edit
call OPrsOfOtx ;ax = oPrs if si falls in DEF FN
inc ax ;test for UNDEFINED
je TcNotDefFn
;if we are in a big edit, we can't depend upon DEF-FN chain after
; the first call to TxtChange. Therefore, ask rude edit, to ensure
; that there is no prs for the DEF-FN. Subsequent calls will use
; the DEF FNs mrs.
cmp [bigEditState],BIG_EDIT_ACTIVE
jne TcNotBigE ;DEF-FN chain is ok.
; Assert that TcUndo won't take unexpected actions for early termination.
DbAssertRel [cbBigIns],e,0,CP,<TxtChange: DEF FN-error1>
DbAssertRel [bdlTxtScrap.BDL_status],e,NOT_OWNER,CP,<TxtChange: DEF FN-error 2>
call AskRudeEdit ;see if user wants to back out of edit
jne short TcNotDefFn ;use module Rs.
jmp TcUndo ;brif user wanted to back out of edit
TcNotBigE:
dec ax ;restore ax = oPrs we're in
push ax ;otxDelFirst falls within a DEF FN
call PrsActivateCP ;activate it (for var mgr)
; *--------------------------------------------------------------
; * Examine the block of pcode being deleted opcode by
; * opcode, taking special action for each opcode of
; * interest. May result in AskCantCont, ModuleRudeEdit, SystemDescan.
; *
; *---------------------------------------------------------------
TcNotDefFn:
test [mrsCur.MRS_flags2],FM2_NoPcode
jne TcInBigEdit ;brif editing document or immediate
; window - no need to ever back out
; of edit. If we didn't do this,
; we could get out-of-memory error
; when trying to delete immediate window
; history, which we do when we're
; trying to recover from tight memory
cmp [bigEditState],BIG_EDIT_FALSE
jne TcInBigEdit ;brif we're in a BigEdit, if so
;TxtStartBigEdit already set this
;flag, and TxtDelete may have been
;called independantly of TxtChange
mov [fFillScrap],1 ;tell TxtDelete to copy text to scrap
; so we can back-out of edit
TcInBigEdit:
push si ;pass otxDelFirst
push [otxDelLast]
call TxtDelete ;delete the text
mov [fFillScrap],FALSE
jne TcDelOk ;brif TxtDelete returned FALSE in ax
TcRetGoDirect:
mov [result], MSG_GoDirect
J1_TcRet:
jmp TcRet ;brif user wants to back out of edit
;just return without doing anything
;Set up ps.tEtCur[] with the default types for this point in the source
;
TcDelOk:
;save current oRs for reactivation
; after Redefining/Deleting undefined
; prs entries. It is guaranteed that
; that this is safe, since SUB/FUNCs
; only get PrsFreed at ?rsDiscard time.
; DEF FNs have the Mrs active at edit
; time.
call ChkAllUndefPrsSaveRs ;Find new "defining" references for all
; Prs entries which had defining.
; references deleted. If no more
; references to prs exist, free it.
cmp [fNoInsert],0 ;is there any text to parse and insert?
jne J1_TcRet ;brif not - finished
; We can't call OtxDefTypeCur if accumulating opReparses for BigEdit,
; since the linked list are not updated until we start processing the
; reparse list at TxtEndBigEdit time. The processing of the reparse
; list will insure the the DEF type state is accurate.
cmp [bigEditState],BIG_EDIT_ACTIVE
je TcDoReParse ;brif we're accumulating BigEdit
;changes, but TxtEndBigEdit has not
;been called yet
mov ax,si ;ax = text offset
call OtxDefTypeCur
TcLoading1:
test [mrsCur.MRS_flags2],FM2_NoPcode
je TcNotDoc ;brif not a document module
;this module is not BASIC source, just text (maybe Scrap,
; command window, document file)
TcDoReParse:
call ResetDstPbCur ;so ParseUndo won't do anything
jmp TcReParse1
;Parse the source line to pcode
TcNotDoc:
;tell parser (and type manager) to recognize any TYPEs which have been
; declared before the place this line is being inserted. This
; prevents forward referencing of types, which BASCOM cannot support.
mov [ps.PS_otxLine],si
;Call the parser to parse the source line. grs.oPrs is updated
;if a SUB/FUNCTION/DEF statement for an as yet undefined procedure
;is parsed, in which case, the we insert the text at the beginning
;of the new text table.
mov ax,[grs.GRS_oPrsCur]
mov [oPrsPreParse],ax
mov ax,[grs.GRS_oRsCur] ;save Entry so we can tell UI to
mov [oRsPreParse],ax ; display new text table if we create
; a new SUB/FUNCTION.
mov al,[prsCur.PRS_flags] ;get prs flags in case we insert a
mov [flagsPrsPreParse],al ;SUB/FUNCTION statement. If we are
; just renaming then FP_DEFINED will
; have be cleared when the Sub/Func
; was deleted.
Retry:
mov [ps.PS_flags],0
call ParseLine
jnc TcNoParseErr ;brif parser encountered no error
;ParseLine encountered some error
mov ax,[oPrsPreParse]
call TxtParseUndo
test [ps.PS_flags],PSF_UndoEdit
jne J1_TcUndo ;brif user said he wants to back out
; of the edit while we were in ParseLine
; (i.e. ParseLine called AskCantCont)
test BYTE PTR [ps.PS_errCode + 1],PSERR_fRude / 100h
je TcNotRude ;brif error isn't cause for a rude-edit
;Variable manager returned an error code which
;means a RudeEdit is being performed.
;Save the line in an opReParse, but do not report the error to
;the user. SsDescan the module to SS_Rude (if the user wants
;to go through with the edit).
;See if user wants to back out of edit or descan to SS_RUDE
call AskRudeEdit ;see if user wants to back out of edit
jne TcNotRude ;brif user didn't back out of edit
J1_TcUndo:
jmp TcUndo ;undo delete (if any) and return
;See if the parser wants us to try parsing this line again. This can
;happen when:
; We saw something that made us need to ModuleRudeEdit, but part
; of the line's pcode had already been emitted in SS_PARSE
; Variable manager could not add a variable, because variable heap
; was locked (because we can CONTinue). Parser called AskCantCont
; and now wants us to try again (much easier than trying to call
; varmgr again from within parser).
;
TcNotRude:
test [ps.PS_flags],PSF_fRetry
jne Retry ;brif ParseLine wants us to try again
jmp SHORT TcParseErr
TcNoParseErr:
; *--------------------------------------------------------------
; * At this point, source line has been parsed with no errors.
; * Examine the block of pcode being inserted opcode by
; * opcode, calling a text-mgr routine for each opcode of interest.
; * Each of these routines in addition to doing other work,
; * returns a value which will cause either
; * No Action, ModuleRudeEdit(), SystemDescan(), or CantCont().
; *
; * NOTE: When reviewing changes to this block, make sure it isn't possible
; * to take some state-changing action, then encounter an error which
; * causes the edit to be discarded (AskCantCont or MakeOpReParse).
; * In general, it is safer to 'remember' state changing actions to
; * be taken, and take them when the pcode has actually been inserted.
; *
; *--------------------------------------------------------------
call ChkAllUndefPrsSaveRs ;check all undefed prs entries
;in case this was a rename
push [ps.PS_bdpDst.BDP_pb]
PUSHI ax,<CODEOFFSET tOpPreIns>
call TxtFindOpDS ;ax = ptr to 1st interesting opcode
PiLoop:
cmp dl,PI_opEot
je J1_PiDone ;brif done with loop
xchg di,ax ;di = ptr to current opcode
sub dh,dh ;dx = dispatch index
shl dx,1 ;dx = dispatch offset
mov ax,di ;ax = pointer to opcode of interest
sub di,[ps.PS_bdpDst.BDP_pb] ;convert ptr to offset in case
; dispatched function causes
; ps.bdpDst to move
mov bx,dx ;bx = dispatch offset
jmp WORD PTR cs:PiDispatch[bx]
;All the PiOpxxx dispatches either branch to an error handler, or PiNext
PiNext:
add di,[ps.PS_bdpDst.BDP_pb] ;convert offset back to pointer
push di ;pass otxCur
PUSHI ax,<CODEOFFSET tOpPreIns>
call TxtFindNextOpDS ;ax = pointer to next opcode of interest
jmp SHORT PiLoop
J1_PiDone:
jmp SHORT PiDone ;finished with loop
TcParseErr:
mov ax,[ps.PS_oSrcErr]
mov [txtErr.TXER_oSrc],ax
mov ax,[ps.PS_errCode]
mov dx,ax
.errnz PSERR_fAsciiMsg - 8000h ;TxtChange callers assume it is high bit
and ah,(PSERR_fAsciiMsg + PSERR_errCode) / 100h
;mask off parser flags
;pass error code in ax to TcReParse or TcAlert
test dh,PSERR_fAlert / 100h
jne TcAlert ;serious error, event at entry time,
; let alone reparse time
jmp SHORT TcReParse ;brif not a serious error
;ax = error code
TcAlert0:
mov [txtErr.TXER_oSrc],UNDEFINED
;for txtmgr detected errors, we cant
;detect the column, compute from otx
;Encountered some error, make sure entry prs is active before
;Undoing the change. This solves the bug where you enter a
;SUB line and the SUB already exists, but is undefined
; (SUB stmt is a reparse). The line parses without error, and
;the parser changes to the new prs. When we call PrsMake, we
;get a duplicate definition error. We were getting here with
;the wrong prs active.
mov bx,[oPrsPreParse]
cmp bx,[grs.GRS_oPrsCur]
je TcAlert ;brif parser didn't move into a new PRS
push ax ;save error code
push bx
call PrsActivateCP ;get back to module level/old prs
pop ax ;recover error code
TcAlert:
cmp [fSyntaxCheck],0
je TcReParse ;brif user has disabled editor
; syntax error reporting
mov [result],ax ;serious error - return code in ax
TcReParse:
mov [txtErr.TXER_errCode],ax
TcReParse1:
mov ax,[oPrsPreParse]
call TxtParseUndo ;undo any changes to prs table or
; name table which parsing this
; line caused.
test [ps.PS_flags],PSF_fRudeIfErr
je MakeOpRp
;Some irreversible action took place, like calling varmgr to
;create a CONSTant, and then some error took place. The user
;already said he didn't want to CONT before PSF_fRudeIfErr was
;set, so its ok to blow away the module's variable table.
call ModuleRudeEdit
MakeOpRp:
call MakeOpReParse
and [flagsTc],NOT (FTC_GotEndProc+FTC_GotEnterProc)
jmp SHORT TcPrescanDone ;don't call LoadEnterProc, LoadExitProc
;si = otxDelFirst
PiDone:
FLoadActive
jne TcPrescanDone ;brif LOADing a file
test [txdCur.TXD_flags],FTX_mrs
jne TcPrescanDone ;brif we're in a module's text table
call ChkInsProc ;see if valid line to insert in proc
je TcPrescanDone ;brif valid line
jns TcAlert0 ;brif illegal
jmp J1_TcUndo ;user wants to back out of edit
;MakeOpReParse could have resulted in an out-of-memory error
;check for it
;si = otxDelFirst
;
TcPrescanDone:
mov ax,[ps.PS_errCode]
cmp al,ER_OM
je J1_TcOmErr ;brif out-of-memory error
; *--------------------------------------------------------------
; * At this point, the user does not want to back out of the edit
; * for the sake of edit & continue, and we are not going to
; * convert the line to an opReParse due to errors.
; *--------------------------------------------------------------
sub [ps.PS_bdpDst.BDP_cbLogical],2 ;don't count opEot as part
; of the line to be inserted
;make room for new text by copying old text up in memory
;making sure there's enough free space in the current text table
;to insert the pcode we want to insert
;si = otxDelFirst
;
TcDoMove1:
mov ax,[ps.PS_bdpDst.BDP_cbLogical]
mov [cbIns],ax
call TxtInsert ;insert ps.bdpDst in text table @ si
je J1_TcOmErr ;brif out-of-memory
; *--------------------------------------------------------------
; * If we've gotten a SUB or FUNCTION statement
; * Move SUB/FUNCTION statement to a new PRS text table,
; * generating synthetic DEFxxx statements, and keeping leading
; * comments in SUB/FUNCTION's text table.
; *
; * NOTE: LoadEnterProc modifies ps.bdpDst
; * It also moves REMs from the module table to the start of
; * the procedure text table, since these REMs may be a proc header.
; * otxDelFirst (si) is updated to reflect this insert.
; *
; *--------------------------------------------------------------
;
TcAfterIns:
test [flagsTc],FTC_GotEnterProc
je TcNoEnterProc ;brif not inserting SUB/FUNC stmt
sub si,[txdCur.TXD_bdlText_cbLogical]
push [otxMrsDelFirst]
call LoadEnterProc ;move pcode from module to proc tbl
jne TcNotOm3
call PrsDeactivate ;make module active for error recovery
J1_TcOmErr:
jmp TcOmErr ;brif out-of-memory error
TcNotOm3:
;update otxDelFirst after copying leading remarks, defints etc. to prs
add si,[txdCur.TXD_bdlText_cbLogical]
; *--------------------------------------------------------------
; * Call TxtInsUpdate to examine every opcode which was inserted
; * in the text table, taking any opcode specific action required.
; *
; *--------------------------------------------------------------
;
TcNoEnterProc:
mov bx,si ;bx = updated otxDelFirst
add bx,[cbIns] ;bx = offset beyond inserted pcode
call TxtInsUpdate ;update program counter and other
; static entries which are affected
; by pcode movement.
je J1_TcOmErr ;brif out-of-memory
cmp [bigEditState],BIG_EDIT_FALSE
je TcNotInBigEdit ;brif we're not accumulating BigEdit
; changes
test [flagsTc],FTC_GotEnterProc
jnz TcNoIncr ;don't increment cbBigIns if proc
mov ax,[cbIns]
add [cbBigIns],ax ;remember how much text we've inserted
TcNoIncr:
cmp si,[otxBigIns]
jae TcNotInBigEdit
mov [otxBigIns],si ;remember base of inserted pcode
; (so we can later back out of BigEdit)
; *--------------------------------------------------------------
; * If we've gotten an END SUB or END FUNCTION statement
; * restore the module's text table.
; *
; *--------------------------------------------------------------
;
TcNotInBigEdit:
test [flagsTc],FTC_GotEndProc
je TcNoExitProc
FLoadActive
je TcNoExitProc ;brif not LOADing a file
call LoadExitProc ;clean up, return to Module level
jnc TcNoExitProc
jmp TcOmErr ;brif out of memory error
TcNoExitProc:
test [flagsTm],FTM_BpDeleted
je TcNoBp ;brif breakpoint was not deleted
push si ;pass otxDelFirst
call LnOfOtx ;ax = line text was inserted
push ax
call FAR PTR ToggleBp ;set breakpoint
and [flagsTm],NOT FTM_BpDeleted ;clear BP deleted flag
cmp [bigEditState],BIG_EDIT_ACTIVE
jne TcNoBp ;brif we're not accumulating BigEdit
; changes
add [cbBigIns],2 ;2 more bytes for inserted BP
; *--------------------------------------------------------------
; * If this line had an $INCLUDE 'filename' directive, recurse here.
; *--------------------------------------------------------------
;
DbPub TcNoBp
TcNoBp:
cmp [fInclude],NULL
je J_TcRet ;brif line contained no $INCLUDE
cmp [txtErr.TXER_errCode],0
je @F
J_TcRet:
jmp SHORT TcRet ; brif $INCLUDE line has error in it
@@:
PUSHI ax,<dataOFFSET b$SdBuf1>;bx = SD for filename.
inc [cInclNest]
mov ax,si ;ax = otxDelFirst
add ax,[cbIns] ;ax = offset beyond inserted text
push ax ;pass insertion point to LoadFile
inc [fLoadInclude] ; inform LoadFile of $INCLUDE
call LoadFile ;merge the $INCLUDE file
dec [fLoadInclude] ; reset flag
dec [cInclNest]
or ax,ax
jz TcNoErr ;brif no $INCLUDE error
; If we fell into TcRet, we would
; be over-writing errors already
; recorded by recursive calls to
; TxtChange via LoadFile.
TcIncErr:
push ds
pop es ;ES=DGROUP for stosw
mov di,[ps.PS_bdpDst.BDP_pb]
mov [ps.PS_bdpDst.BDP_cbLogical],6
mov ax,opReParse
stosw ;insert opReParse in text table
mov ax,2
stosw ;insert cb field in text table
;garbage link field is ok for now
xchg ax,si ;pass otxDelFirst in ax
call TxtSkipOp ;ax = adr of 1st opcode after Bol
xchg si,ax ;si = adr of place to insert opReParse
call TxtInsert
mov bx,si
add bx,6 ;bx = offset beyond inserted pcode
call TxtInsUpdate
TcRet:
cmp [txtErr.TXER_errCode],0
je TcNoErr
;tell caller which Mrs & Prs the error occurred in
mov [txtErr.TXER_fDirect],FALSE
mov ax,[grs.GRS_oRsCur]
mov [txtErr.TXER_oRs],ax
mov [txtErr.TXER_otx],si
TcNoErr:
cmp [bigEditState],BIG_EDIT_FALSE
jne TcExit ;brif in a BigEdit, accumulate changes
cmp [bdlTxtScrap.BDL_status],NOT_OWNER
je TcExit
PUSHI ax,<dataOFFSET bdlTxtScrap>
call BdlFree ;release DELETE scrap
TcExit:
test [txdCur.TXD_flags],FTX_mrs ;make sure current oRs has a
; text table
je TcExit1 ;brif sub or function is active
call PrsDeactivate ;deactivate DEF FN if any
TcExit1:
DbChk TxdOps ;see if TxtChange inserted bad opcode
mov ax,[result] ;return error code or 0 in ax
cEnd
TcOmErr:
mov ax,ER_OM ;out-of-memory error
mov [txtErr.TXER_errCode],ax
mov [result],ax
J2_TcRet:
jmp SHORT TcRet ;just return
;The user has decided to back out of the edit, because it would prevent CONT
;reinsert deleted text (if any).
;
; If bigEditState != BIG_EDIT_FALSE
; If cbBigIns > 0, TxtDelete(otxBigIns, otxBigIns + cbBigIns)
; bigEditState = BIG_EDIT_CANCEL
; If bdTxtScrap is not empty, Insert bdTxtScrap at otxScrap
;
TcUndo:
mov ax,MSG_GoDirect
mov [result],ax ;tell editor to stop the edit
mov [txtErr.TXER_errCode],ax
cmp [bigEditState],BIG_EDIT_FALSE
je NotInBigEdit ;brif not in BigEdit
mov cx,[cbBigIns]
jcxz TcNoIns ;brif no text has been inserted
mov ax,[otxBigIns]
push ax
add ax,cx ;ax = offset beyond inserted text
push ax
call TxtDelete ;delete the inserted text
; doesn't place deleted text in scrap
; either because fFillScrap is false
; or scrap is already in use
TcNoIns:
mov [bigEditState],BIG_EDIT_CANCEL
NotInBigEdit:
cmp [bdlTxtScrap.BDL_status],NOT_OWNER
je J2_TcRet ;brif no text deleted - done with undo
mov ax,[bdlTxtScrap.BDL_cbLogical] ;ax = number of bytes in scrap
cmp ax,2 ; check for empty scrap
jb J2_TcRet ; bfir empty scrap - done.
mov [cbins],ax ;store this in [cbins] static
; CALL TxtInsScrap(si = otxScrap) [9]
mov si,[otxScrap] ;si = insertion point in
; current text table
call TxtInsScrap ;copy scrap back into text table and
; release bdlTxtScrap
jz TcOmErr
jmp TcAfterIns
;
;**************************************************************
; ChkInsProc
; Purpose:
; We're not loading and we're inserting a line in a SUB/FUNCTION
; text table. This function sees if it is legal.
; Entry:
; si = text offset where line is being inserted in SUB/FUNCTION
; Exit:
; ax = error code if illegal line to insert in a SUB/FUNCTION
; = 0 if no error
; = negative number if user wants to back out
; condition codes set based on value in ax
;
;**************************************************************
DbPub ChkInsProc
ChkInsProc PROC NEAR
DbChk Otx,si ;error if > txdCur.bdlText.cbLogical
push di ;preserve caller's di
test [prsCur.PRS_flags],FP_DEFINED
je CiNotDefined ;brif proc has no SUB/FUNCTION stmt
cmp [prsCur.PRS_otxDef],si
jae CiNotDefined ;brif insertion is before definition
jmp CiDone ;insertion is after definition
CiNotDefined:
;Trying to insert something into SUB/FUNCTION window before
;the SUB/FUNCTION definition. Only certain things can
;be inserted before the definition - make sure this is
;one of them
push si ;save si
sub si,si ;set fNonBolSeen=fSubOrFuncSeen=false
; the high bit set means an opStSub,
; or opStFunction has been seen,
; when si is non-zero then we have
; seen some non-bol/non opEot opcode.
mov di,[ps.PS_bdpDst.BDP_pb] ;di->start of pcode to insert (in DS)
;di = otxCur (into parser's DS pcode buffer ps.bdpDst)
CiLoop:
mov ax,[ps.PS_bdpDst.BDP_pb]
add ax,[ps.PS_bdpDst.BDP_cbLogical]
dec ax
dec ax
cmp di,ax
jae CiLoopExit ;brif done scanning line to be inserted
push di ;pass otxCur
PUSHI ax,<CODEOFFSET tOpPreProc>
call TxtFindNextOpDS ;ax = offset to next interesting opcode
cmp dl,PREPROC_bolMax ;are we looking at a bol opcode?
jbe CiLoopNext ;brif so
cmp dl,PREPROC_opEot ;at end of text?
je CiLoopNext ;brif so
cmp dl,PREPROC_opStEndProc ;is this an opStEndproc?
jne CiNotEndProc ;brif not
or si,si ;have we seen preceding OpStSub/Function
jns CiInvBeforeProc ;brif not, illegal before SUB/FUNCTION
CiNotEndProc:
cmp dl,PREPROC_SubOrFuncMin ;is this opStSub or opStFunction?
jb CiNotSubOrFunc
or si,8000H ;set sub of function seen flag
CiNotSubOrFunc:
or si,1 ;set fNonBolSeen flag
CiLoopNext:
push di ;pass otxCur
mov di,ax ;di = otxNext
sub ax,ax ;just get next opcode (not next found in
push ax ; some list)
call TxtFindNextOpDS ;ax = offset to next opcode
cmp ax,di
je CiLoop ;brif opcode is in list
or si,si ;have we seen a SUB or FUNCTION?
js CiLoop ;brif so - ok if after SUB.
;some invalid opcode was found in line
CiInvBeforeProc:
pop si ;recover otx
mov ax,MSG_InvBeforeProcDef
jmp SHORT CiExit
CiLoopExit:
or si,si ;did we see a non-bol?
pop si ;recover otx
jne CiDone ;brif non-Bol seen
cmp [txdCur.TXD_bdlText_cbLogical],CB_EMPTY_TEXT ;is txt tbl empty?
je CiDone ;brif so, allow an opBol
; Inserting a blank line, see if user will allow a single quote rem instead
; We do this so ascii save/ascii load will be able to migrate
; comment blocks correctly with text tables.
;
sub ax,[ps.PS_bdpDst.BDP_pb] ;convert ptr to offset, AskMakeRem
; can cause heap movement
xchg ax,di ;di = offset to opEot
call AskMakeRem ;ask if usr would like a comment instead
add di,[ps.PS_bdpDst.BDP_pb] ;convert offset back to ptr to opEot
or ax,ax ;does user want to back out of edit?
mov ah,-1 ;prepare for back-out
je CiExit ;return high bit set for backout
mov ax,opQuoteRem ;get single quote rem opcode
xchg ax,[di] ;xchg opQuoteRem for opEot
DbAssertRel ax,e,opEot,CP,<ChkInsProc: expected opEot>
push ax ;push opEot (will be emitted last)
sub ax,ax
push ax ;push column for opQuoteRem
inc ax
inc ax ;2 bytes of REM (for column field)
call Emit16_AX ;emit cbRem
call Emit16 ;emit Column (already on stack)
call Emit16 ;emit opEot to ps.pbDst
; (already on stack)
CiDone:
test [prsCur.PRS_flags],FP_ENDPROC
je CiOk ;brif proc has no END SUB/FUNCTION
cmp [ps.PS_bdpDst.BDP_cbLogical],4
jbe CiOk ;brif not inserting a blank line
;user is trying to append something more than a blank
;line (opBol,opEot). See if its beyond the END SUB/FUNCTION statement
sub ax,ax ;search from top of table
push ax
PUSHI ax,<CODEOFFSET tOpEndProc>
call TxtFindOp ;ax = offset to END SUB/FUNCTION
cmp ax,si
jae CiOk ;brif inserted before END SUB/FUNCTION
mov ax,MSG_EndProc
SKIP2_PSW ;skip next instruction
CiOk:
sub ax,ax ;return FALSE (no error)
CiExit:
or ax,ax ;set condition codes for caller
pop di ;restore caller's di
ret
ChkInsProc ENDP
;-------------------------------------------------------------------
; Opcode specific code which gets executed BEFORE pcode is inserted
; in text table. Pixxx stands for Pre Insert <opcode name>
; All of this 'functions' enter with:
; si = otxDelFirst
; di = offset into pcode buffer 'ps.bdpDst'
; ax = pointer into pcode buffer 'ps.bdpDst'
; When they've completed their work, they branch to one of:
; PiNext - normal exit when everything looks ok
; TcUndo - when user has been warned that the edit would prevent
; continuing, and the user responded CANCEL.
; TcAlert0 - ax = error code, when error is to be reported to user
; and line is to be saved as an opReParse
; TcReParse - ax = error code, when error is NOT to be reported to user
; immediately (unless we're going through the reparse loop in preparation
; to execute a direct mode statement). The line is saved as an opReParse.
; TcOmErr - if some memory allocation couldn't be satisfied.
;
;-------------------------------------------------------------------
;extract filename out of OpStInclude(cnt,filename) and/or op_Include
;di points to (opcode,cb,text)
DbPub PiInclude
PiInclude:
push ax
call AskCantCont_CP ;see if user wants to back out of edit
pop ax
jne PiInclCont ;brif ok to edit
jmp TcUndo ;brif user wanted to back out of edit
PiInclCont:
cmp [cInclNest],INCLUDE_DEPTH_MAX
jb NotTmf
or [flagsTm],FTM_reInclude ;cause all $INCLUDE lines to be
;reparsed before next RUN
;so we'll report the error again.
mov ax,ER_TMF ;error: Too many files
J2_TcAlert0:
jmp TcAlert0
NotTmf:
push si ;preserve otxDelFirst
push di ;save offset of opcode
add di,[ps.PS_bdpDst.BDP_pb] ;convert offset to pointer
add di,4 ;point to first byte of operand
push di ;pass pSrc to CopyBlk
push ds
pop es ;set es = dgroup
mov cx,-1
mov al,27H ;search for terminating ' in filename
repne scasb
not cx ;cx = length of filename including '
dec cx ;cx = length of filename
PiOpStInc:
cmp cx,FILNAML ;compare length of name [8]
; to length of static buffer
jb NotTooBig ;brif OK
mov ax,ER_IFN ;report bad filename error
jmp SHORT J2_TcAlert0
NotTooBig:
mov [fInclude],sp ;set flag for loading of include file
DbChk HoldBuf1 ;ensure availability of Buf1 [8]
mov si,dataOFFSET b$SdBuf1 ;si ptr to sd for B$Buf1
mov [si.SD_cb],cx ;save filename length
push [si.SD_pb] ;pass ptr to B$Buf1
push cx ;pass cb to copy
call CopyBlk ;copy $INCLUDE's operand to temp buffer
; we just 0-terminated filename for
; FileExists, set cbLogical to real len
pop di ;recover opcode offset
pop si ;recover otxDelFirst
J1_PiNext:
jmp PiNext
DbPub PiOpStSub
PiOpStSub:
PiOpStFunction:
FLoadActive
jne CheckNestedProcs ;brif loading
;Parser ensures that we will be in SS_RUDE when an insertion
;of a SUB or FUNCTION statement is seen.
cmp [oPrsPreParse],UNDEFINED ;were we in a sub or function?
je NotNestedProcs ;brif not - user entered SUB/FUNCTION
;statement in module level text table
;If we are renaming a SUB/FUNCTION, then the deletion of the
;SUB/FUNCTION line caused the FP_DEFINED flag to be reset.
;If the user just entered a SUB/FUNCTION statement in a SUB or
;FUNCTION, the FP_DEFINED bit will still be set. If the user
;happened to be trying to insert a SUB or FUNCTION, in a SUB
;or FUNCTION that has been commented out, then this new SUB/FUNCTION
;statement will inherit the text table instead of creating a new
;SUB.
test [flagsPrsPreParse],FP_DEFINED ;is this a rename?
je J1_PiNext ;brif so, prs already exists.
jmp SHORT NotNestedProcs
CheckNestedProcs:
;See if we were in an unterminated SUB/FUNCTION. If so,
;then we need to call LoadExitProc to clean up the previous
;call to LoadEnterProc.
DbAssertRelb [fMergeInSub],e,0,CP,<TxtChange: fMergeInSub TRUE when sub/func ins>
NotMergingInSub:
cmp [oPrsPreParse],UNDEFINED ;were we in a SUB/FUNCTION?
je NotNestedProcs ;brif not
push [grs.GRS_oPrsCur] ;push oPrsCur for PrsActivate after
;call to load exit proc
push [oPrsPreParse]
call PrsActivateCP ;activate the previous PRS
call LoadExitProc ;clean up it's state
jnc NotOmErr2 ;brif not out of memory error
PiTcOmErr:
jmp TcOmErr
NotOmErr2:
xchg si,ax ;si = otx of insertion point in
; module's text table
call PrsActivateCP ;activate new Prs(oPrs already on stack)
NotNestedProcs:
;If in ASCII Load, or the user entered SUB or FUNCTION in
;the current window. Parser called PrsDefine to
;create the proc's context and make it current.
;Now make the SUB/FUNCTION's text table
push [prsCur.PRS_ogNam]
push WORD PTR([prsCur.PRS_procType])
call PrsMake
or ax,ax
jne JNE_J1_TcAlert0 ;brif PrsMake err
;Proc definition will be inserted at start of newly created text
;table. Remember where we were in module's text table so we
;can tell LoadEnterProc()
mov [otxMrsDelFirst],si
SetStartOtx si ;set otxDelFirst to 0
or [flagsTc],FTC_GotEnterProc ;set TRUE
FloadActive ;don't change window contents if
jne J1_PiNext ; ascii loading
push [grs.GRS_oRsCur]
call WnResetMove ;tell UI that new SUB/FUNC is active
mov [txdCur.TXD_lnCursor],1 ;position new window's cursor at line 1
mov ax,[ps.PS_bdpDst.BDP_pb] ;bx->start of pcode for cur line
push ax
PUSHI ax,<CODEOFFSET tOpEndProc>
call TxtFindOpDS ;dl = index into tOpEndProc table
cmp dl,ENDPROC_opStEndProc ;does parse buf already have an
;end proc (e.g. was it
;SUB FOO:END SUB)?
je J3_PiNext ;brif so - don't insert endproc
mov cx,6 ;size of 2 bols and opStEndProc
call CheckFreeDstBuf ;see if enough room in parser buf
jz PiTcOmErr ;for inserted pcode. brif not
sub [ps.PS_bdpDst.BDP_cbLogical],2 ;eat the opEot
sub [ps.PS_bdpDst.BDP_pbCur],2 ;eat the opEot
.errnz opBol
sub ax,ax ;ax = opBol
call Emit16_AX ;emit opBol to parser buf to create
; a blank line
.errnz opBol
sub ax,ax ;ax = opBol
call Emit16_AX ;emit opBol to parser buf
mov ax,opStEndProc
call Emit16_AX ;emit opStEndProc to parser buf
mov ax,opEot
call Emit16_AX ;emit opEot to parser buffer
J3_PiNext:
jmp SHORT J2_PiNext
PiOpStEndProc:
mov ax,MSG_InvMain ;Illegal in main program
test [txdCur.TXD_flags],FTX_mrs
JNE_J1_TcAlert0:
jne J1_TcAlert0 ;brif we're looking at module text table
mov ax,MSG_InvIncl ;error msg = illegal in include
test [mrscur.MRS_flags2],FM2_Include
jne J1_TcAlert0 ;error if this is an include module
cmp [cInclNest],0
jne J1_TcAlert0 ;error if merging include file
test [prsCur.PRS_flags],FP_ENDPROC
jne LastNotEndErr ;brif already has END SUB
call OtxEndProg ;ax = otxEndProg (end of user pcode)
cmp si,ax
je PiGotEndProc ;brif inserted at end of text
DbAssertRel ax,a,si,CP,<TxtChange: insertion point of End Proc beyond opEndProg>
sub ax,si ;ax = cbDelta from Insertion point
; to opEndProg
push ax
GetSegTxtCur ;es = text segment
pop bx ;bx = cbDelta
;look at all opcodes between opEndProg (exclusive) and insertion point
;don't allow any opcode except opBol (i.e. only allow trivial blank
;lines from END SUB/FUNCTION to opEndProg. Start search at opcode
;prior to opEndProg, and terminate at insertion point.
EndProcBlankSearch:
mov ax,es:[si+bx-2] ;ax = opcode
.errnz opBol
and ax,OPCODE_MASK ;mask out spaces
jne LastNotEndErr ;brif found non opBol opcode
dec bx
dec bx ;advance to next opcode
jne EndProcBlankSearch
PiGotEndProc:
FLoadActive
je NotMergingInSub1 ;brif not loading
cmp [fMergeInSub],0 ;non-zero if MERGING a file into a SUB
je NotMergingInSub1
MrgInSubErr:
mov ax,MSG_InvProc ;illegal in SUB/FUNCTION
jmp TcReParse
NotMergingInSub1:
or [flagsTc],FTC_GotEndProc ;set TRUE
J2_PiNext:
jmp PiNext
;user is inserting END SUB in window that has one, or before end of table
LastNotEndErr:
mov ax,MSG_EndProc
J1_TcAlert0:
jmp TcAlert0
PiOpStShared:
test [txdCur.TXD_flags],FTX_mrs
je J2_PiNext ;ok if in procedure text table
mov ax,MSG_InvMain ;illegal outside SUB/FUNCTION/DEF FN
jmp SHORT J1_TcAlert0
;See if DATA statement is in a SUB or FUNCTION. If we're ASCII loading,
;the statement will eventually be moved to module level. If the user
;is editing, give an error.
PiOpStData:
cmp [fLoadInclude],FALSE ;[J2]
jne InvProcLevel ;[J2]
FLoadActive
jne J2_PiNext ;brif loading (DATA stmts will be
; moved from prs(s) to mrs at end of
; load
InvProcLevel: ;[J2]
test [txdCur.TXD_flags],FTX_mrs
jne J2_PiNext ;ok if not in procedure text table
jmp short InvProcErr ;invalid in SUB or FUNCTION
;Opcodes which cause ModuleRudeEdit
;DEF FN within SUB/FUNCTION is caught in prsid.asm's MakeProc
PiOpEndSingleDef:
PiOpStEndDef:
test [txdCur.TXD_flags],FTX_mrs
jne NotInSub ;ok if not in procedure text table
InvProcErr:
mov ax,MSG_InvProc ;illegal in SUB/FUNCTION
jmp SHORT J1_TcAlert0
PiOp_Dynamic:
mov [fDynArrays],1 ;set TRUE for ASCII Load
jmp SHORT PiOpStEndType
PiOp_Static:
mov [fDynArrays],FALSE ;set FALSE for ASCII Load
jmp SHORT PiOpStEndType
;Opcodes which cause SystemDescan
; The reason we can't depend on the variable manager to cause a rude edit
; when a NEW common variable is created (as it does for SHARED etc.)
; is because it is legal to have DIM x(1) followed by COMMON x().
;
PiOpStCommon: ;scanner will rebuild common tables
PiOpStOptionBase0:
PiOpStOptionBase1:
PiOpStDefType:
call SystemDescanCP ;implicit parms in DECLARE, SUB,
; FUNCTION stmts need to be rechecked
; by the scanner
;When we insert an A as B in a TYPE/END TYPE block we need to take
; the system to SS_RUDE to force reevaluation of the TYPE block.
;When we insert a SHARED statement, we need to take the system to SS_RUDE
; for the Variable Manager.
;When inserting a CONST statement, we need to take the system to SS_RUDE,
; so that the rude scanner will evaluate the CONST expression.
NotInSub:
PiOpElemRef:
PiOpShared:
PiOpStConst:
PiOpStEndType:
cmp [txdCur.TXD_scanState],SS_RUDE
jae J2_PiNext ; speed opt. - we're already rude
call AskRudeEdit ;see if user wants to back out of edit
je J2_TcUndo ;brif user backed out of edit
jmp Retry ;brif user didn't back out of edit
;re-parse line, won't get back here,
; because now text table is in SS_RUDE
J2_TcUndo:
jmp TcUndo ;undo delete (if any) and return
PiOpStFor:
dec [cForDel] ;cForDel = 1+#FOR stmts deleted
; by TxtDelete.
jmp SHORT PiInsFor
PiOpStForStep:
dec [cForStepDel] ;cForStepDel = 1+#FOR STEP stmts deleted
; by TxtDelete.
PiInsFor:
je AskForCont ;brif we've inserted more FORs than
; were deleted
call FindORsFrame ;see if active prs (if any) has a
; frame on the stack
or ax,ax
je J2_PiNext ;brif not found
;else (can't edit buried prs FOR)
; because it could require change in
; frame size
AskForCont:
call AskCantCont_CP ;see if user wants to back out of edit
je J2_TcUndo ;brif user backed out of edit
jmp SHORT J2_PiNext ;brif user didn't back out of edit
; dispatch table used for processing inserted opcodes.
PiDispatch:
DW PiOp_Static
DW PiOp_Dynamic
DW PiInclude
DW PiOpStSub
DW PiOpStFunction
DW PiOpStEndProc
DW PiOpEndSingleDef
DW PiOpStEndDef
DW PiOpStData
DW PiOpStShared
DW PiOpStDefType
DW PiOpStCommon
DW PiOpStEndType
DW PiOpStFor
DW PiOpStForStep
DW PiOpStConst
DW PiOpShared
DW PiOpStOptionBase0
DW PiOpStOptionBase1
DW PiOpElemRef
;**************************************************************
; TxtParseUndo
; Purpose:
; We are about to make a line into an opReParse.
; Any prs's that were created by this call to ParseLine
; need to be freed.
; We need to deactivate the active prs if it is
; going to be freed.
; Entry:
; ax = oPrs that was active before ParseLine was called.
;
;**************************************************************
cProc TxtParseUndo,<PUBLIC,NEAR>
cBegin
cmp ax,[grs.GRS_oPrsCur]
je NoDeact ;brif parser didn't move into a new PRS
test [txdCur.TXD_flags],FTX_mrs
je NoDeact ;brif new prs has text table (is
; probably the result of renaming
; a prs, and discovering an error
; after the prs was renamed).
push ax
call PrsActivateCP ;get back to module level/old prs
NoDeact:
call ParseUndo ;We must call this before ModuleRudeEdit
; or else we will try to free some
; DEF FN prs's which no-longer exist
call ChkAllUndefPrsSaveRs ;check all undefed prs entries
;in case parser created one before error
cEnd
;**************************************************************
; TxtInsert
; Purpose:
; Insert a block of pcode in the current text table
; Entry:
; si = text offset where new pcode is to be inserted
; ps.bdpDst = buffer to be inserted
; Exit:
; If out-of-memory, returns ax=0 and psw.z set
;
;**************************************************************
PUBLIC TxtInsert
TxtInsert PROC NEAR
push si ;pass otxInsert
push [ps.PS_bdpDst.BDP_cbLogical] ;pass cbIns
call TxtMoveUp
je TInsExit ;brif out-of-memory error
PUSHI ax,<dataOFFSET txdCur.TXD_bdlText>
push si ;pass otxInsert
push [ps.PS_bdpDst.BDP_pb] ;pass ptr to pcode to insert
push [ps.PS_bdpDst.BDP_cbLogical] ;pass cbIns
call BdlCopyTo ;copy from DS to text table
mov ax,sp
TInsExit:
or ax,ax ;set condition codes for caller
ret
TxtInsert ENDP
;**************************************************************
; TxtInsBdl [40]
; Purpose:
; Insert text from a bdl into current text table.
;
; Entry:
; si = text offset where new pcode is to be inserted
; di -> bdl to be inserted
; ax = # bytes to be inserted.
; The start of the text to be copyied
; is always StartOtx
; Exit:
; If out-of-memory, returns ax=0 and psw.z set
;
;**************************************************************
PUBLIC TxtInsBdl
TxtInsBdl PROC NEAR
push ax ;preserve cbInsert
push si ;pass otxInsert
push ax ;pass cbInsert
call TxtMoveUp ;move text starting at otxInsert
; up by cbInsert bytes if possible
pop cx ;cx = cbInsert
jz TIBExit ;brif Out-of-Memory
push di ;pass source bdl
SetStartOtx ax
push ax ;pass otxSrc
PUSHI ax,<dataOFFSET txdCur.TXD_bdlText> ;pass bdlDst
push si ;pass otxDst
push cx ;pass cbInsert
call BdlCopyFromTo ;copy text from the bdl into gap
mov ax,sp ;return non-zero
or ax,ax ;set condition flag
TIBExit:
ret
TxtInsBdl ENDP
;*****************************************************************************
; TxtCopyScrap
; Purpose:
; Copy a block of pcode from the current text table to bdlTxtScrap
;
; Added as part of revision [9]
;
; Entry:
; parm1: otxStart: offset into text table for 1st byte to move
; parm2: oDst: offset of where to place text in Scrap - if non-zero
; this leaves a gap at the start of the buffer
; parm3: cbMove: number of bytes to move
; parm4: fDelete: true if TxtDelete is to be called to delete the text
; FLoadActive should return FALSE if links in deleted text are
; up-to-date
; Exit:
; If out-of-memory error, returns ax = 0, else ax = non-zero
; condition codes set based on value in ax
;
;*****************************************************************************
cProc TxtCopyScrap,<PUBLIC,NEAR>,<di>
parmW otxStart
parmW oDst
parmW cbMove
parmW fDelete
cBegin
DbAssertRel [otxStart],ae,StartOtx,CP,<TxtCopyScrap: bad otxStart>
DbAssertRel [bdlTxtScrap.BDL_status],e,NOT_OWNER,CP,<bdlTxtScrap in use>
mov di,[cbMove] ;di = cbMove for speed
; CALL bdlAlloc(&bdlTxtTemp, cbMove + oDst)
PUSHI ax,<dataOFFSET bdlTxtScrap>
mov ax,di
add ax,[oDst] ;ax = cbMove + oDst
jnz TcsNotZero
inc ax ;cb can't be zero - this is needed
;by TxtDelete
TcsNotZero:
push ax ;total number of bytes to allocate
PUSHBDL_TYPE pgtypEBGeneric,ax ; pass sb type for EB version
call bdlAlloc
or ax,ax
jz TcsExit ;exit if out-of-memory
; CALL bdlCopyFromTo(&txtCur.bdlText, otxStart, - source
; &bdlTxtscrap , oDst, - destination
; cbMove) - number of bytes
PUSHI ax,<dataOFFSET txdCur.TXD_bdlText>
push [otxStart]
PUSHI bx,<dataOFFSET bdlTxtScrap>
push [oDst]
push di ;push cbMove
call BdlCopyFromTo ;no error is possible (checked above)
; if (fDelete) CALL TxtDelete(otxStart, otxStart + cbMove)
cmp [fDelete],FALSE
je TcsReturnTrue ;brif we're not to delete text
mov ax,[otxStart]
push ax ;pass otxStart
add ax,di ;ax = otxStart + cbMove
push ax ;pass otxEnd
call TxtDelete ;delete pcode from prs's text table
TcsReturnTrue:
mov ax,sp ;return TRUE (no error)
TcsExit:
or ax,ax ;set condition codes for caller
cEnd
;**************************************************************
; TxtInsScrap
; Purpose:
; Insert text in Scrap buffer into text table and release
; the Scrap buffer.
;
; Added as part of revision [9]
;
; Entry:
; si = text offset where new pcode is to be inserted
; bdlTxtScrap = buffer to be inserted
; Exit:
; If out-of-memory, returns ax=0 and psw.z set
;
;**************************************************************
PUBLIC TxtInsScrap
TxtInsScrap PROC NEAR
push di ;preserve caller's di
DbChk Otx,si
mov di,dataOFFSET bdlTxtScrap
mov ax,[di.BDL_cbLogical]
DbAssertRel ax,ae,2,CP,<TxtInsScrap: tried to insert empty scrap>
call TxtInsBdl
jz TisExit
; CALL BdlFree(&bdlTxtScrap)
PUSHI ax,<dataOFFSET bdlTxtScrap>
call BdlFree
mov ax,sp
TisExit:
or ax,ax ;set condition codes for caller
pop di ;restore caller's di
ret
TxtInsScrap ENDP
;--------------------------------------------------------------------
;
; Management of linked lists through a text table's pcode:
;
; TxtInsUpdate is called after ANY pcode has been inserted into
; any text table to update static variables and structures affected
; by the pcode inserted (prs definitions etc.). Unfortunately,
; we cannot call UpdateLinks every time TxtChange is called during
; ASCII load, because it would be far too slow. Instead, we call
; it for a block of lines from LoadEnterProc, LoadExitProc, and AsciiMerge.
;
;
; TxtChange TDataEnd TxtPrsInit SaveDeclares ToggleBp
; | | | | |
; +-----------+------+-----------+-----------+
; |
; TxtInsUpdate LoadEnterProc LoadExitProc AsciiMerge TxtEndBigEdit
; | | | | | |
; +---------+ +----------+-----------+-------------+--------+
; | | |
; UpdatePcs UpdatePrs UpdateLinks
;
;--------------------------------------------------------------------
;**************************************************************
; TxtInsUpdate
; Purpose:
; Called after TxtInsert to update program counter and other
; static entries which are affected by pcode movement.
; Entry:
; si = text offset where new pcode was inserted
; bx = text offset beyond last byte of pcode inserted
; If Loading a file (i.e. FLoadActive), or a big edit is active,
; UpdateLinks is not called.
; This makes ASCII Load and BLOCK CUT/COPY/PASTE MUCH faster
; Exit:
; If out-of-memory, returns ax=0 and psw.z set
; NOTE: Out-of-memory is only possible if opStData or opStRestore1
; is being inserted
;
;**************************************************************
cProc TxtInsUpdate,<PUBLIC,NEAR,NODATA>,<di>
localW otxEndInsert
localW oRsSave
cBegin
DbChk Otx,si ;error if > txdCur.bdlText.cbLogical
DbChk Otx,bx ;error if > txdCur.bdlText.cbLogical
mov [otxEndInsert],bx
mov ax,[txdCur.TXD_bdlText_cbLogical]
sub ax,CB_EMPTY_TEXT-StartOtx
cmp bx,ax
jae TiDontUpd ;brif inserting before end-of-text
; Could be true even if we're loading,
; in case of FILE/MERGE, or $INCLUDE.
; *--------------------------------------------------------------
; * pass information about the edit to UpdatePrs in static struct uprs.UPRS_
; * UpdatePrs will update the prs.otx field for all prs entries affected
; * by this text insert.
; *
; *--------------------------------------------------------------
;
mov ax,[grs.GRS_oRsCur]
mov [uprs.UPRS_oRsEdit],ax
mov [uprs.UPRS_otxEdit],si
sub ax,ax ;cbDel = 0
mov [uprs.UPRS_cbDel],ax
sub bx,si ;bx = cbIns
mov [uprs.UPRS_cbIns],bx ;pass cbIns
;Update program counter and any other runtime text pointers
push si ;pass otxInsert
push bx ;pass cbIns
push ax ;pass cbDel (0)
push ax ;fTestOnly = FALSE
call UpdatePcs ;update program counter and any
; stacked return addresses
mov bx,CPOFFSET UpdatePrs
call ForEachPrsInPlaceCPSav ;preserve callers oRs
; If we are in a text paste, then the inserted pcode can only
; contain opBols and opReparses. TxtPaste updates the line
; count, so no further processing is needed.
;
TiDontUpd:
test [flagsTm],FTM_TxtPaste ;are we in a paste operation
jne TiExitTrue ;if so, exit
push si
PUSHI ax,<CODEOFFSET tOpAftIns>
call TxtFindOp ;ax = offset to 1st inserted opcode
;dl = [txtFindIndex]
AiLoop:
xchg di,ax ;di = otxCur
cmp di,[otxEndInsert]
jae AiDone ;brif beyond inserted pcode
DbAssertRelB dl,b,AFTINS_opEot,CP,<TxtInsUpdate - found EOT before expected>
cmp dl,AFTINS_bolInclMax
ja AiChkBol ;brif not opBolInclude opcode
inc [txdCur.TXD_cLinesIncl] ;bump include line count
AiChkBol:
cmp dl,AFTINS_bolMax
ja AiDisp ;brif not opBol opcode
inc [txdCur.TXD_cLines] ;bump line count
AiDisp:
sub dl,AFTINS_dispMin ;adjust index for non-dispatched opcodes
jc AiNext ;brif no more work for this opcode
sub dh,dh ;dx = dispatch index
shl dx,1 ;dx = dispatch offset
mov bx,dx ;bx = dispatch offset
jmp WORD PTR cs:AiDispatch[bx]
;All the AiOpxxx dispatches either branch to an error handler, or AiNext
AiNext:
push di ;pass otxCur
PUSHI ax,<CODEOFFSET tOpAftIns>
call TxtFindNextOp
jmp SHORT AiLoop
; *--------------------------------------------------------------
; * If we're not loading, update all linked lists which traverse
; * the pcode that were affected by the edit.
; * If we did this for every line during ASCII Load, load time
; * would increase about 1000 percent. For ASCII Load, we do
; * it at the end of every procedure's text table, and finally
; * at end of file.
; *
; * This also applies to Big Edits. To speed up block cut/copy/paste
; * we will only update links at the end of a Big Edit.
; *--------------------------------------------------------------
;
AiDone:
FLoadActive
jne TiExitTrue ;brif LOADing a file
; (speed optimization)
cmp [bigEditState],BIG_EDIT_ACTIVE
je TiExitTrue ;brif in a BigEdit
push si ;pass otxInsert
push [otxEndInsert] ;pass offset beyond inserted text
call UpdateLinks ;update linked lists through pcode
DbChk TxdOps ;check for bad linked lists through
; pcode, bad opcodes, etc.
TiExitTrue:
mov ax,sp ;return non-zero (success)
TiExit:
or ax,ax ;set condition codes for caller
cEnd ;TxtInsUpdate
AiDispatch:
DW AiOpBolLab
DW AiOpBolLabSp
DW AiOpLab
DW AiOpLabSp
DW AiOpStSub
DW AiOpStFunction
DW AiOpStDeclare
DW AiOpStCall
DW AiOpStCallS
DW AiOpStCallLess
DW AiOpStEndProc
DW AiOpEndSingleDef
DW AiOpStEndDef
DW AiOpStData
DW AiOpStRestore1
;-------------------------------------------------------------------
; Opcode specific code which gets executed AFTER pcode is inserted
; in text table. Aixxx stands for After Insert <opcode name>
;
; di = offset into text table to opcode
;
;-------------------------------------------------------------------
;set bit that says the label by this name is defined
AiOpLab:
AiOpLabSp:
AiOpBolLab:
AiOpBolLabSp:
lea ax,[di+4] ;pass ptr to oNam field
call GetWOtx ;ax = label's oNam
push ax ;pass it
PUSHI ax,NM_fLineNumLabel
call SetONamMask ;set bit used for duplicate label check
jmp SHORT J1_AiNext
;See if this reference to oPrs is the "strongest" seen so far.
;If so, make it the owner of the prs entry, that is, make the
;prs entry refer back to this text offset.
;
AiOpStSub:
AiOpStFunction:
AiOpStDeclare:
AiOpStCall:
AiOpStCallS:
AiOpStCallLess:
lea ax,[di+4] ;ax = offset to oPrs field
definePrs:
call GetWOtx ;ax = referenced oPrs
push ax ;pass to PrsActivateCP
mov ax,[grs.GRS_oRsCur] ;ax = rs containing new reference
mov [oRsSave],ax
mov [dprs.DPRS_oRs],ax ;fill dprs structure for SetPrsDefn
mov ax,[grs.GRS_oMrsCur]
mov [dprs.DPRS_oMrs],ax
mov [dprs.DPRS_otx],di
test [mrsCur.MRS_flags2],FM2_INCLUDE ;is this an INCLUDE mrs?
jne SetRef ;force it to a "weak" owner
mov al,[txtFindIndex]
mov dl,FP_DEFINED
cmp al,AFTINS_opStDeclare ;compare with txtFindIndex
jb SetFlags ;brif not DECLARE or CALL reference
mov dl,FP_DECLARED
je SetFlags ;brif DECLARE reference
SetRef:
sub dl,dl ;else it must be a CALL reference
SetFlags:
mov [dprs.DPRS_flags],dl
;parm was pushed several lines above
call PrsActivateCP ;activate referenced prs
call SetPrsDefn ;set its defn to dprs.xxx if strongest
push [oRsSave]
call RsActivateCP ;reactivate txt tbl containing the ref
J1_AiNext:
jmp AiNext
;If we're ASCII loading, DATA statements need to be moved from procedure
;level to module level, and RESTORE statements need to be adjusted to
;point to the module level label. Call TDataEntry to mark where this
;DATA/RESTORE statement is. The actual movement will be done by TDataEnd
;when the ASCII load completes.
;
AiOpStData:
mov al,DT_Data
SKIP2_PSW ;skip next 2 byte instr (mov al,const)
AiOpStRestore1:
mov al,DT_Restore
mov bx,di ;bx = otxCur
call TDataEntry ;add entry to table, so we know
; what needs to be moved at end-of-load
jne J1_AiNext ;brif no error
jmp TiExit ;return FALSE (out of memory)
AiOpEndSingleDef:
AiOpStEndDef:
AiOpStEndProc:
;we got an END SUB/FUNCTION.
;Remember we've seen an end-proc for this procedure
or [prsCur.PRS_flags],FP_ENDPROC
jmp SHORT J1_AiNext
;**************************************************************
; ushort TxtBindPrs
; Purpose:
; Called by TxtBindPrsS for each text prs. See comments
; in TxtBindPrsS.
;
;**************************************************************
TxtBindPrs PROC NEAR
push si ;save caller's si,di
push di
DbAssertRelB [txdCur.TXD_scanState],ne,SS_EXECUTE,CP,<TxtBindPrs err1>
mov ax,[grs.GRS_oRsCur] ;Setup for call to SetPrsDefn
mov [dprs.DPRS_oRs],ax
mov ax,[grs.GRS_oMrsCur]
mov [dprs.DPRS_oMrs],ax
sub ax,ax
push ax
PUSHI ax,<CODEOFFSET tOpPrsDef>
call TxtFindOp ;ax=off to 1st opcode with oPrs operand
;dl = [txtFindIndex]
TbLoop:
mov [dprs.DPRS_otx],ax ;pass otx to SetPrsDefn
xchg si,ax ;si = otxCur
cmp dl,PRSDEF_opEot
jne TbNotDone
jmp TbExit ;brif done with loop
TbNotDone:
lea si,[si+4] ;si = otxPrs
cmp dl,PRSDEF_opStDefFn
jne TbNotDefFn1 ;brif not a DEF FN
inc si
inc si ;skip DEF FN's link field
; assert that scan state is SS_RUDE or SS_SUBRUDE
DbAssertRelb [txdCur.TXD_scanState],ae,SS_RUDE,CP,<TxtBindPrs: invalid scan state>
jmp TbNext ;leave DEF FN's operand as an oNam
; when scanState is SS_RUDE
TbNotDefFn1:
mov ax,si
call GetWOtx ;ax = oNam or oPrs
.errnz DCL_oPrs - 2
xchg di,ax ;di = oNam or oPrs
cmp [fBindStatic],TBIND_Save1
jne TbBindNamToPrs
jmp TbBindPrsToNam ;brif binding oPrs to oNam
;convert oNam to oPrs for Binary Load
TbBindNamToPrs:
mov ax,si ;ax = otxPrs
inc ax
inc ax
call GetWOtx ;ax = procAtr field
.errnz DCL_atr - 4
and al,DCLA_oTyp ;al = proc's oTyp
mov dx,ax
sub cx,cx ;cx = FALSE
mov al,[txtFindIndex] ;al = opcode type
cmp al,PRSDEF_DefineMax
DJMP ja TbCall ; brif not DECLARE/SUB/FUNC/DEFFN
;Got a SUB/FUNCTION/DEFFN or DECLARE
.errnz PRSDEF_opStDeclare
or al,al
jne TbNotDeclare ;brif not DECLARE stmt
;Got a DECLARE stmt, dx = procAtr field
;
mov al,dh
and al,03h ;al = procType (PT_SUB, etc.)
.errnz DCLA_procType - 0300h
cbw ;ax = prsType
sub dh,dh ;dx = oTyp
push di ;pass oNam
push ax ;pass proc type
push dx ;pass oTyp
mov al,1 ;(can't push sp because PrsDefine
; expects a byte parm)
push ax ;pass TRUE (for fDeclare)
call PrsDefine ;ax = error code
or ax,ax
jne JNE1_TbErr ;brif error
mov al,FP_DECLARED ;al = flags for SUB/FUNCTION/DEF FN
jmp SHORT TbGotPrs
;Got a SUB/FUNCTION/DEF FN stmt
;al = txtFindIndex = proc type (PT_SUB etc.)
;dx = oTyp
;
TbNotDeclare:
cmp al,PRSDEF_opStDefFn
jne TbNotDefFn ;brif not DEF FN statement
;SUBs and FUNCTIONs already have
;a prs, no need to create one
.errnz ET_IMP
or dl,dl ;test dl for ET_IMP
jne TbNotDefType ;brif explicitly typed
mov ax,si ;pass text offset in ax
call OtxDefTypeCur ;fill tEtCur with default types for
;this text offset
cCall OTypOfONamDefault,<di> ; ax = default oTyp
xchg dx,ax ;dx = default type
TbNotDefType:
push di ;pass oNam
PUSHI ax,PT_DEFFN ;pass procType (PT_DEFFN)
DbAssertRelB dh,e,0,CP,<TxtBindPrs dh!=0>
push dx ;pass oTyp
;pass fDeclare as FALSE if TBIND_Load, TRUE if TBIND_Save2
;If we passed FALSE for TBIND_Save2, we'd get duplicate definition err
;since prs is already declared. In TBIND_Save2, we don't want to
;create a prs entry, we just want to map an oNam to oPrs.
sub ax,ax
mov al,[fBindStatic]
.errnz TBIND_Load
push ax ;pass fDeclare
call PrsDefine
or ax,ax
JNE1_TbErr:
jne TbErr ;brif error
TbNotDefFn:
mov al,FP_DEFINED ;al = flags for SUB/FUNCTION/DEF FN
TbGotPrs:
mov di,[grs.GRS_oPrsCur] ;di = oPrs
DbAssertRel di,ne,UNDEFINED,CP,<TxtBindPrs err2>
jmp SHORT TbSetDefn
TbCall:
;Got some kind of CALL statement
push di ;pass oNam
PUSHI ax,PT_SUB
PUSHI ax,UNDEFINED
call PrsRef ;ax = oPrs (or error code if MSB set)
js TbErr ;brif error (like out-of-memory)
mov di,ax ;save di = oPrs
push ax ;pass oPrs
call PrsActivateCP
sub al,al ;SetPrsDefn flags = 0 (CALL)
TbSetDefn:
mov [dprs.DPRS_flags],al
call SetPrsDefn ;definition is in static struct dprs
push [dprs.DPRS_oRs]
call RsActivateCP
jmp SHORT TbPut
;convert oPrs to oNam for Binary Save
TbBindPrsToNam:
push di ;pass oPrs
call FieldsOfPrs ;ax = prs's oNam.
mov di,ax ;di = oNam
TbPut:
push si ;pass otxPrs
push di ;pass oNam/oPrs
call PutWOtx
TbNext:
push [dprs.DPRS_otx] ;pass otxCur
PUSHI ax,<CODEOFFSET tOpPrsDef>
call TxtFindNextOp
jmp TbLoop
;Error is not necessarily fatal, for example, during Binary Save
;TxtBindPrsS(0) is called, then TxtBindPrsS(TRUE) is called. In this
;case, TxtBindPrsS(TRUE) will always report duplicate definition errors.
;The caller (binary Save) ignores errors - It is only meaningful
;during binary load.
TbErr:
and ah,7FH ;turn off MSB (set by PrsDefine)
mov [bindErrCode],ax
jmp SHORT TbNext
TbExit:
mov [txdcur.TXD_ScanState],SS_RUDE ;if binding change scanstate
;from SUBRUDE to RUDE otw it will
;already be in rude & this is a NOP
mov ax,sp ;return TRUE (non-zero)
pop di ;save caller's si,di
pop si
ret
TxtBindPrs ENDP
;**************************************************************
; ushort TxtBindPrsS(ax:fBind)
; Purpose:
; Called during Binary Load with fBind==TRUE to go through all
; text tables just loaded, and for each opcode which refers to
; a prs (opStSub/Function/DefFn/Declare/Call/CallS) convert
; the prs id from oNam to oPrs.
;
; Called during Binary Save with fBind==FALSE to go through all
; text tables about to be saved, and for each opcode which refers
; to a prs (opStSub/Function/DefFn/Declare/Call/CallS) convert
; the prs id from oPrs to oNam.
; This is because, when the module is re-loaded, offsets into the
; procedure table may not be the same.
;
; Entry:
; al = TBIND_Load: map pcode oNam->oPrs, call PrsDefine
; TBIND_Save1: map pcode oPrs->oNam - called before writing to file
; TBIND_Save2: map pcode oNam->oPrs - called after writing to file
; grs.fDirect must be FALSE
; grs.oMrsCur identifies module just loaded.
; All text tables in this mrs are assumed to be in SS_RUDE or SS_PARSE
;
; Exit:
; returns 0 if no error, else a standard Basic error code.
; condition codes are set based on value in ax
; NOTE: If called with ax = zero, no error is possible, and no
; heap movement will occur - Binary Save depends on this.
;
;**************************************************************
PUBLIC TxtBindPrsS
TxtBindPrsS PROC NEAR
mov [fBindStatic],al
mov [bindErrCode],0
DbAssertRelB [grs.GRS_fDirect],e,FALSE,CP,<TxtBindPrsS:fDirect TRUE>
;convert the module's text table and each procedure's text table
mov bx,CPOFFSET TxtBindPrs
call ForEachTxtTblInMrs
mov ax,[bindErrCode] ;return error code to caller
or ax,ax ;set condition codes for caller
ret
TxtBindPrsS ENDP
;----------------------------------------------------------------------
; BigEdit Related Functions
;
; These EditMgr operations translate into several Text Manager calls:
; Split Line:
; ReplaceLineBuf -> TxtChange(1st half of line, delete split line)
; InsertLineBuf -> TxtChange(2nd half of line, no delete)
;
; Join Lines:
; DeleteLinesInBuf -> TxtChange(delete 2 lines, no insert)
; InsertLineBuf -> TxtChange(joined lines, no delete)
;
; Block Paste:
; DeleteLinesInBuf(selected lines)
; InsertLineBuf -> TxtChange(1st line, no delete)
; :
; InsertLineBuf -> TxtChange(nth line, no delete)
;
; The text manager takes advantage of the fact that no big edit does more
; than 1 delete of any of the user's original pcode. It would need more
; than 1 bdTxtScrap if this were not the case.
;
; This presents a problem for Edit & Continue, since the nth text manager
; call may be the 1st operation that would prevent continuing.
; When we know we're in a BigEdit (by examining 'bigEditState'),
; all calls to TxtChange are done as a ReParse. When the BigEdit is done,
; (i.e. when TxtEndBigEdit is called), we ReParse all lines entered
; during the BigEdit, and if any would prevent continuing, and the user
; indicates he wants to back out of the edit:
; The inserted text (otxBigIns, cbBigIns) is deleted (via TxtDelete)
;
; As a speed optimization for block paste, we only update the txt links
; at the end of a big edit. This significantly reduces the over head for
; large edit operations.
;
; The following shows the BigEdit related actions performed by various routines:
;
; bigEditState is initialized to BIG_EDIT_FALSE
;
; TxtStartBigEdit:
; bigEditState = BIG_EDIT_ACTIVE
; fFillScrap = TRUE
; cbBigIns = 0
; otxBigIns = UNDEFINED
;
; TxtDelete(otxDelFirst, otxDelLast)
; If bigEditState == BIG_EDIT_CANCEL, return without changing anything
; If delete would prevent continuing, & user wants to back out of edit,
; if bigEditState == BIG_EDIT_ACTIVE, then bigEditState = BIG_EDIT_CANCEL
; return without changing anything
; If fFillScrap and bdTxtScrap is empty,
; fFillScrap = FALSE
; copy deleted text to bdTxtScrap
; otxScrap = otxDelFirst
; If cbBigIns > 0, cbBigIns -= cbDel
;
; TxtChange(otxDelFirst, otxDelLast, fNoInsert)
; If bigEditState == BIG_EDIT_CANCEL, return without changing anything
; fFillScrap = TRUE
; If otxDelFirst != otxDelLast
; if TxtDelete(otxDelFirst, otxDelLast) == FALSE
; return without changing any pcode (user wants to back out of edit)
; If fNoInsert return
; fFillScrap = FALSE
; If bigEditState == BIG_EDIT_ACTIVE
; insert line as an opReParse
; cbBigIns += cbInsert
; if otxDelFirst < otxBigIns
; otxBigIns = otxDelFirst
; else
; Parse source line to pcode
; If insert would prevent continuing, and user wants to back out of edit,
; If cbBigIns > 0, TxtDelete(otxBigIns, otxBigIns + cbBigIns)
; If bdTxtScrap is not empty, Insert bdTxtScrap at otxScrap
; bigEditState = BIG_EDIT_CANCEL
;
; TxtEndBigEdit:
; bigEditState = BIG_EDIT_REPARSE
; otxCur = otxBigIns
; While bigEditState != BIG_EDIT_CANCEL && otxCur < otxBigIns + cbBigIns
; call TxtChange to reparse line at otxCur
; otxCur = next opReParse(otxCur)
; release bdTxtScrap
; call update links to rethread the pcode linked lists.
;
;-------------------------------------------------------
;**************************************************************
; TxtStartBigEdit()
; Purpose:
; Called by the Edit Mgr at the start of some operation which results
; multiple calls to InsertLineInBuf/ReplaceLineBuf/DeleteLinesBuf.
; Examples include multi-line-paste/cut/copy, line-split, line-join.
;
;**************************************************************
cProc TxtStartBigEdit,<PUBLIC,FAR>
cBegin TxtStartBigEdit
DbAssertRelB [bigEditState],e,BIG_EDIT_FALSE,CP,<TxtStartBigEdit:Already in big edit>
mov [bigEditState],BIG_EDIT_ACTIVE
and [flagsTm],NOT FTM_BpDeleted ;clear BP deleted flag
mov [cForDel],1
mov [cForStepDel],1
sub ax,ax ;ax = 0
mov [cbBigIns],ax ;cbBigIns = 0
dec ax ;ax = FFFF
mov [otxBigIns],ax ;otxBigIns = UNDEFINED
mov [fFillScrap],al ;fFillScrap = TRUE
cEnd TxtStartBigEdit
;**************************************************************
; bool TxtEndBigEdit()
; Purpose:
; Called by the Edit Mgr at the end of some operation which results
; multiple calls to InsertLineInBuf/ReplaceLineBuf/DeleteLinesBuf.
; Exit:
; same as TxtChange
;
;**************************************************************
cProc TxtEndBigEdit,<PUBLIC,FAR>,<si,di>
cBegin TxtEndBigEdit
DbAssertRelB [bigEditState],ne,BIG_EDIT_FALSE,CP,<TxtEndBigEdit:Not in big edit>
sub ax,ax ;prepare to return 0
mov si,[otxBigIns] ;si = otxStart of big edit
inc si ;did any edit occur?
jz TeDone ;brif not
dec si
mov di,si
add di,[cbBigIns] ;di = otxEnd of big edit
cmp [bigEditState],BIG_EDIT_ACTIVE ;did we successfully complete
jne TeLoop ;the big edit - brif backed out
push si
push di
call UpdateLinks ;update txt threads before processing
;op reparse list.
DbChk TxdOps ;check for bad linked lists through
; pcode, bad opcodes, etc.
mov cx,[grs.GRS_oRsCur] ;cx = oRsCur on entry
TeLoop:
sub ax,ax ;prepare to return 0
test [mrsCur.MRS_flags2],FM2_NoPcode
jne TeDone ;if document or command window, done
cmp [bigEditState],BIG_EDIT_CANCEL
je TeDone ;brif user backed out of BigEdit
cmp cx,[grs.GRS_oRsCur] ;did we change from one SUB/FUNCION
; into a different SUB/FUNCTION?
jne TeDone ;brif so, leave the rest of edit as
; opReparses.
mov [bigEditState],BIG_EDIT_REPARSE
mov ax,si ;pass otxStart to DoReParse
mov bx,di ;bx = otx to stop looking for opReParse
sub di,[txdCur.TXD_bdlText_cbLogical]
;prepare for add di,_cbLogical below
push cx ;preserve entry oRs
call DoReParse ;parse next opReParse in text table
;ax = non-zero if serious error
pop cx ;recover entry oRs
jc TeDone ;brif this edit caused an error
add di,[txdCur.TXD_bdlText_cbLogical]
;adjust terminating otx for delta this
; edit caused.
jmp SHORT TeLoop ;brif 1 line was successfully reparsed
;ax = error code (0 if none)
TeDone:
cmp [bdlTxtScrap.BDL_status],NOT_OWNER
je TeDontFree
push ax ;save return value from DoReParse
PUSHI ax,<dataOFFSET bdlTxtScrap>
call BdlFree ;release DELETE scrap
pop ax ;ax = DoReParse (and TxtChange's)
; return value
TeDontFree:
mov [bigEditState],BIG_EDIT_FALSE
cmp ax,ER_OM
je TeExit
cmp ax, MSG_GoDirect ; Also, allow this error
je TeExit
sub ax,ax ;all errors except Out-of-memory
; are ignored. User may be joining
; or spliting two lines, which will
; temporarily result in a syntax error,
; which the user fully intends to fix.
; Giving the error when the user
; moves off the line is soon enough.
; Anything else is very annoying.
TeExit:
cEnd TxtEndBigEdit
;**************************************************************
; ushort FAR TxtPaste(otxInsert, oRsSrc)
;
; Purpose:
; The editor calls TxtPaste() to insert a block of
; opReparses into a text table. This is called in
; association with BigEdits, after TxtStartBigEdit,
; and prior to TxtEndBigEdit. This speeds up block
; pastes since the opReparses that are in the scrap
; do not have to be listed to ascii, and multiple
; TxtChange calls are avoided.
; TxtDescan() should be called before this, to ensure that
; the text table is descanned to SS_PARSE state.
;
; Entry:
; grs.oMrsCur, grs.oPrsCur have their usual meaning
; parm1: ushort otxInsert - text table offset to opBol
; opcode for where lines should be inserted.
; parm2: ushort oMrsSrc - Describes the MRS and text table
; containing the block to be inserted.
;
; Exit:
; ax = 0 if out of memory
;
;**************************************************************
; This version of TxtPaste will not work in EB since it pushes pointers
; to text tables onto the stack and calls RsActivate.
cProc TxtPaste,<PUBLIC,FAR>,<si,di>
parmW otxInsert
parmW oRsSrc
localW cbIns
cBegin
mov [fFillScrap],0 ;just paste, nothing to put in Scrap
push [grs.GRS_oRsCur] ;save destination oRs
push [oRsSrc]
call RsActivateCP ;activate Src txt table
mov ax,[txdCur.TXD_bdlText_cbLogical] ;get size of text to copy
sub ax,CB_EMPTY_TEXT-StartOtx ;don't include opEndProg and opEot
mov [cbIns],ax ;save amount to move. We can't assign
; to cbBigIns until after we have called
; TxtMoveUp in case of OM.
mov di,[txdCur.TXD_cLines] ;grap number of lines in source buf
call RsActivateCP ;reactivate oRsDst (already on stack)
; Make room for reparse block
mov ax,[otxInsert] ;get insertion point
mov [otxBigIns],ax ;remember for TxtEndBigEdit
push ax ;pass insertion point
push [cbIns] ;pass amount of space to free
call TxtMoveUp
je TxtPasteExit ;brif out-of-memory error
mov ax,[cbIns]
mov [cbBigIns],ax ;save amount moved for TxtEndBigEdit
add [txdCur.TXD_cLines],di ;adjust dest for inserted lines
; Copy bytes to txdcur from source txt table
DbSegMoveOff ;assert no far calls
push [grs.GRS_oRsCur] ;save destination oRs for reactivation
; after move
push ds ;save dgroup
GetSegTxtCur ;es = seg adr of current txt tbl
push es ;save dest seg
push [oRsSrc]
call RsActivateCP ;activate Src txt table
GetSegTxtCur ;es = seg adr of current txt tbl
mov cx,[cbIns]
SetStartOtx si ;start of src txt table
mov di,[otxInsert] ;insert at otxInsert in cur text table
push es
pop ds ;ds = txt seg of src
pop es ;es = txt seg of dst
shr cx,1 ;move words
rep movsw ;insert opReparses
pop ds ;recover ds = dgroup
DbSegMoveOn ;Far calls are OK again
DbAssertFlags nc,CP,<TxtPaste: err2>
call RsActivateCP ;reactivate oRsDst (already on stack)
mov si,[otxInsert]
mov bx,si ;si = otxInsert
add bx,[cbIns] ;bx = otxAfterInsert
or [flagsTm],FTM_TxtPaste ;we are pasting, so don't update line
; count.
call TxtInsUpdate ;update line count, IP, etc.
and [flagsTm],NOT FTM_TxtPaste ;clear paste flag
; OpReparse links will be updated by call to TxtEndBigEdit from
; otxBigIns to otxBigIns+cbBigIns
;
DbChk TxdOps ;check for bad linked lists through
; pcode, bad opcodes, etc.
mov ax,sp ;return True
TxtPasteExit:
cEnd
sEnd CP
end
|
programs/oeis/110/A110391.asm | neoneye/loda | 22 | 244065 | ; A110391: a(n) = L(3*n)/L(n), where L(n) = Lucas number.
; 1,4,6,19,46,124,321,844,2206,5779,15126,39604,103681,271444,710646,1860499,4870846,12752044,33385281,87403804,228826126,599074579,1568397606,4106118244,10749957121,28143753124,73681302246,192900153619,505019158606,1322157322204,3461452808001,9062201101804,23725150497406,62113250390419,162614600673846,425730551631124,1114577054219521,2918000611027444,7639424778862806,20000273725560979,52361396397820126,137083915467899404,358890350005878081,939587134549734844,2459871053643326446,6440026026380244499,16860207025497407046,44140595050111976644,115561578124838522881,302544139324403592004,792070839848372253126,2073668380220713167379,5428934300813767249006,14213134522220588579644,37210469265847998489921,97418273275323406890124,255044350560122222180446,667714778405043259651219,1748099984655007556773206,4576585175559979410668404,11981655542024930675232001,31368381450514812615027604,82123488809519507169850806,215002084978043708894524819,562882766124611619513723646,1473646213395791149646646124,3858055874062761829426214721,10100521408792494338631998044,26443508352314721186469779406,69230003648151669220777340179,181246502592140286475862241126,474509504128269190206809383204,1242282009792667284144565908481,3252336525249732662226888342244,8514727565956530702536099118246,22291846172619859445381409012499,58360810951903047633608127919246,152790586683089283455442974745244,400010949097364802732720796316481,1047242260609005124742719414204204,2741715832729650571495437446296126,7177905237579946589743592924684179,18791999880010189197735341327756406,49198094402450621003462431058585044,128802283327341673812651951847998721,337208755579574400434493424485411124,882823983411381527490828321608234646
mov $2,$0
seq $0,240926 ; a(n) = 2 + L(2*n) = 2 + A005248(n), n >= 0, with the Lucas numbers (A000032).
gcd $2,2
mul $2,2
sub $2,1
sub $0,$2
|
inst/scripts/get-filename.applescript | gaborcsardi/keynote | 27 | 2027 | <filename>inst/scripts/get-filename.applescript
on run argv
set myid to item 1 of argv
tell application "Keynote"
set mydoc to document id myid of application "Keynote"
set myprops to properties of mydoc
set myfile to file of myprops
if myfile is missing value
myfile
else
get POSIX path of (file of myprops)
end if
end tell
end run
|
programs/oeis/184/A184036.asm | neoneye/loda | 22 | 240135 | <reponame>neoneye/loda<filename>programs/oeis/184/A184036.asm
; A184036: 1/16 the number of (n+1) X 7 0..3 arrays with all 2 X 2 subblocks having the same four values.
; 325,337,358,400,478,634,934,1534,2710,5062,9718,19030,37558,74614,148534,296374,591670,1182262,2362678,4723510,9443638,18883894,37761334,75516214,151019830,302027062,604029238,1208033590,2416017718,4831985974,9663873334,19327648054,38655099190,77310001462,154619609398,309238825270,618476863798,1236952940854,2473904308534,4947807043894,9895610941750,19791218737462,39582431183158,79164856074550,158329699565878,316659386548534,633318747930934,1266637470695734,2533274891059510,5066549731787062,10133099362910518,20266198625157430,40532397048987958,81064793896649014,162129587390644534,324259174378635574,648518347951964470,1297036695098622262,2594073388586631478,5188146775562649910,10376293547904074038,20752587092586922294,41505174178731393334,83010348351020335414,166020696689155768630,332041393365426635062,664082786705083466038,1328165573384397127990,2656331146717254648118,5312662293382969688374,10625324586662860161334,21250649173222641107254,42501298346239123783990,85002596692272089137462,170005193384131861414198,340010386767851405967670,680020773534878178214198,1360041547068931722707254,2720083094136214177972534,5440166188270779088503094,10880332376538259642122550,21760664753073220749361462,43521329506139844428955958,87042659012273091788144950,174085318024532989436756278,348170636049052784733978934,696341272098079181188890934,1392682544196131974098714934,2785365088392211171639296310,5570730176784369566720459062,11141460353568633580324651318,22282920707137161607533035830,44565841414274112108833538358,89131682828548013111434543414,178263365657095604010404020534,356526731314190785808342974774,713053462628380727191755817270,1426106925256760609958581502262,2852213850513519531067302740278,5704427701027037373284745216310
mov $1,4
mov $2,$0
lpb $0
mul $1,2
add $1,$2
sub $1,$0
sub $0,1
trn $2,2
lpe
sub $1,4
mul $1,3
add $1,325
mov $0,$1
|
src/base/f64_truncd.asm | rainer-erdmann/libm64 | 0 | 172671 | <reponame>rainer-erdmann/libm64<gh_stars>0
;
; FILENAME : f64_truncd.asm
;
; DESCRIPTION :
; double truncd(double v)
; double ceild(double v)
; double floord(double v)
; double rintd(double v)
; long lrintd(double v)
; long long llrintd(double v)
; double roundd(double v)
; long lroundd(double v)
; long long llroundd(double v)
; int isintegerd(double v)
;
; assembly module written for MASM/NASM
; x86 and x64 code
; we grouped these function into one file
; because we do really use self modifying
; code here for the x86 versions.
; we do not need cpu dispatching for x64
; because almost all x64 cpus support sse4.1
; the x86 versions use sse2 code as default
; and can be switched to sse4.1 code.
;
; remarks:
; - we do not yet dispatch the sse3 inst fisttp
; used in the x86 version of llround
;
;
; AUTHOR : <NAME>
;
; Copyright 2016-2019 <NAME>
;
; License: see accompanying file license.txt
;
; CHANGES :
;
; REF NO VERSION DATE WHO DETAIL
;
IFDEF @Version
INCLUDE common.masm
ELSE
INCLUDE 'common.nasm'
ENDIF
IMPORT C10, ?C10@@3NB, QWORD
IMPORT C05, ?C05@@3NB
IMPORT M7FF, ?M7FF@@3XA
IMPORT useSSE41, ?useSSE41@@3_NA
.data
AMASK dq 08000000000000000h, 08000000000000000h
; this is nextdown(0.5)
OMASK dq 03fdfffffffffffffh, 03fdfffffffffffffh
ZERO dq 0, 0
RIFA64 dq 04330000000000000h; 03ff0000000000000h + (52<<52)
dq 04330000000000000h; 03ff0000000000000h + (52<<52)
_MM_FROUND_TO_NEAREST_INT EQU 0
_MM_FROUND_TO_NEG_INF EQU 1
_MM_FROUND_TO_POS_INF EQU 2
_MM_FROUND_TO_ZERO EQU 3
IFDEF _M_X64 ; 64bit
; x64 - x64 - x64 - x64 - x64 - x64 - x64 - x64 - x64 - x64 - x64
IF 0
isintd_o dq 0
truncd_o dq 0
rintd_o dq 0
roundd_o dq 0
floord_o dq 0
ceild_o dq 0
%macro PATCH 2
mov al , [%1]
cmp al, 0ebh ; rel8 jmp
jnz %%neb
movzx eax, _W [%1]
mov _D [%2], eax
mov _W [%1], 09090h ; replace by nop
jmp %%do1
%%neb:
cmp al, 0e9h ; rel32
jnz %%do1
mov rax, _Q [%1]
mov byte [%2], al
shr rax, 8
mov _D [%2+1], eax
mov byte [%1], 090h
mov _D [%1+1], 090909090h
%%do1:
%endmacro
%macro UNPATCH 2
mov al , [%2]
cmp al, 0ebh ; rel8 jmp
jnz %%neb
movzx eax, _W [%2]
mov _W [%1], ax
jmp %%do1
%%neb:
cmp al, 0e9h ; rel32
jnz %%do1
mov rax, _Q [%2]
mov byte [%1], al
shr rax, 8
mov _D [%1+1], eax
%%do1:
%endmacro
ENDIF
.code
; segment mytext PUBLIC ALIGN=16 exec write
; segment RWCODE; PUBLIC ALIGN=16
; global rintt
PUBLIC rintt
rintt dq rintp, rintn, rintd
; not a good idea; because x64
; uses rip-relative addressing
; means we cannot use memory references
; in the moved code!!!
; we can use a different technique
; place a jmp in the first func
; and changing the offset
; jmps are
; EB <rel8> or
; E9 <rel32>
; and we have to set the offset to 0
; the jmp costs ~2.5cy
; other way:
; NO sm code;
; just testing a bit and jumping
; costs 0.75 if not taken and 2 if taken
ENTRY init_sse41, YAXH@Z
ret
IF 0
test ecx, ecx
jz .no
test _B [useSSE41], 1
jz .no
PATCH isintd_v, isintd_o
PATCH truncd_v, truncd_o
PATCH rintd_v, rintd_o
PATCH roundd_v, roundd_o
PATCH floord_v, floord_o
PATCH ceild_v, ceild_o
IF 0
mov esi, rintd_vsse41s
mov ecx, rintd_vsse41e
sub ecx, esi
mov edi, rintd_v
rep movsb
mov esi, roundd_vsse41s
mov ecx, roundd_vsse41e
sub ecx, esi
mov edi, roundd_v
rep movsb
ENDIF
ret
.no:
UNPATCH isintd_v, isintd_o
UNPATCH truncd_v, truncd_o
UNPATCH rintd_v, rintd_o
UNPATCH roundd_v, roundd_o
UNPATCH floord_v, floord_o
UNPATCH ceild_v, ceild_o
ENDIF
ret
; routines using round
; most in truncd
; sin, cos, tan
; exp + co
; sinh, cosh, tanh
;
; again, again
; how to trunc?
; 0 < x < 1
; sub 0.5 and rint?
; |x| > RIFA => isint
ENTRY isintegerd, YA_NN@Z
isintd_v:
test _B [useSSE41], 1
jz .n41
; if we have sse4.1..
; (except the very first all x64 cpus have sse4.1)
; 7.0 HAS
; 6.0..7.0 SAN
roundsd xmm1, xmm0, 3 ; trunc
subsd xmm0, xmm1
movq rax, xmm0 ; might get trouble with -0
; test rax, rax ; but it does not
shl rax, 1
setz al
ret
xorpd xmm2, xmm2
comisd xmm0, xmm2
; comisd xmm0, xmm1 ; would tell us INF = integer
setnp dl
setz al
and al, dl
ret
.n41:
pextrw eax, xmm0, 3
shr eax, 4
and eax, 07ffh
sub eax, 03ffh
jl .zero
cmp eax, 52
jge .int
mov ecx, 52
sub ecx, eax
movd xmm3, ecx
movdqa xmm1, xmm0
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm3 ; shift mask
pand xmm1, xmm2 ; = trunc(x)
comisd xmm0, xmm1 ; x == trunc(x)
setz al
ret
.zero:
pxor xmm2, xmm2
comisd xmm0, xmm2
setz al
ret
.int:
cmp eax, 0400h ; INF, NAN
setl al
ret
;"double __cdecl __trunc(double)" (?__trunc@@YANN@Z)
ENTRY truncd
ENTRY truncd, YANN@Z
; test _B [useSSE41], 1
; jz .n41
; 4.0..4.5 HAS
; does not get slow on DEN, INF or NAN
; 6.0..6.6 SAN
; roundsd xmm0, xmm0, _MM_FROUND_TO_ZERO
; ret
.n41:
; does not get slow on DEN, INF or NAN
; is correct and not much slower than roundsd SSE4
movq rax, xmm0
; btr rax, 63
; shr rax, 52
add rax, rax ; see ftest for this
shr rax, 53
cmp eax, 3ffh
jl .zero ; => |x| < 1.0
mov ecx, 52 + 3ffh
sub ecx, eax
jle .int ; => |x| >= 2^52
movd xmm1, ecx
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1
; andpd xmm0, xmm2
; here the pand is faster (no domain change)
pand xmm0, xmm2
ret
.zero:
xorpd xmm0, xmm0
ret
.int:
ret
; how to trunc, if we only have round?
; if (x >= 0)
; if (x - y) > 0 ok, we rounded toward zero
; else y -= 1
; else
; if (x - y) < 0 ok, we rounded toward zero
; else y += 1
ENTRY ceild, YANN@Z
; 4.0..6.0 HAS; should be 6 from latency
test _B [useSSE41], 1
jz .n41
roundsd xmm0, xmm0, _MM_FROUND_TO_POS_INF
ret
.n41:
movq rax, xmm0
btr rax, 63
shr rax, 52
cmp eax, 03ffh
jl .zero
mov ecx, 52 + 3ffh
sub ecx, eax ; => shift
jle .int
movd xmm1, ecx
movdqa xmm3, xmm0 ; copy for later use
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1 ; mask
andpd xmm0, xmm2 ; => trunc(x)
comisd xmm3, xmm0 ; x < trunc(x)
jbe .nadd1
addsd xmm0, _Q [C10]
.nadd1:
ret
.zero:
movdqa xmm3, xmm0
xorpd xmm0, xmm0
comisd xmm3, xmm0
jbe .nadd2
movsd xmm0, _Q [C10]
.nadd2:
ret
.int:
ret
ENTRY floord, YANN@Z
; 4.0..6.0 HAS
test _B [useSSE41], 1
jz .n41
roundsd xmm0, xmm0, _MM_FROUND_TO_NEG_INF
ret
.n41:
movq rax, xmm0
btr rax, 63
shr rax, 52
cmp eax, 03ffh
jl .zero
mov ecx, 52 + 3ffh
sub ecx, eax ; => shift
jle .int
movd xmm1, ecx
movdqa xmm3, xmm0 ; copy for later use
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1 ; mask
andpd xmm0, xmm2 ; => trunc(x)
comisd xmm3, xmm0 ; x < trunc(x)
jae .nadd
subsd xmm0, [C10]
.nadd:
ret
.zero:
movdqa xmm3, xmm0
xorpd xmm0, xmm0
comisd xmm3, xmm0
jae .nadd2
subsd xmm0, [C10]
.nadd2:
ret
.int:
ret
ENTRY rintd, YANN@Z
; 4.0..6.0 HAS; should be 6 from latency
test _B [useSSE41], 1
jz .n41
roundsd xmm0, xmm0, _MM_FROUND_TO_NEAREST_INT
ret
.n41:
IF 0
; 7/9 HAS
comisd xmm0, [ZERO]
jb .rintn
addpd xmm0, [RIFA64]
subpd xmm0, [RIFA64]
ret
.rintn:
subpd xmm0, [RIFA64]
addpd xmm0, [RIFA64]
ret
ENDIF
; 8 HAS
movsd xmm1, [RIFA64]
; now copy the sign of x to xmm1
xorpd xmm1, xmm0
andpd xmm1, _X [M7FF]
xorpd xmm1, xmm0
addsd xmm0, xmm1
subsd xmm0, xmm1
ret
; we do not know the sign
; we always round xmm1
; and do not use any other reg
; and we operate on both packed doubles
ENTRY rintd
comisd xmm1, [ZERO]
jb .rintn
addpd xmm1, [RIFA64]
subpd xmm1, [RIFA64]
ret
align 16
.rintn:
subpd xmm1, [RIFA64]
addpd xmm1, [RIFA64]
ret
; we know the sign of xmm1 is pos or zero
ENTRY rintp
addpd xmm1, [RIFA64]
subpd xmm1, [RIFA64]
ret
; we know the sign of xmm0 is neg or zero
ENTRY rintn
subpd xmm1, [RIFA64]
addpd xmm1, [RIFA64]
ret
;"long __cdecl lrintd(double)" (?lrintd@@YAJN@Z)
ENTRY lrintd, YAJN@Z
; 5.5..6.0 HAS
; 6.0 SAN
cvtsd2si eax, xmm0
ret
;"__int64 __cdecl llrintd(double)" (?llrintd@@YA_JN@Z)
ENTRY llrintd, YA_JN@Z
; 5.0..5.0 HAS
; 6.0 SAN
cvtsd2si rax, xmm0
ret
ENTRY roundd, YANN@Z
roundd_v:
test _B [useSSE41], 1
jz .n41
; 6.0..6.3 SSE SAN
; 5.0..5.0 HAS
movdqa xmm1, xmm0
andpd xmm0, _X [AMASK]
orpd xmm0, _X [OMASK]
addsd xmm0, xmm1
roundsd xmm0, xmm0, _MM_FROUND_TO_ZERO
ret
.n41:
movdqa xmm1, xmm0
andpd xmm0, _X [AMASK]
orpd xmm0, _X [OMASK]
addsd xmm0, xmm1
movq rax, xmm0
btr rax, 63
shr rax, 52
cmp eax, 03ffh
jl .zero
mov ecx, 52 + 3ffh
sub ecx, eax
jle .int
movd xmm1, ecx
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1
andpd xmm0, xmm2
ret
.zero:
xorpd xmm0, xmm0
ret
.int:
ret
align 16
; 6.0..7.3 AVX SAN
vandpd xmm1, xmm0, _X [AMASK]
orpd xmm1, _X [OMASK]
addpd xmm0, xmm1
roundsd xmm0, xmm0, _MM_FROUND_TO_ZERO
ret
ENTRY lroundd, YAJN@Z
; 4.0..5.5 HAS
; 6.0 SSE SAN
movdqa xmm1, xmm0
andpd xmm0, _X [AMASK]
orpd xmm0, _X [OMASK]
addsd xmm0, xmm1
cvttsd2si eax, xmm0
ret
align 16
vandpd xmm1, xmm0, _X [AMASK]
orpd xmm1, _X [OMASK]
addpd xmm0, xmm1
cvttsd2si eax, xmm0
ret
ENTRY llroundd, YA_JN@Z
; 4.0..6.0 HAS
; 6.0..6.5 SSE SAN
movdqa xmm1, xmm0
andpd xmm0, _X [AMASK]
orpd xmm0, _X [OMASK]
addpd xmm0, xmm1
cvttsd2si rax, xmm0
ret
align 16
vandpd xmm1, xmm0, _X [AMASK]
orpd xmm1, _X [OMASK]
addpd xmm0, xmm1
cvttsd2si rax, xmm0
ret
FUNC ENDP
ELSE
; x86 - x86 - x86 - x86 - x86 - x86 - x86 - x86 - x86 -
.data
PUBLIC rintt
rintt dd rintp, rintn, rintd
.code
; void __cdecl init_sse41(int)
; WARNING:
; we USE self modifying code here!
; always check code sizes after changes
;
ENTRY init_sse41, YAXH@Z
mov eax, _D [ARGS]
test eax, eax
jz .no
test _B [useSSE41], 1
jz .no
push edi
push esi
mov esi, isintd_csse41s
mov ecx, isintd_csse41e
sub ecx, esi
mov edi, isintd_c
rep movsb
mov esi, truncd_csse41s
mov ecx, truncd_csse41e
sub ecx, esi
mov edi, truncd_c
rep movsb
mov esi, truncd_vsse41s
mov ecx, truncd_vsse41e
sub ecx, esi
mov edi, truncd_v
rep movsb
mov esi, ceild_csse41s
mov ecx, ceild_csse41e
sub ecx, esi
mov edi, ceild_c
rep movsb
mov esi, ceild_vsse41s
mov ecx, ceild_vsse41e
sub ecx, esi
mov edi, ceild_v
rep movsb
mov esi, floord_csse41s
mov ecx, floord_csse41e
sub ecx, esi
mov edi, floord_c
rep movsb
mov esi, floord_vsse41s
mov ecx, floord_vsse41e
sub ecx, esi
mov edi, floord_v
rep movsb
mov esi, rintd_csse41s
mov ecx, rintd_csse41e
sub ecx, esi
mov edi, rintd_c
rep movsb
mov esi, rintd_vsse41s
mov ecx, rintd_vsse41e
sub ecx, esi
mov edi, rintd_v
rep movsb
mov esi, roundd_csse41s
mov ecx, roundd_csse41e
sub ecx, esi
mov edi, roundd_c
rep movsb
mov esi, roundd_vsse41s
mov ecx, roundd_vsse41e
sub ecx, esi
mov edi, roundd_v
rep movsb
pop esi
pop edi
.no:
ret
; "bool __cdecl isintegerd(double)" (?isintegerd@@YA_NN@Z)
ENTRY isintegerd, YA_NN@Z
; 8.0..9.0 HAS SSE2
; slower SAN
IF 0
isintd_c:
mov eax, _D [esp+4+4]
shr eax, 20
and eax, 07ffh
sub eax, 03ffh
jl .zero
cmp eax, 52
jge .int
mov ecx, 52
sub ecx, eax
movd xmm3, ecx
movsd xmm0, _X [esp+4] ; x
movdqa xmm1, xmm0
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm3 ; shift mask
pand xmm1, xmm2 ; = trunc(x)
.sub:
subsd xmm0, xmm1 ; x - trunc(x)
pxor xmm2, xmm2
comisd xmm0, xmm2
setz al
ret
.zero:
movsd xmm0, _X [esp+4]
pxor xmm2, xmm2
comisd xmm0, xmm2
setz al
ret
.int:
cmp eax, 0400h ; INF, NAN
setl al
ret
ELSE
isintd_c:
; 10..13 SAN
movsd xmm0, _Q [ARGS]
pextrw eax, xmm0, 3
shr eax, 4
and eax, 07ffh
sub eax, 03ffh
jl .zero
cmp eax, 52
jge .int
mov ecx, 52
sub ecx, eax
movd xmm3, ecx
movdqa xmm1, xmm0
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm3 ; shift mask
pand xmm1, xmm2 ; = trunc(x)
comisd xmm0, xmm1 ; x == trunc(x)
setz al
ret
.zero:
pxor xmm2, xmm2
comisd xmm0, xmm2
setz al
ret
.int:
cmp eax, 0400h ; INF, NAN
setl al
ret
ENDIF
align 16
isintd_csse41s:
; if we have sse4.1...
; 7.4..8.4 HAS
; 9.0 SAN
movsd xmm0, _X [ARGS]
roundsd xmm1, xmm0, 3
subsd xmm0, xmm1 ; sub necc to handle INF
pxor xmm2, xmm2
comisd xmm0, xmm2
setnp ah
setz al
and al, ah
ret
isintd_csse41e:
ENTRY isintegerd, YQ_NN@Z
; 10..13 SAN
; movsd xmm0, _Q [ARGS]
pextrw eax, xmm0, 3
shr eax, 4
and eax, 07ffh
sub eax, 03ffh
jl .zero
cmp eax, 52
jge .int
mov ecx, 52
sub ecx, eax
movd xmm3, ecx
movdqa xmm1, xmm0
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm3 ; shift mask
pand xmm1, xmm2 ; = trunc(x)
comisd xmm0, xmm1 ; x == trunc(x)
setz al
ret
.zero:
pxor xmm2, xmm2
comisd xmm0, xmm2
setz al
ret
.int:
cmp eax, 0400h ; INF, NAN
setl al
ret
; --------------------------------------
; TRUNC
; --------------------------------------
ENTRY truncd, YANN@Z
; if we do not have sse4.1 ... handmade with sse
; ~12 SAN SSE [1..1e6]
; 7.0 HAS SSE
truncd_c:
mov eax, _D [esp+4+4]
shr eax, 20
and eax, 07ffh
sub eax, 03ffh
cmp eax, 0
jl .zero
cmp eax, 52
jge .int
mov ecx, 52
sub ecx, eax
movd xmm1, ecx
movsd xmm0, _X [esp+4]
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1
pand xmm0, xmm2
movsd _X [esp+4], xmm0
fld _Q [esp+4]
ret
.zero:
fldz
ret
.int:
fld _Q [esp+4]
ret
; easiest and fastest way if we have sse4.1
; 8..10 SAN
align 16
truncd_csse41s:
movsd xmm0, _X [esp+4]
roundsd xmm0, xmm0, _MM_FROUND_TO_ZERO
movsd _X [esp+4], xmm0
fld _Q [esp+4]
ret
truncd_csse41e:
; "double __vectorcall truncd(double)" (?truncd@@YQNN@Z)
; if we do not have sse4.1 ... handmade with sse
; ~10 SAN [1..1e6]
; ~8 SAN
ENTRY truncd, YQNN@Z
truncd_v:
pextrw eax, xmm0, 3
btr eax, 15
; cmp eax, 03ff0h + (52 << 4)
; jge .int
cmp eax, 03ff0h
jl .zero
shr eax, 4
mov ecx, 52 + 3ffh
sub ecx, eax
jle .int
movd xmm1, ecx
; pcmpeqw xmm2, xmm2 ; generate 0xff..ff
; psllq xmm2, xmm1
; pand xmm0, xmm2
psrlq xmm0, xmm1
psllq xmm0, xmm1
ret
.zero:
pxor xmm0, xmm0
ret
.int:
ret
align 16
truncd_vsse41s:
roundsd xmm0, xmm0, _MM_FROUND_TO_ZERO
ret
truncd_vsse41e:
; --------------------------------------
; CEIL
; --------------------------------------
ENTRY ceild, YANN@Z
; if we do not have sse4.1 ... handmade with sse
; ~14 SAN [1..1e6]
ceild_c:
mov eax, _D [esp+4+4]
shr eax, 20
and eax, 07ffh
sub eax, 03ffh
cmp eax, 0
jl .zero
cmp eax, 52
jge .int
mov ecx, 52
sub ecx, eax ; => shift
movd xmm1, ecx
movsd xmm0, _X [esp+4]
movdqa xmm3, xmm0 ; copy for later use
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1 ; mask
pand xmm0, xmm2 ; => trunc(x)
subsd xmm3, xmm0 ; x - trunc(x)
.cmp:
pxor xmm1, xmm1
comisd xmm3, xmm1
jbe .nadd
addsd xmm0, _Q [C10]
.nadd:
movsd _X [esp+4], xmm0
fld _Q [esp+4]
ret
.zero:
movsd xmm3, _X [esp+4]
pxor xmm0, xmm0
jmp .cmp
.int:
fld _Q [esp+4]
ret
; the easiest and fastest way if we have sse4.1
align 16
ceild_csse41s:
movsd xmm0, _X [esp+4]
roundsd xmm0, xmm0, _MM_FROUND_TO_POS_INF
movsd _X [esp+4], xmm0
fld _Q [esp+4]
ret
ceild_csse41e:
; vectorcall
ENTRY ceild, YQNN@Z
ceild_v:
pextrw eax, xmm0, 3
btr eax, 15
cmp eax, 03ff0h
jl .zero
cmp eax, 03ff0h + (52 << 4)
jge .int
shr eax, 4
mov ecx, 52 + 3ffh
sub ecx, eax ; => shift
movd xmm1, ecx
movdqa xmm3, xmm0 ; copy for later use
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1 ; mask
pand xmm0, xmm2 ; => trunc(x)
subsd xmm3, xmm0 ; x - trunc(x)
pxor xmm1, xmm1
comisd xmm3, xmm1
jbe .nadd1
addsd xmm0, _Q [C10]
.nadd1:
ret
.zero:
movdqa xmm3, xmm0
pxor xmm0, xmm0
comisd xmm3, xmm0
jbe .nadd2
movsd xmm0, _Q [C10]
.nadd2:
ret
.int:
ret
align 16
ceild_vsse41s:
roundsd xmm0, xmm0, _MM_FROUND_TO_POS_INF
ret
align 16
ceild_vsse41e:
; --------------------------------------
; FLOOR
; --------------------------------------
ENTRY floord, YANN@Z
floord_c:
mov eax, _D [esp+4+4]
shr eax, 20
and eax, 07ffh
sub eax, 03ffh
cmp eax, 0
jl .zero
cmp eax, 52
jge .int
mov ecx, 52
sub ecx, eax ; => shift
movd xmm1, ecx
movsd xmm0, _X [esp+4]
movdqa xmm3, xmm0 ; copy for later use
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1 ; mask
pand xmm0, xmm2 ; => trunc(x)
subsd xmm3, xmm0 ; x - trunc(x)
.cmp:
pxor xmm1, xmm1
comisd xmm3, xmm1
jae .nadd
subsd xmm0, _X [C10]
.nadd:
movsd _X [esp+4], xmm0
fld _Q [esp+4]
ret
.zero:
movsd xmm3, _X [esp+4]
pxor xmm0, xmm0
jmp .cmp
.int:
fld _Q [esp+4]
ret
align 16
floord_csse41s:
movsd xmm0, _X [esp+4]
roundsd xmm0, xmm0, _MM_FROUND_TO_NEG_INF
movsd _X [esp+4], xmm0
fld _Q [esp+4]
ret
floord_csse41e:
ENTRY floord, YQNN@Z
floord_v:
pextrw eax, xmm0, 3
shr eax, 4
and eax, 07ffh
sub eax, 03ffh
cmp eax, 0
jl .zero
cmp eax, 52
jge .int
mov ecx, 52
sub ecx, eax ; => shift
movd xmm1, ecx
movdqa xmm3, xmm0 ; copy for later use
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1 ; mask
pand xmm0, xmm2 ; => trunc(x)
subsd xmm3, xmm0 ; x - trunc(x)
.cmp:
pxor xmm1, xmm1
comisd xmm3, xmm1
; jbe .nadd
jae .nadd
subsd xmm0, _X [C10]
.nadd:
ret
.zero:
movdqa xmm3, xmm0
pxor xmm0, xmm0
jmp .cmp
.int:
ret
align 16
floord_vsse41s:
roundsd xmm0, xmm0, _MM_FROUND_TO_NEG_INF
ret
floord_vsse41e:
; --------------------------------------
; RINT
; --------------------------------------
.data
RIFA80 dd 3f800000h + (63<<23)
.code
ENTRY rintd, YANN@Z
rintd_c:
fld _Q [ARGS]
mov eax, _D [ARGS+4]
and eax, 07ff00000h
cmp eax, 03ff00000h + (52 << 20)
jge .ret
fadd _D [RIFA80]
fsub _D [RIFA80]
.ret:
ret
fld _Q [esp+4]
frndint
ret
align 16
nop
align 16
rintd_csse41s:
; 8 SAN
movsd xmm0, _X [esp+4]
roundsd xmm0, xmm0, _MM_FROUND_TO_NEAREST_INT
movsd _X [esp+4], xmm0
fld _Q [esp+4]
ret
rintd_csse41e:
; #### not correct for negative x! - but now..
; vectorcall
ENTRY rintd, YQNN@Z
rintd_v:
IF 0
pextrw eax, xmm0, 3
bt eax, 15
jc .neg
addsd xmm0, [RIFA64]
subsd xmm0, [RIFA64]
ret
.neg:
subsd xmm0, [RIFA64]
addsd xmm0, [RIFA64]
ret
ENDIF
movsd xmm1, [RIFA64]
; now copy the sign of x to xmm1
pxor xmm1, xmm0
pand xmm1, [M7FF]
pxor xmm1, xmm0
addsd xmm0, xmm1
subsd xmm0, xmm1
ret
addsd xmm0, [RIFA64]
subsd xmm0, [RIFA64]
ret
pextrw eax, xmm0, 3
and eax, 07ff0h
cmp eax, 03ff0h + (31 << 4)
jge .ge31
cvtsd2si eax, xmm0
cvtsi2sd xmm0, eax
ret
.ge31:
sub esp, 8
movsd _X [esp], xmm0
fld _Q [esp]
frndint
fstp _Q [esp]
movsd xmm0, _X [esp]
add esp, 8
ret
align 16
rintd_vsse41s:
roundsd xmm0, xmm0, _MM_FROUND_TO_NEAREST_INT
ret
rintd_vsse41e:
; we do not know the sign
; we always round xmm1 and do not use
; any other reg
ENTRY rintd
comisd xmm1, [ZERO]
jb .rintn
addpd xmm1, [RIFA64]
subpd xmm1, [RIFA64]
ret
align 16
.rintn:
subpd xmm1, [RIFA64]
addpd xmm1, [RIFA64]
ret
; we know the sign of xmm1 is pos or zero
ENTRY rintp
addpd xmm1, [RIFA64]
subpd xmm1, [RIFA64]
ret
; we know the sign of xmm0 is neg or zero
ENTRY rintn
subpd xmm1, [RIFA64]
addpd xmm1, [RIFA64]
ret
; --------------------------------------
; LRINT
; --------------------------------------
; never a different way necessary
ENTRY lrintd, YAJN@Z
cvtsd2si eax, _Q [ARGS]
ret
; "long __vectorcall lrintd(double)" (?lrintd@@YQJN@Z)
ENTRY lrintd, YQJN@Z
cvtsd2si eax, xmm0
ret
; --------------------------------------
; LLRINT
; --------------------------------------
;"__int64 __cdecl llrintd(double)" (?llrintd@@YA_JN@Z)
ENTRY llrintd, YA_JN@Z
; no xmm way...
; no SSE3 used
; <10 SAN
fld _Q [ARGS]
fistp _Q [ARGS]
mov eax, _D [ARGS]
mov edx, _D [ARGS+4]
ret
;"__int64 __vectorcall llrintd(double)" (?llrintd@@YA_JN@Z)
ENTRY llrintd, YQ_JN@Z
sub esp, 8
movsd _Q [esp], xmm0
fld _Q [esp]
fistp _Q [esp]
mov eax, _D [esp]
mov edx, _D [esp+4]
add esp, 8
ret
; --------------------------------------
; ROUND
; --------------------------------------
; double __cdecl roundd(double)
ENTRY roundd, YANN@Z
movsd xmm0, _X [ARGS]
movdqa xmm1, xmm0
andpd xmm1, _X [AMASK]
orpd xmm1, _X [OMASK]
addpd xmm0, xmm1
roundd_c:
pextrw eax, xmm0, 3
shr eax, 4
and eax, 07ffh
sub eax, 03ffh
cmp eax, 0
jl .zero
cmp eax, 52
jge .int
mov ecx, 52
sub ecx, eax
movd xmm1, ecx
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1
pand xmm0, xmm2
movsd _X [ARGS], xmm0
fld _Q [ARGS]
ret
.zero:
fldz
ret
.int:
movsd _X [ARGS], xmm0
fld _Q [ARGS]
ret
align 16
roundd_csse41s:
roundsd xmm0, xmm0, _MM_FROUND_TO_ZERO
movsd _X [ARGS], xmm0
fld _Q [ARGS]
ret
roundd_csse41e:
; double __vectorcall roundd(double)
ENTRY roundd, YQNN@Z
; 10.4..10.9 SAN SSE
; 9.0 SAN SSE
roundd_v:
movdqa xmm1, xmm0
pand xmm0, _X [AMASK]
por xmm0, _X [OMASK]
addsd xmm0, xmm1
pextrw eax, xmm0, 3
btr eax, 15
cmp eax, 03ff0h + (31 << 4)
jge .diff
cvttpd2dq xmm0, xmm0
cvtdq2pd xmm0, xmm0
ret
.diff:
cmp eax, 03ff0h + (52 << 4)
jge .int
shr eax, 4
mov ecx, 52 + 3ffh
sub ecx, eax
movd xmm1, ecx
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1
pand xmm0, xmm2
ret
.zero:
pxor xmm0, xmm0
ret
.int:
ret
align 16
roundd_vsse41s:
; 8.0 SAN
; 6.7..7.5 HAS
movdqa xmm1, xmm0
pand xmm1, _X [AMASK]
por xmm1, _X [OMASK]
addsd xmm0, xmm1
roundsd xmm0, xmm0, _MM_FROUND_TO_ZERO
ret
roundd_vsse41e:
; --------------------------------------
; LROUND
; --------------------------------------
ENTRY lroundd, YAJN@Z
IF 1
; 9.3..9.6 SAN
movsd xmm0, _X [ARGS]
movdqa xmm1, xmm0
pand xmm1, _X [AMASK]
por xmm1, _X [OMASK]
addsd xmm0, xmm1
cvttsd2si eax, xmm0
ret
ENDIF
; 10.0..10.4 SAN
fld _Q [ARGS]
mov eax, _D [ARGS+4]
fld _Q [OMASK]
test eax, eax
jns .pos
fchs
.pos:
faddp ST(1), ST(0)
fisttp _D [ARGS] ; SSE3
mov eax, _D [ARGS]
ret
; long __vectorcall lroundd(double)
ENTRY lroundd, YQJN@Z
IF 1
; 8.0 SAN
; 7.4..7.8 HAS
movdqa xmm1, xmm0
pand xmm0, _X [AMASK] ; 0x80..00
por xmm0, _X [OMASK] ; 0x3fdf..ff
addsd xmm0, xmm1
cvttsd2si eax, xmm0
ret
ELSE
; 7.4 HAS AVX; more inst, but no mem
; 8.3..8.9 SAN
; 8.0 SAN pand/por
pcmpeqw xmm3, xmm3 ; 0xff..ff
vpsllq xmm2, xmm3, 63
; vandpd xmm1, xmm0, xmm2
vpand xmm1, xmm0, xmm2
mov eax, 03fdfh
pinsrw xmm3, eax, 3
; orpd xmm1, xmm3
por xmm1, xmm3
addsd xmm0, xmm1
cvttsd2si eax, xmm0
ret
ENDIF
; --------------------------------------
; LLROUND
; --------------------------------------
ENTRY llroundd, YA_JN@Z
IF 1
; without SSE3
; 19 SAN
; 15.5..16.5 HAS
movsd xmm0, _X [ARGS]
movdqa xmm1, xmm0
pand xmm1, _X [AMASK]
por xmm1, _X [OMASK]
addsd xmm0, xmm1
pextrw eax, xmm0, 3
shr eax, 4
and eax, 07ffh
sub eax, 03ffh
cmp eax, 31
jl .short
cmp eax, 52
jge .int
mov ecx, 52
sub ecx, eax
movd xmm1, ecx
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1
pand xmm0, xmm2
.int:
movsd _X [esp+4], xmm0
fld _Q [esp+4]
fistp _Q [esp+4]
mov eax, _D [esp+4]
mov edx, _D [esp+4+4]
ret
.short:
.zero:
cvttsd2si eax, xmm0
cdq
ret
ENDIF
ENTRY llroundd, YQ_JN@Z
; without SSE3
; 19 SAN
; 15.5..16.5 HAS
; ~10 with fisttp; also the shortest code
movdqa xmm1, xmm0
pand xmm0, _X [AMASK]
por xmm0, _X [OMASK]
addsd xmm0, xmm1
IF 0
sub esp, 8
movsd _X [esp], xmm0
fld _Q [esp]
fisttp _Q [esp]
pop eax
pop edx
ret
ENDIF
pextrw eax, xmm0, 3
btr eax, 15
cmp eax, 3ff0h + (31 << 4)
jge .diff
cvttsd2si eax, xmm0
cdq
ret
.diff:
cmp eax, 3ff0h + (52 << 4)
jge .int
shr eax, 4
mov ecx, 52 + 3ffh
sub ecx, eax
movd eax, xmm0
psrlq xmm0, 32
movd edx, xmm0
test edx, edx
sets ch
and edx, 000fffffh
or edx, 00100000h
shrd eax, edx, cl
shr edx, cl
test ch, ch
jnz .neg
ret
.neg:
neg eax
adc edx, 0
neg edx
ret
movd xmm1, ecx
pcmpeqw xmm2, xmm2 ; generate 0xff..ff
psllq xmm2, xmm1
pand xmm0, xmm2 ; => trunc
.int:
sub esp, 8
movsd _X [esp], xmm0
fld _Q [esp]
fistp _Q [esp]
mov eax, _D [esp]
mov edx, _D [esp+4]
add esp, 8
ret
.short:
.zero:
cvttsd2si eax, xmm0
cdq
ret
FUNC ENDP
ENDIF
END |
tools/SPARK2005/preprocessor/src/unit_processing.ads | michalkonecny/polypaver | 1 | 12005 | with Asis;
package Unit_Processing is
-- Translate all FP operations in the body of a compilation unit
-- to PolyPaver-friendly function calls.
procedure Process_Unit (The_Unit : Asis.Compilation_Unit;
Trace : Boolean := False;
Output_Path : String);
end Unit_Processing;
|
3-mid/impact/applet/test/other/box_box_collision/launch_box_box_collision_test.adb | charlie5/lace | 20 | 1558 | <reponame>charlie5/lace
with impact.d3.Collision.Configuration.default,
impact.d3.Collision.Broadphase.bounding_volume_Tree,
impact.d3.Dispatcher.collision,
impact.d3.constraint_Solver.sequential_impulse,
impact.d3.Space.dynamic.discrete,
impact.d3.Shape.convex.internal.polyhedral.box,
impact.d3.Object.rigid,
impact.d3.motion_State.default,
impact.d3.Transform,
ada.text_IO;
with any_math.any_Algebra.any_linear.any_d3;
procedure launch_box_box_collision_Test
--
-- This is a test of sphere on sphere collision.
--
is
use Impact.d3,
impact.d3.Collision.Configuration.default,
impact.d3.Transform,
impact.Math,
ada.text_IO;
collisionConfiguration : access Collision.Configuration.item'Class
:= new_default_Configuration;
--
-- Collision configuration contains default setup for memory, collision setup.
-- Advanced users can create their own configuration.
-- Use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded).
--
the_Dispatcher : access Dispatcher.collision.item
:= new Dispatcher.collision.item' (Dispatcher.collision.to_Dispatcher (collisionConfiguration.all'unchecked_access));
-- 'btDbvtBroadphase' is a good general purpose broadphase. You can also try out btAxis3Sweep.
--
overlappingPairCache : Collision.Broadphase.bounding_volume_Tree.view
:= Collision.Broadphase.bounding_volume_Tree.new_Broadphase;
-- The default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
--
solver : access constraint_Solver.sequential_impulse.item'Class := new constraint_Solver.sequential_impulse.item;
dynamicsWorld : access Space.dynamic.discrete.item'Class
:= new Space.dynamic.discrete.item' (Space.dynamic.discrete.Forge.to_Space (the_Dispatcher,
overlappingPairCache,
solver.all'unchecked_access,
collisionConfiguration));
-- Create a few basic rigid bodies.
--
ground_Shape : Shape.convex.internal.polyhedral.box.view
:= new Shape.convex.internal.polyhedral.box.item' (Shape.convex.internal.polyhedral.box.to_box_Shape ((50.0, 1.0, 50.0)));
box_Shape_1 : Shape.convex.internal.polyhedral.box.view
:= new Shape.convex.internal.polyhedral.box.item' (Shape.convex.internal.polyhedral.box.to_box_Shape ((1.0, 1.0, 1.0)));
box_Shape_2 : Shape.convex.internal.polyhedral.box.view
:= new Shape.convex.internal.polyhedral.box.item' (Shape.convex.internal.polyhedral.box.to_box_Shape ((1.0, 1.0, 1.0)));
ground_motion_State : motion_State.default.view;
box_motion_State : motion_State.default.view;
localInertia : Vector_3 := (0.0, 0.0, 0.0);
the_Transform : Transform_3d := transform.getIdentity;
unused : Integer;
begin
dynamicsWorld.setGravity ((0.0, -10.0, 0.0));
ground_Shape.calculateLocalInertia (0.0, localInertia);
setOrigin (the_Transform, (0.0, -2.0, 0.0));
ground_motion_State := new motion_State.default.item' (motion_State.default.to_motion_State (the_Transform));
declare
rbInfo : access Object.rigid.ConstructionInfo
:= new Object.rigid.ConstructionInfo' (Object.rigid.to_ConstructionInfo (0.0, ground_motion_State.all'access, ground_Shape, localInertia));
the_Ground : Object.rigid.View := Object.rigid.new_rigid_Object (rbInfo.all);
begin
dynamicsWorld.addRigidBody (the_Ground); -- Add the body to the dynamics world.
end;
box_Shape_1.calculateLocalInertia (1.0, localInertia);
setOrigin (the_Transform, (0.0, 2.501, 0.0));
setBasis (the_Transform, impact.linear_Algebra_3d.X_Rotation_from (to_Radians (40.0)));
box_motion_State := new motion_State.default.item' (motion_State.default.to_motion_State (the_Transform));
declare
rbInfo : access Object.rigid.ConstructionInfo
:= new Object.rigid.ConstructionInfo' (Object.rigid.to_ConstructionInfo (1.0, box_motion_State.all'access, box_Shape_1, localInertia));
Box_1 : impact.d3.Object.rigid.view := Object.rigid.new_rigid_Object (rbInfo.all);
begin
dynamicsWorld.addRigidBody (Box_1); -- Add the body to the dynamics world.
end;
-- box_Shape_2.calculateLocalInertia (1.0, localInertia);
-- setOrigin (the_Transform, (0.0, 5.0, 0.0));
-- box_motion_State := new motion_State.default.item' (motion_State.default.to_motion_State (the_Transform));
--
-- declare
-- rbInfo : access Object.rigid.ConstructionInfo
-- := new Object.rigid.ConstructionInfo' (Object.rigid.to_ConstructionInfo (1.0, box_motion_State.all'access, box_Shape_2, localInertia));
--
-- Box_2 : Object.rigid.View := Object.rigid.new_rigid_Object (rbInfo.all);
--
-- begin
-- dynamicsWorld.addRigidBody (Box_2); -- Add the body to the dynamics world.
-- end;
--- Do some simulation.
--
for i in 1 .. 500
loop
unused := dynamicsWorld.stepSimulation (1.0/60.0, 10);
box_motion_State.getWorldTransform (the_Transform);
put (" X: " & Image (the_Transform.Translation (1), 9));
put (" Y: " & Image (the_Transform.Translation (2), 9));
put_Line (" Z: " & Image (the_Transform.Translation (3), 9));
end loop;
end launch_box_box_collision_Test;
|
aosvs_dump.adb | SMerrony/LoadA | 2 | 26005 | -- Copyright 2021 S.Merrony
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software
-- and associated documentation files (the "Software"), to deal in the Software without restriction,
-- including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
-- subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all copies or substantial
-- portions of the Software.
-- 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 AND NONINFRINGEMENT.
-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
with Ada.Characters.Handling;
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Task_Identification; use Ada.Task_Identification;
with Ada.Text_IO;
package body Aosvs_Dump is
function Read_Word (Dump_Stream : Stream_Access) return Unsigned_16 is
DG_Word : Unsigned_16;
Byte1, Byte2 : Unsigned_8;
begin
Unsigned_8'Read (Dump_Stream, Byte1);
Unsigned_8'Read (Dump_Stream, Byte2);
DG_Word := Shift_Left (Unsigned_16 (Byte1), 8) + Unsigned_16 (Byte2);
return DG_Word;
end Read_Word;
function Read_Blob
(Num_Bytes : in Positive; Dump_Stream : Stream_Access;
Reason : in Unbounded_String) return Blob_Type
is
Blob : Blob_Type (1 .. Num_Bytes);
begin
-- Ada.Text_IO.Put_Line ("DEBUG: Read_Blob called for bytes: " & Integer'Image(Num_Bytes));
Blob_Type'Read (Dump_Stream, Blob);
return Blob;
end Read_Blob;
function Read_Header
(Dump_Stream : Stream_Access) return Record_Header_Type
is
Hdr : Record_Header_Type;
Byte1, Byte2 : Unsigned_8;
begin
Unsigned_8'Read (Dump_Stream, Byte1);
-- the record type is 6-bit
Hdr.Record_Type := Shift_Right (Byte1, 2);
Hdr.Record_Length := Integer (Byte1 and 2#0000_0011#) * 256;
Unsigned_8'Read (Dump_Stream, Byte2);
Hdr.Record_Length := Hdr.Record_Length + Integer (Byte2);
return Hdr;
end Read_Header;
function Read_SOD (Dump_Stream : Stream_Access) return SOD_Type is
SOD : SOD_Type;
begin
SOD.Header := Read_Header (Dump_Stream);
if SOD.Header.Record_Type /= Start_Dump_Byte then
Ada.Text_IO.Put_Line
(Ada.Text_IO.Standard_Error,
"ERROR: This does not appear to be an AOS/VS DUMP_II/III file");
Set_Exit_Status (Failure);
Abort_Task (Current_Task);
end if;
SOD.Dump_Format_Version := Read_Word (Dump_Stream);
SOD.Dump_Time_Secs := Read_Word (Dump_Stream);
SOD.Dump_Time_Mins := Read_Word (Dump_Stream);
SOD.Dump_Time_Hours := Read_Word (Dump_Stream);
SOD.Dump_Time_Day := Read_Word (Dump_Stream);
SOD.Dump_Time_Month := Read_Word (Dump_Stream);
SOD.Dump_Time_Year := Read_Word (Dump_Stream);
return SOD;
end Read_SOD;
function Extract_First_String(Blob : Blob_Type) return Unbounded_String is
Str : Unbounded_String;
begin
for Ix in Blob'Range loop
exit when Blob (Ix) = 0;
Append (Str, Character'Val (Blob (Ix)));
end loop;
return Str;
end Extract_First_String;
-- Convert to upper-case and replace ":" directory seps with "/"
function To_Linux_Filename (Aosvs_Filename : Unbounded_String) return Unbounded_String is
str : String := To_String(Aosvs_Filename);
begin
str := Ada.Characters.Handling.To_Upper (str);
for C in str'Range loop
if str(C) = ':' then
str(C) := '/';
end if;
end loop;
return To_Unbounded_String (str);
end To_Linux_Filename;
end Aosvs_Dump;
|
oeis/107/A107298.asm | neoneye/loda-programs | 11 | 19482 | ; A107298: a(n) = 3*a(n-1)-a(n-2)-2*a(n-3)+a(n-4), n>5.
; Submitted by <NAME>
; 3,2,5,10,25,56,128,288,649,1459,3280,7371,16564,37220,83634,187925,422265,948822,2131985,4790528,10764220,24186984,54347661,122118087,274396852,616564131
mov $3,1
lpb $0
sub $0,1
add $1,$2
add $2,$3
mov $4,$3
mov $3,$1
add $1,$4
add $2,2
mov $4,$3
lpe
cmp $0,$4
add $0,$3
add $0,1
|
oeis/002/A002061.asm | neoneye/loda-programs | 11 | 16962 | ; A002061: Central polygonal numbers: a(n) = n^2 - n + 1.
; Submitted by <NAME>
; 1,1,3,7,13,21,31,43,57,73,91,111,133,157,183,211,241,273,307,343,381,421,463,507,553,601,651,703,757,813,871,931,993,1057,1123,1191,1261,1333,1407,1483,1561,1641,1723,1807,1893,1981,2071,2163,2257,2353,2451,2551,2653,2757,2863,2971,3081,3193,3307,3423,3541,3661,3783,3907,4033,4161,4291,4423,4557,4693,4831,4971,5113,5257,5403,5551,5701,5853,6007,6163,6321,6481,6643,6807,6973,7141,7311,7483,7657,7833,8011,8191,8373,8557,8743,8931,9121,9313,9507,9703
bin $0,2
mul $0,2
add $0,1
|
oeis/176/A176434.asm | neoneye/loda-programs | 11 | 163227 | <filename>oeis/176/A176434.asm
; A176434: Decimal expansion of (7+3*sqrt(7))/2.
; Submitted by <NAME>
; 7,4,6,8,6,2,6,9,6,6,5,9,6,8,8,5,8,8,5,7,5,2,4,2,3,6,3,0,4,5,8,8,9,0,6,3,8,5,6,5,3,8,8,7,7,4,6,2,3,6,7,5,2,7,0,5,5,2,5,0,1,6,8,8,8,0,1,6,0,3,2,3,4,8,4,5,4,2,5,4,4,1,6,4,0,5,8,9,3,2,9,7,1,1,8,1,5,4,1,5
mov $2,1
mov $3,$0
mul $3,4
lpb $3
add $5,$2
mul $5,2
add $5,$2
add $1,$5
add $2,$1
mov $1,35
sub $3,1
lpe
sub $5,1
mul $5,3
add $1,$5
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
add $0,10
mod $0,10
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c9/c95087b.ada | best08618/asylo | 7 | 15275 | -- C95087B.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT ASSIGNMENTS TO ENTRY FORMAL PARAMETERS OF UNCONSTRAINED
-- RECORD, PRIVATE, AND LIMITED PRIVATE TYPES WITHOUT DEFAULT
-- CONSTRAINTS RAISE CONSTRAINT_ERROR IF AN ATTEMPT IS MADE TO CHANGE
-- THE CONSTRAINT OF THE ACTUAL PARAMETER.
-- SUBTESTS ARE:
-- (A) RECORD TYPE.
-- (B) PRIVATE TYPE.
-- (C) LIMITED PRIVATE TYPE.
-- RJW 1/10/86
WITH REPORT; USE REPORT;
PROCEDURE C95087B IS
BEGIN
TEST ( "C95087B", "CHECK ASSIGNMENT TO ENTRY FORMAL PARAMETERS " &
"OF UNCONSTRAINED TYPE (WITH NO DEFAULT)" );
--------------------------------------------------
DECLARE -- (A)
PACKAGE PKG IS
TYPE RECTYPE (CONSTRAINT : INTEGER) IS
RECORD
INTFIELD : INTEGER;
STRFIELD : STRING (1..CONSTRAINT);
END RECORD;
TASK T IS
ENTRY E (REC9 : OUT RECTYPE;
REC6 : IN OUT RECTYPE);
END T;
END PKG;
REC9 : PKG.RECTYPE(IDENT_INT(9)) :=
(IDENT_INT(9), 9, "123456789");
REC6 : PKG.RECTYPE(IDENT_INT(6)) :=
(IDENT_INT(6), 5, "AEIOUY");
PACKAGE BODY PKG IS
TASK BODY T IS
REC4 : CONSTANT RECTYPE(IDENT_INT(4)) :=
(IDENT_INT(4), 4, "OOPS");
BEGIN
ACCEPT E (REC9 : OUT RECTYPE;
REC6 : IN OUT RECTYPE) DO
BEGIN -- (A.1)
REC9 := REC6;
FAILED ("CONSTRAINT_ERROR NOT RAISED " &
"- A.1");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED " &
"- A.1");
END; -- (A.1)
BEGIN -- (A.2)
REC6 := REC4;
FAILED ("CONSTRAINT_ERROR NOT RAISED " &
"- A.2");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED " &
"- A.2");
END; -- (A.2)
REC9 := (IDENT_INT(9), 9, "987654321");
END E;
END T;
END PKG;
BEGIN -- (A)
PKG.T.E (REC9, REC6);
IF REC9.STRFIELD /= IDENT_STR("987654321") THEN
FAILED ("ASSIGNMENT TO REC9 FAILED - (A)");
END IF;
END; -- (A)
--------------------------------------------------
DECLARE -- (B)
PACKAGE PKG IS
TYPE RECTYPE (CONSTRAINT : INTEGER) IS PRIVATE;
TASK T IS
ENTRY E (REC9 : OUT RECTYPE;
REC6 : IN OUT RECTYPE);
END T;
PRIVATE
TYPE RECTYPE (CONSTRAINT : INTEGER) IS
RECORD
INTFIELD : INTEGER;
STRFIELD : STRING (1..CONSTRAINT);
END RECORD;
END PKG;
REC9 : PKG.RECTYPE(9);
REC6 : PKG.RECTYPE(6);
PACKAGE BODY PKG IS
TASK BODY T IS
REC4 : CONSTANT RECTYPE(4) := (4, 4, "OOPS");
BEGIN
ACCEPT E (REC9 : OUT RECTYPE;
REC6 : IN OUT RECTYPE) DO
BEGIN -- (B.1)
REC9 := REC6;
FAILED ("CONSTRAINT_ERROR NOT RAISED " &
"- B.1");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED " &
"- B.1");
END; -- (B.1)
BEGIN -- (B.2)
REC6 := REC4;
FAILED ("CONSTRAINT_ERROR NOT RAISED " &
"- B.2");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED " &
"- B.2");
END; -- (B.2)
END E;
END T;
BEGIN
REC9 := (9, 9, "123456789");
REC6 := (6, 5, "AEIOUY");
END PKG;
BEGIN -- (B)
PKG.T.E (REC9, REC6);
END; -- (B)
--------------------------------------------------
DECLARE -- (C)
PACKAGE PKG IS
TYPE RECTYPE (CONSTRAINT : INTEGER) IS LIMITED PRIVATE;
TASK T IS
ENTRY E (REC9 : OUT RECTYPE;
REC6 : IN OUT RECTYPE);
END T;
PRIVATE
TYPE RECTYPE (CONSTRAINT : INTEGER) IS
RECORD
INTFIELD : INTEGER;
STRFIELD : STRING (1..CONSTRAINT);
END RECORD;
END PKG;
REC6 : PKG.RECTYPE(IDENT_INT(6));
REC9 : PKG.RECTYPE(IDENT_INT(9));
PACKAGE BODY PKG IS
TASK BODY T IS
REC4 : CONSTANT RECTYPE(4) := (4, 4, "OOPS");
BEGIN
ACCEPT E (REC9 : OUT RECTYPE;
REC6 : IN OUT RECTYPE) DO
BEGIN -- (C.1)
REC9 := REC6;
FAILED ("CONSTRAINT_ERROR NOT RAISED " &
"- C.1");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED " &
"- C.1");
END; -- (C.1)
BEGIN -- (C.2)
REC6 := REC4;
FAILED ("CONSTRAINT_ERROR NOT RAISED " &
"- C.2");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED " &
"- C.2");
END; -- (C.2)
END E;
END T;
BEGIN
REC6 := (6, 5, "AEIOUY");
REC9 := (9, 9, "123456789");
END PKG;
BEGIN -- (C)
PKG.T.E (REC9, REC6);
END; -- (C)
--------------------------------------------------
RESULT;
END C95087B;
|
src/pointed/equality.agda | pcapriotti/agda-base | 20 | 1398 | {-# OPTIONS --without-K #-}
module pointed.equality where
open import sum
open import equality.core
open import function.extensionality
open import function.isomorphism.core
open import function.isomorphism.utils
open import pointed.core
pmap-eq : ∀ {i j}{X : Set i}{Y : Set j}{x₀ : X}{y₀ : Y}
→ {f : X → Y}{p : f x₀ ≡ y₀}
→ {g : X → Y}{q : g x₀ ≡ y₀}
→ (Σ ((x : X) → f x ≡ g x) λ γ → p ≡ γ x₀ · q)
≅ _≡_ {A = PMap (X , x₀) (Y , y₀)} (f , p) (g , q)
pmap-eq {X = X}{Y}{x₀}{y₀} = Σ-ap-iso' strong-funext-iso lem ·≅ Σ-split-iso
where
lem : {f : X → Y}{p : f x₀ ≡ y₀}
→ {g : X → Y}{q : g x₀ ≡ y₀}
→ (h : f ≡ g)
→ (p ≡ funext-inv h x₀ · q)
≅ (subst (λ u → u x₀ ≡ y₀) h p ≡ q)
lem refl = refl≅
|
oeis/332/A332129.asm | neoneye/loda-programs | 11 | 23588 | ; A332129: a(n) = 2*(10^(2n+1)-1)/9 + 7*10^n.
; Submitted by <NAME>(s2)
; 9,292,22922,2229222,222292222,22222922222,2222229222222,222222292222222,22222222922222222,2222222229222222222,222222222292222222222,22222222222922222222222,2222222222229222222222222,222222222222292222222222222,22222222222222922222222222222,2222222222222229222222222222222
add $0,1
mov $2,10
pow $2,$0
mul $2,2
add $2,32
bin $2,2
mov $0,$2
sub $0,1326
div $0,90
add $0,9
|
Games/banchorce/source/chests.asm | CiaranGruber/Ti-84-Calculator | 1 | 167225 | <reponame>CiaranGruber/Ti-84-Calculator
;---------------------------------------------------------------;
; ;
; Banchor ;
; Chest Routines ;
; ;
;---------------------------------------------------------------;
;------------------------------------------------
; checkChests - Check to see if player can open a chest
; input: none
; output: none
;------------------------------------------------
checkChests:
ld a,(playerDir)
or a
ret nz ; If player not facing up, can't open a chest
ld a,(playerOffset)
sub COLS
ld c,a ; C = Offset in map
ld b,100 ; B = # chest entries to check
ld hl,chests
checkChestsLoop:
ld a,(mapNo)
cp (hl) ; Check map number
jr nz,notOpeningChest1
inc hl
ld a,c
cp (hl) ; Check offset
jr nz,notOpeningChest2
inc hl
pop de ; Remove now-redundant stack data
ld e,(hl)
dec hl
dec hl
call openChest
call updateItems
ld hl,map
ld (__changeListPtr),hl
call executeChangeList
jp mainLoop
notOpeningChest1:
inc hl
notOpeningChest2:
inc hl
inc hl
djnz checkChestsLoop
ret
;------------------------------------------------
; openChest - Open a chest
; input: C = Offset to tile in map data
; E = Chest item
; HL => Chest entry
; output: DE => Chest entry
;------------------------------------------------
openChest:
push hl
; Check for open chest animation thingy
ld b,0
ld hl,map
add hl,bc
ld a,(hl)
cp CHEST_CLOSED
jr nz,afterOpenChestAnim
ld a,(mapNo)
ld b,CHEST_OPEN
push de
call addToChangeList
pop de
afterOpenChestAnim:
; Find chest scripts to run
ld h,3
ld l,e
mlt hl
ld de,chestItems
add hl,de
ld de,(hl)
ex de,hl
pop de
jp (hl)
chestItems:
.dl chestEmpty,chestBluntSword,chestSuperiorSword,chestLegendarySword,chestWoodenShield
.dl chestIronShield,chestLightArmor,chestHeavyArmor,chestAquaBoots,chestWingedBoots
.dl chestRingOfMight,chestRingOfThunder,chestHeartPiece,chestCrystal1,chestCrystal2
.dl chestCrystal3,chestCrystal4,chestCrystal5,chestCrystal6,chestCrystal7
.dl chestHeartContainer1,chestHeartContainer2,chestHeartContainer3,chest1000Gold,chest5000Gold
.dl chest10000Gold,chestLifeRefill,chestWell
;------------------------------------------------
; All chest scripts follow
; input: C = Offset to tile in map data
; DE => Chest entry
; output: none
;------------------------------------------------
chestSuperiorSword:
ld a,1
ld bc,COST_SUPERIOR_SWORD
ld hl,superiorSword
jr chestBuyItem
chestLegendarySword:
ld a,2
ld bc,COST_LEGENDARY_SWORD
ld hl,legendarySword
jr chestBuyItem
chestIronShield:
ld a,4
ld bc,COST_IRON_SHIELD
ld hl,ironShield
jr chestBuyItem
chestLightArmor:
ld a,5
ld bc,COST_LIGHT_ARMOR
ld hl,lightArmor
jr chestBuyItem
chestHeavyArmor:
ld a,6
ld bc,COST_HEAVY_ARMOR
ld hl,heavyArmor
jr chestBuyItem
chestAquaBoots:
ld a,7
ld bc,COST_AQUA_BOOTS
ld hl,aquaBoots
jr chestBuyItem
chestWingedBoots:
ld a,8
ld bc,COST_WINGED_BOOTS
ld hl,wingedBoots
jr chestBuyItem
chestRingOfMight:
ld a,9
ld bc,COST_RING_OF_MIGHT
ld hl,ringOfMight
jr chestBuyItem
chestRingOfThunder:
ld a,10
ld bc,COST_RING_OF_THUNDER
ld hl,ringOfThunder
jr chestBuyItem
chestBuyItem:
call commonPurchaseCode
ld a,1
ld (hl),a
ret
chestBluntSword:
ld a,255
ld (de),a
xor a
call textMessage
ld a,1
ld (bluntSword),a
ret
chestWoodenShield:
ld a,255
ld (de),a
ld a,3
call textMessage
ld a,1
ld (woodenShield),a
ret
chestHeartPiece:
ld a,255
ld (de),a
ld a,11
call textMessage
ld hl,heartPiece
ld a,(hl)
or a
jr nz,twoHeartPieces
inc (hl)
ret
twoHeartPieces:
ld (hl),0
addHeartContainer:
ld hl,maxHearts
inc (hl)
jp healOneHeart
chestHeartContainer1:
ld a,13
ld bc,COST_HEART_CONTAINER_1
call commonPurchaseCode
jr addHeartContainer
chestHeartContainer2:
ld a,64
ld bc,COST_HEART_CONTAINER_2
call commonPurchaseCode
jr addHeartContainer
chestHeartContainer3:
ld a,65
ld bc,COST_HEART_CONTAINER_3
call commonPurchaseCode
jr addHeartContainer
chestLifeRefill:
ld a,255
ld (de),a
ld a,16
call textMessage
ld a,(maxHearts)
ld (hearts),a
ld a,INI_HEART_LEVEL
ld (heartLevel),a
ret
chestWell:
ld a,17
call textMessage
ret z
ld bc,COST_WELL
ld a,19
call tryPurchaseItem
ret c
ld a,(maxHearts)
ld (hearts),a
ld a,INI_HEART_LEVEL
ld (heartLevel),a
ret
chestCrystal1:
ld hl,crystals
jr chestCrystal
chestCrystal2:
ld hl,crystals+1
jr chestCrystal
chestCrystal3:
ld hl,crystals+2
jr chestCrystal
chestCrystal4:
ld hl,crystals+3
jr chestCrystal
chestCrystal5:
ld hl,crystals+4
jr chestCrystal
chestCrystal6:
ld hl,crystals+5
jr chestCrystal
chestCrystal7:
ld hl,crystals+6
chestCrystal:
ld (hl),1
ld a,255
ld (de),a
; Check if player has all 7 crystals
ld hl,crystals ; HL => Start of crystal data
xor a ; Continue until we find an empty crystal slot
ld b,7 ; 7 crystals to check
checkCrystalsLoop:
add a,(hl) ; If we have this crystal, add 1 to A
inc hl ; HL => Next crystal
djnz checkCrystalsLoop ; Loop
cp 7 ; Do we have 7 crystals?
jr nz,after7Crystals ; If not, player still hasn't gotten all 7 crystals
; add entries to change list to turn on portal from Ancient Chamber to Hell
ld a,218
ld bc,PORTAL_1*256+39
call addToChangeList
ld a,218
ld bc,PORTAL_1*256+40
call addToChangeList
ld a,218
ld bc,PORTAL_1*256+55
call addToChangeList
ld a,218
ld bc,PORTAL_1*256+56
call addToChangeList
after7Crystals:
ld a,12
jp textMessage
chest1000gold:
ld b,14
ld hl,1000
jr chestGold
chest5000gold:
ld b,15
ld hl,5000
jr chestGold
chest10000gold:
ld b,63
ld hl,10000
chestGold:
ld a,255
ld (de),a
call addGold
ld a,b
jp textMessage
chestEmpty:
ld a,18
jp textMessage
;------------------------------------------------
; tryPurchaseItem - Try to purchase an item
; input: A = Text message to show if item can't be purchased
; BC = Cost of item
; output: CA = 1 if item couldn't be purchased
;------------------------------------------------
tryPurchaseItem:
ld hl,(gold)
or a
sbc hl,bc
jr c,cantPurchaseItem
ld (gold),hl
ret
cantPurchaseItem:
call textMessage
scf
ret
;------------------------------------------------
; commonPurchaseCode - Common set of code used in some of the chest scripts
; input: BC = Cost of item
; DE => Chest entry
; HL = Misc data
; output: DE => (Chest entry +2)
; HL = Misc data
;------------------------------------------------
commonPurchaseCode:
push bc
push de
push hl
call textMessage
pop hl
pop de
pop bc
jr z,dontPurchase
push hl
ld a,19
call tryPurchaseItem
pop hl
jr c,dontPurchase
xor a ; set chest to "nothing left to sell"
inc de
inc de
ld (de),a
ret
dontPurchase:
pop bc
ret
.end
|
Transynther/x86/_processed/AVXALIGN/_st_zr_un_sm_/i7-7700_9_0xca.log_21829_411.asm | ljhsiun2/medusa | 9 | 92951 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r15
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x10bcb, %rax
nop
nop
nop
nop
cmp $39871, %r15
mov $0x6162636465666768, %rbp
movq %rbp, (%rax)
nop
nop
inc %r15
lea addresses_D_ht+0x1b40b, %rsi
lea addresses_D_ht+0x18ad6, %rdi
sub %r15, %r15
mov $101, %rcx
rep movsb
nop
nop
xor $4039, %r15
lea addresses_normal_ht+0x1e80b, %rsi
nop
nop
nop
and $45664, %r14
vmovups (%rsi), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $1, %xmm6, %r15
nop
nop
xor $28021, %rax
lea addresses_A_ht+0x6c0b, %rcx
nop
nop
nop
nop
dec %r15
movl $0x61626364, (%rcx)
nop
nop
nop
nop
nop
add %rbp, %rbp
lea addresses_A_ht+0x6f0b, %rbp
nop
nop
nop
xor $6120, %rsi
mov (%rbp), %edi
nop
nop
lfence
lea addresses_UC_ht+0x1370b, %rsi
lea addresses_normal_ht+0x5965, %rdi
nop
add $28573, %r11
mov $120, %rcx
rep movsl
nop
nop
nop
nop
nop
cmp $11869, %rdi
lea addresses_UC_ht+0xd3cb, %rax
clflush (%rax)
nop
nop
nop
nop
sub %r11, %r11
mov $0x6162636465666768, %rbp
movq %rbp, %xmm5
vmovups %ymm5, (%rax)
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0x70b, %rdi
nop
sub %rsi, %rsi
movw $0x6162, (%rdi)
nop
xor $64429, %r11
lea addresses_A_ht+0xd0b, %rdi
nop
nop
nop
nop
lfence
vmovups (%rdi), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $0, %xmm0, %r15
add %rbp, %rbp
lea addresses_A_ht+0x818b, %rbp
nop
nop
nop
dec %rax
mov $0x6162636465666768, %r15
movq %r15, %xmm6
vmovups %ymm6, (%rbp)
nop
add %r14, %r14
lea addresses_D_ht+0x1380b, %r11
nop
nop
nop
nop
nop
xor $39844, %r15
movups (%r11), %xmm5
vpextrq $0, %xmm5, %r14
cmp $9118, %rax
lea addresses_D_ht+0x11b0b, %r14
inc %rcx
mov $0x6162636465666768, %rbp
movq %rbp, %xmm2
vmovups %ymm2, (%r14)
nop
nop
nop
cmp $34342, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r15
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r15
push %r9
push %rax
push %rbx
push %rdx
// Load
lea addresses_A+0x1180b, %rdx
nop
nop
nop
xor %r10, %r10
movb (%rdx), %al
nop
nop
nop
add %rdx, %rdx
// Store
mov $0x603cdf0000000c0b, %r9
nop
nop
and %r11, %r11
mov $0x5152535455565758, %rax
movq %rax, %xmm6
movups %xmm6, (%r9)
nop
nop
nop
cmp $39987, %r11
// Faulty Load
mov $0x603cdf0000000c0b, %rbx
nop
add $63229, %r10
mov (%rbx), %r11d
lea oracles, %rbx
and $0xff, %r11
shlq $12, %r11
mov (%rbx,%r11,1), %r11
pop %rdx
pop %rbx
pop %rax
pop %r9
pop %r15
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
{'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_NC'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_NC'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 8, 'NT': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 10, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_D_ht'}}
{'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 8, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_UC_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_UC_ht'}}
{'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A_ht'}}
{'src': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_D_ht'}}
{'00': 306, '5f': 497, '58': 21026}
58 58 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 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 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 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 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 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 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 58 58 58 5f 58 58 58 58 58 58 58 58 58 58 58 58 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 5f 58 58 58 58 58 58 58 5f 58 58 5f 58 58 58 58 58 58 58 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 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 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 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 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 5f 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 5f 58 58 5f 58 5f 58 58 58 58 58 58 58 58 58 58 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 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 58 58 58 58 58 58 58 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 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 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 5f 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 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 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 5f 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
share_internet.applescript | tylerrocha/InternetSharing | 0 | 231 | <filename>share_internet.applescript
#TODO
#make subroutines
--UI elements and properties of UI elements for debugging, or try entire contents
tell application "System Preferences"
activate
reveal (pane id "com.apple.preferences.sharing")
end tell
tell application "System Events"
tell process "System Preferences"
delay 0.5 #avoids "Loading Sharing" window
try
tell group 1 of window "Sharing"
# check whether Internet Sharing is already active
set sharingStatus to value of checkbox 1 of row 7 of table 1 of scroll area 1 as boolean
if sharingStatus is true then
display dialog "Internet sharing is on"
return true
end if
# Share connection from Ethernet
tell pop up button 1
click
click menu item "AX88179 USB 3.0 to Gigabit Ethernet" of menu 1
end tell
# Share to Wifi
set wifiStatus to value of checkbox 1 of row 3 of table 1 of scroll area 2 as boolean
if wifiStatus is false then
click checkbox 1 of row 3 of table 1 of scroll area 2
end if
#Turn on Internet Sharing
click checkbox 1 of row 7 of table 1 of scroll area 1
delay 0.3
if button "Turn Wi-Fi On" of window "Sharing" of application process "System Preferences" of application "System Events" exists then
click button "Turn Wi-Fi On" of window "Sharing" of application process "System Preferences" of application "System Events"
end if
delay 0.1
end tell
tell window "Sharing"
click button "Start"
end tell
delay 3
tell application "System Preferences"
activate
reveal (pane id "com.apple.preferences.sharing")
end tell
tell group 1 of window "Sharing"
click checkbox 1 of row 7 of table 1 of scroll area 1
display dialog "Renew internet sharing?" buttons {"No", "Yes"} default button 2
if result = {button returned:"Yes"} then
# should do a reveal here.
click checkbox 1 of row 7 of table 1 of scroll area 1
end if
end tell
on error
activate
display dialog "Error"
#tell application "System Preferences" to quit
return false
end try
end tell
end tell |
programs/oeis/195/A195122.asm | karttu/loda | 0 | 27215 | ; A195122: a(n) = 2*n - floor(n*r/2), where r=(1+sqrt(5))/2.
; 0,2,3,4,5,6,8,9,10,11,12,14,15,16,17,18,20,21,22,23,24,26,27,28,29,30,31,33,34,35,36,37,39,40,41,42,43,45,46,47,48,49,51,52,53,54,55,56,58,59,60,61,62,64,65,66,67,68,70,71,72,73,74,76,77,78,79,80,81,83,84,85,86,87,89,90,91,92,93,95,96,97,98,99,101,102,103,104,105,106,108,109,110,111,112,114,115,116,117,118,120,121,122,123,124,126,127,128,129,130,132,133,134,135,136,137,139,140,141,142,143,145,146,147,148,149,151,152,153,154,155,157,158,159,160,161,162,164,165,166,167,168,170,171,172,173,174,176,177,178,179,180,182,183,184,185,186,187,189,190,191,192,193,195,196,197,198,199,201,202,203,204,205,207,208,209,210,211,212,214,215,216,217,218,220,221,222,223,224,226,227,228,229,230,232,233,234,235,236,238,239,240,241,242,243,245,246,247,248,249,251,252,253,254,255,257,258,259,260,261,263,264,265,266,267,268,270,271,272,273,274,276,277,278,279,280,282,283,284,285,286,288,289,290,291,292,293,295,296,297
mov $2,$0
mul $0,55
mov $1,$0
lpb $0,1
mov $0,1
div $1,288
lpe
add $0,$1
mov $1,$0
add $1,$2
|
test/Fail/Sections-8.agda | cruhland/agda | 1,989 | 13715 | <reponame>cruhland/agda
data D : Set₁ where
⟨_⟩_ : Set → Set → D
Test : D → Set
Test ((⟨_⟩ X) _) = X
|
EngineHacks/CoreHacks/MapMaster/MoveLimitViewFix/_1D9DC_Loop6C_MoveLimitView.asm | MokhaLeee/FE16re-Proto | 5 | 26498 | <reponame>MokhaLeee/FE16re-Proto
.thumb
.include "_Definitions.h.s"
SET_FUNC_INLINE _1D9DC_Loop6C_MoveLimitView
@ new_MapMovement: 0x1 Blue/ 0x20 Red/ 0x40 Green
@ new_RangeMap: 0x2 Red/ 0x4 Green/ 0x10 Blue
_1D9DC_Loop6C_MoveLimitView:
push {r3-r7, lr}
mov r4, r0
_blh1 GetGameClock|1
lsr r5, r0, #0x1
mov r0, #0x1F
and r5, r0
add r4, #0x4A
ldrh r1,[r4]
.TestRoutine:
mov r0, #0x1
and r0, r1
cmp r0, #0x0
beq .NotBit1
lsl r0, r5, #0x1
ldr r1, =gPalBlueRangeSquare
add r0, r0, r1
mov r1, #0x82
mov r2, #0x20
_blh3 CopyToPaletteBuffer
.NotBit1:
ldrh r1,[r4]
mov r0, #0x2
and r0, r1
cmp r0, #0x0
beq .NotBit2
lsl r0, r5, #0x1
ldr r1, =gPalRedRangeSquare
add r0, r0, r1
mov r1, #0xA2
mov r2, #0x20
_blh3 CopyToPaletteBuffer
.NotBit2:
ldrh r1,[r4]
mov r0, #0x4
and r0, r1
cmp r0, #0x0
beq .NotBit4
lsl r0, r5, #0x1
ldr r1, =gPalGreenRangeSquare
add r0, r0, r1
mov r1, #0xA2
mov r2, #0x20
_blh3 CopyToPaletteBuffer
.NotBit4:
ldrh r1,[r4]
mov r0, #0x10
and r0, r1
cmp r0, #0x0
beq .NotBit10
lsl r0, r5, #0x1
ldr r1, =gPalBlueRangeSquare
add r0, r0, r1
mov r1, #0xA2
mov r2, #0x20
_blh3 CopyToPaletteBuffer
.NotBit10:
@-------------------- New Here -------------------
ldrh r1,[r4]
mov r0, #0x20
and r0, r1
cmp r0, #0x0
beq .NotBit20
lsl r0, r5, #0x1
ldr r1, =gPalRedRangeSquare
add r0, r0, r1
mov r1, #0x82
mov r2, #0x20
_blh3 CopyToPaletteBuffer
.NotBit20:
ldrh r1,[r4]
mov r0, #0x40
and r0, r1
cmp r0, #0x0
beq .NotBit40
lsl r0, r5, #0x1
ldr r1, =gPalGreenRangeSquare
add r0, r0, r1
mov r1, #0x82
mov r2, #0x20
_blh3 CopyToPaletteBuffer
.NotBit40:
@-------------------------------------------------
.End:
pop {r3-r7}
pop {r0}
bx r0
|
oeis/157/A157728.asm | neoneye/loda-programs | 11 | 98750 | <reponame>neoneye/loda-programs
; A157728: a(n) = Fibonacci(n) - 4.
; Submitted by <NAME>
; 1,4,9,17,30,51,85,140,229,373,606,983,1593,2580,4177,6761,10942,17707,28653,46364,75021,121389,196414,317807,514225,832036,1346265,2178305,3524574,5702883,9227461,14930348,24157813,39088165,63245982,102334151,165580137,267914292,433494433,701408729,1134903166,1836311899,2971215069,4807526972,7778742045,12586269021,20365011070,32951280095,53316291169,86267571268,139583862441,225851433713,365435296158,591286729875,956722026037,1548008755916,2504730781957,4052739537877,6557470319838,10610209857719
mov $1,2
mov $3,3
lpb $0
sub $0,1
mov $2,$3
add $3,$1
mov $1,$2
lpe
add $3,$1
mov $0,$3
sub $0,4
|
src/search-fields.adb | stcarrez/ada-search | 9 | 18032 | -----------------------------------------------------------------------
-- search-fields -- Document fields
-- Copyright (C) 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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.
-----------------------------------------------------------------------
with Ada.Streams.Stream_IO;
with Ada.Strings.Unbounded.Hash;
with Util.Streams.Files;
with Util.Streams.Buffered;
package body Search.Fields is
-- ------------------------------
-- Get the field name.
-- ------------------------------
function Get_Name (Field : in Field_Type) return String is
begin
return To_String (Field.Name);
end Get_Name;
-- ------------------------------
-- Get the field value for the meta field.
-- ------------------------------
function Get_Value (Field : in Field_Type) return String is
begin
if not Is_Stored (Field) then
return "";
else
return To_String (Field.Value);
end if;
end Get_Value;
-- ------------------------------
-- Returns True if this field is indexable.
-- ------------------------------
function Is_Indexable (Field : in Field_Type) return Boolean is
begin
return Field.Kind = F_TOKEN or Field.Kind = F_PATH or Field.Kind = F_CONTENT;
end Is_Indexable;
-- ------------------------------
-- Returns True if this field is composed of multiple tokens.
-- ------------------------------
function Is_Tokenized (Field : in Field_Type) return Boolean is
begin
return Field.Kind = F_CONTENT or Field.Kind = F_PATH;
end Is_Tokenized;
-- ------------------------------
-- Returns True if this field is stored in the index.
-- ------------------------------
function Is_Stored (Field : in Field_Type) return Boolean is
begin
return Field.Kind = F_Path;
end Is_Stored;
-- ------------------------------
-- Create a field with the given name and content.
-- ------------------------------
function Create (Name : in String;
Value : in String;
Kind : in Field_Kind := F_TOKEN) return Field_Type is
begin
return Field_Type '(Kind => Kind,
Name => To_UString (Name),
Value => To_UString (Value));
end Create;
-- ------------------------------
-- Stream the content of the field to the procedure.
-- ------------------------------
procedure Stream (Field : in Field_Type;
Into : not null access
procedure (S : in out Util.Streams.Input_Stream'Class)) is
begin
case Field.Kind is
when F_PATH =>
declare
Stream : Util.Streams.Files.File_Stream;
begin
Stream.Open (Ada.Streams.Stream_IO.In_File, To_String (Field.Value));
Into (Stream);
Stream.Close;
end;
when F_CONTENT =>
declare
Stream : Util.Streams.Buffered.Input_Buffer_Stream;
begin
Stream.Initialize (To_String (Field.Value));
Into (Stream);
end;
when others =>
null;
end case;
end Stream;
-- ------------------------------
-- Create a hash on the field on its name only.
-- ------------------------------
function Hash (Field : in Field_Type) return Ada.Containers.Hash_Type is
begin
return Ada.Strings.Unbounded.Hash (Field.Name);
end Hash;
end Search.Fields;
|
oeis/147/A147568.asm | neoneye/loda-programs | 11 | 170209 | <filename>oeis/147/A147568.asm
; A147568: a(n) = 2*A000695(n)+3.
; Submitted by <NAME>
; 3,5,11,13,35,37,43,45,131,133,139,141,163,165,171,173,515,517,523,525,547,549,555,557,643,645,651,653,675,677,683,685,2051,2053,2059,2061,2083,2085,2091,2093,2179,2181,2187,2189,2211,2213,2219,2221,2563,2565,2571
mov $2,2
lpb $0
mov $3,$0
div $0,2
mod $3,2
mul $3,$2
add $1,$3
mul $2,4
lpe
mov $0,$1
add $0,3
|
Kernel/source/exceptions.asm | MessiahAndrw/Perception | 56 | 169259 | <reponame>MessiahAndrw/Perception<filename>Kernel/source/exceptions.asm
; Copyright 2020 Google LLC
;
; 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.
[BITS 64]
[GLOBAL isr0]
[GLOBAL isr1]
[GLOBAL isr2]
[GLOBAL isr3]
[GLOBAL isr4]
[GLOBAL isr5]
[GLOBAL isr6]
[GLOBAL isr7]
[GLOBAL isr8]
[GLOBAL isr9]
[GLOBAL isr10]
[GLOBAL isr11]
[GLOBAL isr12]
[GLOBAL isr13]
[GLOBAL isr14]
[GLOBAL isr15]
[GLOBAL isr16]
[GLOBAL isr17]
[GLOBAL isr18]
[GLOBAL isr19]
[GLOBAL isr20]
[GLOBAL isr21]
[GLOBAL isr22]
[GLOBAL isr23]
[GLOBAL isr24]
[GLOBAL isr25]
[GLOBAL isr26]
[GLOBAL isr27]
[GLOBAL isr28]
[GLOBAL isr29]
[GLOBAL isr30]
[GLOBAL isr31]
; 0: Divide By Zero Exception
isr0:
cli
push 0
push 0
jmp exception_common_stub
; 1: Debug Exception
isr1:
cli
push 0
push 1
jmp exception_common_stub
; 2: Non Maskable Interrupt Exception
isr2:
cli
push 0
push 2
jmp exception_common_stub
; 3: Int 3 Exception
isr3:
cli
push 0
push 3
jmp exception_common_stub
; 4: INTO Exception
isr4:
cli
push 0
push 4
jmp exception_common_stub
; 5: Out of Bounds Exception
isr5:
cli
push 0
push 5
jmp exception_common_stub
; 6: Invalid Opcode Exception
isr6:
cli
push 0
push 6
jmp exception_common_stub
; 7: Coprocessor Not Available Exception
isr7:
cli
push 0
push 7
jmp exception_common_stub
; 8: Double Fault Exception (With Error Code!)
isr8:
cli
push 8
jmp exception_common_stub
; 9: Coprocessor Segment Overrun Exception
isr9:
cli
push 0
push 9
jmp exception_common_stub
; 10: Bad TSS Exception (With Error Code!)
isr10:
cli
push 10
jmp exception_common_stub
; 11: Segment Not Present Exception (With Error Code!)
isr11:
cli
push 11
jmp exception_common_stub
; 12: Stack Fault Exception (With Error Code!)
isr12:
cli
push 12
jmp exception_common_stub
; 13: General Protection Fault Exception (With Error Code!)
isr13:
cli
push 13
jmp exception_common_stub
; 14: Page Fault Exception (With Error Code!)
isr14:
cli
push 14
jmp exception_common_stub
; 15: Reserved Exception
isr15:
cli
push 0
push 15
jmp exception_common_stub
; 16: Floating Point Exception
isr16:
cli
push 0
push 16
jmp exception_common_stub
; 17: Alignment Check Exception
isr17:
cli
push 0
push 17
jmp exception_common_stub
; 18: Machine Check Exception
isr18:
cli
push 0
push 18
jmp exception_common_stub
; 19: Reserved
isr19:
cli
push 0
push 19
jmp exception_common_stub
; 20: Reserved
isr20:
cli
push 0
push 20
jmp exception_common_stub
; 21: Reserved
isr21:
cli
push 0
push 21
jmp exception_common_stub
; 22: Reserved
isr22:
cli
push 0
push 22
jmp exception_common_stub
; 23: Reserved
isr23:
cli
push 0
push 23
jmp exception_common_stub
; 24: Reserved
isr24:
cli
push 0
push 24
jmp exception_common_stub
; 25: Reserved
isr25:
cli
push 0
push 25
jmp exception_common_stub
; 26: Reserved
isr26:
cli
push 0
push 26
jmp exception_common_stub
; 27: Reserved
isr27:
cli
push 0
push 27
jmp exception_common_stub
; 28: Reserved
isr28:
cli
push 0
push 28
jmp exception_common_stub
; 29: Reserved
isr29:
cli
push 0
push 29
jmp exception_common_stub
; 30: Reserved
isr30:
cli
push 0
push 30
jmp exception_common_stub
; 31: Reserved
isr31:
cli
push 0
push 31
jmp exception_common_stub
[EXTERN ExceptionHandler]
[EXTERN currently_executing_thread_regs]
[EXTERN interrupt_stack_top]
[EXTERN JumpIntoThread]
exception_common_stub:
; Copy what's at the top of the thread's stack.
push rbp
push rdi ; Using to keep the interrupt number.
; Move these values out of the interrupt handler
mov rbp, [currently_executing_thread_regs]
pop qword [rbp + 13 * 8] ; rdi
pop qword [rbp + 14 * 8] ; rbp
pop rdi ; interrupt number
add rsp, 8
pop qword [rbp + 15 * 8] ; rip
pop qword [rbp + 16 * 8] ; cs
pop qword [rbp + 17 * 8] ; eflags
pop qword [rbp + 18 * 8] ; usersp
pop qword [rbp + 19 * 8] ; ss
; Point our stack to the top of isr_regs, minus the registers already saved.
mov rsp, [currently_executing_thread_regs]
add rsp, 13 * 8
; Push the rest of the registers.
push rax
push rbx
push rcx
push rdx
push rsi
push r8
push r9
push r10
push r11
push r12
push r13
push r14
push r15
; Move back to the interrupt's stack.
mov rsp, interrupt_stack_top
; Move to kernel land data segment
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
; Call the handler
; mov rdi, [rbp - 46] ; pass interrupt number as argument
; Interrupt number is in rdi and will get passed as an argument.
mov rax, ExceptionHandler
call rax
jmp JumpIntoThread |
contrib/gnu/gdb/dist/gdb/testsuite/gdb.ada/rename_subscript_param/pkg.adb | TheSledgeHammer/2.11BSD | 3 | 11438 | -- Copyright 2016-2020 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pck; use Pck;
package body Pkg is
procedure Flip (Bits : in out Bits_Type; I : Natural) is
begin
-- Create a new scope to check that the scope match algorithm is fine in
-- the front-end.
declare
Rename_Subscript_Param_B : Boolean renames Bits (I);
begin
Rename_Subscript_Param_B := not Rename_Subscript_Param_B; -- BREAK
Do_Nothing (Bits'Address);
end;
end Flip;
end Pkg;
|
source/numerics/a-numdsf.ads | ytomino/drake | 33 | 25169 | <reponame>ytomino/drake
pragma License (Unrestricted); -- BSD 3-Clause
-- translated unit from dSFMT
--
-- Copyright (c) 2007, 2008, 2009 <NAME>, <NAME>
-- and Hiroshima University.
-- Copyright (c) 2011, 2002 <NAME>, <NAME>, Hiroshima
-- University and The University of Tokyo.
-- 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 the Hiroshima University 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.
--
-- Ada version: 2018 yt
with Ada.IO_Exceptions;
with Interfaces;
generic
-- Mersenne Exponent. The period of the sequence is a multiple of 2^MEXP-1.
MEXP : Natural;
-- the pick up position of the array.
POS1 : Natural;
-- the parameter of shift left as four 32-bit registers.
SL1 : Natural;
-- A bitmask, used in the recursion. These parameters are introduced to
-- break symmetry of SIMD.
MSK1 : Interfaces.Unsigned_64;
MSK2 : Interfaces.Unsigned_64;
FIX1 : Interfaces.Unsigned_64;
FIX2 : Interfaces.Unsigned_64;
-- These definitions are part of a 128-bit period certification vector.
PCV1 : Interfaces.Unsigned_64;
PCV2 : Interfaces.Unsigned_64;
package Ada.Numerics.dSFMT is
-- Double precision SIMD oriented Fast Mersenne Twister(dSFMT)
-- pseudorandom number generator based on IEEE 754 format.
pragma Preelaborate;
type Long_Float_Array is array (Natural range <>) of Long_Float;
for Long_Float_Array'Alignment use 16;
subtype Unsigned_32 is Interfaces.Unsigned_32;
type Unsigned_32_Array is
array (Natural range <>) of aliased Interfaces.Unsigned_32;
for Unsigned_32_Array'Alignment use 16;
-- Identification string
function Id return String;
DSFMT_MEXP : Natural
renames MEXP;
-- Basic facilities
type Generator is limited private;
function Random_1_To_Less_Than_2 (Gen : aliased in out Generator)
return Long_Float;
function Random_0_To_Less_Than_1 (Gen : aliased in out Generator)
return Long_Float;
function Random_Greater_Than_0_To_1 (Gen : aliased in out Generator)
return Long_Float;
function Random_Greater_Than_0_To_Less_Than_1 (
Gen : aliased in out Generator)
return Long_Float;
pragma Inline (Random_1_To_Less_Than_2);
pragma Inline (Random_0_To_Less_Than_1);
pragma Inline (Random_Greater_Than_0_To_1);
pragma Inline (Random_Greater_Than_0_To_Less_Than_1);
procedure Fill_Random_1_To_Less_Than_2 (
Gen : aliased in out Generator;
Item : out Long_Float_Array);
procedure Fill_Random_0_To_Less_Than_1 (
Gen : aliased in out Generator;
Item : out Long_Float_Array);
procedure Fill_Random_Greater_Than_0_To_1 (
Gen : aliased in out Generator;
Item : out Long_Float_Array);
procedure Fill_Random_Greater_Than_0_To_Less_Than_1 (
Gen : aliased in out Generator;
Item : out Long_Float_Array);
function Initialize return Generator;
function Initialize (Initiator : Unsigned_32) return Generator;
function Initialize (Initiator : Unsigned_32_Array) return Generator;
procedure Reset (Gen : in out Generator);
procedure Reset (Gen : in out Generator; Initiator : Integer);
-- Advanced facilities
type State is private;
pragma Preelaborable_Initialization (State); -- uninitialized
function Initialize return State;
function Initialize (Initiator : Unsigned_32) return State;
function Initialize (Initiator : Unsigned_32_Array) return State;
procedure Save (Gen : Generator; To_State : out State);
procedure Reset (Gen : in out Generator; From_State : State);
function Reset (From_State : State) return Generator;
Max_Image_Width : constant Natural;
function Image (Of_State : State) return String;
function Value (Coded_State : String) return State;
Default_Initiator : constant := 1234; -- test.c
-- This constant means the minimum size of array used for
-- Fill_Random_... procedures.
Min_Array_Length : constant Natural;
-- Exceptions
Use_Error : exception
renames IO_Exceptions.Use_Error;
-- Note: Initialize propagates Use_Error if it failed.
private
pragma Compile_Time_Error (Long_Float'Size /= 64, "Long_Float'Size /= 64");
subtype Unsigned_64 is Interfaces.Unsigned_64;
type Unsigned_64_Array is
array (Natural range <>) of aliased Interfaces.Unsigned_64;
for Unsigned_64_Array'Alignment use 16;
-- the parameters of DSFMT
LOW_MASK : constant := 16#000FFFFFFFFFFFFF#;
HIGH_CONST : constant := 16#3FF0000000000000#;
SR : constant := 12;
-- DSFMT generator has an internal state array of 128-bit integers, and N
-- is its size.
N : constant Natural := (MEXP - 128) / 104 + 1;
-- N32 is the size of internal state array when regarded as an array of
-- 32-bit integers.
N32 : constant Natural := N * 4;
-- N64 is the size of internal state array when regarded as an array of
-- 64-bit integers.
Min_Array_Length : constant Natural := N * 2;
N64 : Natural renames Min_Array_Length;
Max_Image_Width : constant Natural := (N64 + 2) * (64 / 4 + 1) + 32 / 4;
-- 128-bit data type
type w128_t is array (0 .. 1) of Unsigned_64;
for w128_t'Alignment use 16;
pragma Suppress_Initialization (w128_t);
type w128_t_Array is array (Natural range <>) of aliased w128_t
with Convention => Ada_Pass_By_Reference;
pragma Suppress_Initialization (w128_t_Array);
subtype w128_t_Array_1 is w128_t_Array (0 .. 0);
subtype w128_t_Array_N is w128_t_Array (0 .. N - 1);
type State is record
-- the 128-bit internal state array
status : aliased w128_t_Array_N;
lung : aliased w128_t; -- status (N)
idx : Integer;
end record;
pragma Suppress_Initialization (State);
type Generator is limited record
dsfmt : aliased State := Initialize (Default_Initiator);
end record;
end Ada.Numerics.dSFMT;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/complex1.adb | best08618/asylo | 0 | 18440 | <filename>gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/complex1.adb
-- { dg-do compile }
with Ada.Numerics.Complex_types; use Ada.Numerics.Complex_types;
with Complex1_Pkg; use Complex1_Pkg;
procedure Complex1 is
Z : Complex;
begin
Coord (Z.Re, Z.Im);
end;
|
programs/oeis/263/A263334.asm | karttu/loda | 1 | 101677 | <gh_stars>1-10
; A263334: Number of (n+2) X (1+2) 0..2 arrays with each row and column divisible by 13, read as a base-3 number with top and left being the most significant digits.
; 3,7,19,57,169,505,1515,4543,13627,40881,122641,367921,1103763,3311287,9933859,29801577,89404729,268214185,804642555,2413927663,7241782987,21725348961,65176046881,195528140641,586584421923,1759753265767,5279259797299,15837779391897,47513338175689,142540014527065,427620043581195,1282860130743583,3848580392230747
add $0,3
mov $1,3
pow $1,$0
div $1,13
sub $1,2
div $1,2
mul $1,2
add $1,3
|
alloy4fun_models/trainstlt/models/4/nvEgFBXyARLBcGzZT.als | Kaixi26/org.alloytools.alloy | 0 | 3416 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idnvEgFBXyARLBcGzZT_prop5 {
all t:Train |{
always (t.pos in Exit implies t.pos'= t.pos)
}
}
pred __repair { idnvEgFBXyARLBcGzZT_prop5 }
check __repair { idnvEgFBXyARLBcGzZT_prop5 <=> prop5o } |
src/BreathOfTheWild/Mods/DrawDistance/patch_DrawDistance.asm | lilystudent2016/cemu_graphic_packs | 184 | 6386 | [BotW_DrawDistance_V208]
moduleMatches = 0x6267BFD0
.origin = codecave
actorMultiplier:
.float $actor
_setActorDrawDistanceMultiplier:
lis r9, actorMultiplier@ha
lfs f9, actorMultiplier@l(r9)
stfs f9, 0x13BC(r28)
blr
0x03857F58 = nop ; Force the draw distance used for load balancing normally to be enabled
0x03857F5C = bla _setActorDrawDistanceMultiplier
objectMultiplier:
.float $object
objectDivider:
.float 1.0 - ($object - 1.0)
_setObjectDrawDistance:
lis r12, objectMultiplier@ha
lfs f0, objectMultiplier@l(r12)
; Doesn't catch objects that don't have their traverseRadiusXZ set, so those default to 0
blr
0x03137ECC = nop
0x03137ED0 = bla _setObjectDrawDistance
_setObjectDrawDistanceDivider:
fmuls f13, f1, f1
lis r8, objectDivider@ha
lfs f1, objectDivider@l(r8)
fmuls f13, f13, f1
blr
0x0313A60C = bla _setObjectDrawDistanceDivider
0x0313A678 = bla _setObjectDrawDistanceDivider |
Library/Breadbox/Impex/JPEG/Main/mainManager.asm | steakknife/pcgeos | 504 | 98976 | <filename>Library/Breadbox/Impex/JPEG/Main/mainManager.asm<gh_stars>100-1000
include stdapp.def
include vm.def
include Objects/gCtrlC.def
include library.def
include resource.def ; idata/udata, ProcCallFixedOrMovable etc.
include gstring.def
UseLib math.def
DefLib Main/jpeg.def
include Internal/heapInt.def
ErrorHandlerContext struct
EHC_ss word
EHC_ds word
EHC_es word
EHC_di word
EHC_si word
EHC_cs word
EHC_ip word
EHC_sp word
EHC_bp word
EHC_stackBot word
ErrorHandlerContext ends
global JPEGIMPORT: far
global JPEGTESTFILE: far
global JPEGEXPORT: far
global PALGSTRINGCOLELEMENT: far
global MY_GRPARSEGSTRING:far
global _set_error_handler:far
SetGeosConvention ; set calling convention
INIT segment resource
assume cs:INIT
db "OK"
dw InfoResource ; resource containing format names
dw 1 ; contains two sub-formats
dw 4000h ; this is a graphics translator
db "OK"
LibraryEntry proc far
clc
ret
LibraryEntry endp
INIT ends
ASM segment resource
assume cs:ASM
TransExport proc far
uses es,ds,si,di
.enter
push ds ; arg 1: pointer to impex data block
push si
mov ax,idata ; DS=dgroup
mov ds,ax
mov ax,25 ; Allocate default float stack size
mov bl,FLOAT_STACK_GROW
call FloatInit
call JPEGEXPORT ; Call high-level procedure to do work
call FloatExit
mov bx,dx ; BX:AX returns error code or format ID
.leave
ret
TransExport endp
TransImport proc far
uses es,ds,si,di
_vmc local dword
.enter
push ds ; arg 1: pointer to impex data block
push si
push ss ; arg 2: pointer to vm chain return buf
lea ax,_vmc
push ax
mov ax,idata ; DS=dgroup
mov ds,ax
mov ax,25 ; Allocate default float stack size
mov bl,FLOAT_STACK_GROW
call FloatInit
call JPEGIMPORT ; Call high-level procedure to do work
call FloatExit
mov bx,dx ; BX:AX returns error code or format ID
movdw dxcx,_vmc ; VMChain of object returned in DX:CX
.leave
ret
TransImport endp
TransGetFormat proc far
uses es,ds,si,di
.enter
push si ; argument file handle
mov ax,idata ; DS=dgroup
mov ds,ax
mov ax,25 ; Allocate default float stack size
mov bl,FLOAT_STACK_GROW
call FloatInit
call JPEGTESTFILE ; Call high-level procedure to do work
call FloatExit
mov cx, ax
xor ax, ax
.leave
ret
TransGetFormat endp
TransGetImportUI proc far
mov bp,00004h ; 0006 BD0800
push di ; 0009 57
push ds ; 000A 1E
mov bx,handle InfoResource ; 000B BB1400
call MemLock ; 000E 9A05000000
mov ds,ax ; 0013 8ED8
mov ax,0000Eh ; 0015 B80E00
mul cx ; 0018 F7E1
mov di,00010h ; 001A BF1000
add di,ax ; 001D 03F8
mov cx,[ds:bp+di+002h] ; 001F 3E8B4B02
mov dx,[ds:bp+di] ; 0023 3E8B13
call MemUnlock ; 0026 9A06000000
xor ax,ax ; 002B 33C0
mov bx,ax ; 002D 8BD8
pop ds ; 002F 1F
pop di ; 0030 5F
ret
TransGetImportUI endp
TransGetExportUI proc far
mov bp,00004h ; 0006 BD0800
push di ; 0009 57
push ds ; 000A 1E
mov bx,handle InfoResource ; 000B BB1400
call MemLock ; 000E 9A05000000
mov ds,ax ; 0013 8ED8
mov ax,0000Eh ; 0015 B80E00
mul cx ; 0018 F7E1
mov di,00014h ; 001A BF1000
add di,ax ; 001D 03F8
mov cx,[ds:bp+di+002h] ; 001F 3E8B4B02
mov dx,[ds:bp+di] ; 0023 3E8B13
call MemUnlock ; 0026 9A06000000
xor ax,ax ; 002B 33C0
mov bx,ax ; 002D 8BD8
pop ds ; 002F 1F
pop di ; 0030 5F
ret
TransGetExportUI endp
TransGetImportOptions proc far
push ax ; 01ED 50
push cx ; 01EE 51
push bx ; 01EF 53
push bp ; 01F0 55
push si ; 01F1 56
push di ; 01F2 57
push ds ; 01F3 1E
comment %
mov ax,MSG_GEN_ITEM_GROUP_GET_SELECTION
mov bx,dx
mov si,offset BmpExpBitFormGroup
mov di,mask MF_CALL
call ObjMessage
%
push ax
mov ax,00002h
mov cl,050h
mov ch,040h
call MemAlloc
xor dx,dx
jc iopt_err
push ax
pop ds
pop ax
mov [ds:00000h],ax ; booleanOptions
call MemUnlock
mov dx,bx
clc
iopt_err:
pop ds ; 0236 1F
pop di ; 0237 5F
pop si ; 0238 5E
pop bp ; 0239 5D
pop bx ; 023A 5B
pop cx ; 023B 59
pop ax ; 023C 58
ret
TransGetImportOptions endp
TransGetExportOptions proc far
push ax ; 01ED 50
push cx ; 01EE 51
push bx ; 01EF 53
push bp ; 01F0 55
push si ; 01F1 56
push di ; 01F2 57
push ds ; 01F3 1E
mov ax,MSG_GEN_VALUE_GET_VALUE
mov bx,dx
mov si,offset JpegQuality
mov di,mask MF_CALL
call ObjMessage
push dx
mov ax,00002h
mov cl,050h
mov ch,040h
call MemAlloc
xor dx,dx
jc iopt_err
push ax
pop ds
pop ax
mov [ds:00000h],ax ; booleanOptions
call MemUnlock
mov dx,bx
clc
iopt_err:
pop ds ; 0236 1F
pop di ; 0237 5F
pop si ; 0238 5E
pop bp ; 0239 5D
pop bx ; 023A 5B
pop cx ; 023B 59
pop ax ; 023C 58
ret
TransGetExportOptions endp
TransInitImportUI proc far
ret
TransInitImportUI endp
TransInitExportUI proc far
ret
TransInitExportUI endp
ASM ends
include manager.rdef
InfoResource segment lmem LMEM_TYPE_GENERAL,mask LMF_IN_RESOURCE
dw fmt_1_name,fmt_1_mask
D_OPTR 0
D_OPTR JpegExportGroup
dw 0C000h ; Currently we only support import
dw 0
fmt_1_name chunk char
char "JPEG",0
fmt_1_name endc
fmt_1_mask chunk char
char "*.jpg",0
fmt_1_mask endc
InfoResource ends
ASM_FIXED segment
_MYPARSEGSTRING_callback proc far
uses si,di,ds,es
.enter
push ds ; push ptr argument for routine
push si
push di ; push gstate argument
push bx ; push memory handle
call PALGSTRINGCOLELEMENT
.leave
ret
_MYPARSEGSTRING_callback endp
MY_GRPARSEGSTRING proc far _gstate:word, _gstring:word, _flags:word, _h:word
uses bx,cx,dx,si,di
.enter
mov di,_gstate ; load arguments
mov si,_gstring
mov dx,_flags
mov bx,segment _MYPARSEGSTRING_callback
mov cx,offset _MYPARSEGSTRING_callback
; pointer to callback thunk
mov bp,_h ; handle passed to callback
call GrParseGString ; do it!
.leave
ret
MY_GRPARSEGSTRING endp
SetDefaultConvention
; WARNING: THIS ROUTINE MUST BE LOCATED IN A FIXED RESOURCE! RCI WILL SCREW
; UP THE ALGORITHM IF IT OCCURS BETWEEN THIS ROUTINE AND ITS CALLER!
; Thanks for your cooperation. -Dave
_set_error_handler proc far errorContextP:fptr.word
uses es, di
.enter
mov ax, size ErrorHandlerContext
mov cx, ALLOC_DYNAMIC_LOCK
call MemAlloc
tst bx
jz returnMem
mov cx, es ; original ES
mov es, ax
clr ax
mov es:[EHC_ss], ss
mov es:[EHC_ds], ds
mov es:[EHC_es], cx
mov es:[EHC_di], di
mov es:[EHC_si], si
mov ax, ss:[bp] ; caller's BP
mov es:[EHC_bp], ax
mov ax, ss:[bp]+2 ; return off
mov es:[EHC_ip], ax
mov ax, ss:[bp]+4 ; return seg
mov es:[EHC_cs], ax
mov ax, bp
add ax, 2 ; SP to return to caller
mov es:[EHC_sp], ax
mov ax, ss:[TPD_stackBot]
mov es:[EHC_stackBot], ax
call MemUnlock
returnMem:
mov es, errorContextP.segment
mov di, errorContextP.offset
mov es:[di], bx
mov ax, 0 ; error handler set
.leave
ret
_set_error_handler endp
SetGeosConvention
ASM_FIXED ends
|
programs/oeis/084/A084264.asm | karttu/loda | 0 | 246094 | ; A084264: Binomial transform of A084263.
; 1,2,7,22,64,176,464,1184,2944,7168,17152,40448,94208,217088,495616,1122304,2523136,5636096,12517376,27656192,60817408,133169152,290455552,631242752,1367343104,2952790016,6358564864,13656653824,29259464704
mov $5,2
mov $11,$0
lpb $5,1
mov $0,$11
sub $5,1
add $0,$5
sub $0,1
mov $7,$0
mov $9,2
lpb $9,1
mov $0,$7
sub $9,1
add $0,$9
sub $0,1
mov $2,$0
mov $4,1
lpb $2,1
bin $0,2
sub $2,1
add $4,1
add $4,$0
mov $0,1
mul $4,2
lpe
mov $6,$4
mov $10,$9
lpb $10,1
mov $8,$6
sub $10,1
lpe
lpe
lpb $7,1
mov $7,0
sub $8,$6
lpe
mov $3,$5
mov $6,$8
lpb $3,1
mov $1,$6
sub $3,1
lpe
lpe
lpb $11,1
sub $1,$6
mov $11,0
lpe
|
gcc-gcc-7_3_0-release/gcc/ada/pprint.ads | best08618/asylo | 7 | 16076 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- P P R I N T --
-- --
-- S p e c --
-- --
-- Copyright (C) 2008-2015, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
-- http://www.gnu.org/licenses for a complete copy of the license. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package (pretty print) contains a routine for printing an expression
-- given its node in the syntax tree. Contrarily to the Sprint package, this
-- routine tries to obtain "pretty" output that can be used for e.g. error
-- messages.
with Types; use Types;
with Urealp; use Urealp;
package Pprint is
generic
-- ??? The generic parameters should be removed.
with function Real_Image (U : Ureal) return String;
with function String_Image (S : String_Id) return String;
with function Ident_Image (Expr : Node_Id;
Orig_Expr : Node_Id;
Expand_Type : Boolean) return String;
-- Will be called for printing N_Identifier and N_Defining_Identifier
-- nodes
-- ??? Expand_Type argument should be removed
Hide_Parameter_Blocks : Boolean := False;
-- If true, then "Parameter_Block.Field_Name.all" is
-- instead displayed as "Field_Name".
function Expression_Image
(Expr : Node_Id;
Default : String) return String;
-- Given a Node for an expression, return a String that is meaningful for
-- the programmer. If the expression comes from source, it is copied from
-- there.
-- Subexpressions outside of the maximum depth (3), the maximal number of
-- accepted nodes (24), and the maximal number of list elements (3), are
-- replaced by the default string.
end Pprint;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_878.asm | ljhsiun2/medusa | 9 | 104322 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r15
push %rax
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_D_ht+0x7695, %r12
nop
nop
nop
nop
nop
and %rax, %rax
mov $0x6162636465666768, %r11
movq %r11, (%r12)
nop
nop
nop
nop
dec %rdi
lea addresses_WC_ht+0x13e96, %rdx
nop
nop
nop
xor %rcx, %rcx
movl $0x61626364, (%rdx)
nop
nop
xor $36287, %r12
lea addresses_normal_ht+0xcb3d, %rsi
lea addresses_UC_ht+0x395, %rdi
and $8608, %r15
mov $34, %rcx
rep movsq
and $19053, %r12
lea addresses_UC_ht+0xf695, %r11
nop
nop
and $51926, %r15
mov $0x6162636465666768, %rax
movq %rax, %xmm5
vmovups %ymm5, (%r11)
nop
nop
nop
nop
cmp $27004, %r15
lea addresses_WT_ht+0x1be95, %rsi
nop
nop
nop
nop
xor $37073, %r12
mov (%rsi), %di
nop
cmp %rdx, %rdx
lea addresses_A_ht+0x974b, %r11
nop
nop
nop
nop
cmp %r12, %r12
vmovups (%r11), %ymm1
vextracti128 $1, %ymm1, %xmm1
vpextrq $0, %xmm1, %rsi
nop
nop
nop
nop
nop
sub $58055, %r11
lea addresses_A_ht+0x1de95, %rdi
nop
nop
nop
and $22879, %r11
movb $0x61, (%rdi)
nop
nop
nop
nop
nop
and $31292, %rsi
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r9
push %rbx
push %rcx
// Faulty Load
lea addresses_WT+0xf095, %r9
clflush (%r9)
nop
nop
nop
inc %r10
mov (%r9), %r11d
lea oracles, %r9
and $0xff, %r11
shlq $12, %r11
mov (%r9,%r11,1), %r11
pop %rcx
pop %rbx
pop %r9
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_WT', 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_D_ht', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WC_ht', 'congruent': 0}, 'OP': 'STOR'}
{'dst': {'same': False, 'congruent': 8, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal_ht'}}
{'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_UC_ht', 'congruent': 9}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_WT_ht', 'congruent': 9}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 1}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_A_ht', 'congruent': 8}, 'OP': 'STOR'}
{'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
*/
|
uw1/call-eop-mouseLookOrMoveCursor.asm | JohnGlassmyer/UltimaHacks | 68 | 17703 | %ifndef EXE_LENGTH
%include "../UltimaPatcher.asm"
%include "include/uw1.asm"
%include "include/uw1-eop.asm"
defineAddress 14, 0x0B16, moveCursor
defineAddress 14, 0x0B5B, doneMovingCursor
%define pushYDelta push di
%endif
[bits 16]
startPatch EXE_LENGTH, \
call mouselook eop instead of updating cursor position
startBlockAt addr_moveCursor
%assign var_mouseXDelta -0x0A
; di == mouseYDelta
push word [bp+var_mouseXDelta]
pushYDelta
push word varArgsEopArg(mouseLookOrMoveCursor, 2)
callFromLoadModule varArgsEopDispatcher
add sp, 6
jmp calcJump(off_doneMovingCursor)
endBlock
endPatch
|
programs/oeis/107/A107660.asm | karttu/loda | 1 | 87930 | ; A107660: Sum 3^max(k,n-k),k=0..n.
; 1,6,21,72,225,702,2133,6480,19521,58806,176661,530712,1592865,4780782,14344533,43040160,129127041,387400806,1162222101,3486725352,10460235105,31380882462,94142824533,282429005040,847287546561,2541864234006,7625594296341,22876787671992,68630367798945,205891117745742,617673367586133,1853020145805120,5559060480462081
add $0,1
cal $0,32096 ; "BHK" (reversible, identity, unlabeled) transform of 2,2,2,2,...
mov $1,$0
sub $1,2
|
src/host/x86/asm/has/uXmhasAVX_VPCLMULQDQ.asm | Navegos/uasmlib | 3 | 96479 | <reponame>Navegos/uasmlib
include uXmx86asm.inc
option casemap:none
ifndef __X64__
.686P
.xmm
.model flat, c
else
.X64P
.xmm
option win64:11
option stackbase:rsp
endif
option frame:auto
.code
align 16
uXm_has_AVX_VPCLMULQDQ proto VECCALL (byte)
align 16
uXm_has_AVX_VPCLMULQDQ proc VECCALL (byte)
mov eax, 1
cpuid
and ecx, bit_OSXS_AVX
cmp ecx, bit_OSXS_AVX ; OSXSAVE AVX feature flags
jne not_supported
; processor supports AVX instructions and XGETBV is enabled by OS
mov eax, 7
cpuid
and ecx, bit_VPCLMULQDQ
cmp ecx, bit_VPCLMULQDQ ; VPCLMULQDQ support by microprocessor
jne not_supported
mov ecx, 0 ; specify 0 for XCR0 register
xgetbv ; result in edx:eax
and eax, 06h
cmp eax, 06h ; check OS has enabled both XMM and YMM state support
jne not_supported
mov al, true
jmp done
not_supported:
mov al, false
done:
ret
uXm_has_AVX_VPCLMULQDQ endp
end ;.code |
DebrisFromExercises/04/fill/Fill.asm | it-depends/CPSG-Nand2Tetris | 0 | 168260 | <gh_stars>0
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by <NAME> Schocken, MIT Press.
// File name: projects/04/Fill.asm
// Runs an infinite loop that listens to the keyboard input.
// When a key is pressed (any key), the program blackens the screen,
// i.e. writes "black" in every pixel. When no key is pressed, the
// program clears the screen, i.e. writes "white" in every pixel.
// Put your code here.
@SCREEN
D=A
@Start // Holds start address of area to flll
M=D
// @4
@8192
D=A
@Size // Number of address in area
M=D
@Start
D=M
@Size
D=D+M
@End // Address After last address in Area
M=D
(CheckKeyboard)
// set default value (white)
@Value
M=0
// read keyboard
@KBD
D=M
// Jump to Redraw if no key is pressed
@Redraw
D;JEQ
// set value to 1's (black)
@Value
M=-1
(Redraw)
// set cell address to start
@Start
D=M
@Cell
M=D
(DrawCell)
// Check cell is within bounds
// Find how far Cell is below End
@Cell
D=M
@End
D=M-D
// If not positive go back CheckKeyboard
@CheckKeyboard
D;JLE
// Actual do some srawing
// load value
@Value
D=M
// Load current address
@Cell
A=M
// Set cell value
M=D
// Increment Cell
@Cell
M=M+1
// Draw next Cell
@DrawCell
0;JMP
|
alloy4fun_models/trashltl/models/6/vfR6wojSATiCrCWzi.als | Kaixi26/org.alloytools.alloy | 0 | 4563 | <gh_stars>0
open main
pred idvfR6wojSATiCrCWzi_prop7 {
always all f : File | after f in Protected
}
pred __repair { idvfR6wojSATiCrCWzi_prop7 }
check __repair { idvfR6wojSATiCrCWzi_prop7 <=> prop7o } |
TeamProject/MindReader1_0.asm | SCGTall/Water | 1 | 28462 | ##############################################################################
# Program : MindReader Programmer: <NAME>, <NAME>, <NAME>, <NAME>
# Due Date: 12/05/19 Last Modified:10/04/19
# Course: CS3340 Section:501
#############################################################################
# Description:
#
# Topic:
# The topic for the team project this semester is the Mind Reader game.
# For a feel of the game visit
# https://www.mathsisfun.com/games/mind-reader.html
#
# Minimum requirements for the program:
# The game is for a human player and your program is the 'mind reader'. Your program must display the
# cards, get input from the player then correctly display the number that the player has in mind.
# At the end of a game, the program will ask the player if he/she wants to play another game and then
# repeat or end the program.
# The 'cards' MUST be generated and displayed once at a time during a game, i.e. NOT pre-calculated
# and stored in memory. The order of displayed cards MUST be random.
# The player input (keystrokes) should be minimum
# The ASCII based display is the minimum requirement. Creative ways to display the game (e.g. colors)
# will earn the team extra credits.
# If the player gives an invalid input, an error message is displayed to explain why the input was not valid.
#
# Extra credits will be given for:
# Graphic/color display
# Extra features of the programs (e.g. background music, sounds or music to indicate invalid input,
# pleasant display etc...) implemented and documented.
# Any other notable creativity that the team has shown.
# You must document these extra credit features in your report and explain well to unlock these extra
# credits.
#
# Log:
# version 1.0 10/04/19 Design the interaction flow
#
#############################################################################
# Register:
# $v0 for I/O
# $a0 for I/O
# $s0 'y'
# $s1 'n'
# $s2 6 (6 digits)
# $t0 result
# $t1 digit
# $t2 1 for y and 0 for n
# $t3 digit < 6 ? 1 : 0
#############################################################################
.data
# messages
start: .asciiz "Think of a number between 0 and 63. Six cards will be displayed and you would tell\n"
start2: .asciiz "me whether your number is in the card. Once you finish all six cards, I can read your\n"
start3: .asciiz "mind. Start now?\n"
hint: .asciiz "input 'y' or 'n':\n"
question: .asciiz "Do you find your number here?"
unvalid: .asciiz "\nThe only valid answer is 'y' or 'n' (lower case). So input correctly.\n"
answer: .asciiz "\nYour number is "
again: .asciiz ". Awesome right?\nDo you wanna another try?\n"
end: .asciiz "\nGLHF!"
test: .asciiz "\n########"
#############################################################################
.text
.globl main
main: # init
li $s0, 0x79 # save character 'y'
li $s1, 0x6e # save character 'n'
li $s2, 6 # max digit
li $t0, 0 # set result to 0
li $t1, 0 # start from last digit
# get start
li $v0, 4 # print message start
la $a0, start # load address
syscall
li $v0, 4 # print message start2
la $a0, start2
syscall
li $v0, 4 # print message start3
la $a0, start3
syscall
li $v0, 4 # print message hint
la $a0, hint
syscall
jal input # get an input
beq $t2, $zero, exit
# print card and ask question
loop: slt $t3, $t1, $s2 # digit < 6 ? 1 : 0
beq $t3, $zero, show # if digit >= 6, show reslut
jal print # print card
li $v0, 4 # print question
la $a0, answer
syscall
li $v0, 4 # print hint
la $a0, hint
syscall
jal input # get an input
addi $t1, $t1, 1 # digit++
j loop
show: li $v0, 4 # print answer
la $a0, answer
syscall
li $v0, 1 # print result
move $a0, $t0 # set $a0 to result
syscall
li $v0, 4 # print again
la $a0, again
syscall
li $v0, 4 # print hint
la $a0, hint
syscall
jal input
beq $t2, $zero, exit
j main
input: li $v0, 12 # load a character
syscall
# check input validity
beq $v0, $s0, branchY # input is y
beq $v0, $s1, branchN # input is n
li $v0, 4 # print unvalid
la $a0, unvalid
syscall
j input
branchY: li $t2, 1 # set $s2 to 1 if input is y
jr $ra
branchN: li $t2, 0 # set $s2 to 0 if input is n
jr $ra
print: li $v0, 4 # print card
la $a0, test
syscall
jr $ra
exit: li $v0, 4 # print end
la $a0, end
syscall
|
models/112.als | trojan321/AlloyViz | 0 | 2914 | module examples/toys/genealogy
abstract sig Person {spouse: lone Person, parents: set Person}
{
-- nobody is his or her own ancestor
this not in this.^@parents
}
sig Man, Woman extends Person {}
one sig Eve extends Woman {}
one sig Adam extends Man {}
fact Bible {
-- every person except Adam and Eve has a mother and father
all p: Person - (Adam + Eve) | one mother: Woman, father: Man |
p.parents = mother + father
-- Adam and Eve have no parents
no (Adam + Eve).parents
-- Adam's spouse is Eve
Adam.spouse = Eve
}
fact SocialNorms {
-- nobody is his or her own spouse
no p: Person | p.spouse = p
-- spouse is symmetric
spouse = ~spouse
-- a man's spouse is a woman and vice versa
Man.spouse in Woman && Woman.spouse in Man
}
fact NoIncest {
-- can't marry a sibling
no p: Person | some p.spouse.parents & p.parents
-- can't marry a parent
no p: Person | some p.spouse & p.parents
}
fun getSiblings(p:Person): set Person{
p.(parents).~(parents) - p
}
pred Show {
some p: Person - (Adam + Eve) | some p.spouse
}
run Show for 6 expect 1
assert noOneIsOwnParent {
no p: Person | p in p.^parents
}
check noOneIsOwnParent expect 0
|
programs/oeis/326/A326422.asm | neoneye/loda | 22 | 88246 | ; A326422: Numbers k such that A000045(k) mod 5 is prime.
; 3,4,6,7,13,14,16,17,23,24,26,27,33,34,36,37,43,44,46,47,53,54,56,57,63,64,66,67,73,74,76,77,83,84,86,87,93,94,96,97,103,104,106,107,113,114,116,117,123,124,126,127,133,134,136,137,143,144,146,147,153,154,156,157
mov $1,$0
mul $0,6
div $0,4
add $0,$1
add $0,2
mod $1,4
sub $0,$1
add $0,1
|
src/keystore-repository-workers.ads | My-Colaborations/ada-keystore | 25 | 24157 | <filename>src/keystore-repository-workers.ads
-----------------------------------------------------------------------
-- keystore-repository-workers -- Data access and management for the keystore
-- Copyright (C) 2019, 2020 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- 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.
-----------------------------------------------------------------------
with Util.Encoders.AES;
with Keystore.IO;
with Ada.Streams;
with Util.Streams;
with Keystore.Random;
with Keystore.Repository.Keys;
with Util.Concurrent.Sequence_Queues;
private package Keystore.Repository.Workers is
type Wallet_Worker (Work_Count : Natural) is limited private;
type Wallet_Worker_Access is access all Wallet_Worker;
-- Create the wallet encryption and decryption work manager.
function Create (Manager : access Wallet_Repository;
Work_Manager : in Keystore.Task_Manager_Access;
Count : in Positive) return Wallet_Worker_Access;
subtype Buffer_Offset is Buffers.Buffer_Size range 1 .. DATA_MAX_SIZE;
type Data_Work_Type is (DATA_ENCRYPT, DATA_DECRYPT, DATA_RELEASE);
type Status_Type is (SUCCESS, PENDING, IO_ERROR, DATA_CORRUPTION);
type Data_Work;
type Data_Work_Access is access all Data_Work;
package Work_Queues is
new Util.Concurrent.Sequence_Queues (Element_Type => Data_Work_Access,
Sequence_Type => Natural,
Default_Size => 32,
Clear_On_Dequeue => False);
type Data_Work is limited new Work_Type with record
Kind : Data_Work_Type := DATA_DECRYPT;
Status : Status_Type;
Key_Block : IO.Marshaller;
Key_Pos : IO.Block_Index;
Data_Block : IO.Storage_Block;
Fragment_Count : Natural;
Fragment_Pos : Natural;
Entry_Id : Wallet_Entry_Index;
Data_Offset : Interfaces.Unsigned_64;
Seek_Offset : Stream_Element_Offset;
Data_Need_Setup : Boolean;
Sequence : Natural;
Start_Data : Stream_Element_Offset;
End_Data : Stream_Element_Offset;
End_Aligned_Data : Stream_Element_Offset;
Buffer_Pos : Buffer_Offset;
Last_Pos : Buffer_Offset;
Random : Keystore.Random.Generator;
Data_Decipher : Util.Encoders.AES.Decoder;
Data_Cipher : Util.Encoders.AES.Encoder;
Info_Cryptor : Keystore.Keys.Cryptor;
Stream : Keystore.IO.Wallet_Stream_Access;
Queue : access Work_Queues.Queue;
Manager : access Keystore.Repository.Wallet_Repository;
Data : aliased Ada.Streams.Stream_Element_Array (1 .. DATA_MAX_SIZE);
end record;
overriding
procedure Execute (Work : in out Data_Work);
procedure Fill (Work : in out Data_Work;
Input : in out Util.Streams.Input_Stream'Class;
Space : in Buffer_Offset;
Data_Size : out Buffers.Buffer_Size);
procedure Fill (Work : in out Data_Work;
Input : in Ada.Streams.Stream_Element_Array;
Input_Pos : in Ada.Streams.Stream_Element_Offset;
Data_Size : out IO.Buffer_Size);
procedure Do_Decipher_Data (Work : in out Data_Work);
procedure Do_Cipher_Data (Work : in out Data_Work);
procedure Do_Delete_Data (Work : in out Data_Work);
function Get_Work (Worker : in out Wallet_Worker) return Data_Work_Access;
procedure Put_Work (Worker : in out Wallet_Worker;
Work : in Data_Work_Access);
procedure Allocate_Work (Manager : in out Wallet_Repository;
Kind : in Data_Work_Type;
Process : access procedure (Work : in Data_Work_Access);
Iterator : in Keys.Data_Key_Iterator;
Work : out Data_Work_Access);
procedure Initialize_Queue (Manager : in out Wallet_Repository);
procedure Flush_Queue (Manager : in out Wallet_Repository;
Process : access procedure (Work : in Data_Work_Access));
procedure Queue_Decipher_Work (Manager : in out Wallet_Repository;
Work : in Data_Work_Access;
Queued : out Boolean);
procedure Queue_Cipher_Work (Manager : in out Wallet_Repository;
Work : in Data_Work_Access);
procedure Queue_Delete_Work (Manager : in out Wallet_Repository;
Work : in Data_Work_Access);
private
type Data_Work_Array is array (Positive range <>) of aliased Data_Work;
type Data_Work_Access_Array is array (Positive range <>) of Data_Work_Access;
type Wallet_Worker (Work_Count : Natural) is limited record
Sequence : Natural := 0;
Work_Manager : Keystore.Task_Manager_Access;
Data_Queue : aliased Work_Queues.Queue;
Pool_Count : Natural := 0;
Work_Pool : Data_Work_Access_Array (1 .. Work_Count);
Work_Slots : Data_Work_Array (1 .. Work_Count);
end record;
procedure Load_Data (Work : in out Data_Work;
Data_Block : in out IO.Marshaller);
end Keystore.Repository.Workers;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.