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
Assembly/bosses_moved.asm
Berserker66/Enemizer
2
85690
;================================================================================ ; Move the bosses to the right screen location depending on the room ;-------------------------------------------------------------------------------- boss_move: { ; TODO: should probably double check that we don't need to preserve registers (A,X)... JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites LDA $A0 ; load room index (low byte) LDX $A1 ; (high byte) CMP #7 : BNE + ; Is is Hera Tower Boss Room CPX #$00 : BNE + JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_middle + CMP #200 : BNE + ; Is is Eastern Palace Boss Room JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_bottom_right + CMP #41 : BNE + ; Is is Skull Woods Boss Room ; TODO: Add moving floor sprite JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites LDA #$07 : STA $0B00;Spawn the moving floor sprite STZ $0B28 INC $0B08 BRL .move_to_bottom_right + CMP #51 : BNE + ; Is is Desert Palace Boss Room JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_bottom_left + CMP #90 : BNE + ; Is is Palace of darkness Boss Room JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_bottom_right + CMP #144 : BNE + ; Is is Misery Mire Boss Room JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_bottom_left + CMP #172 : BNE + ; Is is Thieve Town Boss Room ; IF MAIDEN IS NOT RESCUED -> DO NOTHING ; IF MAIDEN IS ALREADY RESCUED -> spawn sprites normally JSL Sprite_ResetAll ; removes sprites in thieve town boss room JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites ;Close the door if !BLIND_DOOR_FLAG == 1 LDA !BLIND_DOOR_FLAG : BEQ .no_blind_door INC $0468 ; $0468[0x02] - Flag that is set when trap doors are down. STZ $068E ; $068E[0x02] - (Dungeon) ???? related to trap doors and if they are open ; possibly bomb doors too? Update: module 0x07.0x4 probably uses this to know whether it's a key door or big key door to open. STZ $0690 ; $0690[0x02] - (Overworld) Generally is used as an animation step indicator, only for doors that animate when they open, such as the Santuary and Hyrule Castle doors. This variable is incremented up to a value of 3, at which point a logic check kicks in and stops animating the opening of a door. INC $0CF3 ; $0CF3[0x01] - free ram ; ;That must be called after the room load! .no_blind_door BRL .move_to_bottom_right + CMP #6 : BNE + ; Is is Swamp Palace Boss Room CPX #$00 : BNE + JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_bottom_left + CMP #222 : BNE + ; Is is Ice Palace Boss Room JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_top_right + CMP #164 : BNE + ; Is is Turtle Rock Boss Room JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_bottom_left + CMP #28 : BNE + ; Is is Gtower (Armos2) Boss Room CPX #$00 : BNE + JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_bottom_right + CMP #108 : BNE + ; Is is Gtower (Lanmo2) Boss Room JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_bottom_left + CMP #77 : BNE + ; Is is Gtower (Moldorm2) Boss Room JSL Sprite_ResetAll ; reset sprites twice in that room for some reasons (fix bug with kholdstare) JSL Dungeon_ResetSprites ; Restore the dungeon_resetsprites BRL .move_to_middle + BRL .return ; $0D00[0x10] - The lower byte of a sprite's Y - coordinate. ; $0D10[0x10] - The lower byte of a sprite's X - coordinate. ; $0D20[0x10] - The high byte of a sprite's Y - coordinate. ; $0D30[0x10] - The high byte of a sprite's X - coordinate. ; $0B08[0x08] - (Overlord) X coordinate low byte. ; $0B18[0x08] - (Overlord) Y coordinate low byte. ; $0B10[0x08] - (Overlord) X coordinate high byte. ; $0B20[0x08] - (Overlord) Y coordinate high byte. .move_to_middle ;load all sprite of that room and overlord LDX #$00 .loop_middle ; move sprites LDA $0E20, X CMP #$E3 : BNE + ;is it a fairy?? if not check next BRA .no_change + CMP #$D1 : BNE + ;is it a bunny changer BRA .no_change + CMP #$C5 : BNE + ;is it a medusa head BRA .no_change + LDA $0D10, X : !ADD #$68 : STA $0D10, X LDA $0D00, X : !ADD #$68 : STA $0D00, X .no_change INX : CPX #$10 : BNE .loop_middle LDX #$00 .loop_middle2 ; move overlords LDA $0B00, X CMP #$E3 : BNE + ;is it moving floor? BRA .no_change_ov + LDA $0B08, X : !ADD #$68 : STA $0B08, X LDA $0B18, X : !ADD #$68 : STA $0B18, X .no_change_ov INX : CPX #$08 : BNE .loop_middle2 BRL .return .move_to_top_right LDX #$00 .loop_top_right ; move sprites LDA $0E20, X CMP #$E3 : BNE + ;is it a fairy?? if not check next BRA .no_change2 + CMP #$D1 : BNE + ;is it a bunny changer BRA .no_change2 + CMP #$C5 : BNE + ;is it a medusa head BRA .no_change2 + LDA $0D20, X : !ADD #$00 : STA $0D20, X LDA $0D30, X : !ADD #$01 : STA $0D30, X .no_change2 INX : CPX #$10 : BNE .loop_top_right LDX #$00 .loop_top_right2 ; move overlords LDA $0B00, X CMP #$E3 : BNE + ;is it moving floor? BRA .no_change_ov2 + LDA $0B10, X : !ADD #$01 : STA $0B10, X LDA $0B20, X : !ADD #$00 : STA $0B20, X .no_change_ov2 INX : CPX #$08 : BNE .loop_top_right2 BRL .return .move_to_bottom_right LDX #$00 .loop_bottom_right ; move sprites LDA $0E20, X CMP #$E3 : BNE + ;is it a fairy?? if not check next BRA .no_change3 + CMP #$D1 : BNE + ;is it a bunny changer BRA .no_change3 + CMP #$C5 : BNE + ;is it a medusa head BRA .no_change3 + LDA $0D20, X : !ADD #$01 : STA $0D20, X LDA $0D30, X : !ADD #$01 : STA $0D30, X .no_change3 INX : CPX #$10 : BNE .loop_bottom_right LDX #$00 .loop_bottom_right2 ; move overlords LDA $0B00, X CMP #$E3 : BNE + ;is it moving floor? BRA .no_change_ov3 + LDA $0B10, X : !ADD #$01 : STA $0B10, X LDA $0B20, X : !ADD #$01 : STA $0B20, X .no_change_ov3 INX : CPX #$08 : BNE .loop_bottom_right2 BRL .return .move_to_bottom_left LDX #$00 .loop_bottom_left ; move sprites LDA $0E20, X CMP #$E3 : BNE + ;is it a fairy?? if not check next BRA .no_change4 + CMP #$D1 : BNE + ;is it a bunny changer BRA .no_change4 + CMP #$C5 : BNE + ;is it a medusa head BRA .no_change4 + LDA $0D20, X : !ADD #$01 : STA $0D20, X LDA $0D30, X : !ADD #$00 : STA $0D30, X .no_change4 INX : CPX #$10 : BNE .loop_bottom_left LDX #$00 .loop_bottom_left2 ; move overlords LDA $0B00, X CMP #$E3 : BNE + ;is it moving floor? BRA .no_change_ov4 + LDA $0B10, X : !ADD #$00 : STA $0B10, X LDA $0B20, X : !ADD #$01 : STA $0B20, X .no_change_ov4 INX : CPX #$08 : BNE .loop_bottom_left2 BRL .return .return RTL } ;================================================================================ ; Fix the gibdo key drop in skull woods before the boss room - USELESS CODE ;-------------------------------------------------------------------------------- ;gibdo_drop_key: ; LDA $A0 : CMP #$39 : BNE .no_key_drop ; Check if the room id is skullwoods before boss ; LDA $0DD0, X : CMP #$09 : BNE .no_key_drop ; Check if the sprite is alive ; LDA #$01 : STA $0CBA, X;set key ; ;.no_key_drop ; JSL $06DC5C ;Restore draw shadow ; RTL ;-------------------------------------------------------------------------------- ;================================================================================ ; Set a flag to draw kholdstare shell on next NMI ;-------------------------------------------------------------------------------- new_kholdstare_code: LDA $0CBA : BNE .already_iced LDA #$01 : STA $0CBA LDA #$01 : STA !SHELL_DMA_FLAG ; tell our NMI to draw the shell .already_iced ; restore code JSL Kholdstare_Draw ; sprite_kholdstare.asm (154) : JSL Kholdstare_Draw RTL ;-------------------------------------------------------------------------------- ;================================================================================ ; Set a flag to draw trinexx shell on next NMI ;-------------------------------------------------------------------------------- new_trinexx_code: LDA $0CBA : BNE .already_rocked LDA #$01 : STA $0CBA LDA #$02 : STA !SHELL_DMA_FLAG ; tell our NMI to draw the shell .already_rocked ; restore code LDA.b #$03 : STA $0DC0, X ; sprite_trinexx.asm (62) : LDA.b #$03 : STA $0DC0, X RTL ;--------------------------------------------------------------------------------
libsrc/_DEVELOPMENT/arch/zxn/esxdos/c/sccz80/esx_f_rmdir.asm
Toysoft/z88dk
0
241823
<gh_stars>0 ; unsigned char esx_f_rmdir(unsigned char *pathname) SECTION code_esxdos PUBLIC esx_f_rmdir EXTERN asm_esx_f_rmdir defc esx_f_rmdir = asm_esx_f_rmdir
src/functions.asm
Hacktix/gbctv
14
19568
SECTION "Functions", ROM0 ;------------------------------------------------------------------------ ; Copies BC bytes to a memory region starting at HL from a memory ; region starting at DE. ;------------------------------------------------------------------------ Memcpy:: ld a, [de] ld [hli], a inc de dec bc ld a, b or c jr nz, Memcpy ret ;------------------------------------------------------------------------ ; Copies a null-terminated string pointed to by DE to HL (excluding ; the terminating zero-byte) ;------------------------------------------------------------------------ Strcpy:: ld a, [de] and a ret z ld [hli], a inc de jr Strcpy ;------------------------------------------------------------------------ ; Converts the lower nibble of A to an ASCII value and stores it in A. ;------------------------------------------------------------------------ NibbleToASCII: and $0f cp 10 jr c, .digit add a, "A" - 10 - "0" .digit add a, "0" ret
scripts/SeafoamIslandsB3F.asm
opiter09/ASM-Machina
1
162322
<filename>scripts/SeafoamIslandsB3F.asm<gh_stars>1-10 SeafoamIslandsB3F_Script: call EnableAutoTextBoxDrawing ld hl, wFlags_0xcd60 bit 7, [hl] res 7, [hl] jr z, .asm_465dc ld hl, Seafoam4HolesCoords call CheckBoulderCoords ret nc EventFlagAddress hl, EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, [wCoordIndex] cp $1 jr nz, .asm_465b8 SetEventReuseHL EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_1 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B4F_BOULDER_1 ld [wObjectToShow], a jr .asm_465c4 .asm_465b8 SetEventAfterBranchReuseHL EVENT_SEAFOAM4_BOULDER2_DOWN_HOLE, EVENT_SEAFOAM4_BOULDER1_DOWN_HOLE ld a, HS_SEAFOAM_ISLANDS_B3F_BOULDER_2 ld [wObjectToHide], a ld a, HS_SEAFOAM_ISLANDS_B4F_BOULDER_2 ld [wObjectToShow], a .asm_465c4 ld a, [wObjectToHide] ld [wMissableObjectIndex], a predef HideObject ld a, [wObjectToShow] ld [wMissableObjectIndex], a predef ShowObject jr .asm_465ed .asm_465dc ld a, SEAFOAM_ISLANDS_B4F ld [wDungeonWarpDestinationMap], a ld hl, Seafoam4HolesCoords call IsPlayerOnDungeonWarp ld a, [wd732] bit 4, a ret nz .asm_465ed ld hl, SeafoamIslandsB3F_ScriptPointers ld a, [wSeafoamIslandsB3FCurScript] jp CallFunctionInTable Seafoam4HolesCoords: dbmapcoord 3, 16 dbmapcoord 6, 16 db -1 ; end SeafoamIslandsB3F_ScriptPointers: dw SeafoamIslands4Script0 dw SeafoamIslands4Script1 dw SeafoamIslands4Script2 dw SeafoamIslands4Script3 SeafoamIslands4Script0: CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE ret z ld a, [wYCoord] cp 8 ret nz ld a, [wXCoord] cp 15 ret nz ld hl, wSimulatedJoypadStatesEnd ld de, RLEMovement46632 call DecodeRLEList dec a ld [wSimulatedJoypadStatesIndex], a call StartSimulatingJoypadStates ld hl, wFlags_D733 set 2, [hl] ld a, $1 ld [wSeafoamIslandsB3FCurScript], a ret RLEMovement46632: db D_DOWN, 6 db D_RIGHT, 5 db D_DOWN, 3 db -1 ; end SeafoamIslands4Script1: ld a, [wSimulatedJoypadStatesIndex] and a ret nz ld a, $0 ld [wSeafoamIslandsB3FCurScript], a ret SeafoamIslands4Script2: CheckBothEventsSet EVENT_SEAFOAM3_BOULDER1_DOWN_HOLE, EVENT_SEAFOAM3_BOULDER2_DOWN_HOLE ret z ld a, [wXCoord] cp 18 jr z, .asm_4665e cp 19 ld a, $0 jr nz, .asm_4667b ld de, RLEData_4667f jr .asm_46661 .asm_4665e ld de, RLEData_46688 .asm_46661 ld hl, wSimulatedJoypadStatesEnd call DecodeRLEList dec a ld [wSimulatedJoypadStatesIndex], a xor a ld [wSpritePlayerStateData2MovementByte1], a ld hl, wd730 set 7, [hl] ld hl, wFlags_D733 set 2, [hl] ld a, $3 .asm_4667b ld [wSeafoamIslandsB3FCurScript], a ret RLEData_4667f: db D_DOWN, 6 db D_RIGHT, 2 db D_DOWN, 4 db D_LEFT, 1 db -1 ; end RLEData_46688: db D_DOWN, 6 db D_RIGHT, 2 db D_DOWN, 4 db -1 ; end SeafoamIslands4Script3: ld a, [wSimulatedJoypadStatesIndex] and a ret nz ld a, $0 ld [wSeafoamIslandsB3FCurScript], a ret SeafoamIslandsB3F_TextPointers: dw BoulderText dw BoulderText dw BoulderText dw BoulderText dw BoulderText dw BoulderText
tests/aco-drivers-dummy.adb
jonashaggstrom/ada-canopen
6
17850
package body ACO.Drivers.Dummy is overriding procedure Receive_Message_Blocking (This : in out Dummy_Driver; Msg : out ACO.Messages.Message) is begin This.Get_First_Sent (Msg); end Receive_Message_Blocking; overriding procedure Send_Message (This : in out Dummy_Driver; Msg : in ACO.Messages.Message) is begin This.Tx_Buffer.Append (Msg); end Send_Message; overriding procedure Initialize (This : in out Dummy_Driver) is begin This.Tx_Buffer.Clear; end Initialize; overriding procedure Finalize (This : in out Dummy_Driver) is begin This.Tx_Buffer.Clear; end Finalize; overriding function Is_Message_Pending (This : Dummy_Driver) return Boolean is begin return This.Nof_Sent > 0; end Is_Message_Pending; procedure Get_First_Sent (This : in out Dummy_Driver; Msg : out ACO.Messages.Message) is begin if Natural (This.Tx_Buffer.Length) > 0 then Msg := This.Tx_Buffer.First_Element; This.Tx_Buffer.Delete_First; else raise Constraint_Error with "No messages sent"; end if; end Get_First_Sent; function Nof_Sent (This : Dummy_Driver) return Natural is (Natural (This.Tx_Buffer.Length)); overriding function Current_Time (This : Dummy_Driver) return Ada.Real_Time.Time is (This.T_Now); procedure Set_Time (This : in out Dummy_Driver; T : in Ada.Real_Time.Time) is begin This.T_Now := T; end Set_Time; end ACO.Drivers.Dummy;
libsrc/_DEVELOPMENT/arch/zxn/esxdos/z80/asm_esx_dos_catalog_next.asm
jpoikela/z88dk
640
25406
; unsigned char esx_dos_catalog_next(struct esx_cat *cat) SECTION code_esxdos PUBLIC asm_esx_dos_catalog_next EXTERN l_asm_esx_dos_catalog asm_esx_dos_catalog_next: ; enter : hl = struct esx_cat *cat (unchanged from last catalog call) ; note that this structure must be in main memory ; ; exit : success ; ; hl = number of catalog entries filled in (0 if cat is done) ; carry reset ; ; fail ; ; hl = -1 ; carry set, errno set ; ; uses : all except af', iy xor a jp l_asm_esx_dos_catalog
notes/FOT/FOTC/Program/Mirror/Induction/Acc/WellFounded.agda
asr/fotc
11
4346
<gh_stars>10-100 ------------------------------------------------------------------------------ -- Generic well-founded induction on trees ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- Adapted from FOTC.Data.Nat.Induction.Acc.WellFounded. module FOT.FOTC.Program.Mirror.Induction.Acc.WellFounded where open import FOTC.Base open import FOTC.Program.Mirror.Type ------------------------------------------------------------------------------ -- The accessibility predicate: x is accessible if everything which is -- smaller than x is also accessible (inductively). data Acc (_<_ : D → D → Set)(t : D) : Set where acc : (∀ {t'} → Tree t' → t' < t → Acc _<_ t') → Acc _<_ t accFold : {P : D → Set}(_<_ : D → D → Set) → (∀ {t} → Tree t → (∀ {t'} → Tree t' → t' < t → P t') → P t) → ∀ {t} → Tree t → Acc _<_ t → P t accFold _<_ f Tt (acc h) = f Tt (λ Tt' t'<t → accFold _<_ f Tt' (h Tt' t'<t)) -- The accessibility predicate encodes what it means to be -- well-founded; if all elements are accessible, then _<_ is -- well-founded. WellFounded : (D → D → Set) → Set WellFounded _<_ = ∀ {t} → Tree t → Acc _<_ t WellFoundedInduction : {P : D → Set}{_<_ : D → D → Set} → WellFounded _<_ → (∀ {t} → Tree t → (∀ {t'} → Tree t' → t' < t → P t') → P t) → ∀ {t} → Tree t → P t WellFoundedInduction {_<_ = _<_} wf f Tt = accFold _<_ f Tt (wf Tt)
alloy4fun_models/trashltl/models/18/vijahzyogXPZjm8er.als
Kaixi26/org.alloytools.alloy
0
5072
open main pred idvijahzyogXPZjm8er_prop19 { all f:File | f in Protected until f in Trash } pred __repair { idvijahzyogXPZjm8er_prop19 } check __repair { idvijahzyogXPZjm8er_prop19 <=> prop19o }
agda-stdlib/src/Data/Star/Properties.agda
DreamLinuxer/popl21-artifact
5
13927
<reponame>DreamLinuxer/popl21-artifact ------------------------------------------------------------------------ -- The Agda standard library -- -- This module is DEPRECATED. Please use the -- Relation.Binary.Construct.Closure.ReflexiveTransitive.Properties -- module directly. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Data.Star.Properties where open import Relation.Binary.Construct.Closure.ReflexiveTransitive.Properties public {-# WARNING_ON_IMPORT "Data.Star.Properties was deprecated in v0.16. Use Relation.Binary.Construct.Closure.ReflexiveTransitive.Properties instead." #-}
ada/protected_counters.ads
rtoal/enhanced-dining-philosophers
0
12898
<reponame>rtoal/enhanced-dining-philosophers ------------------------------------------------------------------------------ -- protected_counters.ads -- -- This package defines protected type Counter. A counter is basically an in- -- teger which starts with some initial positive value and is decremented (by -- 1) by calling tasks. When a task decrements the counter it is informed -- whether or not it made the counter go to zero. The decrement and test -- are bound together in a critical section because without this protection, -- the zero might be missed or discovered by two different tasks! -- -- Entries: -- -- Decrement_And_Test_If_Zero (Is_Zero) decrements the counter's value and -- sets Is_Zero to whether the newly -- updated value is 0. ------------------------------------------------------------------------------ package Protected_Counters is protected type Counter (Initial_Value: Positive) is procedure Decrement_And_Test_If_Zero (Is_Zero: out Boolean); private Value: Natural := Initial_Value; end Counter; end Protected_Counters;
Transynther/x86/_processed/NC/_ht_un_/i7-7700_9_0x48.log_14_1006.asm
ljhsiun2/medusa
9
89651
<filename>Transynther/x86/_processed/NC/_ht_un_/i7-7700_9_0x48.log_14_1006.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %r8 push %r9 lea addresses_D_ht+0x7462, %r10 nop nop nop nop inc %r15 mov (%r10), %r9w nop nop nop nop sub $38964, %r8 lea addresses_WC_ht+0xfdc2, %r8 nop nop and $12136, %r13 movb (%r8), %r10b nop nop nop sub $32630, %r8 pop %r9 pop %r8 pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r14 push %r8 push %r9 push %rax push %rbx push %rcx push %rdx // Store lea addresses_US+0x3b45, %r14 nop nop xor $54144, %r9 mov $0x5152535455565758, %rbx movq %rbx, (%r14) nop xor %rcx, %rcx // Store lea addresses_D+0x15242, %r14 nop nop nop nop add $8026, %r8 mov $0x5152535455565758, %rbx movq %rbx, (%r14) nop nop inc %r8 // Faulty Load mov $0x60a3c0000000462, %rcx add $43772, %rdx vmovups (%rcx), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $0, %xmm4, %r14 lea oracles, %rdx and $0xff, %r14 shlq $12, %r14 mov (%rdx,%r14,1), %r14 pop %rdx pop %rcx pop %rbx pop %rax pop %r9 pop %r8 pop %r14 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 11, 'size': 2, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}} {'4b': 2, '4c': 2, '64': 2, '06': 1, '7b': 1, '03': 3, '7a': 1, '90': 1, '0c': 1} 06 03 03 03 4c 90 64 64 0c 4c 7a 7b 4b 4b */
oeis/001/A001680.asm
neoneye/loda-programs
11
97530
; A001680: The partition function G(n,3). ; Submitted by <NAME> ; 1,1,2,5,14,46,166,652,2780,12644,61136,312676,1680592,9467680,55704104,341185496,2170853456,14314313872,97620050080,687418278544,4989946902176,37286121988256,286432845428192,2259405263572480,18280749571449664,151561941235370176,1286402259593355776,11168256342434121152,99099358725069658880,898070590439513534464,8306264068494786829696,78356602827085494476416,753453613504797679722752,7380771881944947770497280,73617027420304412284895744,747250748582624134806267136,7715405978050522488223499776 mov $2,1 lpb $0 sub $0,1 mov $1,$4 mul $1,$0 add $3,$4 mov $4,$2 add $2,$3 mov $3,$1 div $3,2 mul $4,$0 lpe mov $0,$2
libsrc/_DEVELOPMENT/adt/p_forward_list_alt/z80/asm_p_forward_list_alt_empty.asm
jpoikela/z88dk
640
97746
; =============================================================== ; Dec 2013 ; =============================================================== ; ; int p_forward_list_alt_empty(p_forward_list_alt_t *list) ; ; Return true (non-zero) if list is empty. ; ; =============================================================== SECTION code_clib SECTION code_adt_p_forward_list_alt PUBLIC asm_p_forward_list_alt_empty EXTERN l_testword_hl defc asm_p_forward_list_alt_empty = l_testword_hl ; enter : hl = p_forward_list_alt_t * ; ; exit : if list is empty ; ; hl = 1 ; z flag set ; ; if list is not empty ; ; hl = 0 ; nz flag set ; ; uses : af, hl
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_586.asm
ljhsiun2/medusa
9
169979
<filename>Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0x48.log_21829_586.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r9 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_WC_ht+0x500e, %r11 nop nop add $24752, %r10 movups (%r11), %xmm5 vpextrq $1, %xmm5, %r9 nop nop nop nop nop xor %rbx, %rbx lea addresses_WT_ht+0x2a96, %rdi nop nop nop nop sub $34660, %rbp mov (%rdi), %r9d xor $56056, %r11 lea addresses_UC_ht+0x55ae, %rsi lea addresses_normal_ht+0x10a8e, %rdi clflush (%rsi) nop nop nop nop nop and %r11, %r11 mov $31, %rcx rep movsw cmp $5979, %r9 lea addresses_D_ht+0x1320e, %rdi nop nop nop nop nop sub %r9, %r9 vmovups (%rdi), %ymm6 vextracti128 $1, %ymm6, %xmm6 vpextrq $1, %xmm6, %rsi xor %r11, %r11 lea addresses_A_ht+0xf95e, %rcx nop nop nop nop nop add $17117, %rdi mov $0x6162636465666768, %r9 movq %r9, %xmm5 movups %xmm5, (%rcx) add %rbp, %rbp pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r9 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r14 push %r15 push %rax push %rbp push %rdx push %rsi // Store lea addresses_PSE+0x1778e, %rbp nop nop sub $34071, %rsi mov $0x5152535455565758, %rdx movq %rdx, (%rbp) nop nop nop inc %rdx // Faulty Load lea addresses_UC+0x3c0e, %rdx nop nop nop nop and $6441, %r15 vmovups (%rdx), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $0, %xmm4, %r14 lea oracles, %rbp and $0xff, %r14 shlq $12, %r14 mov (%rbp,%r14,1), %r14 pop %rsi pop %rdx pop %rbp pop %rax pop %r15 pop %r14 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 9, 'size': 16, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 3, 'size': 4, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 8, 'size': 32, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 4, 'size': 16, 'same': False, 'NT': False}} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
theorems/homotopy/SmashIsCofiber.agda
timjb/HoTT-Agda
294
8784
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import homotopy.elims.CofPushoutSection as CofPushoutSection module homotopy.SmashIsCofiber {i j} (X : Ptd i) (Y : Ptd j) where {- the proof that our smash matches the more classical definition as a cofiber -} Smash-equiv-Cof : Smash X Y ≃ Cofiber (∨-to-× {X = X} {Y = Y}) Smash-equiv-Cof = equiv to from to-from from-to where module To = SmashRec {C = Cofiber (∨-to-× {X = X} {Y = Y})} (curry cfcod) cfbase cfbase (λ x → ! (cfglue (winl x))) (λ y → ! (cfglue (winr y))) to : Smash X Y → Cofiber (∨-to-× {X = X} {Y = Y}) to = To.f module FromGlue = WedgeElim {P = λ x∨y → smin (pt X) (pt Y) == uncurry smin (∨-to-× {X = X} {Y = Y} x∨y)} (λ x → smgluel (pt X) ∙' ! (smgluel x)) (λ y → smgluer (pt Y) ∙' ! (smgluer y)) (↓-cst=app-in $ ap2 _∙'_ (!-inv'-r (smgluel (pt X))) ( ap-∘ (uncurry smin) (∨-to-× {X = X} {Y = Y}) wglue ∙ ap (ap (uncurry smin)) (∨-to-×-glue-β {X = X} {Y = Y})) ∙ ! (!-inv'-r (smgluer (pt Y)))) module From = CofiberRec {C = Smash X Y} (smin (pt X) (pt Y)) (uncurry smin) FromGlue.f from : Cofiber (∨-to-× {X = X} {Y = Y}) → Smash X Y from = From.f abstract from-to : ∀ x → from (to x) == x from-to = Smash-elim (λ _ _ → idp) (smgluel (pt X)) (smgluer (pt Y)) (λ x → ↓-∘=idf-in' from to $ ap from (ap to (smgluel x)) ∙' smgluel (pt X) =⟨ ap (_∙' smgluel (pt X)) $ ap from (ap to (smgluel x)) =⟨ ap (ap from) (To.smgluel-β x) ⟩ ap from (! (cfglue (winl x))) =⟨ ap-! from (cfglue (winl x)) ⟩ ! (ap from (cfglue (winl x))) =⟨ ap ! $ From.glue-β (winl x) ⟩ ! (smgluel (pt X) ∙' ! (smgluel x)) =⟨ !-∙' (smgluel (pt X)) (! (smgluel x)) ⟩ ! (! (smgluel x)) ∙' ! (smgluel (pt X)) =∎ ⟩ (! (! (smgluel x)) ∙' ! (smgluel (pt X))) ∙' smgluel (pt X) =⟨ ∙'-assoc (! (! (smgluel x))) (! (smgluel (pt X))) (smgluel (pt X)) ⟩ ! (! (smgluel x)) ∙' ! (smgluel (pt X)) ∙' smgluel (pt X) =⟨ ap2 _∙'_ (!-! (smgluel x)) (!-inv'-l (smgluel (pt X))) ⟩ smgluel x =∎) (λ y → ↓-∘=idf-in' from to $ ap from (ap to (smgluer y)) ∙' smgluer (pt Y) =⟨ ap (_∙' smgluer (pt Y)) $ ap from (ap to (smgluer y)) =⟨ ap (ap from) (To.smgluer-β y) ⟩ ap from (! (cfglue (winr y))) =⟨ ap-! from (cfglue (winr y)) ⟩ ! (ap from (cfglue (winr y))) =⟨ ap ! $ From.glue-β (winr y) ⟩ ! (smgluer (pt Y) ∙' ! (smgluer y)) =⟨ !-∙' (smgluer (pt Y)) (! (smgluer y)) ⟩ ! (! (smgluer y)) ∙' ! (smgluer (pt Y)) =∎ ⟩ (! (! (smgluer y)) ∙' ! (smgluer (pt Y))) ∙' smgluer (pt Y) =⟨ ∙'-assoc (! (! (smgluer y))) (! (smgluer (pt Y))) (smgluer (pt Y)) ⟩ ! (! (smgluer y)) ∙' ! (smgluer (pt Y)) ∙' smgluer (pt Y) =⟨ ap2 _∙'_ (!-! (smgluer y)) (!-inv'-l (smgluer (pt Y))) ⟩ smgluer y =∎) to-from : ∀ x → to (from x) == x to-from = CofPushoutSection.elim (λ _ → unit) (λ _ → idp) (! (cfglue (winr (pt Y)))) (λ _ → idp) (λ x → ↓-∘=idf-in' to from $ ap to (ap from (cfglue (winl x))) =⟨ ap (ap to) (From.glue-β (winl x)) ⟩ ap to (FromGlue.f (winl x)) =⟨ ap-∙' to (smgluel (pt X)) (! (smgluel x)) ⟩ ap to (smgluel (pt X)) ∙' ap to (! (smgluel x)) =⟨ ap2 _∙'_ (To.smgluel-β (pt X)) (ap-! to (smgluel x) ∙ ap ! (To.smgluel-β x) ∙ !-! (cfglue (winl x))) ⟩ ! (cfglue (winl (pt X))) ∙' cfglue (winl x) =⟨ ap (λ p → ! p ∙' cfglue (winl x)) $ ap (cfglue (winl (pt X)) ∙'_) ( ap (ap cfcod) (! ∨-to-×-glue-β) ∙ ∘-ap cfcod ∨-to-× wglue) ∙ ↓-cst=app-out (apd cfglue wglue) ⟩ ! (cfglue (winr (pt Y))) ∙' cfglue (winl x) =⟨ ∙'=∙ (! (cfglue (winr (pt Y)))) (cfglue (winl x)) ⟩ ! (cfglue (winr (pt Y))) ∙ cfglue (winl x) =∎) (λ y → ↓-∘=idf-in' to from $ ap to (ap from (cfglue (winr y))) =⟨ ap (ap to) (From.glue-β (winr y)) ⟩ ap to (FromGlue.f (winr y)) =⟨ ap-∙' to (smgluer (pt Y)) (! (smgluer y)) ⟩ ap to (smgluer (pt Y)) ∙' ap to (! (smgluer y)) =⟨ ap2 _∙'_ (To.smgluer-β (pt Y)) (ap-! to (smgluer y) ∙ ap ! (To.smgluer-β y) ∙ !-! (cfglue (winr y))) ⟩ ! (cfglue (winr (pt Y))) ∙' cfglue (winr y) =⟨ ∙'=∙ (! (cfglue (winr (pt Y)))) (cfglue (winr y)) ⟩ ! (cfglue (winr (pt Y))) ∙ cfglue (winr y) =∎) Smash-⊙equiv-Cof : ⊙Smash X Y ⊙≃ ⊙Cofiber (∨-⊙to-× {X = X} {Y = Y}) Smash-⊙equiv-Cof = ≃-to-⊙≃ Smash-equiv-Cof (! (cfglue (winl (pt X))))
test/Fail/WithScopeError.agda
cruhland/agda
1,989
2985
-- There was a bug when scope checking with clauses. module WithScopeError where data Nat : Set where zero : Nat suc : Nat -> Nat f : Nat -> Nat f n with y where y = suc n f n | x = y x
oeis/033/A033270.asm
neoneye/loda-programs
11
102607
<filename>oeis/033/A033270.asm ; A033270: Number of odd primes <= n. ; Submitted by <NAME> ; 0,0,1,1,2,2,3,3,3,3,4,4,5,5,5,5,6,6,7,7,7,7,8,8,8,8,8,8,9,9,10,10,10,10,10,10,11,11,11,11,12,12,13,13,13,13,14,14,14,14,14,14,15,15,15,15,15,15,16,16,17,17,17,17,17,17,18,18,18,18,19,19,20,20,20,20,20,20,21,21,21,21,22,22,22,22,22,22,23,23,23,23,23,23,23,23,24,24,24,24 mov $3,$0 mov $5,$0 lpb $3 mov $0,$5 sub $3,2 sub $0,$3 mov $2,$0 seq $2,80339 ; Characteristic function of {1} union {primes}: 1 if n is 1 or a prime, else 0. add $4,$2 lpe mov $0,$4
mc-sema/validator/x86/tests/RCR16rCL.asm
randolphwong/mcsema
2
179821
BITS 32 ;TEST_FILE_META_BEGIN ;TEST_TYPE=TEST_F ;TEST_IGNOREFLAGS=FLAG_OF ;TEST_FILE_META_END ; RCR16rCL mov bx, 0x414 mov cl, 0x3 ;TEST_BEGIN_RECORDING rcr bx, cl ;TEST_END_RECORDING
vendor/stdlib/src/Algebra/RingSolver/Simple.agda
isabella232/Lemmachine
56
13681
------------------------------------------------------------------------ -- Instantiates the ring solver with two copies of the same ring ------------------------------------------------------------------------ open import Algebra.RingSolver.AlmostCommutativeRing module Algebra.RingSolver.Simple (r : AlmostCommutativeRing) where open AlmostCommutativeRing r import Algebra.RingSolver as R open R rawRing r (-raw-almostCommutative⟶ r) public
thirdparty/adasdl/thin/adasdl/AdaSDL/stdtest/testwm_sprogs.ads
Lucretia/old_nehe_ada95
0
24013
<reponame>Lucretia/old_nehe_ada95 -- ----------------------------------------------------------------- -- -- -- -- This is free software; you can redistribute it and/or -- -- modify it under the terms of the GNU General Public -- -- License as published by the Free Software Foundation; either -- -- version 2 of the License, or (at your option) any later version. -- -- -- -- This software 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 library; if not, write to the -- -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- -- Boston, MA 02111-1307, USA. -- -- -- -- ----------------------------------------------------------------- -- -- ----------------------------------------------------------------- -- -- This is a translation, to the Ada programming language, of the -- -- original C test files written by <NAME> - www.libsdl.org -- -- translation made by <NAME> - www.adapower.net/~avargas -- -- ----------------------------------------------------------------- -- with Interfaces.C.Pointers; with Interfaces.C.Strings; with SDL.Types; use SDL.Types; with SDL.Video; with SDL.Events; with SDL.Error; package Testwm_Sprogs is package C renames Interfaces.C; package CS renames Interfaces.C.Strings; package V renames SDL.Video; package Er renames SDL.Error; package Ev renames SDL.Events; type Icon_Mask_Array_Access is access V.Icon_Mask_Array; use Uint8_Ptrs; use Uint8_PtrOps; procedure LoadIconSurface ( file : in string; maskp : in out Icon_Mask_Array_Access; icon : out V.Surface_ptr); procedure HotKey_ToggleFullScreen; procedure HotKey_ToggleGrab; procedure HotKey_Iconify; procedure HotKey_Quit; function FilterEvents (event : Ev.Event_ptr) return C.int; pragma Convention (C, FilterEvents); end Testwm_Sprogs;
unittests/ASM/PrimaryGroup/2_D3_03_6.asm
cobalt2727/FEX
628
98731
<gh_stars>100-1000 %ifdef CONFIG { "RegData": { "RBX": "0x8000000000000000", "RDI": "0x0000000000000000", "RDX": "0xC000000000000000", "RSI": "0x4000000000000000", "R8": "0x1", "R9": "0x0", "R10": "0x0", "R11": "0x1" } } %endif mov rbx, 0x0000000000000001 mov rdi, 0x0000000000000001 mov rdx, 0x8000000000000000 mov rsi, 0x8000000000000000 mov r15, 1 mov rcx, 1 stc rcr rbx, cl mov r8, 0 cmovo r8, r15 ; We only care about OF here clc rcr rdi, cl mov r9, 0 cmovo r9, r15 ; We only care about OF here stc rcr rdx, cl mov r10, 0 cmovo r10, r15 ; We only care about OF here clc rcr rsi, cl mov r11, 0 cmovo r11, r15 ; We only care about OF here hlt
alloy4fun_models/trashltl/models/7/gi5ko7RXYoRhJGK4Y.als
Kaixi26/org.alloytools.alloy
0
1028
open main pred idgi5ko7RXYoRhJGK4Y_prop8 { always (some f : File | some f.link implies eventually f in Trash') } pred __repair { idgi5ko7RXYoRhJGK4Y_prop8 } check __repair { idgi5ko7RXYoRhJGK4Y_prop8 <=> prop8o }
x86/linux64.asm
lantonov/asm
150
165549
<reponame>lantonov/asm struct timespec tv_sec rq 1 tv_nsec rq 1 ends ; for stat stucture, see /usr/include/x86_64-linux-gnu/bits/stat.h ; it takes some work to unwind everything struct stat ; offset of st_dev rq 1 ; 0 st_ino rq 1 ; 8 st_nlink rq 1 ; 16 st_mode rd 1 ; 24 st_uid rd 1 ; 28 st_gid rd 1 ; 32 rd 1 ; 36 st_rdev rq 1 ; 40 st_size rq 1 ; 48 st_blksize rq 1 ; 56 st_blocks rq 1 ; 64 st_atimespec timespec; 72 st_mtimespec timespec; 88 st_ctimespec timespec; 104 rq 3 ; 120 ends ; 144 = sizeof.stat sys_read = $0000 sys_write = $0001 sys_open = $0002 sys_close = $0003 sys_newstat = $0004 sys_newfstat = $0005 sys_newlstat = $0006 sys_stat = $0004 sys_fstat = $0005 sys_lstat = $0006 sys_poll = $0007 sys_lseek = $0008 sys_mmap = $0009 sys_mprotect = $000A sys_munmap = $000B sys_brk = $000C sys_rt_sigaction = $000D sys_rt_sigprocmask = $000E stub_rt_sigreturn = $000F sys_ioctl = $0010 sys_pread64 = $0011 sys_pwrite64 = $0012 sys_readv = $0013 sys_writev = $0014 sys_access = $0015 sys_pipe = $0016 sys_select = $0017 sys_sched_yield = $0018 sys_mremap = $0019 sys_msync = $001A sys_mincore = $001B sys_madvise = $001C sys_shmget = $001D sys_shmat = $001E sys_shmctl = $001F sys_dup = $0020 sys_dup2 = $0021 sys_pause = $0022 sys_nanosleep = $0023 sys_getitimer = $0024 sys_alarm = $0025 sys_setitimer = $0026 sys_getpid = $0027 sys_sendfile64 = $0028 sys_socket = $0029 sys_connect = $002A sys_accept = $002B sys_sendto = $002C sys_recvfrom = $002D sys_sendmsg = $002E sys_recvmsg = $002F sys_shutdown = $0030 sys_bind = $0031 sys_listen = $0032 sys_getsockname = $0033 sys_getpeername = $0034 sys_socketpair = $0035 sys_setsockopt = $0036 sys_getsockopt = $0037 stub_clone = $0038 stub_fork = $0039 stub_vfork = $003A stub_execve = $003B sys_exit = $003C sys_wait4 = $003D sys_kill = $003E sys_newuname = $003F sys_semget = $0040 sys_semop = $0041 sys_semctl = $0042 sys_shmdt = $0043 sys_msgget = $0044 sys_msgsnd = $0045 sys_msgrcv = $0046 sys_msgctl = $0047 sys_fcntl = $0048 sys_flock = $0049 sys_fsync = $004A sys_fdatasync = $004B sys_truncate = $004C sys_ftruncate = $004D sys_getdents = $004E sys_getcwd = $004F sys_chdir = $0050 sys_fchdir = $0051 sys_rename = $0052 sys_mkdir = $0053 sys_rmdir = $0054 sys_creat = $0055 sys_link = $0056 sys_unlink = $0057 sys_symlink = $0058 sys_readlink = $0059 sys_chmod = $005A sys_fchmod = $005B sys_chown = $005C sys_fchown = $005D sys_lchown = $005E sys_umask = $005F sys_gettimeofday = $0060 sys_getrlimit = $0061 sys_getrusage = $0062 sys_sysinfo = $0063 sys_times = $0064 sys_ptrace = $0065 sys_getuid = $0066 sys_syslog = $0067 sys_getgid = $0068 sys_setuid = $0069 sys_setgid = $006A sys_geteuid = $006B sys_getegid = $006C sys_setpgid = $006D sys_getppid = $006E sys_getpgrp = $006F sys_setsid = $0070 sys_setreuid = $0071 sys_setregid = $0072 sys_getgroups = $0073 sys_setgroups = $0074 sys_setresuid = $0075 sys_getresuid = $0076 sys_setresgid = $0077 sys_getresgid = $0078 sys_getpgid = $0079 sys_setfsuid = $007A sys_setfsgid = $007B sys_getsid = $007C sys_capget = $007D sys_capset = $007E sys_rt_sigpending = $007F sys_rt_sigtimedwait = $0080 sys_rt_sigqueueinfo = $0081 sys_rt_sigsuspend = $0082 sys_sigaltstack = $0083 sys_utime = $0084 sys_mknod = $0085 sys_personality = $0087 sys_ustat = $0088 sys_statfs = $0089 sys_fstatfs = $008A sys_sysfs = $008B sys_getpriority = $008C sys_setpriority = $008D sys_sched_setparam = $008E sys_sched_getparam = $008F sys_sched_setscheduler = $0090 sys_sched_getscheduler = $0091 sys_sched_get_priority_max = $0092 sys_sched_get_priority_min = $0093 sys_sched_rr_get_interval = $0094 sys_mlock = $0095 sys_munlock = $0096 sys_mlockall = $0097 sys_munlockall = $0098 sys_vhangup = $0099 sys_modify_ldt = $009A sys_pivot_root = $009B sys_sysctl = $009C sys_prctl = $009D sys_arch_prctl = $009E sys_adjtimex = $009F sys_setrlimit = $00A0 sys_chroot = $00A1 sys_sync = $00A2 sys_acct = $00A3 sys_settimeofday = $00A4 sys_mount = $00A5 sys_umount = $00A6 sys_swapon = $00A7 sys_swapoff = $00A8 sys_reboot = $00A9 sys_sethostname = $00AA sys_setdomainname = $00AB stub_iopl = $00AC sys_ioperm = $00AD sys_init_module = $00AF sys_delete_module = $00B0 sys_quotactl = $00B3 sys_gettid = $00BA sys_readahead = $00BB sys_setxattr = $00BC sys_lsetxattr = $00BD sys_fsetxattr = $00BE sys_getxattr = $00BF sys_lgetxattr = $00C0 sys_fgetxattr = $00C1 sys_listxattr = $00C2 sys_llistxattr = $00C3 sys_flistxattr = $00C4 sys_removexattr = $00C5 sys_lremovexattr = $00C6 sys_fremovexattr = $00C7 sys_tkill = $00C8 sys_time = $00C9 sys_futex = $00CA sys_sched_setaffinity = $00CB sys_sched_getaffinity = $00CC sys_io_setup = $00CE sys_io_destroy = $00CF sys_io_getevents = $00D0 sys_io_submit = $00D1 sys_io_cancel = $00D2 sys_lookup_dcookie = $00D4 sys_epoll_create = $00D5 sys_remap_file_pages = $00D8 sys_getdents64 = $00D9 sys_set_tid_address = $00DA sys_restart_syscall = $00DB sys_semtimedop = $00DC sys_fadvise64 = $00DD sys_timer_create = $00DE sys_timer_settime = $00DF sys_timer_gettime = $00E0 sys_timer_getoverrun = $00E1 sys_timer_delete = $00E2 sys_clock_settime = $00E3 sys_clock_gettime = $00E4 sys_clock_getres = $00E5 sys_clock_nanosleep = $00E6 sys_exit_group = $00E7 sys_epoll_wait = $00E8 sys_epoll_ctl = $00E9 sys_tgkill = $00EA sys_utimes = $00EB sys_mbind = $00ED sys_set_mempolicy = $00EE sys_get_mempolicy = $00EF sys_mq_open = $00F0 sys_mq_unlink = $00F1 sys_mq_timedsend = $00F2 sys_mq_timedreceive = $00F3 sys_mq_notify = $00F4 sys_mq_getsetattr = $00F5 sys_kexec_load = $00F6 sys_waitid = $00F7 sys_add_key = $00F8 sys_request_key = $00F9 sys_keyctl = $00FA sys_ioprio_set = $00FB sys_ioprio_get = $00FC sys_inotify_init = $00FD sys_inotify_add_watch = $00FE sys_inotify_rm_watch = $00FF sys_migrate_pages = $0100 sys_openat = $0101 sys_mkdirat = $0102 sys_mknodat = $0103 sys_fchownat = $0104 sys_futimesat = $0105 sys_newfstatat = $0106 sys_unlinkat = $0107 sys_renameat = $0108 sys_linkat = $0109 sys_symlinkat = $010A sys_readlinkat = $010B sys_fchmodat = $010C sys_faccessat = $010D sys_pselect6 = $010E sys_ppoll = $010F sys_unshare = $0110 sys_set_robust_list = $0111 sys_get_robust_list = $0112 sys_splice = $0113 sys_tee = $0114 sys_sync_file_range = $0115 sys_vmsplice = $0116 sys_move_pages = $0117 sys_utimensat = $0118 sys_epoll_pwait = $0119 sys_signalfd = $011A sys_timerfd_create = $011B sys_eventfd = $011C sys_fallocate = $011D sys_timerfd_settime = $011E sys_timerfd_gettime = $011F sys_accept4 = $0120 sys_signalfd4 = $0121 sys_eventfd2 = $0122 sys_epoll_create1 = $0123 sys_dup3 = $0124 sys_pipe2 = $0125 sys_inotify_init1 = $0126 sys_preadv = $0127 sys_pwritev = $0128 sys_rt_tgsigqueueinfo = $0129 sys_perf_event_open = $012A sys_recvmmsg = $012B sys_fanotify_init = $012C sys_fanotify_mark = $012D sys_prlimit64 = $012E sys_name_to_handle_at = $012F sys_open_by_handle_at = $0130 sys_clock_adjtime = $0131 sys_syncfs = $0132 sys_sendmmsg = $0133 sys_setns = $0134 sys_getcpu = $0135 sys_process_vm_readv = $0136 sys_process_vm_writev = $0137 sys_kcmp = $0138 sys_finit_module = $0139 sys_ni_syscall = $013A sys_ni_syscall2 = $013B sys_ni_syscall3 = $013C sys_seccomp = $013D compat_sys_rt_sigaction = $0200 stub_x32_rt_sigreturn = $0201 compat_sys_ioctl = $0202 compat_sys_readv = $0203 compat_sys_writev = $0204 compat_sys_recvfrom = $0205 compat_sys_sendmsg = $0206 compat_sys_recvmsg = $0207 stub_x32_execve = $0208 compat_sys_ptrace = $0209 compat_sys_rt_sigpending = $020A compat_sys_rt_sigtimedwait = $020B compat_sys_rt_sigqueueinfo = $020C compat_sys_sigaltstack = $020D compat_sys_timer_create = $020E compat_sys_mq_notify = $020F compat_sys_kexec_load = $0210 compat_sys_waitid = $0211 compat_sys_set_robust_list = $0212 compat_sys_get_robust_list = $0213 compat_sys_vmsplice = $0214 compat_sys_move_pages = $0215 compat_sys_preadv64 = $0216 compat_sys_pwritev64 = $0217 compat_sys_rt_tgsigqueueinfo = $0218 compat_sys_recvmmsg = $0219 compat_sys_sendmmsg = $021A compat_sys_process_vm_readv = $021B compat_sys_process_vm_writev = $021C compat_sys_setsockopt = $021D compat_sys_getsockopt = $021E compat_sys_io_setup = $021F compat_sys_io_submit = $0220 ; Signals SIGHUP = 1 SIGINT = 2 SIGQUIT = 3 SIGILL = 4 SIGTRAP = 5 SIGIOT = 6 SIGABRT = 6 SIGBUS = 7 SIGFPE = 8 SIGKILL = 9 SIGUSR1 = 10 SIGSEGV = 11 SIGUSR2 = 12 SIGPIPE = 13 SIGALRM = 14 SIGTERM = 15 SIGSTKFLT = 16 SIGCHLD = 17 SIGCLD = 17 SIGCONT = 18 SIGSTOP = 19 SIGTSTP = 20 SIGTTIN = 21 SIGTTOU = 22 SIGURG = 23 SIGXCPU = 24 SIGXFSZ = 25 SIGVTALRM = 26 SIGPROF = 27 SIGWINCH = 28 SIGIO = 29 SIGPOLL = 29 SIGINFO = 30 SIGPWR = 30 SIGSYS = 31 ; Error numbers EPERM = 1 ENOENT = 2 ESRCH = 3 EINTR = 4 EIO = 5 ENXIO = 6 E2BIG = 7 ENOEXEC = 8 EBADF = 9 ECHILD = 10 EAGAIN = 11 ENOMEM = 12 EACCES = 13 EFAULT = 14 ENOTBLK = 15 EBUSY = 16 EEXIST = 17 EXDEV = 18 ENODEV = 19 ENOTDIR = 20 EISDIR = 21 EINVAL = 22 ENFILE = 23 EMFILE = 24 ENOTTY = 25 ETXTBSY = 26 EFBIG = 27 ENOSPC = 28 ESPIPE = 29 EROFS = 30 EMLINK = 31 EPIPE = 32 EDOM = 33 ERANGE = 34 EDEADLK = 35 ENAMETOOLONG = 36 ENOLCK = 37 ENOSYS = 38 ENOTEMPTY = 39 ELOOP = 40 EWOULDBLOCK = EAGAIN ENOMSG = 42 EIDRM = 43 ECHRNG = 44 EL2NSYNC = 45 EL3HLT = 46 EL3RST = 47 ELNRNG = 48 EUNATCH = 49 ENOCSI = 50 EL2HLT = 51 EBADE = 52 EBADR = 53 EXFULL = 54 ENOANO = 55 EBADRQC = 56 EBADSLT = 57 EDEADLOCK = EDEADLK EBFONT = 59 ENOSTR = 60 ENODATA = 61 ETIME = 62 ENOSR = 63 ENONET = 64 ENOPKG = 65 EREMOTE = 66 ENOLINK = 67 EADV = 68 ESRMNT = 69 ECOMM = 70 EPROTO = 71 EMULTIHOP = 72 EDOTDOT = 73 EBADMSG = 74 EOVERFLOW = 75 ENOTUNIQ = 76 EBADFD = 77 EREMCHG = 78 ELIBACC = 79 ELIBBAD = 80 ELIBSCN = 81 ELIBMAX = 82 ELIBEXEC = 83 EILSEQ = 84 ERESTART = 85 ESTRPIPE = 86 EUSERS = 87 ENOTSOCK = 88 EDESTADDRREQ = 89 EMSGSIZE = 90 EPROTOTYPE = 91 ENOPROTOOPT = 92 EPROTONOSUPPORT = 93 ESOCKTNOSUPPORT = 94 EOPNOTSUPP = 95 EPFNOSUPPORT = 96 EAFNOSUPPORT = 97 EADDRINUSE = 98 EADDRNOTAVAIL = 99 ENETDOWN = 100 ENETUNREACH = 101 ENETRESET = 102 ECONNABORTED = 103 ECONNRESET = 104 ENOBUFS = 105 EISCONN = 106 ENOTCONN = 107 ESHUTDOWN = 108 ETOOMANYREFS = 109 ETIMEDOUT = 110 ECONNREFUSED = 111 EHOSTDOWN = 112 EHOSTUNREACH = 113 EALREADY = 114 EINPROGRESS = 115 ESTALE = 116 EUCLEAN = 117 ENOTNAM = 118 ENAVAIL = 119 EISNAM = 120 EREMOTEIO = 121 EDQUOT = 122 ENOMEDIUM = 123 EMEDIUMTYPE = 124 ECANCELED = 125 ENOKEY = 126 EKEYEXPIRED = 127 EKEYREVOKED = 128 EKEYREJECTED = 129 EOWNERDEAD = 130 ENOTRECOVERABLE = 131 ERFKILL = 132 EHWPOISON = 133 ; O_ flags O_ACCMODE = 00000003o O_RDONLY = 00000000o O_WRONLY = 00000001o O_RDWR = 00000002o O_CREAT = 00000100o O_EXCL = 00000200o O_NOCTTY = 00000400o O_TRUNC = 00001000o O_APPEND = 00002000o O_NONBLOCK = 00004000o O_NDELAY = O_NONBLOCK O_SYNC = 04010000o O_FSYNC = O_SYNC O_ASYNC = 00020000o O_DIRECTORY = 00200000o O_NOFOLLOW = 00400000o O_CLOEXEC = 02000000o O_DIRECT = 00040000o O_NOATIME = 01000000o O_PATH = 10000000o O_DSYNC = 00010000o O_RSYNC = O_SYNC O_LARGEFILE = 00100000o ; R_ flags R_OK = 4 W_OK = 2 X_OK = 1 F_OK = 0 ; S_ flags S_IRWXU = 00000700o S_IRUSR = 00000400o S_IWUSR = 00000200o S_IXUSR = 00000100o S_IRWXG = 00000070o S_IRGRP = 00000040o S_IWGRP = 00000020o S_IXGRP = 00000010o S_IRWXO = 00000007o S_IROTH = 00000004o S_IWOTH = 00000002o S_IXOTH = 00000001o ; PROT_ flags PROT_READ = $01 PROT_WRITE = $02 PROT_EXEC = $04 PROT_SEM = $08 PROT_NONE = $00 PROT_GROWSDOWN = $01000000 PROT_GROWSUP = $02000000 ; MAP_ flags MAP_SHARED = $01 MAP_PRIVATE = $02 MAP_TYPE = $0F MAP_FIXED = $10 MAP_ANONYMOUS = $20 MAP_ANON = MAP_ANONYMOUS MAP_FILE = 0 MAP_HUGE_SHIFT = 26 MAP_HUGE_MASK = $3F MAP_32BIT = $40 MAP_GROWSUP = $00200 MAP_GROWSDOWN = $00100 MAP_DENYWRITE = $00800 MAP_EXECUTABLE = $01000 MAP_LOCKED = $02000 MAP_NORESERVE = $04000 MAP_POPULATE = $08000 MAP_NONBLOCK = $10000 MAP_STACK = $20000 MAP_HUGETLB = $40000 ; MS_ flags MS_ASYNC = 1 MS_SYNC = 4 MS_INVALIDATE = 2 ; MCL_ flags MCL_CURRENT = 1 MCL_FUTURE = 2 ; MREMAP_ flags MREMAP_MAYMOVE = 1 MREMAP_FIXED = 2 ; MADV_ flags MADV_NORMAL = 0 MADV_RANDOM = 1 MADV_SEQUENTIAL = 2 MADV_WILLNEED = 3 MADV_DONTNEED = 4 MADV_REMOVE = 9 MADV_DONTFORK = 10 MADV_DOFORK = 11 MADV_MERGEABLE = 12 MADV_UNMERGEABLE = 13 MADV_HUGEPAGE = 14 MADV_NOHUGEPAGE = 15 MADV_HWPOISON = 100 ; SEEK_ flags SEEK_6 = $0B SEEK_10 = $2B SEEK_SET = 0 SEEK_CUR = 1 SEEK_END = 2 SEEK_DATA = 3 SEEK_HOLE = 4 SEEK_MAX = SEEK_HOLE ; CLONE_ flags CSIGNAL = $000000FF CLONE_VM = $00000100 CLONE_FS = $00000200 CLONE_FILES = $00000400 CLONE_SIGHAND = $00000800 CLONE_PTRACE = $00002000 CLONE_VFORK = $00004000 CLONE_PARENT = $00008000 CLONE_THREAD = $00010000 CLONE_NEWNS = $00020000 CLONE_SYSVSEM = $00040000 CLONE_SETTLS = $00080000 CLONE_PARENT_SETTID = $00100000 CLONE_CHILD_CLEARTID = $00200000 CLONE_DETACHED = $00400000 CLONE_UNTRACED = $00800000 CLONE_CHILD_SETTID = $01000000 CLONE_NEWUTS = $04000000 CLONE_NEWIPC = $08000000 CLONE_NEWUSER = $10000000 CLONE_NEWPID = $20000000 CLONE_NEWNET = $40000000 CLONE_IO = $80000000 ; stdio stdin = 0 stdout = 1 stderr = 2 ; PRIO_ flags PRIO_PROCESS = 0 PRIO_PGRP = 1 PRIO_USER = 2 ; futex FUTEX_WAIT = 0 FUTEX_WAKE = 1 FUTEX_FD = 2 FUTEX_REQUEUE = 3 FUTEX_CMP_REQUEUE = 4 FUTEX_WAKE_OP = 5 FUTEX_LOCK_PI = 6 FUTEX_UNLOCK_PI = 7 FUTEX_TRYLOCK_PI = 8 FUTEX_WAIT_BITSET = 9 FUTEX_WAKE_BITSET = 10 FUTEX_WAIT_REQUEUE_PI = 11 FUTEX_CMP_REQUEUE_PI = 12 FUTEX_PRIVATE_FLAG =128 FUTEX_CLOCK_REALTIME =256 FUTEX_CMD_MASK = not (FUTEX_PRIVATE_FLAG or FUTEX_CLOCK_REALTIME) FUTEX_WAIT_PRIVATE =(FUTEX_WAIT or FUTEX_PRIVATE_FLAG) FUTEX_WAKE_PRIVATE =(FUTEX_WAKE or FUTEX_PRIVATE_FLAG) FUTEX_REQUEUE_PRIVATE =(FUTEX_REQUEUE or FUTEX_PRIVATE_FLAG) FUTEX_CMP_REQUEUE_PRIVATE =(FUTEX_CMP_REQUEUE or FUTEX_PRIVATE_FLAG) FUTEX_WAKE_OP_PRIVATE =(FUTEX_WAKE_OP or FUTEX_PRIVATE_FLAG) FUTEX_LOCK_PI_PRIVATE =(FUTEX_LOCK_PI or FUTEX_PRIVATE_FLAG) FUTEX_UNLOCK_PI_PRIVATE =(FUTEX_UNLOCK_PI or FUTEX_PRIVATE_FLAG) FUTEX_TRYLOCK_PI_PRIVATE =(FUTEX_TRYLOCK_PI or FUTEX_PRIVATE_FLAG) FUTEX_WAIT_BITSET_PRIVATE =(FUTEX_WAIT_BITSET or FUTEX_PRIVATE_FLAG) FUTEX_WAKE_BITSET_PRIVATE =(FUTEX_WAKE_BITSET or FUTEX_PRIVATE_FLAG) FUTEX_WAIT_REQUEUE_PI_PRIVATE =(FUTEX_WAIT_REQUEUE_PI or FUTEX_PRIVATE_FLAG) FUTEX_CMP_REQUEUE_PI_PRIVATE =(FUTEX_CMP_REQUEUE_PI or FUTEX_PRIVATE_FLAG) ; memory policy MPOL_DEFAULT = 0 MPOL_PREFERRED = 1 MPOL_BIND = 2 MPOL_INTERLEAVE = 3 ; CLOCK_ flags CLOCK_REALTIME = 0 CLOCK_MONOTONIC = 1 CLOCK_PROCESS_CPUTIME_ID = 2 CLOCK_THREAD_CPUTIME_ID = 3 CLOCK_MONOTONIC_RAW = 4 CLOCK_REALTIME_COARSE = 5 CLOCK_MONOTONIC_COARSE = 6 CLOCK_BOOTTIME = 7 CLOCK_REALTIME_ALARM = 8 CLOCK_BOOTTIME_ALARM = 9 CLOCK_SGI_CYCLE = 10 CLOCK_TAI = 11 MAX_CLOCKS = 16 CLOCKS_MASK = CLOCK_REALTIME or CLOCK_MONOTONIC CLOCKS_MONO = CLOCK_MONOTONIC TIMER_ABSTIME = 1 ; SIGEV_ flags SIGEV_SIGNAL = 0 SIGEV_NONE = 1 SIGEV_THREAD = 2 SIGEV_THREAD_ID = 4
汇编语言/实验/exp2/4.asm
wine99/hfut-cs-assignments
56
91105
<filename>汇编语言/实验/exp2/4.asm ; Initialize the 20 bytes starting at DS:0000 ; to 0cch and copy to into the next 20 bytes. assume cs:code, ds:data data segment db 40 dup(10) data ends code segment start: mov ax, data mov ds, ax mov es, ax cld mov cx, 20 mov di, 0 mov al, 0cch rep stosb mov cx, 20 mov si, 0 rep movsb mov ah, 4ch int 21h code ends end start
tools/assembler/forth/math.asm
Darkstrumn/HCTM
4
162813
dcode 1+,2,,INCR ; ( a -- a+1 ) pla inc a pha nxt dcode 1-,2,,DECR ; ( a -- a-1 ) pla dec a pha nxt dcode 2+,2,,INCRTWO ; ( a -- a+2 ) pla inc a inc a pha nxt dcode 2-,2,,DECRTWO ; ( a -- a-2 ) pla dec a dec a pha nxt dcode +,1,,ADD ; ( a b -- a+b ) pla clc adc $01, s ply pha nxt dword -,1,,SUB ; ( a b -- a-b ) .wp NEGATE .wp ADD .wp EXIT dcode UM*,3,,UMMUL ; ( a b -- d[a*b] ) pla tsx sec mul $0001, x ply pha phd nxt dword U*,2,,UMUL ; ( a b -- a*b ) .wp UMMUL .wp DROP .wp EXIT dcode M*,2,,MMUL ; (a b -- d[a*b] ) pla tsx clc mul $0001, x ply pha phd nxt dword *,1,,MUL ; ( a b -- a*b ) .wp MMUL .wp DROP .wp EXIT dcode 2*,2,,TWOMUL ; ( a -- 2*a ) pla clc rol a pha nxt dword UM/MOD,6,,UMDIVMOD ; ( d b -- d/b d%b ) .wp ROT .wp _DM nxt dword U/MOD,5,,UDIVMOD ; ( a b -- a/b a%b ) .wp SWAP .wp ZERO .wp _DM .wp EXIT dword /MOD,4,,DIVMOD ; ( a b -- a/b a%b ) .wp SWAP .wp NUM_TODOUBLE .wp _DM .wp EXIT dcode (UM/MOD),7,F_HIDDEN,_DM pld pla tsx sec div $0001, x ply pha phd nxt dword U/,2,,UDIV ; ( a b -- a/b ) .wp UDIVMOD .wp DROP .wp EXIT dword /,1,,DIV ; ( a b -- a/b ) .wp DIVMOD .wp DROP .wp EXIT dword MOD,3,, ; ( a b -- a%b ) .wp UDIVMOD .wp NIP .wp EXIT dword 2/,2,,TWODIV ; ( a -- b/2 ) .wp ONE .wp RSHIFT .wp EXIT dword ABS,3,, ; ( a -- |a| ) .wp DUP .wp ZLT .zbranch ABS_noaction .wp NEGATE ABS_noaction: .wp EXIT dcode N>D,3,,NUM_TODOUBLE ; ( value -- d ) pla sea pha phd nxt .ifcflag dbl_size dword DNEGATE,7,, .wp INVERT .wp SWAP .wp INVERT .wp SWAP .wp ONE .wp ZERO .wp DADD .wp EXIT dcode D+,2,,DADD ; ( a b -- a+b ) plx pla clc adc $03, s tay txa adc $01, s plx plx phy pha nxt dword D-,2,,DSUB ; ( a b -- a-b ) .wp DNEGATE .wp DADD .wp EXIT signed_prep: ; if the numbers are negative make them positive stz $48 ; set $48 to -1, gets increased when a number is negative, dec $48 ; is used to determine if the result is negative or not lda $40 bit #$8000 beq sp_next_a ; number is negative, make it positive inc $48 lda #$ffff pha eor $40 sta $40 pla eor $42 inc a sta $42 bne sp_next_a inc $40 ; overflow, carry into next bits sp_next_a: lda $44 bit #$8000 beq sp_next_b ; number is negative, make it positive inc $48 lda #$ffff pha eor $44 sta $44 pla eor $46 inc a sta $46 bne sp_next_b inc $44 ; overflow, carry into next bits sp_next_b: rts load_double: pla sta $40 ; MSB A pla sta $42 ; LSB A pla sta $44 ; MSB B pla sta $46 ; LSB B rts double_mul: ; multiply LSB A with LSB B sec ; we want unsigned multiplication lda $42 mul $46 rha phd ; MSB A * LSB B lda $40 mul $46 pha ; we only need the lower bits ; MSB B * LSB A lda $44 mul $42 clc ; we want to ignore overflow here as this is the upper part of the 32 bits adc $01, s clc adc $03, s ply ply tay ; LSB in y rla tax ; MSB in x rts double_div: ; TODO Implement division routine lda #$0000 tax tay setsb: lda $48 bne setsb_positive ; if the result should be negative, negate the value txa eor #$ffff tax tya eor #$ffff inc a tay bcc setsb_positive txa inc a tax setsb_positive: rts dcode D*,2,,DMUL jsr load_double jsr signed_prep jsr double_mul jsr setsb phx phy nxt dcode D/,2,,DDIV jsr load_double jsr signed_prep jsr double_div jsr setsb phx phy nxt dcode UD*,3,,UDMUL jsr load_double jsr double_mul phx phy nxt dcode UD/,3,,UDDIV jsr load_double jsr double_div phx phy nxt .endif dcode SPLIT,5,, ; ( $1234 -- $34 $12 ) pla sep #$30 ldx #$00 phx pha xba phx pha rep #$30 nxt dcode JOIN,4,, ; ( $34 $12 -- $1234 ) sep #$30 plx ply ply pla phx phy rep #$30 nxt .ifcflag math_ext dword UNDER+,6,,UNDERADD ; ( a b c -- a+c b ) .wp ROT .wp ADD .wp SWAP .wp EXIT .endif
Cutting.agda
pigworker/InteriorDesign
6
9687
<reponame>pigworker/InteriorDesign<filename>Cutting.agda module Cutting where open import Basics open import Ix open import All record _|>_ (I O : Set) : Set1 where field Cuts : O -> Set inners : {o : O} -> Cuts o -> List I NatCut : Nat |> Nat NatCut = record { Cuts = \ mn -> Sg Nat \ m -> Sg Nat \ n -> (m +N n) == mn ; inners = \ { (m , n , _) -> m ,- n ,- [] } } record Cutting {I O}(C : I |> O)(P : I -> Set)(o : O) : Set where constructor _8><_ open _|>_ C field cut : Cuts o pieces : All P (inners cut) infixr 3 _8><_ open Cutting public
Library/Shell/Buffer/bufferManager.asm
steakknife/pcgeos
504
242840
COMMENT @===================================================================== Copyright (c) GeoWorks 1992 -- All Rights Reserved PROJECT: PC/GEOS MODULE: Iclas -- HugeFile FILE: hugefileManager.asm AUTHOR: <NAME>, September 23, 1992 REVISION HISTORY: Name Date Description ---- ---- ----------- martin 9/23/92 Initial version DESCRIPTION: Manager for this module. $Id: hugefileManager.asm,v 1.1 97/04/04 19:42:20 newdeal Exp $ =============================================================================@ _ShellBuffer = 1 ;------------------------------------------------------------------------------ ; Include global library definitions. ;------------------------------------------------------------------------------ include shellGeode.def ;------------------------------------------------------------------------------ ; Include local module definitions. ;------------------------------------------------------------------------------ include bufferConstant.def ;------------------------------------------------------------------------------ ; Here comes the code... ;------------------------------------------------------------------------------ ShellFileBuffer segment resource include bufferMain.asm ; Main code file for this module. ShellFileBuffer ends ShellCStubs segment resource include bufferC.asm ; C stubs for this module. ShellCStubs ends
cmstack/codegen/tabla/include/Tabla.g4
he-actlab/cdstack
1
4908
<filename>cmstack/codegen/tabla/include/Tabla.g4<gh_stars>1-10 grammar Tabla; /* scanner tokens */ MODEL_INPUT : 'model_input'; MODEL_OUTPUT : 'model_output'; MODEL : 'model'; GRADIENT : 'gradient'; ITERATOR : 'iterator'; ADD : '+'; SUB : '-'; LT : '<'; GT : '>'; MUL : '*'; PI : 'pi'; SUM : 'sum'; NORM : 'norm'; GAUSSIAN : 'gaussian'; SIGMOID : 'sigmoid'; SIG_SYM : 'sigmoid_symmetric'; LOG : 'log'; SEMI : ';'; COLON: ':'; LEFT_BRACK : '['; RIGHT_BRACK : ']'; LEFT_PAREN : '('; RIGHT_PAREN : ')'; COMMA : ','; ASSIGN : '='; /* var name */ ID : (LOWER | UPPER) (LOWER | UPPER | DIGIT | '_')* ('\'')? ; fragment LOWER: 'a'..'z'; fragment UPPER: 'A'..'Z'; fragment DIGIT: '0'..'9'; WHITESPACE : (' ' | '\t' | '\n' | '\r')+ -> skip ; COMMENT // : '/*' .*? '*/' : '//' .+? ('\n' | EOF) -> skip ; INTLIT : '0' | '1'..'9' (DIGIT)* ; /* LL(1) parser rules */ program : data_decl_list stat_list EOF ; data_decl_list : data_decl* ; data_decl : data_type SEMI ; data_type : non_iterator var_list | GRADIENT var_with_link_list | iterator var_list_iterator | ID ASSIGN INTLIT ; non_iterator : MODEL_INPUT | MODEL_OUTPUT | MODEL // | GRADIENT ; iterator : ITERATOR ; var_with_link_list : var '->' var var_with_link_list_tail ; var_with_link_list_tail : ',' var_with_link_list var_with_link_list_tail | // elipse ; var_list : var var_list_tail ; var : var_id ; var_id : ID id_tail ; id_tail : LEFT_BRACK (ID | INTLIT) RIGHT_BRACK id_tail | // epsilon ; var_list_tail : COMMA var_list | // epsilon ; var_list_iterator : ID LEFT_BRACK (ID | INTLIT) COLON (ID | INTLIT) RIGHT_BRACK ; stat_list : stat* | // epsilon ; stat : var ASSIGN expr SEMI ; // expr_list : expr expr_list; // | ; expr : term2 term2_tail ; function : PI | SUM | NORM | GAUSSIAN | SIGMOID | SIG_SYM | LOG ; function_args : LEFT_BRACK ID RIGHT_BRACK LEFT_PAREN expr RIGHT_PAREN | LEFT_PAREN expr RIGHT_PAREN ; term2_tail : compare_op term2 term2_tail | // epsilon ; term2 : term1 term1_tail ; term1_tail : add_op term1 term1_tail | // epsilon ; term1 : term0 term0_tail ; term0_tail : mul_op term0 term0_tail | // epsilon ; term0 : var | LEFT_PAREN expr RIGHT_PAREN | INTLIT | function function_args ; mul_op : MUL ; add_op : ADD | SUB ; compare_op : LT | GT ;
tools/scitools/conf/understand/ada/ada95/i-cobol.ads
brucegua/moocos
1
5586
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- I N T E R F A C E S . C O B O L -- -- -- -- S p e c -- -- -- -- $Revision: 2 $ -- -- -- -- This specification is adapted from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ package Interfaces.COBOL is ------------------------------------------------------------ -- Types And Operations For Internal Data Representations -- ------------------------------------------------------------ type Floating is new Float; type Long_Floating is new Long_Float; type Binary is new Integer; type Long_Binary is new Long_Long_Integer; Max_Digits_Binary : constant := 9; Max_Digits_Long_Binary : constant := 18; type Decimal_Element is mod 16; type Packed_Decimal is array (Positive range <>) of Decimal_Element; pragma Pack (Packed_Decimal); type COBOL_Character is new Character; Ada_To_COBOL : array (Standard.Character) of COBOL_Character := ( COBOL_Character'Val (000), COBOL_Character'Val (001), COBOL_Character'Val (002), COBOL_Character'Val (003), COBOL_Character'Val (004), COBOL_Character'Val (005), COBOL_Character'Val (006), COBOL_Character'Val (007), COBOL_Character'Val (008), COBOL_Character'Val (009), COBOL_Character'Val (010), COBOL_Character'Val (011), COBOL_Character'Val (012), COBOL_Character'Val (013), COBOL_Character'Val (014), COBOL_Character'Val (015), COBOL_Character'Val (016), COBOL_Character'Val (017), COBOL_Character'Val (018), COBOL_Character'Val (019), COBOL_Character'Val (020), COBOL_Character'Val (021), COBOL_Character'Val (022), COBOL_Character'Val (023), COBOL_Character'Val (024), COBOL_Character'Val (025), COBOL_Character'Val (026), COBOL_Character'Val (027), COBOL_Character'Val (028), COBOL_Character'Val (029), COBOL_Character'Val (030), COBOL_Character'Val (031), COBOL_Character'Val (032), COBOL_Character'Val (033), COBOL_Character'Val (034), COBOL_Character'Val (035), COBOL_Character'Val (036), COBOL_Character'Val (037), COBOL_Character'Val (038), COBOL_Character'Val (039), COBOL_Character'Val (040), COBOL_Character'Val (041), COBOL_Character'Val (042), COBOL_Character'Val (043), COBOL_Character'Val (044), COBOL_Character'Val (045), COBOL_Character'Val (046), COBOL_Character'Val (047), COBOL_Character'Val (048), COBOL_Character'Val (049), COBOL_Character'Val (050), COBOL_Character'Val (051), COBOL_Character'Val (052), COBOL_Character'Val (053), COBOL_Character'Val (054), COBOL_Character'Val (055), COBOL_Character'Val (056), COBOL_Character'Val (057), COBOL_Character'Val (058), COBOL_Character'Val (059), COBOL_Character'Val (060), COBOL_Character'Val (061), COBOL_Character'Val (062), COBOL_Character'Val (063), COBOL_Character'Val (064), COBOL_Character'Val (065), COBOL_Character'Val (066), COBOL_Character'Val (067), COBOL_Character'Val (068), COBOL_Character'Val (069), COBOL_Character'Val (070), COBOL_Character'Val (071), COBOL_Character'Val (072), COBOL_Character'Val (073), COBOL_Character'Val (074), COBOL_Character'Val (075), COBOL_Character'Val (076), COBOL_Character'Val (077), COBOL_Character'Val (078), COBOL_Character'Val (079), COBOL_Character'Val (080), COBOL_Character'Val (081), COBOL_Character'Val (082), COBOL_Character'Val (083), COBOL_Character'Val (084), COBOL_Character'Val (085), COBOL_Character'Val (086), COBOL_Character'Val (087), COBOL_Character'Val (088), COBOL_Character'Val (089), COBOL_Character'Val (090), COBOL_Character'Val (091), COBOL_Character'Val (092), COBOL_Character'Val (093), COBOL_Character'Val (094), COBOL_Character'Val (095), COBOL_Character'Val (096), COBOL_Character'Val (097), COBOL_Character'Val (098), COBOL_Character'Val (099), COBOL_Character'Val (100), COBOL_Character'Val (101), COBOL_Character'Val (102), COBOL_Character'Val (103), COBOL_Character'Val (104), COBOL_Character'Val (105), COBOL_Character'Val (106), COBOL_Character'Val (107), COBOL_Character'Val (108), COBOL_Character'Val (109), COBOL_Character'Val (110), COBOL_Character'Val (111), COBOL_Character'Val (112), COBOL_Character'Val (113), COBOL_Character'Val (114), COBOL_Character'Val (115), COBOL_Character'Val (116), COBOL_Character'Val (117), COBOL_Character'Val (118), COBOL_Character'Val (119), COBOL_Character'Val (120), COBOL_Character'Val (121), COBOL_Character'Val (122), COBOL_Character'Val (123), COBOL_Character'Val (124), COBOL_Character'Val (125), COBOL_Character'Val (126), COBOL_Character'Val (127), COBOL_Character'Val (128), COBOL_Character'Val (129), COBOL_Character'Val (130), COBOL_Character'Val (131), COBOL_Character'Val (132), COBOL_Character'Val (133), COBOL_Character'Val (134), COBOL_Character'Val (135), COBOL_Character'Val (136), COBOL_Character'Val (137), COBOL_Character'Val (138), COBOL_Character'Val (139), COBOL_Character'Val (140), COBOL_Character'Val (141), COBOL_Character'Val (142), COBOL_Character'Val (143), COBOL_Character'Val (144), COBOL_Character'Val (145), COBOL_Character'Val (146), COBOL_Character'Val (147), COBOL_Character'Val (148), COBOL_Character'Val (149), COBOL_Character'Val (150), COBOL_Character'Val (151), COBOL_Character'Val (152), COBOL_Character'Val (153), COBOL_Character'Val (154), COBOL_Character'Val (155), COBOL_Character'Val (156), COBOL_Character'Val (157), COBOL_Character'Val (158), COBOL_Character'Val (159), COBOL_Character'Val (160), COBOL_Character'Val (161), COBOL_Character'Val (162), COBOL_Character'Val (163), COBOL_Character'Val (164), COBOL_Character'Val (165), COBOL_Character'Val (166), COBOL_Character'Val (167), COBOL_Character'Val (168), COBOL_Character'Val (169), COBOL_Character'Val (170), COBOL_Character'Val (171), COBOL_Character'Val (172), COBOL_Character'Val (173), COBOL_Character'Val (174), COBOL_Character'Val (175), COBOL_Character'Val (176), COBOL_Character'Val (177), COBOL_Character'Val (178), COBOL_Character'Val (179), COBOL_Character'Val (180), COBOL_Character'Val (181), COBOL_Character'Val (182), COBOL_Character'Val (183), COBOL_Character'Val (184), COBOL_Character'Val (185), COBOL_Character'Val (186), COBOL_Character'Val (187), COBOL_Character'Val (188), COBOL_Character'Val (189), COBOL_Character'Val (190), COBOL_Character'Val (191), COBOL_Character'Val (192), COBOL_Character'Val (193), COBOL_Character'Val (194), COBOL_Character'Val (195), COBOL_Character'Val (196), COBOL_Character'Val (197), COBOL_Character'Val (198), COBOL_Character'Val (199), COBOL_Character'Val (200), COBOL_Character'Val (201), COBOL_Character'Val (202), COBOL_Character'Val (203), COBOL_Character'Val (204), COBOL_Character'Val (205), COBOL_Character'Val (206), COBOL_Character'Val (207), COBOL_Character'Val (208), COBOL_Character'Val (209), COBOL_Character'Val (210), COBOL_Character'Val (211), COBOL_Character'Val (212), COBOL_Character'Val (213), COBOL_Character'Val (214), COBOL_Character'Val (215), COBOL_Character'Val (216), COBOL_Character'Val (217), COBOL_Character'Val (218), COBOL_Character'Val (219), COBOL_Character'Val (220), COBOL_Character'Val (221), COBOL_Character'Val (222), COBOL_Character'Val (223), COBOL_Character'Val (224), COBOL_Character'Val (225), COBOL_Character'Val (226), COBOL_Character'Val (227), COBOL_Character'Val (228), COBOL_Character'Val (229), COBOL_Character'Val (230), COBOL_Character'Val (231), COBOL_Character'Val (232), COBOL_Character'Val (233), COBOL_Character'Val (234), COBOL_Character'Val (235), COBOL_Character'Val (236), COBOL_Character'Val (237), COBOL_Character'Val (238), COBOL_Character'Val (239), COBOL_Character'Val (240), COBOL_Character'Val (241), COBOL_Character'Val (242), COBOL_Character'Val (243), COBOL_Character'Val (244), COBOL_Character'Val (245), COBOL_Character'Val (246), COBOL_Character'Val (247), COBOL_Character'Val (248), COBOL_Character'Val (249), COBOL_Character'Val (250), COBOL_Character'Val (251), COBOL_Character'Val (252), COBOL_Character'Val (253), COBOL_Character'Val (254), COBOL_Character'Val (255)); COBOL_To_Ada : array (COBOL_Character) of Standard.Character := ( Standard.Character'Val (000), Standard.Character'Val (001), Standard.Character'Val (002), Standard.Character'Val (003), Standard.Character'Val (004), Standard.Character'Val (005), Standard.Character'Val (006), Standard.Character'Val (007), Standard.Character'Val (008), Standard.Character'Val (009), Standard.Character'Val (010), Standard.Character'Val (011), Standard.Character'Val (012), Standard.Character'Val (013), Standard.Character'Val (014), Standard.Character'Val (015), Standard.Character'Val (016), Standard.Character'Val (017), Standard.Character'Val (018), Standard.Character'Val (019), Standard.Character'Val (020), Standard.Character'Val (021), Standard.Character'Val (022), Standard.Character'Val (023), Standard.Character'Val (024), Standard.Character'Val (025), Standard.Character'Val (026), Standard.Character'Val (027), Standard.Character'Val (028), Standard.Character'Val (029), Standard.Character'Val (030), Standard.Character'Val (031), Standard.Character'Val (032), Standard.Character'Val (033), Standard.Character'Val (034), Standard.Character'Val (035), Standard.Character'Val (036), Standard.Character'Val (037), Standard.Character'Val (038), Standard.Character'Val (039), Standard.Character'Val (040), Standard.Character'Val (041), Standard.Character'Val (042), Standard.Character'Val (043), Standard.Character'Val (044), Standard.Character'Val (045), Standard.Character'Val (046), Standard.Character'Val (047), Standard.Character'Val (048), Standard.Character'Val (049), Standard.Character'Val (050), Standard.Character'Val (051), Standard.Character'Val (052), Standard.Character'Val (053), Standard.Character'Val (054), Standard.Character'Val (055), Standard.Character'Val (056), Standard.Character'Val (057), Standard.Character'Val (058), Standard.Character'Val (059), Standard.Character'Val (060), Standard.Character'Val (061), Standard.Character'Val (062), Standard.Character'Val (063), Standard.Character'Val (064), Standard.Character'Val (065), Standard.Character'Val (066), Standard.Character'Val (067), Standard.Character'Val (068), Standard.Character'Val (069), Standard.Character'Val (070), Standard.Character'Val (071), Standard.Character'Val (072), Standard.Character'Val (073), Standard.Character'Val (074), Standard.Character'Val (075), Standard.Character'Val (076), Standard.Character'Val (077), Standard.Character'Val (078), Standard.Character'Val (079), Standard.Character'Val (080), Standard.Character'Val (081), Standard.Character'Val (082), Standard.Character'Val (083), Standard.Character'Val (084), Standard.Character'Val (085), Standard.Character'Val (086), Standard.Character'Val (087), Standard.Character'Val (088), Standard.Character'Val (089), Standard.Character'Val (090), Standard.Character'Val (091), Standard.Character'Val (092), Standard.Character'Val (093), Standard.Character'Val (094), Standard.Character'Val (095), Standard.Character'Val (096), Standard.Character'Val (097), Standard.Character'Val (098), Standard.Character'Val (099), Standard.Character'Val (100), Standard.Character'Val (101), Standard.Character'Val (102), Standard.Character'Val (103), Standard.Character'Val (104), Standard.Character'Val (105), Standard.Character'Val (106), Standard.Character'Val (107), Standard.Character'Val (108), Standard.Character'Val (109), Standard.Character'Val (110), Standard.Character'Val (111), Standard.Character'Val (112), Standard.Character'Val (113), Standard.Character'Val (114), Standard.Character'Val (115), Standard.Character'Val (116), Standard.Character'Val (117), Standard.Character'Val (118), Standard.Character'Val (119), Standard.Character'Val (120), Standard.Character'Val (121), Standard.Character'Val (122), Standard.Character'Val (123), Standard.Character'Val (124), Standard.Character'Val (125), Standard.Character'Val (126), Standard.Character'Val (127), Standard.Character'Val (128), Standard.Character'Val (129), Standard.Character'Val (130), Standard.Character'Val (131), Standard.Character'Val (132), Standard.Character'Val (133), Standard.Character'Val (134), Standard.Character'Val (135), Standard.Character'Val (136), Standard.Character'Val (137), Standard.Character'Val (138), Standard.Character'Val (139), Standard.Character'Val (140), Standard.Character'Val (141), Standard.Character'Val (142), Standard.Character'Val (143), Standard.Character'Val (144), Standard.Character'Val (145), Standard.Character'Val (146), Standard.Character'Val (147), Standard.Character'Val (148), Standard.Character'Val (149), Standard.Character'Val (150), Standard.Character'Val (151), Standard.Character'Val (152), Standard.Character'Val (153), Standard.Character'Val (154), Standard.Character'Val (155), Standard.Character'Val (156), Standard.Character'Val (157), Standard.Character'Val (158), Standard.Character'Val (159), Standard.Character'Val (160), Standard.Character'Val (161), Standard.Character'Val (162), Standard.Character'Val (163), Standard.Character'Val (164), Standard.Character'Val (165), Standard.Character'Val (166), Standard.Character'Val (167), Standard.Character'Val (168), Standard.Character'Val (169), Standard.Character'Val (170), Standard.Character'Val (171), Standard.Character'Val (172), Standard.Character'Val (173), Standard.Character'Val (174), Standard.Character'Val (175), Standard.Character'Val (176), Standard.Character'Val (177), Standard.Character'Val (178), Standard.Character'Val (179), Standard.Character'Val (180), Standard.Character'Val (181), Standard.Character'Val (182), Standard.Character'Val (183), Standard.Character'Val (184), Standard.Character'Val (185), Standard.Character'Val (186), Standard.Character'Val (187), Standard.Character'Val (188), Standard.Character'Val (189), Standard.Character'Val (190), Standard.Character'Val (191), Standard.Character'Val (192), Standard.Character'Val (193), Standard.Character'Val (194), Standard.Character'Val (195), Standard.Character'Val (196), Standard.Character'Val (197), Standard.Character'Val (198), Standard.Character'Val (199), Standard.Character'Val (200), Standard.Character'Val (201), Standard.Character'Val (202), Standard.Character'Val (203), Standard.Character'Val (204), Standard.Character'Val (205), Standard.Character'Val (206), Standard.Character'Val (207), Standard.Character'Val (208), Standard.Character'Val (209), Standard.Character'Val (210), Standard.Character'Val (211), Standard.Character'Val (212), Standard.Character'Val (213), Standard.Character'Val (214), Standard.Character'Val (215), Standard.Character'Val (216), Standard.Character'Val (217), Standard.Character'Val (218), Standard.Character'Val (219), Standard.Character'Val (220), Standard.Character'Val (221), Standard.Character'Val (222), Standard.Character'Val (223), Standard.Character'Val (224), Standard.Character'Val (225), Standard.Character'Val (226), Standard.Character'Val (227), Standard.Character'Val (228), Standard.Character'Val (229), Standard.Character'Val (230), Standard.Character'Val (231), Standard.Character'Val (232), Standard.Character'Val (233), Standard.Character'Val (234), Standard.Character'Val (235), Standard.Character'Val (236), Standard.Character'Val (237), Standard.Character'Val (238), Standard.Character'Val (239), Standard.Character'Val (240), Standard.Character'Val (241), Standard.Character'Val (242), Standard.Character'Val (243), Standard.Character'Val (244), Standard.Character'Val (245), Standard.Character'Val (246), Standard.Character'Val (247), Standard.Character'Val (248), Standard.Character'Val (249), Standard.Character'Val (250), Standard.Character'Val (251), Standard.Character'Val (252), Standard.Character'Val (253), Standard.Character'Val (254), Standard.Character'Val (255)); type Alphanumeric is array (Positive range <>) of COBOL_Character; pragma Pack (Alphanumeric); function To_COBOL (Item : in String) return Alphanumeric; function To_Ada (Item : in Alphanumeric) return String; procedure To_COBOL (Item : in String; Target : out Alphanumeric; Last : out Natural); procedure To_Ada (Item : in Alphanumeric; Target : out String; Last : out Natural); type Numeric is array (Positive range <>) of COBOL_Character; pragma Pack (Numeric); -------------------------------------------- -- Formats For COBOL Data Representations -- -------------------------------------------- type Display_Format is private; Unsigned : constant Display_Format; Leading_Separate : constant Display_Format; Trailing_Separate : constant Display_Format; Leading_Nonseparate : constant Display_Format; Trailing_Nonseparate : constant Display_Format; type Binary_Format is private; High_Order_First : constant Binary_Format; Low_Order_First : constant Binary_Format; Native_Binary : constant Binary_Format; type Packed_Format is private; Packed_Unsigned : constant Packed_Format; Packed_Signed : constant Packed_Format; ------------------------------------------------------------ -- Types For External Representation Of COBOL Binary Data -- ------------------------------------------------------------ type Byte is mod 2 ** COBOL_Character'Size; type Byte_Array is array (Positive range <>) of Byte; pragma Pack (Byte_Array); Conversion_Error : exception; generic type Num is delta <> digits <>; package Decimal_Conversions is -- Display Formats: data values are represented as Numeric function Valid (Item : in Numeric; Format : in Display_Format) return Boolean; function Length (Format : in Display_Format) return Natural; function To_Decimal (Item : in Numeric; Format : in Display_Format) return Num; function To_Display (Item : in Num; Format : in Display_Format) return Numeric; -- Packed Formats: data values are represented as Packed_Decimal function Valid (Item : in Packed_Decimal; Format : in Packed_Format) return Boolean; function Length (Format : in Packed_Format) return Natural; function To_Decimal (Item : in Packed_Decimal; Format : in Packed_Format) return Num; function To_Packed (Item : in Num; Format : in Packed_Format) return Packed_Decimal; -- Binary Formats: external data values are represented as Byte_Array function Valid (Item : in Byte_Array; Format : in Binary_Format) return Boolean; function Length (Format : in Binary_Format) return Natural; function To_Decimal (Item : in Byte_Array; Format : in Binary_Format) return Num; function To_Binary (Item : in Num; Format : in Binary_Format) return Byte_Array; function To_Comp (Item : in Num; Format : in Binary_Format) return Byte_Array; -- Internal Binary formats: data values are of type Binary/Long_Binary function To_Decimal (Item : in Binary) return Num; function To_Decimal (Item : in Long_Binary) return Num; function To_Binary (Item : in Num) return Binary; function To_Long_Binary (Item : in Num) return Long_Binary; end Decimal_Conversions; private type Display_Format is (U, LS, TS, LN, TN); Unsigned : constant Display_Format := U; Leading_Separate : constant Display_Format := LS; Trailing_Separate : constant Display_Format := TS; Leading_Nonseparate : constant Display_Format := LN; Trailing_Nonseparate : constant Display_Format := TN; type Binary_Format is (H, L, N); High_Order_First : constant Binary_Format := H; Low_Order_First : constant Binary_Format := L; Native_Binary : constant Binary_Format := N; type Packed_Format is (U, S); Packed_Unsigned : constant Packed_Format := U; Packed_Signed : constant Packed_Format := S; end Interfaces.COBOL;
cpm2/RomWBW/Source/Apps/XM/xmdm125.asm
grancier/z180
0
97982
<filename>cpm2/RomWBW/Source/Apps/XM/xmdm125.asm<gh_stars>0 ; ; TITLE 'XMODEM ver. 12.5 - 07/13/86' ; ; XMDM125.ASM - REMOTE CP/M FILE TRANSFER PROGRAM ; ; Originally adapted from <NAME>en's MODEM2 ; by <NAME>, W8SDZ ; ; ASEG ;Needed by M80 assemblers, comment out if using MAC ; ; This program allows a remote user to transfer files (to or from) RCPM ; systems running under BYE (remote console program). It can be assem- ; bled with ASM, LASM, MAC, M80, SRLMAC and other 8080 assemblers. ; ; All comments and past revisions have been removed from this file and ; put into the XMODEM.UPD file. Place only the current revision at the ; beginning of this file and move the one that was here to XMODEM.UPD. ; ;======================================================================= ; ; v12.5 Fixed conditional assembly bug which caused date to ; 07/13/86 appear in log twice when MBBS and BYEBDOS were both set ; to YES. ; Fixed conditional assembly bug which did not allow MBFMSG ; to be set to YES while MBDESC was set to NO. ; Removed patch to log download before sending EOF because ; EOF would not be sent, leaving caller's program in file ; transfer mode, if LOGCALL routine exited with an error. ; This problem was noticed by <NAME>. ; Modified to abort any download which would result in a ; user exceeding his time limit when BYEBDOS is YES. ; Fixed bug which would cause caller to be logged off ; without updating log file if transmission errors caused ; his download to put him over time limit when BYEBDOS was ; YES and CLOCK and TIMEON in BYE were YES (call to TCHECK ; in BYE's extended BDOS call would hang up on caller). ; Revised comments for some equates to make them easier to ; understand. ; - <NAME> ; ;======================================================================== ; VERSION EQU 1 INTERM EQU 2 MODLEV EQU 5 VMONTH EQU 07 VDAY EQU 13 VYEAR EQU 86 ; NO EQU 0 YES EQU NOT NO ; ; Define ASCII characters used ; BS EQU 08H ; Backspace character ACK EQU 06H ; Acknowledge CAN EQU 18H ; CTL-X for cancel CR EQU 0DH ; Carriage return CRC EQU 'C' ; CRC request character EOF EQU 1AH ; End of file - ^Z EOT EQU 04H ; End of transmission LF EQU 0AH ; Line feed NAK EQU 15H ; Negative acknowledge RLEN EQU 128 ; Record length TAB EQU 09H ; Horizontal tab SOH EQU 01H ; Start of header for 128-byte blocks STX EQU 02H ; 'Start of header' for 1024 byte blocks ; ;======================================================================= ; ; Conditional equates - change to suit your system, then assemble ; MHZ EQU 10 ; Clock speed, use integer (2,4,5,8, etc.) SCL EQU 6600 ; WBW: Receive loop timeout scalar CPM3 EQU NO ; Yes, if operating in CP/M v3.0 environment STOPBIT EQU NO ; No, if using 1 stop bit, yes if using 2 BYEBDOS EQU NO ; Yes, if using BYE338-up, BYE501-up, or NUBYE ; with its I/O (CLOCK in BYE must be YES) ; No if using your own hardware overlay LUXMOD EQU NO ; Set to YES if LUXMODEM version desired rather ; than standard XMODEM with upload options. ; ;======================================================================= ; ; If OK2400 is YES, then it overrides the TAGLBR and MAXMIN restrictions ; if the current caller is operating at 2400 baud (or higher). ; OK2400 EQU NO ; Yes, no restrictions for 2400 bps callers ; MSPEED EQU 3CH ; Location of speed byte set by BYE prgm, must ; be set for OK2400 or BYEBDOS to work ; DSPFNAM EQU YES ; Set to YES if you wish XMODEM to display the ; file name being up or downloaded for user to ; see and verify system received name correctly. ; ; If ZCPR3 is YES, then NO filetypes of .NDR or .RCP will be received. ; This is for security if you need LDR.COM on A0: for cold starts or if ; LDR is in the defined path. (If you don't have LDR on-line or ; accessible, then this equate isn't necessary for ZCPR3 systems.) ; ZCPR3 EQU NO ; Yes, NO filetypes .NDR or .RCP received ; ;======================================================================= ; ; If ZCPR2 = yes, then the following will all be NO if wheel is set ; in local non-zero (0FFH) mode. SYSOP rules... ; ZCPR2 EQU NO ; Yes, if using ZCPR* with WHEEL byte ; WHEEL EQU 3EH ; Location of wheel byte (normally 3EH) NOCOMR EQU NO ; Yes, change .COM to .OBJ on receive NOCOMS EQU NO ; Yes, .COM files not sent NOLBS EQU NO ; Yes, .??# files not sent NOSYS EQU NO ; Yes, no $SYS files sent or reported ; ;======================================================================= ; ; The following are only used by NZCPR or ZCMD systems ; USEMAX EQU NO ; Yes, using NZCPR for maximum du: values ; No, use MAXDRV and MAXUSR specified next DRIVMAX EQU 03DH ; Location of MAXDRIV byte USRMAX EQU 03FH ; Location of MAXUSER byte ; ;======================================================================= ; ; Hard-coded system maximums allowed if USEMAX above is NO ; MAXDRV EQU 16 ; Number of disk drives used (1=A, 2=B, etc) MAXUSR EQU 16 ; Maximum 'SEND' user allowed ; ;======================================================================= ; ; File transfer buffer size - 16k is the same buffer length used in IMP, ; MDM7 and MEX so all those modem programs as well as XMODEM would be ; transferring from the buffer simultaneously, minimizing any delays. ; Slower floppy disk drives may require the use of a smaller buffer, try ; 8k, 4k, or 2k and use largest that does not result in a time-out at ; the sending end. Please note the requirement for the protocol to ac- ; cept any mixture of 1K and small blocks may result in effective buffer ; usage extending an additional 896 bytes (7*128) beyond the 'end' of ; the buffer defined here. (Actually, due to handshaking, the buffers ; are NOT loaded simultaneously, so the above statement is misleading, ; too large a buffer will slow things down if you have a slow disk ; drive.. Too small a buffer will really slow you down though, so ; stick with 16k...) ; BUFSIZ EQU 16 ; File transfer buffer size in Kbytes (16k) ; ;======================================================================= ; ; DESCRIB is used to ask the uploader to give a description of the file ; he just uploaded. If YES and ZCPR2 is YES and wheel is set, it does ; NOT ask for a description unless ASKSYS is set to YES. ; (If using on an MBBS v4.1 and up system, use MBDESC instead of ; this option.) (NDESC can be used with either DESCRIB or MBDESC.) ; DESCRIB EQU NO ; Yes asks for a description of uploaded file DRIVE EQU 'A' ; Drive area for description of upload USER EQU 14 ; User area for description of upload BSIZE EQU 32*1024 ; Set for 16k, 24k or 32k as desired for DESCRIB ; NDESC EQU NO ; If YES, user can add a "N" to option to skip ; description for pre-arranged uploads or ; for the sysop.. ASKSYS EQU NO ; If YES, and ZCPR2=YES, the system will ask ; the sysop for a description of the uploaded ; file ASKIND EQU NO ; IF YES, user is asked for the category of ; the uploaded file. This category is auto- ; matically added to the file description. ; ;======================================================================= ; ; XMODEM transfer log options ; LOGCAL EQU NO ; Yes, logs XMODEM transfers LOGDRV EQU 'A' ; Drive to place 'XMODEM.LOG' file LOGUSR EQU 14 ; User area to put 'XMODEM.LOG' file ; ; OxGate BBS puts the date after the caller's name. If you are using ; either BYEBDOS or B3RTC or RTC, and have an OxGate, then set this ; equate to YES, so the date doesn't appear twice. ; OXGATE EQU NO ; If yes, and B3RTC or RTC is yes, does not read ; date in OxGate's LASTCALR file. ; KNET EQU NO ; If yes, the log file is called XMODEM.TX# with ; $SYS attr set (for K-NET 84(tm) RCP/M Systems) ; LASTDRV EQU 'A' ; Drive to read 'LASTCALR' file from LASTUSR EQU 14 ; User area of 'LASTCALR' file, if 'LOGCAL' yes ; ;======================================================================= ; ; The receiving station sends an 'ACK' for each valid sector received. ; It sends a 'NAK' for each sector incorrectly received. In poor con- ; ditions either may be garbled. Waiting for a valid 'NAK' can slow ; things down somewhat, giving more time for the interference to quit. ; RETRY EQU NO ; Yes requires a valid NAK to resend a record ; No resends a record after any non-ACK ; ; Note that some modem programs will send a "C" instead of a NAK when ; operating in CRC mode. Therefore, RETRY EQU NO will allow XMODEM to ; work correctly with more programs. ; ;======================================================================= ; ; When sending in 1K block mode, XMODEM will downshift to 128 byte ; blocks when the ratio of successfully transmitted blocks to total ; errors falls below the ratio defined here. ; DWNSHFT EQU 5 ; must have at least this many good blocks for ; every error, or will downshift to size 128 ; MINKSP EQU 5 ; set this equate to the minimum MSPEED value ; allowed to use the 1k block protocol.. ; ; MSPEED values: 1=300, 5=1200, 6=2400 ; ;======================================================================= ; ; Allows uploading to be done on a specified driver and user area so all ; can readily find the latest entries. ; SETAREA EQU NO ; Yes, using designated du: to receive files ; No, upload to currently logged du: SPCDU EQU NO ; Yes, upload to designated du: if wheel set ; DRV EQU 'B' ; Drive to receive file on USR EQU 0 ; User area to receive file in ; ASKAREA EQU NO ; If YES, ask user what type of upload and ; set area accordingly. For Multiple ; Operating system support. ; SYSNEW EQU NO ; If YES, then new uploads are made $SYS ; to "hide" them from users until cleared... ; ;======================================================================= ; ; Selects the DU: for uploading private files with XMODEM RP option. ; PRDRV EQU 'A' ; Private drive for SYSOP to receive file PRUSR EQU 0 ; Private user area for SYSOP to receive file ; ;======================================================================= ; ; Selects the DU: for private download files. This permits Sysop ; to put file(s) in this area, then leave a private note to that ; person mentioning the name(s) of the file and its location. ; SPLDRV EQU 'A' ; Special drive area for downloading SYSOP files SPLUSR EQU 0 ; Special user area for downloading SYSOP files ; ;======================================================================= ; ; Selects the DU: used for message files uploaded with the "RM" option. ; (Used only if MBFMSG option enabled) ; MSGDRV EQU 'A' ; Drive used to receive message files MSGUSR EQU 15 ; User used to receive message files ; ;======================================================================= ; ; SYSOP may use NSWP or TAG and set the high bit of F1 to disallow the ; sending of large .LBR files. If TAGLBR is YES, only LUX or the option ; XMODEM L will allow transfer of individual member files from tagged ; .LBR files. The entire .LBR file can NOT be sent using XMODEM S NAME. ; TAGLBR EQU NO ; Yes tagged .LBR files not sent ; ; Note: The OK2400 equate if YES will bypass this restriction if the ; caller is operating at 2400 baud (or faster). ; ;======================================================================= ; ; Some modems will either go onhook immediately after carrier loss or ; can be set to lower values. A good value with the Smartmodem is five ; seconds, since it catches all "call forwarding" breaks. Not all is ; lost after timeout in XMODEM; BYE will still wait some more, but the ; chance of someone slipping in is less now. ; TIMOUT EQU 2 ; Seconds to abort after carrier loss ; ;======================================================================= ; ; Count the number of up/down loads since login. Your BBS program can ; check UPLDS and NDLDS when user logs out and update either the users ; file or another file for this purpose. ; LOGLDS EQU NO ; Count number of up/down loads since login. ; IF LOGLDS UPLDS EQU 054H ; Clear these values to Zero from your BBS pro- DNLDS EQU 055H ; gram when somebody logs in. NOTE: Clear ; ONLY when a user logs in. Not when he re- ; enters the BBS program for CP/M. ENDIF ; ;====================================================================== ; ; Maximum file transfer time allowed. ; ; NOTE: If ZCPR2 = YES and WHEEL byte is set, send time is unlimited. ; ; TIME 300 BPS 1200 BPS ; ------ ------- -------- ; 30 min 48.7k 180k ; 45 min 73.1k 270k ; 60 min 97.5k 360k ; MAXTIM EQU NO ; Yes if limiting transmission time ; MAXMIN EQU 60 ; Minutes for maximum file transfer time. ; this should be set to 60 if TIMEON is YES ; (99 minutes maximum.) (This is ignored if ; BYEBDOS is set.) ; ; Note: The OK2400 equate if YES will bypass MAXMIN limits. ; ;====================================================================== ; ; The following equates need to be set ONLY if you are NOT using the ; BYE-BDOS calls supported in BYE338 and newer. ; ; Length of external patch program. If over 128 bytes, get/set size ; LARGEIO EQU YES ; Yes, if modem patch area over 128 bytes LARSIZE EQU 500H ; If 'LARGEIO' set patch area size (bytes) here ; ;======================================================================= ; ; USECON allows XMODEM to display the record count on the local CRT ; during transfers. All new remote console programs support this ; feature. BYE3* and MBYE3* will tell XMODEM where to find the local ; console's output vector. ; USECON EQU NO ; Yes to get CONOUT address from BYE ; NO, get CONOUT address from the XMODEM overlay ; CONOFF EQU 15 ; Offset to COVECT where original console output ; routine address is stored in BYE3/MBYE ; versions immediately followed by BYE as a ; check to insure BYE is running. ; ;======================================================================= ; start of TIMEON area ; RTC EQU NO ; If YES, add clock and date reader code at ; start of GETTIME: and GETDATE: below ; ; The TIMEON and RTC equates should be NO if B3RTC is YES ; TIMEON EQU NO ; If YES and BYEBDOS is NO, add your clock reader ; code at the start of label GETTIME: and return ; time in registers A & B. Also set to YES if ; BYEBDOS is YES and you want XMODEM to check ; time on system (not necessary if TIMEON in BYE ; is YES - saves unnecessary code). TOSEXIT EQU NO ; If YES, time on system displayed on exit if ; B3RTC or TIMEON or BYEBDOS set to YES ; IF TIMEON AND NOT CPM3 LHOUR EQU 050H ; Set by BBS (or BYE) in binary when user logs LMIN EQU 051H ; on and his status STATUS EQU 053H ENDIF ; IF TIMEON AND CPM3 LHOUR EQU 022H ; Set by BBS (or BYE) in binary when user logs LMIN EQU 023H ; on and his status STATUS EQU 024H ENDIF ; ; end of TIMEON area ;======================================================================== ; Miscellaneous Support Bytes ;======================================================================== ; Set this equate to enable access byte support. ACBOFF specifies ; the offset from the JMP COLDBOOT instruction as above with WRTLOC. ; MBBS and some newer BBS's support this byte, therefore, it is no ; longer specific to MBBS. You must determine if your system uses this. ; ACCESS EQU NO ; Yes, check flags for upload/dwnld restrictions ACBOFF EQU 21 ; # of bytes from JMP COLDBOOT to ACCESS byte. ACWRIT EQU 8 ; Bit to test for BBS msg write OK (1=OK,0=NOT OK) ACDNLD EQU 32 ; Bit to test for downloads OK (1=OK,0=NOT OK) ACUPLD EQU 64 ; Bit to test for uploads OK (1=OK,0=NOT OK) DWNTAG EQU NO ; If YES, files with F3 attribute bit can be ; downloaded regardless of access byte restrictions ; ; Access byte flag bit assignments ; ; Bit ; Used for ; 0 ; System access (no admittance if off) ; 1 ; BBS access (if off, dumped to CP/M) ; 2 ; Read access (if off, no "R" command allowed) ; 3 ; Write access (if off, no "E" command allowed) ; 4 ; CP/M access (if off, no admittance to CP/M) ; 5 ; Download access (if off, no downloads permitted) ; 6 ; Upload access (if off, no uploads permitted) ; 7 ; Privileged user (if on, user is "privileged") ; ; Of these bits, only 5 and 6 are used by XMODEM. Bit numbers are ; powers of 2, bit 0 being least significant bit of byte. ;------------------------------------------------------------------------- ; The CONFUN and WRTLOC are supported by BYE339 and many BBS's require ; the WRTLOC for propoer operation. These functions are not specific to ; MBBS and therefore have been made independant of the MBBS equate. ; ; (Set CONFUN/WRTLOC YES if using with MBBS) ; CONFUN EQU YES ; Yes, check local console for function keys SYSABT EQU YES ; If yes, sysop can abort up/downloads with ^X ; (CONFUN must be enabled to use this option) ; ; If you set CONFUN true, a call to the console status check routine in ; the BIOS will be done during waiting periods and when sector counts ; are displayed on the local console in order to allow MBYE and BYE339 ; function keys to work. This is for MBYE. Other versions of BYE3 ; may or may not check for console function keys during the console ; status check "MSTAT" routine. ; WRTLOC EQU YES ; Yes, set/reset WRTLOC so BYE won't hang up LOCOFF EQU 12 ; # of bytes from JMP COLDBOOT to WRTLOC byte ; ; NOTE: Code to set/reset WRTLOC assumes WRTLOC byte to be ; located "LOCOFF" bytes from the JMP COLDBOOT instruction at ; the beginning of the BYE3 BIOS jump table. On BYE3 versions ; and MBYE versions, this offset is usually 12. Note: ; TIMEON and RTC should be set to no if B3RTC is on. ; (If BYEBDOS is enabled, the appropriate extended BDOS ; calls are used to set and reset the WRTLOC if this ; equate is set and LOCOFF is ignored in these cases.) ; ; End of Miscellaneous Support Bytes ;======================================================================= ; start of MBBS/MBYE specific information ; B3RTC EQU NO ; If YES, your clock is setup in BYE3 (or MBYE) ; set to NO if using BYEBDOS B3COFF EQU 25 ; OFFSET from COLDBOOT: to RTCBUF address B3CMOS EQU 7 ; OFFSET from RTCBUF: to mins on system ; MBMXT EQU NO ; If YES, running MBYE with max. time on system MBMXO EQU 24 ; OFFSET from COLDBOOT: to MXML address ; ; If B3RTC is YES and LOGCAL is YES, the log file will show ; the date and time of all up/downloads. Note: Set RTC, TIMEON, ; and BYEBDOS to NO if using B3RTC or MBMXT. ; ; Note: Some of these equates may not be valid if you are using MBYE* ; with another BBS program - check them carefully. ; MBBS EQU NO ; Yes if running MBBS v2.9 up LOGSYS EQU NO ; Set YES if running MBBS v3.1 or earlier MBDESC EQU NO ; Yes if running MBBS v4.0 up for upload desc. NEWPRV EQU NO ; Yes: all new uploads are private initially MBFMSG EQU NO ; Yes if running MBYE v4.1 up with MFMSG ; ; ;---------------------------------------------------------------------- ; ; If B3RTC is YES download time may be limited using the following ; equates instead of using MAXMIN. MAXMIN will be the default value ; if BYE is not running. ; B3TOS EQU NO ; Yes if using BYE3/MBYE and want to show time on sys ; MTOS EQU NO ; Yes if using maximum time on system instead ; of MAXMIN to limit transmission time ; IF MTOS AND MBMXT ; both must be YES MXTOS EQU YES ; (leave YES) ENDIF ; IF NOT (MTOS AND MBMXT) ; (if either is NO) MXTOS EQU NO ; (leave NO) ENDIF ; MXTL EQU NO ; Yes if limiting transmission time to time ; left plus MAXMIN. MXTOS must be yes. ; IF MXTL AND MXTOS ; both must be YES MTL EQU YES ; (leave YES) ENDIF ; IF NOT (MXTL AND MXTOS); (if either are NO) MTL EQU NO ; (leave NO) ENDIF ; ; end of MBBS/MBYE specific information ;======================================================================= ; ORG 100H JMP BEGIN ; ;----------------------------------------------------------------------- ; ; This is the I/O patch area. Assemble the appropriate I/O patch file ; for your modem, then integrate it into this program via DDT (or SID). ; Initially, all jumps are to zero, which will cause an unpatched XMODEM ; to simply execute a warm boot. All routines must end with RET. ; IF NOT BYEBDOS ; Universal I/O CONOUT: JMP 0 ; See 'CONOUT' discussion above MINIT: JMP 0 ; Initialization routine (if needed) UNINIT: JMP 0 ; Undo whatever MINIT did (or return) SENDR: JMP 0 ; Send character (via POP PSW) CAROK: JMP 0 ; Test for carrier MDIN: JMP 0 ; Receive data byte GETCHR: JMP 0 ; Get character from modem RCVRDY: JMP 0 ; Check receive ready (A - ERRCDE) SNDRDY: JMP 0 ; Check send ready SPEED: JMP 0 ; Get speed value for transfer time EXTRA1: JMP 0 ; Extra for custom routine EXTRA2: JMP 0 ; Extra for custom routine EXTRA3: JMP 0 ; Extra for custom routine ENDIF ; ;----------------------------------------------------------------------- ; IF NOT (LARGEIO OR BYEBDOS) ORG 100H+80H ; Origin plus 128 bytes for patches ENDIF ; IF LARGEIO AND NOT BYEBDOS ORG 100H+LARSIZE ; I/O patch area size if over 128 bytes ENDIF ; ; PRIVATE/SETAREA UPLOAD DISK/USER AREAS: ; ; (Here at start (usually 180H unless LARGEIO) so can be easily patched ; in .COM file using DDT without needing to reassemble. All references ; are made to these locations in memory and not to DRV/PRDRV/USR/PRUSR ; equates directly.) ; XPRDRV: DB PRDRV ; Private uploads go to this disk/user XPRUSR: DB PRUSR ; XDRV: DB DRV ; Forced uploads (if SETAREA EQU YES) XUSR: DB USR ; Go to this disk/user ; IF MBFMSG XMDRV: DB MSGDRV ; Message uploads go to this disk/user XMUSR: DB MSGUSR ; (if MBFMSG option enabled) ENDIF ; ;----------------------------------------------------------------------- ; ; File descriptors, change as desired if this list is not suitable. ; Move the line with the terminating '$' up, if fewer descriptors are ; desired. ; IF ASKIND AND DESCRIB ; KIND0: DB ' 0) - CP/M',CR,LF KIND1: DB ' 1) - ZCPR',CR,LF KIND2: DB ' 2) - MS-DOS/PC-DOS',CR,LF KIND3: DB ' 3) - dBASE',CR,LF KIND4: DB ' 4) - Basic',CR,LF KIND5: DB ' 5) - General',CR,LF KIND6: DB ' 6) - Modems',CR,LF KIND7: DB ' 7) - Games',CR,LF KIND8: DB ' 8) - Xerox/KPro',CR,LF KIND9: DB ' 9) - RCP/M',CR,LF DB '$' ENDIF ;..... ; ;---------------------------------------------------------------------- ; ; If ASKAREA and SETAREA are set, then set these areas up and modify ; the message text in the FILTYP: function below if you desire a ; different choice. (As released in XMDM121, 1 = CP/M, 2 = MS/PC-DOS ; and 3 = General Interest.) ; IF ASKAREA AND SETAREA ; MAXTYP EQU '3' ; Set maximum type choice # here ; TYPTBL: DB 'B',0 ; CHOICE 1 (CP/M NORMAL) DB 'B',9 ; CHOICE 1 (CP/M PRIVATE) DB 'B',3 ; CHOICE 2 (MS/PC-DOS NORMAL) DB 'B',9 ; CHOICE 2 (MS/PC-DOS PRIVATE) DB 'B',0 ; CHOICE 3 (General interest NORMAL) DB 'B',9 ; CHOICE 3 (General interest PRIVATE) ; ENDIF ; ;======================================================================= ; ; PROGRAM STARTS HERE ; ;======================================================================= ; ; Save CP/M stack, initialize new one for this program ; BEGIN: LXI H,0 DAD SP SHLD STACK LXI SP,STACK ; Initialize new stack ; IF BYEBDOS CALL BYECHK JZ BYEOK CALL ILPRT DB 'You need to be running BYEBDOS',CR,LF,0 JMP EXIT2 ; Get stack pointer back and return ; BYEOK: MVI C,BDSTOS ; Get current maximum time on system MVI E,255 CALL BDOS STA MAXTOS ENDIF ; IF B3RTC AND MXTOS AND (NOT BYEBDOS) CALL BYECHK ; If BYE not active MVI A,MAXMIN ; (we'll use MAXMIN as default) JNZ EXTMXT ; Skip MXML update LHLD 0001H ; Get JMP COLDBOOT DCX H MOV D,M DCX H MOV E,M LXI H,MBMXO ; + MBMXO offset to MXML DAD D MOV A,M ; = max time allowed on system ; EXTMXT: STA MAXTOS ; Store max download time ENDIF ; ; Get address of RTCBUF in BYE3 or MBYE ; IF B3RTC AND (NOT BYEBDOS) CALL BYECHK ; See if BYE3/MBYE is running JNZ NOBYE0 ; If not, skip this junk LHLD 0001H ; Get COLDBOOT addr DCX H ; (just before JMP WBOOT) MOV D,M ; And stuff in DE DCX H MOV E,M LXI H,B3COFF ; Add offset to RTCBUF address DAD D ; (in HL) MOV E,M ; Get RTCBUF address INX H ; And MOV D,M ; Stuff in DE XCHG ; Swap into HL SHLD RTCBUF ; Save for use later ENDIF ; NOBYE0: IF CONFUN ; Console status checks to be done? LHLD 0001H ; If so get addr of warmboot (jmp table) INX H INX H INX H ; + 3 = address of console status check SHLD CONCHK+1 ; Stuff after call for FUNCHK ENDIF ; IF WRTLOC ; Set WRITE LOCK? CALL SETLCK ENDIF ; ; Save the current drive and user area ; NOBYE1: MVI E,0FFH ; Get the current user area MVI C,SETUSR CALL BDOS STA OLDUSR ; Save user number here MVI C,CURDRV ; Get the current drive CALL BDOS STA OLDDRV ; Save drive here ; IF B3TOS OR TIMEON CALL TIME ; Get user's time status ENDIF ; IF BYEBDOS AND (NOT TIMEON) MVI C,BDPTOS ; Display time on system and CALL BDOS ; log off if over time limit ENDIF ; CALL ILPRT DB CR,LF ; IF LUXMOD DB 'LUX-' ENDIF ; DB 'XMODEM v' DB VERSION+'0',INTERM+'0','.',MODLEV+'0',' - ' DB VMONTH/10+'0',VMONTH MOD 10+'0','/' DB VDAY/10+'0',VDAY MOD 10+'0','/' DB VYEAR/10+'0',VYEAR MOD 10+'0',CR,LF,0 ; ; Stuff address of BIOS CONOUT vector in our routine as default. ; IF USECON AND NOT BYEBDOS LHLD 0001H ; Point to warm boot for normal BIOS LXI D,9 DAD D ; Calc addr of normal BIOS conout vector SHLD CONOUT+1 ; Save in case no BYE program is active CALL BYECHK JNZ NOBYE XCHG ; Point to the console output routine SHLD CONOUT+1 ; Save vector address supplied by BYE ENDIF ; ; Get option ; NOBYE: LXI H,FCB+1 ; Get primary option MOV A,M STA OPTSAV ; Save option CPI 'R' ; Receive file? JZ RECVOPT ; ; Send option processor ; Single option: "K" - force 1k mode ; INX H ; Look for a 'K' MOV A,M CPI ' ' ; Is it a space? JZ ALLSET ; Then we're ready to send... CPI 'K' JNZ OPTERR ; "K" is the only setable 2nd option LDA MSPEED CPI MINKSP ; If less than MINKSP bps, ignore 1k JC ALLSET ; Request MVI A,'K' ; Set 1k mode STA KFLAG ; First, force us to 1K mode CALL ILPRT DB '(1k protocol selected)',CR,LF,0 JMP ALLSET ; That's it for send... ; ; Receive option processor ; 3 or 4 options: "X" - disable auto-protocol select ; "P" - receive file in private area ; "C" - force checksum protocol ; "M" - message file upload (if MBFMSG) ; RECVOPT:MVI A,'K' ; First off, default to 1K mode STA KFLAG MVI A,0 ; And default to CRC mode STA CRCFLG ; CALL RCVOPC ; Check 1st option CALL RCVOPC ; Check 2nd option CALL RCVOPC ; Check 3rd option ; IF MBFMSG CALL RCVOPC ; Check 4th option ENDIF ; IF NDESC CALL RCVOPC ; Check 4th (or 5th) option ENDIF ; JMP OPTERR ; If 5th or 6th option, whoops! ; RCVOPC: INX H ; Increment pointer to next character MOV A,M ; Get option character HL points to CPI ' ' ; Space? JNZ CHK1ST ; No, we have an option POP PSW ; Else, we are done (restore stack) JMP ALLSET ; Exit routine now ; CHK1ST: CPI 'P' ; Got a "P" option? JNZ CHK2ND ; Nope STA PRVTFL ; Yep, set private upload flag RET ; Check next option ; CHK2ND: CPI 'C' ; Got a "C" option? JNZ CHK3RD ; Nope STA CRCFLG ; Set checksum flag (crc flag="C") CALL ILPRT DB '(Checksum protocol selected)',CR,LF,0 RET ; CHK3RD: CPI 'X' ; Got an "X" for first option? JNZ CHK4TH MVI A,0 STA KFLAG ; Disable "1K" flag CALL ILPRT DB '(128 byte protocol only)',CR,LF,0 RET ; CHK4TH: IF MBFMSG ; Allowing "RM" for message uploads? CPI 'M' ; Got an "M" for message upload? JNZ CHK5TH ; If not, bad option STA MSGFLG ; If "M", set MSGFLG MVI A,'P' ; Also, set PRVTFL STA PRVTFL LDA XMDRV ; And copy XMDRV STA XPRDRV LDA XMUSR ; And XMUSR to XPRDRV / XPRUSR STA XPRUSR RET ENDIF ; CHK5TH: IF NDESC ; Allowing "RN" to skip upload descript? CPI 'N' ; Got an 'N'? JNZ BADROP ; If nope, is NG.. STA NDSCFL ; else set flag to skip descript phase RET ENDIF ; BADROP: POP PSW ; Restore stack JMP OPTERR ; is bad option ; ; All options have been set, gobble up garbage characters from the line ; prior to receive or send and initialize whatever has to be initialized ; ALLSET: CALL GETCHR CALL GETCHR CALL MINIT STA CPUMHZ ; WBW: Save CPU speed from MINIT SHLD RCVSCL ; WBW: Save rcv loop scalar from MINIT ; ; Jump to appropriate function ; LDA OPTSAV ; Get primary option again ; IF LOGCAL STA LOGOPT ; But save it ENDIF ; CPI 'L' ; To send a file from a library? JZ SENDFIL CPI 'R' ; To receive a file? JZ RCVFIL CPI 'S' JZ SENDFIL ; Otherwise go send a file ; ; Invalid option ; OPTERR: ; IF ASKAREA AND SETAREA LDA OPTSAV ; Check 'option' CPI 'A' ; If 'A' (avail upload space option) CZ FILTYP ; ask type of upload... ENDIF ; IF NOT (SETAREA OR LUXMOD) CALL ILPRT DB CR,LF,'Uploads files to specified or ' DB 'current disk/user',0 ENDIF ; IF SETAREA AND NOT LUXMOD CALL ILPRT DB CR,LF,'Uploads files to ',0 LDA XDRV CALL CTYPE LDA XUSR MVI H,0 MOV L,A CALL DECOUT MVI A,':' CALL CTYPE CALL ILPRT DB ' (',0 LDA XDRV STA KDRV CALL KSHOW MVI A,')' CALL CTYPE ENDIF ; IF NOT LUXMOD CALL ILPRT DB CR,LF,'Private files to ',0 LDA XPRDRV CALL CTYPE LDA XPRUSR MVI H,0 MOV L,A CALL DECOUT MVI A,':' CALL CTYPE LDA XPRDRV ; If private drive is MOV B,A LDA XDRV ; The same as forced upload drive SUB B JZ SKSK2 ; Skip showing space available 2nd time CALL ILPRT DB ' (',0 LDA XPRDRV ; Else show it.. STA KDRV CALL KSHOW MVI A,')' CALL CTYPE ; SKSK2: CALL ILPRT DB CR,LF,0 ENDIF ; LDA OPTSAV ; Check 'option' CPI 'A' ; If 'A' (avail upload space option) JZ EXIT ; Skip error message ; IF WRTLOC AND NOT BYEBDOS CALL RSTLCK ENDIF ; CALL ERXIT ; Exit with error DB '++ Examples of valid options: ++ ' DB '(use Ctrl-C or Ctrl-K to abort)',CR,LF,LF ; IF NOT LUXMOD DB 'XMODEM S HELLO.DOC send a file to you',CR,LF DB 'XMODEM S B1:HELLO.DOC send from a named ' DB 'drive/area',CR,LF DB 'XMODEM SK HELLO.DOC send in 1k blocks',CR,LF DB 'XMODEM L CAT.LBR CAT.COM send a file from a library' DB CR,LF DB 'XMODEM LK CAT.LBR CAT.COM send in 1k blocks',CR,LF DB ' The ".LBR" file extension may be omitted',CR,LF,LF DB 'XMODEM R HELLO.DOC receive a file from you' DB CR,LF DB 'XMODEM RP HELLO.DOC receive in a private area' DB CR,LF ENDIF ; IF (MBDESC OR DESCRIB) AND NDESC DB 'XMODEM RN FILE.EXT receive without description' DB CR,LF ENDIF ; IF (NOT LUXMOD) AND MBFMSG DB 'XMODEM RM MESSAGE.FIL receive message for MBBS' DB CR,LF ENDIF ; IF NOT LUXMOD DB ' Add "C" for forced checksum ("RC" "RPC")',CR,LF DB ' Add "X" for forced 128 byte protocol ("RX" "RPX")' DB CR,LF DB ' "R" switches from CRC to checksum after 5 retries' DB CR,LF,LF DB 'XMODEM A shows areas/space for ' DB 'uploads$' ENDIF ; IF LUXMOD DB 'SEND MEMBERNAME.TYP sends member with CRC' DB CR,LF DB 'SENDK MEMBERNAME.TYP sends using 1k packets' DB CR,LF,LF DB 'XMODEM S MEMBERNAME.TYP same as SEND command' DB CR,LF DB 'XMODEM SK MEMBERNAME.TYP same as SENDK',CR,LF,LF DB '(XMODEM can NOT receive while in LUX.)$' ENDIF ; ; ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; ; ---> SENDFIL sends a CP/M file ; ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; ; The CP/M file specified in the XMODEM command is transferred over the ; phone to another computer running modem with the "R" (receive) option. ; The data is sent one record at a time with headers and checksums, and ; retransmission on errors. ; SENDFIL:CALL LOGDU ; Check file name or drive/user option LDA OPTSAV CPI 'L' ; If library option skip 'CNREC' CNZ CNREC ; Ignore if in library mode CALL OPENFIL ; Open the file MVI E,100 ; Wait 100 sec for initial 'NAK' CALL WAITNAK LHLD RCNT ; XMDM116.FIX CALL CKKSIZ ; XMDM116.FIX -- <NAME> ; SENDLP: CALL CHKERR ; Check ratio of blocks to errors CALL RDRECD ; Read a record JC SENDEOF ; Send 'EOF' if done CALL INCRRNO ; Bump record number XRA A ; Initialize error count to zero STA ERRCT ; SENDRPT:CALL SENDHDR ; Send a header CALL SENDREC ; Send data record LDA CRCFLG ; Get 'CRC' flag ORA A ; 'CRC' in effect? CZ SENDCRC ; Yes, send 'CRC' CNZ SENDCKS ; No, send checksum CALL GETACK ; Get the 'ACK' JC SENDRPT ; Repeat if no 'ACK' CALL UPDPTR ; Update buffer pointers and counters LDA OPTSAV ; Get the command option again CPI 'L' JNZ SENDLP ; If not library option, go ahead ; ; ; Check to see if done sending LBR member yet, downshift to small blocks ; if less that 8 remaining ; LHLD RCNT MOV A,H ORA L ; See if L and H both zero now JZ SENDEOF ; If finished, exit LDA KFLAG ; Was last record a 1024 byte one? ORA A JZ SNRPT0 ; Just handled an normal 128 byte record DCX H ; Otherwise, must have be a BIG one, so DCX H ; Seven ... DCX H DCX H DCX H DCX H DCX H ; Plus ; SNRPT0: DCX H ; One, is either 1 or 8 SHLD RCNT ; One (or eight) less to go CALL CKKSIZ ; Check to see if at least 8 left JMP SENDLP ; Loop until EOF ; ; File sent, send EOT's ; SENDEOF: IF LOGLDS LDA DNLDS ; Get Down loads Counter INR A ; One more download since log in STA DNLDS ; And update counter ENDIF ; SNDEOFL:LDA EOFCTR ; Get EOF counter CPI 5 ; Tried five times ? JZ EXITLG ; Yes, quit trying MVI A,EOT ; Send an 'EOT' CALL SEND LDA EOFCTR ; Get EOF counter INR A ; Add one STA EOFCTR ; Save new count CALL GETACK ; Get the ACK JC SNDEOFL ; Loop if no ACK JMP EXITLG ; All done ;..... ; ; ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; ; ---> RCVFIL Receive a CP/M file ; ;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ; ; Receives a file in block format as sent by another person doing ; "XMODEM S FILENAME.TYP". Can be invoked by "XMODEM R FILENAME.TYPE" ; or by "XMODEM RC FILENAME.TYP" if checksum is to be used. ; RCVFIL: IF ACCESS CALL BYECHK JNZ RCVFL1 LHLD 0001H ; Get JMP COLDBOOT DCX H MOV D,M DCX H MOV E,M LXI H,ACBOFF ; + ACBOFF DAD D MOV A,M ; = ACCESS byte address ANI ACUPLD ; Test upload access bit JNZ RCVFL0 ; If bit on, uploads OK CALL ERXIT DB 'Sorry, but you are not allowed to upload files ' DB 'at this time...$' ENDIF ; RCVFL0: IF ACCESS AND MBFMSG LDA MSGFLG ORA A ; Is this "RM" upload? JZ RCVFL1 ; If not, skip ACWRIT check MOV A,M ANI ACWRIT ; If "RM", check if WRITE access JNZ RCVFL1 ; If so, ok CALL ERXIT DB 'Sorry, but you are not allowed to enter messages ' DB 'at this time...$' ENDIF ; RCVFL1: CALL LOGDU ; Check file name or drive/user option ; IF ZCPR2 LDA WHEEL ; Let SYSOP put file wherever he wants ORA A JZ RCVFL5 ; If WHEEL byte not set, stay normal LDA RCVDRV ORA A ENDIF ; ; IF ZCPR2 AND NOT SPCDU JZ RCVFL2 ENDIF ; IF ZCPR2 AND SPCDU JZ RCVFL2 ENDIF ; IF ZCPR2 SUI 'A' ; Convert ASCII drive to binary JMP RCVFL3 ; RCVFL2: LDA OLDDRV ; RCVFL3: INR A STA FCB ADI 'A'-1 ; Convert binary to ASCII STA XDRV ; Drive LDA RCVDRV ; See if a drive was requested ORA A LDA OLDUSR ; Current user JZ RCVFL4 ; If not, use current user LDA RCVUSR ; Else get requested user ; RCVFL4: STA XUSR ; User JMP CONTIN ENDIF ; ZCPR2 ; RCVFL5: IF SETAREA LDA XDRV SUI 40H STA FCB ENDIF ; LDA PRVTFL ; Receiving to a private area? ORA A JZ RCVFL6 ; If not, exit LDA XPRDRV ; Private area takes precedence SUI 40H STA FCB ; Store drive to be used ; RCVFL6: IF NOCOMR LXI H,FCB+9 ; Point to filetype MVI A,'C' ; 1st letter CMP M ; Is it C ? JNZ RCVFL7 ; If not, continue normally INX H ; Get 2nd letter MVI A,'O' ; 2nd letter CMP M ; Is it O ? JNZ RCVFL7 ; If not, continue normally INX H ; Get 3rd letter MVI A,'M' ; 3rd letter CMP M ; Is it M ? JNZ RCVFL7 ; If not, continue normally CALL ILPRT ; Print renaming message DB 'Auto-renaming file to ".OBJ"',CR,LF,0 LXI H,FCB+9 MVI M,'O' INX H MVI M,'B' INX H MVI M,'J' JMP CONTIN ENDIF ; NOCOMR ; RCVFL7: IF NOCOMR AND CPM3 LXI H,FCB+9 ; Point to filetype MVI A,'P' ; 1st letter CMP M ; Is it P ? JNZ RCVFL8 ; If not, continue normally INX H ; Get 2nd letter MVI A,'R' ; 2nd letter CMP M ; Is it R ? JNZ RCVFL8 ; If not, continue normally INX H ; Get 3rd letter MVI A,'L' ; 3rd letter CMP M ; Is it L ? JNZ RCVFL8 ; If not, continue normally CALL ILPRT ; Print renaming message DB 'Auto-renaming file to ".OBP"',CR,LF,0 LXI H,FCB+9 MVI M,'O' INX H MVI M,'B' INX H MVI M,'P' JMP CONTIN ENDIF ; NOCOMR AND CPM3 ; ; Check to see if filetype is .NDR, if so do NOT allow upload ; RCVFL8: IF ZCPR3 LXI H,FCB+9 ; Point to filetype MVI A,'N' ; 1st letter CMP M ; Is it N ? JNZ RCVFL9 ; If not, continue normally INX H ; Get 2nd letter MVI A,'D' ; 2nd letter CMP M ; Is it D ? JNZ RCVFL9 ; If not, continue normally INX H ; Get 3rd letter MVI A,'R' ; 3rd letter CMP M ; Is it R ? JNZ RCVFL9 ; If not, continue normally CALL ERXIT ; Print renaming message DB 'Cannot receive filetype ".NDR"',CR,LF,'$' ; ; Check to see if filetype is .RCP, if so do NOT allow upload ; RCVFL9: LXI H,FCB+9 ; Point to filetype MVI A,'R' ; 1st letter CMP M ; Is it R ? JNZ CONTIN ; If not, continue normally INX H ; Get 2nd letter MVI A,'C' ; 2nd letter CMP M ; Is it C ? JNZ CONTIN ; If not, continue normally INX H ; Get 3rd letter MVI A,'P' ; 3rd letter CMP M ; Is it P ? JNZ CONTIN ; If not, continue normally CALL ERXIT ; Abort with error msg DB 'Cannot receive filetype ".RCP"',CR,LF,'$' ENDIF ; ZCPR3 ; CONTIN: IF MBFMSG LDA MSGFLG ORA A ; Is this "RM" upload? JNZ DONT ; If yes, skip asking what kind of upload ENDIF ; IF ASKAREA AND SETAREA AND (NOT ZCPR2) CALL FILTYP ; Ask caller what kinda beast it is ENDIF ; IF ASKAREA AND SETAREA AND ZCPR2 LDA WHEEL ; Don't ask the SYSOP ORA A JNZ DONT ; If WHEEL byte set, skip asking CALL FILTYP ; Ask caller what kinda beast it is ENDIF ; DONT: CALL ILPRT ; Print the message ; IF NOT DSPFNAM DB CR,LF,'File will be received on ',0 ENDIF ; IF DSPFNAM DB CR,LF,'Receiving: ',0 ENDIF ; LDA PRVTFL ; Going to store in the private area? ORA A JZ CONT1 ; If not, exit ; LDA XPRDRV ; Get private drive JMP CONT2 ; If yes, it takes priority ; CONT1: IF SETAREA LDA XDRV ; Setarea uses a specified drive ENDIF ; IF NOT SETAREA LDA OLDDRV ; Otherwise get current drive ADI 'A' ; Convert to ASCII ; NOTDRV: DB 0,0 ; Filled in by 'GETDU' if requested ENDIF ; CONT2: STA KDRV ; Save drive for KSHOW SUI 40H ; Convert ASCII to binary STA FCB ; Stuff in FCB LDA KDRV ; Get ASCII version back again CALL CTYPE ; Print the drive to store on LDA PRVTFL ; Going to store in the private area? ORA A JZ NOPRVL ; If nope, skip ahead ; IF LOGCAL MVI A,'P' ; If private upload STA LOGOPT ; Show "P" as option ENDIF ; LDA XPRUSR ; Get private user area JMP CONT3 ; It takes priority ; NOPRVL: IF SETAREA LDA XUSR ; Setarea takes next precedence ENDIF ; IF NOT SETAREA LDA OLDUSR ; Get current drive for default ; NOTUSR: DB 0,0 ; Filled in by 'GETDU' if requested ENDIF ; CONT3: MVI H,0 MOV L,A CALL DECOUT ; Print the user area ; IF NOT DSPFNAM CALL ILPRT DB ':',CR,LF,0 ENDIF ; IF DSPFNAM MVI A,':' CALL CTYPE ; We showed disk/user: LXI H,FCB+1 ; Now display filename CALL DSPFN CALL ILPRT DB CR,LF,0 ENDIF ; CALL KSHOW ; Show available space remaining CALL ILPRT DB CR,LF,0 CALL CHEKFIL ; See if file exists CALL MAKEFIL ; If not, start a new file CALL ILPRT DB 'File open - ready to receive',CR,LF DB 'To cancel: Ctrl-X, pause, Ctrl-X',CR,LF,0 ; IF B3RTC AND (NOT MBMXT OR BYEBDOS) CALL GETTOS ; Get time on system SHLD TOSSAV ; Save it for exit ENDIF ; RCVLP: CALL RCVRECD ; Get a record JC RCVEOT ; Got 'EOT' CALL WRRECD ; Write the record CALL INCRRNO ; Bump record number CALL SENDACK ; Ack the record JMP RCVLP ; Loop until 'EOF' ; ; ; Got EOT on record so flush buffers then done ; RCVEOT: LHLD RECDNO ; Check for zero length file MOV A,H ; If no records, no file ORA L JNZ EOT1 ; If not zero, continue, else abort CALL RCVSABT ; Abort and erase the zero length file JMP EXIT ; And exit ; EOT1: CALL WRBLOCK ; Write the last block CALL SENDACK ; Ack the record CALL CLOSFIL ; Close the file XRA A ; Clear CTYPE's console STA CONONL ; Output only flag ; IF LOGLDS LDA UPLDS ; Get Upload Counter INR A ; One more upload since log in STA UPLDS ; Update Counter ENDIF ; ; Logging upload or crediting time on? ; IF LOGCAL LHLD VRECNO ; If yes, get virtual # of recs SHLD RCNT ; And stuff in RCNT CALL FILTIM ; Calculate appox. xfer time ENDIF ; IF B3RTC AND MBMXT AND (NOT BYEBDOS) CALL BYECHK ; If BYE not active JNZ EXITLG ; Skip MXML update LHLD 0001H ; Get JMP COLDBOOT DCX H MOV D,M DCX H MOV E,M LXI H,MBMXO ; + MBMXO offset to MXML DAD D MOV A,M ; = max time allowed on system ORA A ; Check it (zero?) JZ EXITLG ; If unlimited time, skip update INR A ; Else, increment it (for secs) ADD C ; Add mins LSB (can't be >255) JC MAK255 ; If overflow, make it max (255) JZ MAK255 ; (if zero, make 255) MOV M,A ; Update it (credit them for upload) JMP EXITLM ; MAK255: MVI A,255 ; If up to max, make sure they don't MOV M,A ; Get LESS than what they had.. ENDIF ; IF B3RTC AND NOT (BYEBDOS OR MBMXT) CALL BYECHK JNZ EXITLG ; SKIP this if BYE not running LHLD RTCBUF ; Get address of RTCBUF in HL LXI D,B3CMOS ; Add offset to mins on system DAD D ; (addr in HL) LDA TOSSAV ;Get saved time on system MOV M,A ; And restore it INX H ; (don't count upload time LDA TOSSAV+1 ; Against them) MOV M,A ENDIF ; IF BYEBDOS AND (NOT B3RTC) LDA MAXTOS ; Get maximum time allowed ORA A JZ EXITLG ; If zero, he's a super-guy anyway INR A ADD C ; Add in upload time JC MAK254 ; Make it 254 minutes if overflow JZ MAK254 ; (or zero) CPI 255 ; (or 255) JNZ MAXSTR ; MAK254: MVI A,254 ; (254 is max allowed) ; MAXSTR: STA MAXTOS ; Save for internal use MOV E,A MVI C,BDSTOS ; Set maximum time on system CALL BDOS ENDIF ; EXITLM: IF BYEBDOS OR (B3RTC AND MBMXT) CALL ILPRT DB CR,LF,'Upload time credited towards maximum timeon.' DB CR,LF,0 ENDIF ; JMP EXITLG ; ;----------------------------------------------------------------------- ; ; SUBROUTINES ; ;----------------------------------------------------------------------- ; ; FILTYP: Ask file type for uploads ; IF ASKAREA AND SETAREA ; ; Routine to get file type for uploads (modified from XMDM10XX.ASM ; by <NAME> (Dallas Connection)). (Modify MAXTYP and TYPTBL ; near the top of the program.) ; FILTYR: CALL ILPRT DB CR,LF,0 ; FILTYP: CALL ILPRT ; Modify message as needed DB CR,LF,'Is file for:',CR,LF,CR,LF DB ' (1) CP/M',CR,LF DB ' (2) MS/PC-DOS',CR,LF DB 'or (3) General interest?',CR,LF,CR,LF DB 'Enter choice (1, 2 or 3): ',0 ENDIF ;ASKAREA AND SETAREA ; IF ASKAREA AND SETAREA AND WRTLOC CALL RSTLCK ;Turn off WRTLOC so RDCON will work ENDIF ; IF ASKAREA AND SETAREA MVI C,RDCON CALL BDOS CPI '1' ;is it a cpm file JC FILTYR ;nope, ask again use default upload area(s) CPI MAXTYP+1 JNC FILTYR SUI '1' ;GET OFFSET FOR TYPTBL RAL RAL MVI D,0 MOV E,A LXI H,TYPTBL DAD D MOV A,M STA XDRV ;set drive INX H MOV A,M ;user STA XUSR INX H MOV A,M ;private drive STA XPRDRV INX H MOV A,M ;and private user values STA XPRUSR CALL ILPRT DB CR,LF,0 ENDIF ;ASKAREA AND SETAREA ; IF ASKAREA AND SETAREA AND WRTLOC CALL SETLCK ;Turn WRTLOC back on ENDIF ; IF ASKAREA AND SETAREA RET ENDIF ; ;--------------------------------------------------------------------- ; WRTLOC ROUTINES (SETLCK AND RSTLCK) ; IF WRTLOC AND NOT BYEBDOS SETLCK: CALL BYECHK ; Is BYE running RNZ ; If not, skip this LHLD 0001H ; Get JMP COLDBOOT DCX H MOV D,M DCX H MOV E,M LXI H,LOCOFF ; + LOCOFF DAD D ORI 0FFH ; = WRTLOC address MOV M,A ; Turn the lock on RET ; RSTLCK: CALL BYECHK ; Is BYE running RNZ ; Nope, don't touch a thing LHLD 0001H ; If so, time to reset it DCX H ; Get JMP COLDBOOT addr. MOV D,M DCX H MOV E,M LXI H,LOCOFF ; + LOCOFF bytes DAD D ; = WRTLOC address XRA A ; Clear it MOV M,A ; (so ctrl-C/ctrl-K work) RET ENDIF ;WRTLOC AND NOT BYEBDOS ; IF WRTLOC AND BYEBDOS SETLCK: MVI C,BDWRTL ; Set/Get writeloc function MVI E,1 ; Turn on WRTLOC flag CALL BDOS RET ; RSTLCK: MVI C,BDWRTL ; Set/Get writeloc function MVI E,0 ; Turn off WRTLOC flag CALL BDOS RET ENDIF ; ;--------------------------------------------------------------------- ; ; Display file name function ; IF DSPFNAM ; HL=FCB address DSPFN: MVI B,8 ; PRNAM: MOV A,M ANI 7FH ; Strip any attribute bits CPI ' ' ; Don't print blanks CNZ CTYPE ; Print filename INX H DCR B JNZ PRNAM ; PRDOT: MVI A,'.' ; After first part, print dot CALL CTYPE MVI B,3 ; PRTYP: MOV A,M ANI 7FH ; Strip any attribute bits CPI ' ' ; Don't print blanks CNZ CTYPE ; Print filetype INX H DCR B JNZ PRTYP RET ENDIF ; DSPFNAM ; ; Check to see if BYE is running before getting CONOUT, checking MBBS ; ACCESS byte or setting/resetting WRTLOC. This routine also returns ; the address of the original cold boot routine in DE. ; ; Go through a big search to see if BYE is active. ; IF BYEBDOS BYECHK: MVI C,32 ; This bizarre combination determines MVI E,241 ; If BYE is not there. CALL BDOS CPI 77 ; Is it there? RET ENDIF ; IF (NOT BYEBDOS) AND (USECON OR ACCESS OR WRTLOC) BYECHK: LHLD 0001H ; Point to warm boot again DCX H ; If BYE active, MOV D,M ; Pick up pointer to BYE variables DCX H ; (COVECT) followed by 'BYE' MOV E,M LXI H,CONOFF ; Calculate address of BYE variable DAD D ; Where ptr to orig BIOS vector stored MOV E,M ; Load that address into DE, if BIOS INX H ; Is active, DE now points to original MOV D,M ; BIOS console output vector INX H ; Point to BYE signon message ; ; Note that if more BYE variables are added after the cold boot pointer, ; extra INX may be needed. Fix to match your BYE. ; MOV A,M ; Get letter ANI 05FH ; Convert to upper case if needed CPI 'B' ; Try to match 'BYE' RNZ ; Out if BYE not active INX H MOV A,M ANI 05FH ; Convert to upper case if needed CPI 'Y' RNZ INX H MOV A,M ANI 05FH ; Convert to upper case if needed CPI 'E' RET ENDIF ; ; Check next character to see if a space or non-space, file name error ; if no ASCII character. ; CHKFSP: DCR B JZ NFN ; Error if end of chars. MOV A,M CPI ' '+1 RNC ; Ok if valid character so return INX H JMP CHKFSP ; Look at next character ; ; Check next character to see if a space or non-space, go to menu if a ; command error. ; CHKSP: DCR B JZ OPTERR INX H MOV A,M ; Get the char. there CPI ' ' ; Space character? RET ; JZ = space, JNZ = non-space ; ; Exit, but first write record to log file and ask for description ; EXITLG: ; IF LOGCAL OR MBDESC OR MBFMSG CALL LOGCALL ENDIF ; ; Ask sysop for a description of the file if ASKSYS is yes ; IF DESCRIB AND ZCPR2 AND (NOT ASKSYS) LDA WHEEL ; If its the Sysop, don't ask ORA A ; For a description because he JNZ EXIT ; Might want to batch recv files ENDIF ; IF DESCRIB AND NDESC LDA NDSCFL ; If user picked "N" option ORA A ; allow them to skip upload JNZ EXIT ; descript ENDIF ; IF DESCRIB AND WRTLOC CALL RSTLCK ; Clear WRTLOC before DESCRIB ENDIF ; IF DESCRIB CALL ASK ; If yes, ask for description of file ENDIF ; ; Finished, clean up and return to CP/M, send thank-you and timeon ; messages if enabled. ; EXIT: XRA A STA CONONL ; Reset 'console only' flag for timeon ; IF WRTLOC CALL RSTLCK ; Clear WRTLOC ENDIF ; NOBYE2: CALL UNINIT ; Reset vectors (if needed) LDA OLDDRV ; Restore the original drive CALL RECDRX LDA OLDUSR ; Restore the original number CALL RECARE LXI D,TBUF ; Reset to default DMA address MVI C,SETDMA CALL BDOS LDA OPTSAV ; If so check option flag CPI 'R' ; Was it 'R' for receive JNZ EXIT1 ; If not, then skip this, CALL ILPRT ; And print DB CR,LF,'Thanks for the upload',CR,LF,0 ; IF SYSNEW CALL ILPRT DB CR,LF,'(Upload set as SYS file and cannot be examined' DB CR,LF,'or downloaded until released by the SYSOP....)' DB CR,LF,0 ENDIF ; IF B3RTC AND NOT (MBMXT OR BYEBDOS) CALL ILPRT ; And print DB CR,LF,'Time online is not increased during uploads' DB CR,LF,0 ENDIF ; IF MBFMSG LDA MSGFLG ; Was this a "XMODEM RM" upload? ORA A JZ NOTMSG CALL BYECHK JNZ EXIT1 CALL ILPRT DB CR,LF DB 'Loading MFMSG for message input, please stand by...' DB CR,LF,LF,0 LXI D,81H ; Our buffer starts at 81H MVI C,0 ; C=# of characters (stuff at 80H) CALL MBDFIL STA 80H ; Save # of chars in 80H MVI A,0C2H ; Stuff C2H (JNZ instruction) STA 0000H ORA A ; Make sure NZ flag set so JNZ will jump JMP 0000H ; NOTMSG: ENDIF ; MBFMSG ; IF MBFMSG AND NOT MBDESC JMP EXIT1 ; If not message upload, exit ENDIF ; ;----------------------------------------------------------------------- ; IF MBDESC AND ZCPR2 AND (NOT ASKSYS) LDA WHEEL ; If its the Sysop, don't ask ORA A ; For a description because he JNZ EXIT1 ; Might want to batch recv files ENDIF ; IF MBDESC AND NDESC LDA NDSCFL ; If user picked "N" option ORA A ; allow them to skip upload JNZ EXIT1 ; descript ENDIF ; IF MBDESC CALL BYECHK JNZ EXIT1 CALL ILPRT DB CR,LF DB 'Loading MBBS for upload description, ' DB 'please stand by...',CR,LF,LF,0 ENDIF ; IF MBDESC AND NEWPRV MVI A,'P' ; ALL "NEW UPLOADS:" private to start ENDIF ; IF MBDESC AND NOT NEWPRV LDA PRVTFL ; 80H=0 if public, "P" if private ENDIF ; IF MBDESC STA 80H ; Stuff "private" flag in page zero LXI D,82H ; Our buffer starts at 82H MVI C,0 ; C=# of characters (stuff at 81H) LXI H,MBDSH ; Heading ("NEW UPLOAD: ") ; MBDSHP: MOV A,M CPI 0 JZ MBDFS CALL MBDPUT INX H JMP MBDSHP ; MBDFS: CALL MBDFIL STA 81H ; Save # of chars in 81H MVI A,0CAH ; Stuff CAH (JZ instruction) STA 0000H XRA A ; Make sure Z flag set so JZ will jump JMP 0000H ; MBDSH: DB 'NEW UPLOAD: ',0 ; Heading stuffed ahead of filename ENDIF ; MBDESC ; IF MBDESC OR MBFMSG MBDFIL: LDA FCB ; Get drive code ORA A ; Check it JNZ MWDRV ; If auto login, use it LDA DSKSAV ; Else, get current disk INR A ; MWDRV: ADI 'A'-1 CALL MBDPUT ; Stuff in command line buffer LDA USRSAV ; Get user # CPI 10 ; Are we 0-9 or above? JC US0 ; Must be 0-9 ORA A ; Clear flags DAA ; Decimal adjust RAR ; Shift down tens digit RAR RAR RAR ANI 0FH ; Mask out tens digit ADI '0' ; Make it ASCII CALL MBDPUT LDA USRSAV ORA A ; Clear flags DAA ; Decimal adjust ANI 0FH ; Mask out singles digit ; US0: ADI '0' ; Make it ASCII CALL MBDPUT MVI A,':' ; Put in a colon CALL MBDPUT LXI H,FCB+1 ; Stuff in filename without spaces MVI B,8 ; DESNM: MOV A,M CPI ' ' CNZ MBDPUT INX H DCR B JNZ DESNM MVI A,'.' CALL MBDPUT MVI B,3 ; DESNM3: MOV A,M CPI ' ' JZ DESGO CPI 0 JZ DESGO CALL MBDPUT INX H DCR B JNZ DESNM3 ; DESGO: MOV A,C RET ; MBDPUT: ANI 7FH ; Strip off any high bits STAX D ; Short routine to stuff A in (DE) and INX D ; Increment pointer and character count INR C RET ENDIF ; MBDESC OR MBFMSG ; ;----------------------------------------------------------------------- ; EXIT1: IF (TIMEON OR B3TOS) AND (NOT LUXMOD) AND TOSEXIT CALL TIME ; Tell user how long he's been on ENDIF ; IF (BYEBDOS AND (NOT TIMEON)) AND TOSEXIT AND (NOT LUXMOD) MVI C,BDPTOS ; Print time on system CALL BDOS ENDIF ; EXIT2: XRA A LHLD STACK SPHL RET ; ; Check local console status in order to let BYE function keys work in ; MBYE and possibly other BYE versions also. (Your BYE must check for ; console function keys in MSTAT.) ; IF CONFUN FUNCHK: PUSH B ; Save everything PUSH D ; (to be safe) PUSH H PUSH PSW ; CONCHK: CALL 0000H ; Address patched in by START ; ENDIF ; IF CONFUN AND SYSABT ORA A ; If SYSABT set, check for JZ CONDNE ; CANCEL (^X) typed by sysop MVI C,RDCON CALL BDOS CPI CAN JNZ CONDNE STA SYSABF ENDIF ; CONDNE: IF CONFUN POP PSW ; For BIOS JMP CONSTAT POP H POP D POP B ; Restore everything RET ; And return ENDIF ; ; Get Disk and User from DUSAVE and log in if valid. ; GETDU: CALL CHKFSP ; See if a file name is included SHLD SAVEHL ; Save location of the filename LDA PRVTFL ; Uploading to a private area? ORA A JNZ TRAP ; If yes, going to a specified area LXI H,DUSAVE ; Point to drive/user LDA OLDDRV ; Get current drive STA DUD ADI 'A' STA RCVDRV MOV A,M ; Get 1st character CPI '0' JC GETDU1 CPI '9'+1 JC NUMER1 ; GETDU1: STA RCVDRV ; Allows SYSOP to upload to any drive CPI 'A'-1 JC NUMER ; Satisfied with current drive SUI 'A' STA DUD ; IF ZCPR2 LDA WHEEL ; SYSOP using the system? ORA A LDA DUD ; Get the value back (flags stay) JNZ GETDU2 ; If sysop, all things are possible ENDIF ; IF NOT USEMAX CPI MAXDRV JNC ILLDU ; Drive selection not available ENDIF ; IF USEMAX PUSH H LXI H,DRIVMAX ; Point to max drive byte INR M CMP M ; And check it PUSH PSW ; Save flags from the CMP DCR M ; Restore max drive to normal POP PSW ; Restore flags from the CPM JNC ILLDU POP H ENDIF ; GETDU2: INX H ; Get 2nd character ; NUMER: MOV A,M CPI ':' JZ OK4 ; Colon for drive only, no user number CALL CKNUM ; Check if numeric ; NUMER1: SUI '0' ; Convert ASCII to binary STA DUU ; Save it INX H ; Get 3rd character if any MOV A,M CPI ':' JZ OK1 LDA DUU CPI 1 ; Is first number a '1'? JNZ ILLDU MOV A,M CALL CKNUM SUI '0'-10 STA DUU INX H ; Get 4th (and last character) if any MOV A,M CPI ':' JNZ ILLDU ; OK1: LDA OPTSAV ; Get the option back CPI 'R' ; Receiving a file? LDA DUU ; Get desired user area JZ OK2 ; Yes, can not use special download area LDA DUD ; Get desired drive CPI SPLDRV-'A' ; Special download drive requested? LDA DUU ; Get user area requested JNZ OK2 ; If none, exit CPI SPLUSR ; Special download area requested? JZ OK3 ; If yes, process request ; OK2: IF ZCPR2 LDA WHEEL ; SYSOP using the system? ORA A LDA DUU ; Restore desired user area STA RCVUSR ; Allows SYSOP to upload anywhere JNZ OK3 ; If yes, let him have all user areas ENDIF ; IF NOT USEMAX CPI MAXUSR+1 ; Check for maximum user download area JNC ILLDU ; Error if more (and not special area) ENDIF ; IF USEMAX PUSH H LXI H,USRMAX ; Point at maximum user byte CMP M ; And check it JNC ILLDU POP H ENDIF ; OK3: MOV E,A ; IF NOT SETAREA STA NOTUSR+1 ; Store requested user area MVI A,3EH ; 'MVI A,--' instruction STA NOTUSR ENDIF ; MVI C,SETUSR CALL BDOS ; Set to requested user area ; OK4: LDA DUD ; Get drive MOV E,A ; IF NOT SETAREA ADI 'A' STA NOTDRV+1 ; Store requested drive MVI A,3EH ; 'MVI A,--' instruction STA NOTDRV ENDIF ; MVI C,SELDSK CALL BDOS ; Set to requested drive ; XIT: JMP TRAP ; Now find file selected ; ; Shows available space on upload disk/area. Uses KDRV data area which ; must be loaded before calling this routine. (So KSHOW will work with ; user specified disk if SETAREA equate is not set YES.) ; ; Print the free space remaining for the received file ; CPMVER EQU 0CH CURDPB EQU 1FH GALLOC EQU 1BH SELDSK EQU 0EH GETFRE EQU 46 ; KDRV: DB 0 ; Drive stored here before calling KSHOW ; KSHOW: LDA KDRV ; Get drive ('A','B','C',etc.) SUI 41H ; Convert to numeric (0,1,2,etc.) MOV E,A ; Stuff in E for BDOS call MVI C,SELDSK ; Select the directory drive to retrieve CALL BDOS ; The proper allocation vector MVI C,CURDPB ; It's 2.X or MP/M...request DPB CALL BDOS INX H INX H MOV A,M ; Get block shift STA BLKSHF INX H ; Bump to block mask MOV A,M INX H INX H MOV E,M ; Get max block # INX H MOV D,M XCHG SHLD BLKMAX ; Save it XCHG INX H MOV E,M ; Get directory size INX H MOV D,M XCHG ; ; Calculate # of K free on selected drive ; MVI C,CPMVER ; Get CP/M version number CALL BDOS MOV A,L ; Get returned version number CPI 30H ; 3.0? JC FREE20 ; Use old method if not LDA KDRV ; Get drive # SBI 'A' ; Change from ASCII to binary MOV E,A ; Use new Compute Free Space BDOS call MVI C,GETFRE CALL BDOS MVI C,3 ; Answer is a 24-bit integer ; FRE3L1: LXI H,80H+2 ; Answer is in 1st 3 bytes of DMA adr MVI B,3 ; Convert it from sectors to K ORA A ; By dividing by 8 ; FRE3L2: MOV A,M RAR MOV M,A DCX H DCR B JNZ FRE3L2 ; Loop for 3 bytes DCR C JNZ FRE3L1 ; Shift 3 times LHLD 80H ; Now get result in K JMP SAVFRE ; Go store it ; FREE20: MVI C,GALLOC ; Get address of allocation vector CALL BDOS XCHG LHLD BLKMAX ; Get its length INX H LXI B,0 ; Init block count to 0 ; GSPBYT: PUSH D ; Save alloc address LDAX D MVI E,8 ; Set to process 8 blocks ; GSPLUP: RAL ; Test bit JC NOTFRE INX B ; NOTFRE: MOV D,A ; Save bits DCX H ; Count down blocks MOV A,L ORA H JZ ENDALC ; Quit if out of blocks MOV A,D ; Restore bits DCR E ; Count down 8 bits JNZ GSPLUP ; Do another bit POP D ; Bump to next byte.. INX D ; Of alloc. vector JMP GSPBYT ; Process it ; ENDALC: POP D ; Clear stack of allocation vector ptr. MOV L,C ; Copy block to HL MOV H,B LDA BLKSHF ; Get block shift factor SUI 3 ; Convert from sectors to K JZ SAVFRE ; Skip shifts if 1K blocks... ; ; Return free in HL FREKLP: DAD H ; Multiply blocks by K/BLK DCR A JNZ FREKLP ; ; Print the amount of free space remaining on the selected drive ; SAVFRE: CALL DECOUT CALL ILPRT DB 'k available for uploads',0 RET ; ; Log into drive and user (if specified). If none mentioned, it falls ; through to 'TRAP' routine for normal use. ; LOGDU: LXI H,TBUF ; Point to default buffer command line MOV B,M ; Store number of characters in command INR B ; Add in current location ; LOG1: CALL CHKSP ; Skip spaces to find 1st command JZ LOG1 ; LOG2: CALL CHKSP ; Skip 1st command (non-spaces) JNZ LOG2 INX H CALL CHKFSP ; Skip spaces to find 2nd command SHLD SAVEHL ; Save start address of the 2nd command ; ; Now point to the first byte in the argument, i.e., if it was of format ; similar to: B6:HELLO.DOC then we point at the drive character 'B'. ; LXI D,DUSAVE MVI C,4 ; Drive/user is 4 characters maximum ; CPLP: MOV A,M CPI ' '+1 ; Space or return, finished JC TRAP STAX D INX H INX D CPI ':' JZ GETDU ; If colon, get drive/user and log in DCR B ; One less position to check DCR C ; One less to go JNZ CPLP ; ; Check for no file name or ambiguous name ; TRAP: CALL MOVEFCB ; Move the filename into the file block LXI H,FCB+1 ; Point to file name MOV A,M ; Get first character of file name CPI ' ' ; Any there? JNZ ATRAP ; Yes, check for ambigous file name ; NFN: CALL ERXIT ; Print message, exit DB '++ No file name requested ++$' ; ATRAP: MVI B,11 ; 11 characters to check ; TRLOOP: MOV A,M ; Get char from FCB CPI '?' ; Ambiguous? JZ TRERR ; Yes, exit with error message CPI '*' ; Even more ambiguous? JZ TRERR ; Yes, exit with error message INX H ; Point to next character DCR B ; One less to go JNZ TRLOOP ; Not done, check some more RET ; TRERR: CALL ERXIT ; Print message, exit DB '++ Wild-card options are not valid ++$' ; CKNUM: CPI '0' JC ILLDU ; Error if less than ascii '0' CPI '9'+1 RC ; Error if more than ascii '9' ; ILLDU: CALL ERXIT DB '++ Improper drive/user combination ++$' ; ; Receive a record - returns with carry bit set if EOT received ; RCVRECD:XRA A ; Initialize error count to zero STA ERRCT ; RCVRPT: IF CONFUN ; Check for function key? CALL FUNCHK ; Yeah, why not? ENDIF ; IF CONFUN AND SYSABT LDA SYSABF ; If SYSABT option, check ORA A ; to see if Abort JNZ RCVSABT ; If so, bail out now... ENDIF ; MVI B,10-1 ; 10-second timeout CALL RECV ; Get any character received JC RCVSTOT ; Timeout ; RCVRPTB:CPI SOH ; 'SOH' for a 128-byte block? JZ RCVSOH ; Yes CPI STX ; A 1024-byte block? JZ RCVSTX ; ORA A ; JZ RCVRPT ; Ignore nulls CPI CRC ; Ignore our own 'CRC' if needed JZ RCVRPT CPI NAK ; Ignore our own 'NAK' if needed JZ RCVRPT CPI CAN ; CANcel? JZ CANRCV ; (look for CAN CAN) CPI EOT ; End of transfer? STC ; Return with carry set if 'EOT' RZ ; ; Didn't get SOH or EOT - or - didn't get valid header - purge the line, ; then send nak ; RCVSERR:MVI B,1 ; Wait for 1 second CALL RECV ; After last char. received JNC RCVSERR ; Loop until sender done LDA FRSTIM ; Is it the first time? ORA A MVI A,NAK JNZ RCVSER2 ; If not first time, send NAK ; ; First time through...do crc/1k/checksum select ; LDA CRCFLG ; Get 'CRC' flag ORA A ; 'CRC' in effect? MVI A,NAK ; Put 'NAK' in accum JNZ RCVSER2 ; And go send it MVI A,CRC ; Tell sender 'CRC' is in effect CALL SEND LDA KFLAG ; Did we want 1k protocol? ORA A JZ RCVSERX ; No, just send the "C" MVI A,'K' ; Else send a C and a K ; RCVSER2:CALL SEND ; The 'NAK' or 'CRC' request ; RCVSERX:LDA ERRCT ; Abort if INR A ; We have reached STA ERRCT ; The error CPI 10 ; Limit? JZ RCVSABT ; Yes, abort CPI 5 ; Have we tried 5 times already? JNZ RCVRPT ; No, try again with same mode MVI A,'C' ; Else flip to checksum mode if CRC STA CRCFLG JMP RCVRPT ; And try again ; ; Error limit exceeded, so abort ; CANRCV: CALL DELAY ; Wait 100ms CALL RCVRDY ; Character waiting? JZ RCVRPT ; If so, no pause, skip CANcel MVI B,4 CALL RECV ; Else wait for 2nd character JC RCVSERR ; If no second character received, error CPI CAN JNZ RCVRPTB ; If second character not CAN, check it ; RCVSABT:CALL CLOSFIL ; Close file CALL ILPRT DB CR,LF,CR,LF,'++ Receive cancelled ++',0 CALL DELFILE ; Delete received file CALL ERXIT ; Print second half of message DB '++ Partial file deleted ++$' ; ; Deletes the received file (used if receive aborts) ; DELFILE:LXI D,FCB ; Point to file MVI C,DELET ; Get function CALL BDOS ; Delete it INR A ; Delete ok? RNZ ; Yes, return CALL ERXIT ; No, abort DB '++ Can''t delete received file ++$' ; ; Timed out on receive ; RCVSTOT:JMP RCVSERR ; Bump error count, etc. ; ; Got SOH or STX - get block number, block number complemented ; RCVSOH: LXI H,128 ; 128 bytes in this block XRA A ; Zero-out KFLAG JMP RCVHDR ; ; RCVSTX: MVI A,0FFH ; Set KFLAG true LXI H,1024 ; 1024 bytes in block ; RCVHDR: SHLD BLKSIZ ; Store block size for later STA KFLAG ; Set KFLAG as appropriate MVI B,1 ; Timeout = 1 sec MVI A,1 ; Need something to store at FRSTIM STA FRSTIM ; Indicate first 'SOH' received CALL RECV ; Get record JC RCVSTOT ; Got timeout MOV D,A ; D=block number MVI B,1 ; Timeout = 1 sec CALL RECV ; Get complimented record number JC RCVSTOT ; Timeout CMA ; Calculate the complement CMP D ; Good record number? JZ RCVDATA ; Yes, get data ; ; Got bad record number ; JMP RCVSERR ; Bump error count ; RCVDATA:MOV A,D ; Get record number STA RCVRNO ; Save it MVI C,0 ; Initialize checksum CALL CLRCRC ; Clear CRC counter LHLD BLKSIZ ; Get block size, XCHG ; And put in DE pair to initialize count LHLD RECPTR ; Get buffer address ; RCVCHR: MVI B,1 ; 1 sec timeout CALL RECV ; Get the character JC RCVSTOT ; Timeout MOV M,A ; Store the character INX H ; Point to next character DCX D ; Done? MOV A,D ORA E JNZ RCVCHR ; No, loop if <= BLKSIZ LDA CRCFLG ; Get 'CRC' flag ORA A ; 'CRC' in effect? JZ RCVCRC ; Yes, to receive 'CRC' ; ; Verify checksum ; MOV D,C ; Save checksum MVI B,1 ; Timeout length CALL RECV ; Get checksum JC RCVSTOT ; Timeout CMP D ; Checksum ok? JNZ RCVSERR ; No, error ; ; Got a record, it's a duplicate if = previous, or OK if = 1 + previous ; record. ; CHKSNUM:LDA RCVRNO ; Get received MOV B,A ; Save it LDA RECDNO ; Get previous CMP B ; Prev repeated? JZ RECVACK ; 'ACK' to catch up INR A ; Calculate next record number CMP B ; Match? JNZ ABORT ; No match - stop sender, exit RET ; Carry off - no errors ; ; Receive the Cyclic Redundancy Check characters (2 bytes) and see if ; the CRC received matches the one calculated. If they match, get next ; record, else send a NAK requesting the record be sent again. ; RCVCRC: MVI E,2 ; Number of bytes to receive ; RCVCRC2:MVI B,1 ; 1 sececond timeout CALL RECV ; Get crc byte JC RCVSTOT ; Timeout DCR E ; Decrement the number of bytes JNZ RCVCRC2 ; Get both bytes CALL CHKCRC ; Check received CRC against calc'd CRC ORA A ; Is CRC okay? JZ CHKSNUM ; Yes, go check record numbers JMP RCVSERR ; Go check error limit and send NAK ; ; Previous record repeated, due to the last ACK being garbaged. ACK it ; so sender will catch up ; RECVACK:CALL SENDACK ; Send the ACK JMP RCVRECD ; Get next block ; ; Send an ACK for the record ; SENDACK:MVI A,ACK ; Get 'ACK' CALL SEND ; And send it RET ; ; Send the record header ; ; Send [(SOH) or (STX)] (block number) (complemented block number) ; SENDHDR:LDA KFLAG ; 1k blocks enabled? ORA A JNZ SENDBIG ; Yes MVI A,SOH ; 128 blocks, use SOH JMP MORHDR ; Send it ; SENDBIG:MVI A,STX ; 1024 byte block - Start of Header ; MORHDR: CALL SEND ; One Start of Header or another LDA RECDNO ; Then send record number CALL SEND LDA RECDNO ; Then record number CMA ; Complemented CALL SEND ; Record number RET ; From SENDHDR ; ; Send the data record ; SENDREC:MVI C,0 ; Initialize checksum CALL CLRCRC ; Clear the 'CRC' counter LDA KFLAG ; Are we using 1K blocks? ORA A JNZ SEND1 ; Yes, 1k size LXI D,128 ; Initialize small count JMP SEND2 ; SEND1: LXI D,1024 ; Initialize big count ; SEND2: LHLD RECPTR ; Get buffer address ; SENDC: MOV A,M ; Get a character CALL SEND ; Send it INX H ; Point to next character DCX D ; Done? MOV A,D ORA E JNZ SENDC ; Loop if <=Blocksize RET ; From SENDREC ; ; Send the checksum ; SENDCKS:MOV A,C ; Send the CALL SEND ; Checksum RET ; From 'SENDCKS' ; ; Send the two Cyclic Redundancy Check characters. Call FINCRC to cal- ; culate the CRC which will be in 'DE' upon return. ; SENDCRC:CALL FINCRC ; Calculate the 'CRC' for this record MOV A,D ; Put first 'CRC' byte in accumulator CALL SEND ; Send it MOV A,E ; Put second 'CRC' byte in accumulator CALL SEND ; Send it XRA A ; Set zero return code RET ; ; Returns with carry clear if ACK received. If an ACK is not received, ; the error count is incremented, and if less than 10, carry is set and ; the record is resent. if the error count is 10, the program aborts. ; waits 12 seconds to avoid any collision with the receiving station. ; GETACK: MVI B,10 ; Wait 10 seconds max CALL RECVDG ; Receive with garbage collect JC ACKERR ; Timed out CPI ACK ; Was it an 'ACK' character? RZ ; Yes, return ; IF RETRY CPI NAK ; Was it an authentic 'NAK'? JNZ GETACK ; Ignore if neither 'ACK' nor 'NAK' ENDIF ; ; Timeout or error on ACK - bump error counters then resend the record ; if error limit is not exceeded. ; ACKERR: LDA ERRCT ; Get count INR A ; Bump it STA ERRCT ; Save back LHLD TOTERR ; Total errors this run INX H SHLD TOTERR ; Update and put back CPI 10 ; At limit? RC ; If not, go resend the record ; ; Reached error limit ; CALL ERXIT DB '++ Send file cancelled ++$' ; CHKERR: LDA KFLAG ORA A ; Check to see if in 1024 mode RZ ; No, so don't bother with rest LHLD TOTERR ; Check on errors to date... MOV A,L ; Skip if less than DWNSHFT error so far CPI DWNSHFT RC ; Not enough errors to bother with yet XCHG ; Total errors to DE LHLD RECDNO ; Get records sent so far CALL DVHLDE ; Divide by errors so far MOV A,C ; Take low order byte of quotient... CPI DWNSHFT ; Compare to specified ratio... RNC ; Better ratio than needed, so return XRA A ; Noisy line, let's try STA KFLAG ; 128 byte blocks RET ; ABORT: LXI SP,STACK ; ABORTL: MVI B,1 ; One second without characters CALL RECV JNC ABORTL ; Loop until sender done MVI A,CAN ; CTL-X CALL SEND ; Stop sending end ; ABORTW: MVI B,1 ; One second without chracters CALL RECV JNC ABORTW ; Loop until sender done MVI A,CR ; Get a space... CALL SEND ; To clear out CTL-X CALL ERXIT ; Exit with abort message DB '++ XMODEM aborted ++$' ; ; Increment record number ; INCRRNO:PUSH H LHLD RECDNO ; Increment record number INX H SHLD RECDNO LHLD VRECNO ; Update Virtual Record Number LDA KFLAG ; Was last record a 1024 byte one? ORA A ; JZ INCRR1 ; Just handled an normal 128 byte record INX H ; Otherwise, must have be a BIG one, so INX H ; Seven ... INX H INX H INX H INX H INX H ; Plus ; INCRR1: INX H ; One SHLD VRECNO ; Equals the new virtual record number ; IF NOT (USECON OR BYEBDOS) LHLD CONOUT+1 ; Check to see if showing count on crt MOV A,H ; If both zero, user did not fill out ORA L ; 'CONOUT: jmp 0000H' in patch area JZ INCRN5 ; With his own console output address ENDIF ; ; Display the record count on the local CRT if "CONOUT" was filled in by ; the implementor ; MVI A,1 STA CONONL ; Set local only LDA OPTSAV ; See if receive or send mode CPI 'R' JZ RMSG CALL ILPRT DB CR,'Sending # ',0 JMP REST ; RMSG: CALL ILPRT DB CR,'Received # ',0 ; REST: LDA KFLAG ORA A JZ REST1 LHLD VRECNO DCX H ; Stupid but simple way to subtract 7 DCX H ; Without dying on high-byte DCX H DCX H DCX H DCX H DCX H CALL DECOUT MVI A,'-' CALL CTYPE ; REST1: LHLD VRECNO ; Virtual record number to minimize CALL DECOUT ; Confusion between 1K and normal CALL ILPRT ; 'record' sizes (always in terms of DB ' ',18H,0 ; 128-byte records) ; IF CONFUN ; Check for sysop console function CALL FUNCHK ; Keys if CONFUN EQU YES ENDIF ; INCRN5: POP H ; Here from above if no CONOUT RET ; ; See if file exists - if it exists, ask for a different name. ; CHEKFIL: IF NOT SETAREA LDA PRVTFL ; Receiving in private area? ORA A CNZ RECAREA ; If yes, set drive and user area ENDIF ; IF SETAREA CALL RECAREA ; Set the designated area up ENDIF ; LXI D,FCB ; Point to control block MVI C,SRCHF ; See if it CALL BDOS ; Exists INR A ; Found? RZ ; No, return CALL ERXIT ; Exit, print error message DB '++ File exists, use a different name ++$' ; ; Makes the file to be received ; MAKEFIL:XRA A ; Set extent and record number to 0 STA FCBEXT STA FCBRNO LXI D,FCB ; Point to FCB MVI C,MAKE ; Get BDOS FNC CALL BDOS ; To the make INR A ; 0FFH=bad? RNZ ; Open ok ; ; Directory full - can't make file ; CALL ERXIT DB '++ Error: can''t make file -' DB ' directory may be full? ++$' ; ; Computes record count, and saves it until a successful file-open. ; CNREC: MVI C,CFSIZE ; Computes file size LXI D,FCB CALL BDOS ; Read first LHLD RANDOM ; Get the file size SHLD RCNT ; Save total record count MOV A,H ORA L RNZ ; Return if not zero length ; NONAME: CALL ERXIT DB '++ File not found, check DIR ++','$' ; ; Opens the file to be sent ; OPENFIL:XRA A ; Set extent and rec number to 0 STA FCBEXT ; For proper open STA FCBRNO LXI D,FCB ; Point to file MVI C,OPEN ; Get function CALL BDOS ; Open it INR A ; Open ok? JNZ OPENOK ; If yes, exit LDA OPTSAV ; Get command line option CPI 'L' ; Want to send a library file? JNZ NONAME ; Exit, if not CALL ILPRT DB CR,LF,'++ Member not found, check DIR ++',CR,LF,0 JMP OPTERR ; ; Check to see if the SYSOP has tagged a .LBR file for NO SEND - if so, ; only allow XMODEM L NAME to transfer individual files. If requested ; file is a $SYS file or has any high bits set, disallow unless WHEEL. ; OPENOK: IF ZCPR2 LDA WHEEL ; Check wheel status if ZCPR2 ORA A ; Is it zero JNZ OPENOK1 ; If non-zero skip all restrictions ENDIF ; IF DWNTAG LDA FCB+3 ; Regardless of access byte? ANI 80H ; If so, JNZ OPENOK1 ; Allow it if F3 set regardless ENDIF ; IF ACCESS CALL BYECHK JNZ SNDFOK LHLD 0001H ; Get JMP COLDBOOT DCX H MOV D,M DCX H MOV E,M LXI H,ACBOFF ; + ACBOFF DAD D MOV A,M ; = ACCESS byte address ANI ACDNLD ; Test download access bit JNZ SNDFOK ; If bit on, downloads OK CALL ERXIT DB 'Sorry, but you are not allowed to download files ' DB 'at this time...','$' ENDIF ; SNDFOK: IF NOSYS AND NOT LUXMOD LDA FCB+10 ANI 80H JNZ NONAME ; If $SYS then fake a "file not found" ENDIF ; IF OK2400 AND TAGLBR AND NOT LUXMOD LDA MSPEED ; Check baudrate byte set by BYE CPI 6 ; Is caller >=2400 baud? JNC OPENOK1 ; If so - let em send the file (PAT2) ENDIF ; IF TAGLBR AND NOT LUXMOD LDA OPTSAV ; Has SYSOP tagged a large .LBR file? CPI 'L' ; Using XMODEM L? JZ OPENOK1 ; Yes, skip tag test LDA FCB+1 ; First char of file name ANI 80H ; Check bit 7 for tag JZ OPENOK1 ; If on, file cannot be sent ENDIF ; IF TAGLBR AND NOT LUXMOD OPENOT: CALL ERXIT ; Exit with message DB '++ File is not for distribution, sorry. ++',CR,LF,CR,LF DB 'For large LBR files please use XMODEM L or LUX',CR,LF DB 'to transfer individual member files','$' ENDIF ; OPENOK1:LDA OPTSAV CPI 'L' JNZ OPN2 LXI D,TBUF MVI C,SETDMA CALL BDOS MVI C,READ LXI D,FCB CALL BDOS ORA A ; Read ok? JNZ LERROR LHLD TBUF+14 ; Value in buffer where DIRSIZE is SHLD DIRSZ LXI H,TBUF MOV A,M ORA A JZ CKDIR ; Check directory present? ; NOTLBR: CALL ERXIT DB '++ Bad .LBR directory, notify Sysop ++','$' ; ; Check to see if there is a .LBR file directory with that name and ; complain if not. ; CKDIR: MVI B,11 ; Maximum length of file name MVI A,' ' ; First entry must be all blanks INX H ; CKDLP: CMP M JNZ NOTLBR DCR B INX H JNZ CKDLP ; ; The first entry in the .LBR directory is indeed blank. Now see if the ; directory size is more than 0. ; MOV D,M ; Get directory starting location INX H ; Which must be 0000H... MOV A,M ORA D JNZ NOTLBR ; Directory does not start in record 0 INX H MOV A,M ; Get size of directory INX H ORA M JZ NOTLBR ; Directory must be >0 records! LXI H,TBUF ; Point to directory ; ; The next routine checks the .LBR directory for the specified member. ; Name one sector at a time. ; CMLP: MOV A,M ; Get member active flag ORA A ; 00=active, anything else can be... MVI B,11 ; Regarded as invalid (erased or blank) INX H ; Point to member name JNZ NOMTCH ; No match if inactive entry ; CKLP: LDAX D ; Now compare the file name specified... CMP M ; Against the member file name JNZ NOMTCH ; Exit loop if no match found INX H INX D DCR B JNZ CKLP ; Check all 11 characters MOV E,M ; Got the file - get file address INX H MOV D,M XCHG SHLD INDEX ; Save file address in .LBR XCHG INX H MOV E,M ; Get the file size INX H MOV D,M XCHG DCX H SHLD RCNT ; Save size a # of records LHLD INDEX ; Get file address SHLD RANDOM ; Place it into random field XRA A STA RANDOM+2 ; Must zero the 3rd byte STA FCBRNO ; Also zero FCB record # LXI D,FCB ; Point to FCB of .LBR file MVI C,RRDM ; Read random CALL BDOS JMP OPENOK3 ; No need to error check ; ; Come here if no file name match and another sector is needed ; NOMTCH: INX H ; Skip past the end of the file entry DCR B JNZ NOMTCH LXI B,20 ; Point to next file entry DAD B LXI D,MEMFCB ; Point to member name again MOV A,H ; See if we checked all 4 entries ORA A JZ CMLP ; No, check next LHLD DIRSZ ; Get directory size MOV A,H ORA L JNZ INLBR ; Continue if still more to check CALL ERXIT DB '++ Member not found, check DIR ++$' ; INLBR: DCX H ; Decrement dirctory size SHLD DIRSZ MVI C,READ ; Read next sector of directory LXI D,FCB CALL BDOS ORA A ; Read ok? JNZ LERROR LXI H,TBUF ; Set our pointers for compare LXI D,MEMFCB JMP CMLP ; Check next sector ; OPN2: IF ZCPR2 LDA WHEEL ; Check status of wheel if zcpr2 ORA A ; Is it zero JNZ OPENOK3 ; If not then skip the # and .com check ENDIF ; IF NOLBS OR NOCOMS ; Check for send restrictions LXI H,FCB+11 MOV A,M ; Check for protect attr ANI 7FH ; Remove CP/M 2.x attrs ENDIF ; IF NOLBS ; Do not allow '#' to be sent CPI '#' ; Chk for '#' as last first JNZ OPELOK ; If '#', can not send, show why CALL ERXIT DB '++ File not for distribution ++$' ; OPELOK: ENDIF ; IF NOCOMS ; Do not allow '.COM' to be sent CPI 'M' ; If not, check for '.COM' JNZ OPENOK3 ; If not, ok to send DCX H MOV A,M ; Check next character ANI 7FH ; Strip attributes CPI 'O' ; 'O'? JNZ OPENOK3 ; If not, ok to send DCX H MOV A,M ; Now check 1st character ANI 7FH ; Strip attributes CPI 'C' ; 'C' as in '.COM'? JNZ OPENOK3 ; If not, continue CALL ERXIT ; Exit with message DB '++ Sending .COM files not allowed ++$' ENDIF ; NOCOMS ; OPENOK3: IF NOT DSPFNAM CALL ILPRT ; Print the message DB 'File open: ',0 ENDIF ; IF DSPFNAM CALL ILPRT DB 'Sending: ',0 LDA OPTSAV CPI 'L' JNZ SFNNL ; If not L opt, just show name LXI H,MEMFCB CALL DSPFN CALL ILPRT DB ' from ',0 ; SFNNL: LXI H,FCB+1 CALL DSPFN CALL ILPRT DB CR,LF,'File size: ',0 ENDIF ; LHLD RCNT ; Get record count LDA OPTSAV CPI 'L' JNZ OPENOK4 ; If send from library add 1 to INX H ; Show correct record count ; OPENOK4:CALL CKKSIZ ; Check to see if it is at least 1K... CALL DECOUT ; Print decimal number of records PUSH H CALL ILPRT DB ' records (',0 POP H ; Get # of 128 byte records LXI D,8 ; Divide by 8 CALL DVHLDE ; To get # of 1024 byte blocks MOV A,H ORA L ; Check if remainder MOV H,B ; Get quotient MOV L,C JZ EXKB ; If 0 remainder, exact kilobytes INX H ; Else, increment to next k ; EXKB: CALL DECOUT ; Show # of kilobytes CALL ILPRT DB 'k)',CR,LF,0 CALL ILPRT DB 'Send time: ',0 CALL FILTIM ; Get file xfer time in mins in BC PUSH H ; Save seconds in HL ; IF ZCPR2 AND MAXTIM LDA WHEEL ; Check wheel status if zcpr2 ORA A ; Is it zero JNZ SKIPTIM ; If its not then skip the limit ENDIF ; IF OK2400 ; No restrictions for 2400 bps callers? LDA MSPEED ; Check baudrate byte set by BYE CPI 6 ; Is >=2400? JNC SKIPTIM ; If so, skip time check ENDIF ; IF MAXTIM MOV A,C ; If limiting get length of this program INR A ; Increment to next full minute ENDIF ; IF MAXTIM AND TIMEON LXI H,TON ADD M ; Add time on to xfer time, TON will ENDIF ; IF MAXTIM STA MINUTE ; Store value for later comparison MOV A,B ; Get high byte of minute if >255 JNZ MXTMC2 ; If no carry from increment/add INR A ; MXTMC2: STA MINUTE+1 ENDIF ; SKIPTIM:MOV L,C MOV H,B CALL DECOUT ; Print decimal number of minutes MVI A,':' CALL CTYPE ; Output colon POP H ; Get seconds MOV A,L CPI 10 MVI A,'0' ; Needs a leading zero CC CTYPE CALL DECOUT ; Print the seconds portion CALL ILPRT DB ' at ',0 LXI H,SPTBL ; Start of baud rate speeds MVI D,0 ; Zero the 'D' register CALL SPEED ; Get speed indicator ADD A ; Index into the baud rate table ADD A MOV E,A ; Now have the index factor in 'DE' DAD D ; Add to 'HL' XCHG ; Put address in 'DE' regs. MVI C,PRINT ; Show the baud CALL BDOS CALL SPEED CPI 5 MVI A,'0' ; Adds a zero for 1200, 2400, 4800 and CNC CTYPE ; 9600 bps ; OPENOK5:CALL ILPRT DB ' baud',CR,LF,0 ; IF ZCPR2 AND MAXTIM LDA WHEEL ; Check wheel status if zcpr2 ORA A ; Is it zero JNZ SKIPEM ; If not then no time limits ENDIF ; IF MAXTIM AND (BYEBDOS OR MXTOS) LDA MAXTOS ; Get maximum time on system ORA A ; If zero, this guy is a winner JZ SKIPEM ; (skip restrictions) LDA MINUTE+1 ; Is it over 255 minutes? ORA A JNZ OVERTM ENDIF ; IF MTL CALL GETTOS ; Get time on system in HL ENDIF ; IF MAXTIM AND BYEBDOS AND (NOT TIMEON) MVI C,BDGRTC ; Get time on system in A CALL BDOS MOV B,A ; Put in B ENDIF ; IF MAXTIM AND (BYEBDOS OR MXTOS) LDA MAXTOS INR A ENDIF ; IF MAXTIM AND BYEBDOS AND (NOT TIMEON) SUB B ENDIF ; IF MTL SUB L ; Get how much time is left ADI MAXMIN ; Give them MAXMIN extra ENDIF ; IF MAXTIM AND (BYEBDOS OR MXTOS) MOV B,A ; Put max time on sys in B LDA MINUTE ; Are we > max time on sys? CMP B JNC OVERTM ENDIF ; IF MAXTIM AND NOT (BYEBDOS OR MXTOS) LDA MINUTE+1 ; Get minute count high byte ORA A ; Check if zero JNZ OVERTM ; If not, is over 255 minutes! LDA MINUTE ; Get minute count CPI MAXMIN+1 ; Compare to MAXTIM value JNC OVERTM ; If greater than MAXTIM ENDIF ; SKIPEM: CALL ILPRT DB 'To cancel: Ctrl-X, pause, Ctrl-X',CR,LF,0 RET ; IF MAXTIM OVERTM: CALL ILPRT DB CR,LF,'++ XMODEM ABORTED - send time exceeds the ',0 ENDIF ; IF MAXTIM AND NOT (BYEBDOS OR MXTOS) LXI H,MAXMIN ENDIF ; IF MAXTIM AND BYEBDOS MVI C,BDGRTC CALL BDOS MOV B,A ENDIF ; IF MTL CALL GETTOS ; Get TOS back into HL ENDIF ; IF MAXTIM AND (BYEBDOS OR MXTOS) LDA MAXTOS ENDIF ; IF MAXTIM AND BYEBDOS SUB B ENDIF ; IF MTL SUB L ; Get time left ADI MAXMIN ; Add MAXMIN ENDIF ; IF MAXTIM AND (BYEBDOS OR MXTOS) MVI H,0 MOV L,A ENDIF ; IF MAXTIM CALL DECOUT CALL ERXIT1 DB ' minutes allowed ++$' ENDIF ; BTABLE: IF NOT STOPBIT ; One stop bit DW 5,13,19,25,30,48,85,141,210,280,0 ENDIF ; IF STOPBIT ; Two stop bits DW 5,12,18,23,27,44,78,128,191,255,0 ENDIF ; KTABLE: IF NOT STOPBIT ; One stop bit DW 5,14,21,27,32,53,101,190,330,525,0 ENDIF ; IF STOPBIT ; Two stop bits DW 5,13,19,25,29,48,92,173,300,477,0 ENDIF ; RECTBL: IF NOT STOPBIT ; One stop bit DB 192,74,51,38,32,20,11,8,5,3,0 ENDIF ; IF STOPBIT ; Two stop bits DB 192,80,53,42,36,22,12,7,5,4,0 ENDIF ; KECTBL: IF NOT STOPBIT ; One stop bit DB 192,69,46,36,30,18,10,5,3,2,0 ENDIF ; IF STOPBIT ; Two stop bits DB 192,74,51,38,33,20,10,6,3,2,0 ENDIF ; SPTBL: DB '110$','300$','450$','600$','710$','120$','240$' DB '480$','960$','1920$' ; ; Pass record count in RCNT: returns file's approximate download/upload ; time in minutes in BC, seconds in HL, also stuffs the # of mins/secs ; values in PGSIZE if LOGCAL is YES. ; FILTIM: CALL SPEED ; Get speed indicator MVI D,0 MOV E,A ; Set up for table access LXI H,BTABLE ; Point to baud factor table LDA KFLAG CPI 'K' JNZ FILTI1 LXI H,KTABLE ; The guy is using 1k file xfers ; FILTI1: DAD D ; Index to proper factor DAD D MOV E,M INX H MOV D,M LHLD RCNT ; Get number of records LDA OPTSAV CPI 'L' ; If not L download JNZ SKINCR ; Skip increment of record count INX H ; Increment record count ; SKINCR: CALL DVHLDE ; Divide HL by value in DE (records/min) PUSH H ; Save remainder LXI H,RECTBL ; Point to divisors for seconds calc. LDA KFLAG CPI 'K' JNZ FILTI2 LXI H,KECTBL ; The guy is using 1k file transfers ; FILTI2: MVI D,0 CALL SPEED ; Get speed indicator MOV E,A DAD D ; Index into table MOV A,M ; Get multiplier POP H ; Get remainder CALL MULHLA ; Multiply 'H' by 'A' CALL SHFTHL CALL SHFTHL CALL SHFTHL CALL SHFTHL MVI H,0 ; HL now = seconds (L=secs,H=0) ; IF LOGCAL MOV A,C ; Add minutes of length (to 0 or 1) STA PGSIZE ; Save as LSB of minutes MOV A,B ; Get MSB of minutes STA PGSIZE+1 ; Save as MSB of minutes (>255?) MOV A,L ; Get LSB of seconds (can't be >59) STA PGSIZE+2 ; Save for LOGCALL ENDIF ; RET ; End of FILTIM routine ; ; Divides 'HL' by value in 'DE' - upon exit: BC=quotient, HL=remainder ; DVHLDE: PUSH D ; Save divisor MOV A,E CMA ; Negate divisor MOV E,A MOV A,D CMA MOV D,A INX D ; 'DE' is now two's complemented LXI B,0 ; Init quotient ; DIVL1: DAD D ; Subtract divisor from divident INX B ; Bump quotient JC DIVL1 ; Loop until sign changes DCX B ; Adjust quotient POP D ; Retrieve divisor DAD D ; Readjust remainder RET ; ; Multiply the value in 'HL' by the value in 'A', return with answer in ; 'HL'. ; MULHLA: XCHG ; Multiplicand to 'DE' LXI H,0 ; Init product INR A ; MULLP: DCR A RZ DAD D JMP MULLP ; ; Shift the 'HL' register pair one bit to the right ; SHFTHL: MOV A,L RAR MOV L,A ORA A ; Clear the carry bit MOV A,H RAR MOV H,A RNC MVI A,128 ORA L MOV L,A RET ; ; Closes the received file ; CLOSFIL:LXI D,FCB ; Point to file MVI C,CLOSE ; Get function CALL BDOS ; Close it INR A ; Close ok? JNZ CLSEXIT ; Yes, continue CALL ERXIT ; No, abort DB '++ Can''t close file ++$' ; CLSEXIT: IF SYSNEW LDA FCB+10 ; Set $SYS attribute ORI 80H STA FCB+10 LXI D,FCB ; Point to file MVI C,SETATT ; Set attribute function CALL BDOS ENDIF ; RET ; ; Decimal output routine - call with decimal value in 'HL' ; DECOUT: PUSH B PUSH D PUSH H LXI B,-10 LXI D,-1 ; DECOU2: DAD B INX D JC DECOU2 LXI B,10 DAD B XCHG MOV A,H ORA L CNZ DECOUT MOV A,E ADI '0' CALL CTYPE POP H POP D POP B RET ; ; Makes sure there are enough records to send. For speed, this routine ; buffers up 16 records at a time. ; RDRECD: LDA KFLAG ; Check for 1024 byte records ORA A JNZ RDRECDK ; Using 1K blocks ; NOTKAY: LDA RECNBF ; Get number of records in buffer DCR A ; Decrement it JM RDBLOCK ; Exhausted? need more ORA A ; Otherwise, clear carry and... RET ; From 'RDRECD' ; RDRECDK:LDA RECNBF ; Get number of records in buffer ORA A ; Any records in buffer? JZ RDBLOCK ; Nope, get more SUI 8 ; Decrement count of records RNC ; 8 or more left XRA A ; Less than 8 left STA KFLAG ; Revert to 128 blocks JMP NOTKAY ; Continue with short blocks ; ; Update buffer pointers and counters AFTER sending a good block. ; UPDPTR: LDA KFLAG ORA A JNZ BIG LXI D,128 ; Small pointer increment MVI B,1 ; Small sector number JMP UPDPTR1 ; BIG: LXI D,1024 ; Big pointer increment MVI B,8 ; Number of sectors in big block ; UPDPTR1:LDA RECNBF ; Update buffer sector count SUB B STA RECNBF LHLD RECPTR ; Get buffer address DAD D ; To next buffer SHLD RECPTR ; Save buffer address RET ; ; Buffer is empty - read in another block of 16 ; RDBLOCK:LDA EOFLG ; Get 'EOF' flag CPI 1 ; Is it set? STC ; To show 'EOF' RZ ; Got 'EOF' MVI C,0 ; Records in block LXI D,DBUF ; To disk buffer ; RDRECLP:PUSH B PUSH D MVI C,SETDMA ; Set DMA address CALL BDOS LXI D,FCB MVI C,READ CALL BDOS POP D POP B ORA A ; Read ok? JZ RDRECOK ; Yes DCR A ; 'EOF'? JZ REOF ; Got 'EOF' ; ; Read error ; LERROR: CALL ERXIT DB '++ File read error ++$' ; RDRECOK:LXI H,128 ; Add length of one record DAD D ; To next buffer XCHG ; Buffer to 'DE' INR C ; More records? MOV A,C ; Get count CPI BUFSIZ*8 ; Done? JZ RDBFULL ; Yes, buffer is full JMP RDRECLP ; Read more ; REOF: MVI A,1 STA EOFLG ; Set EOF flag MOV A,C ; ; Buffer is full, or got EOF ; RDBFULL:STA RECNBF ; Store record count LXI H,DBUF ; Init buffer pointear SHLD RECPTR ; Save buffer address LXI D,TBUF ; Reset DMA address MVI C,SETDMA CALL BDOS JMP RDRECD ; Pass record to caller ; ; Writes the record into a buffer. When 16 have been written, writes ; the block to disk. ; ; Entry point "WRBLOCK" flushes the buffer at EOF ; WRRECD: LHLD BLKSIZ ; Get length of last record XCHG ; Get ready for add LHLD RECPTR ; Get buffer address DAD D ; To next buffer SHLD RECPTR ; Save buffer address XCHG ; Move BLKSIZ to HL CALL SHFTHL ; Divide by 128 to get recors CALL SHFTHL CALL SHFTHL CALL SHFTHL CALL SHFTHL CALL SHFTHL CALL SHFTHL LDA RECNBF ; Bump the records number in the buffer ADD L STA RECNBF CPI BUFSIZ*8 ; Equal to, or past 'end' of buffer? RC ; No, return ; ; Writes a block to disk ; WRBLOCK:LDA RECNBF ; Number of records in the buffer ORA A ; 0 means end of file RZ ; None to write MOV C,A ; Save count LXI D,DBUF ; Point to disk buff ; DKWRLP: PUSH H PUSH D PUSH B MVI C,SETDMA ; Set DMA CALL BDOS ; To buffer LXI D,FCB ; Then write the block MVI C,WRITE CALL BDOS POP B POP D POP H ORA A JNZ WRERR ; Oops, error LXI H,128 ; Length of 1 record DAD D ; 'HL'= next buff XCHG ; To 'DE' for setdma DCR C ; More records? JNZ DKWRLP ; Yes, loop XRA A ; Get a zero STA RECNBF ; Reset number of records LXI H,DBUF ; Reset buffer buffer SHLD RECPTR ; Save buffer address ; RSDMA: LXI D,TBUF ; Reset DMA address MVI C,SETDMA CALL BDOS RET ; WRERR: CALL RSDMA ; Reset DMA to normal MVI C,CAN ; Cancel CALL SEND ; Sender CALL RCVSABT ; Kill receive file CALL ERXIT ; Exit with msg: DB '++ Error writing file ++$' ; ; Receive a character - timeout time is in 'B' in seconds. Entry via ; 'RECVDG' deletes garbage characters on the line. For example, having ; just sent a record calling 'RECVDG' will delete any line-noise-induced ; characters "long" before the ACK/NAK would be received. ; RECVDG: CALL GETCHR CALL GETCHR ; RECV: PUSH D ; Save 'DE' regs. ;WBW BEGIN: Use dynamic CPU speed ; MVI E,MHZ ; Get the clock speed LDA CPUMHZ ; Get the clock speed MOV E,A ; Put speed in E ;WBW END XRA A ; Clear the 'A' reg. ; MSLOOP: ADD B ; Number of seconds DCR E ; One less mhz. to go JNZ MSLOOP ; If not zero, continue MOV B,A ; Put total value back into 'B' ; MSEC: IF NOT BYEBDOS ;WBW BEGIN: Use scalar passed in by patch ;LXI D,6600 ; 1 second DCR count XCHG LHLD RCVSCL ; Use scalar value from patch XCHG ;WBW END ENDIF ; IF BYEBDOS LXI D,2800 ; (includes BYEBDOS overhead) ENDIF ; MWTI: CALL RCVRDY ; Input from modem ready JZ MCHAR ; Got the character DCR E ; Count down for timeout JNZ MWTI DCR D JNZ MWTI DCR B ; More seconds? JNZ MSEC ; Yes, wait ; ; Test for the presence of carrier - if none, go to 'CARCK' and continue ; testing for specified time. If carrier returns, continue. If it does ; not return, exit. ; CALL CAROK ; Is carrier still on? CNZ CARCK ; If not, test for 15 seconds ; ; Modem timed out receiving - but carrier is still on. ; POP D ; Restore 'DE' STC ; Carry shows timeout RET ; ; Get character from modem. ; MCHAR: CALL MDIN ; Get data byte from modem POP D ; Restore 'DE' ; ; Calculate checksum and CRC ; PUSH PSW ; Save the character CALL UPDCRC ; Calculate CRC ADD C ; Add to checksum MOV C,A ; Save checksum POP PSW ; Restore the character ORA A ; Carry off: no error RET ; From 'RECV' ; ; Common carrier test for receive and send. If carrier returns within ; TIMOUT seconds, normal program execution continues. Else, it will ; abort to CP/M via EXIT. ; CARCK: MVI E,TIMOUT*10 ; Value for 15 second delay ; CARCK1: CALL DELAY ; Kill .1 seconds CALL CAROK ; Is carrier still on? RZ ; Return if carrier on DCR E ; Has 15 seconds expired? JNZ CARCK1 ; If not, continue testing ; ; See if got a local console, and report if so. ; IF NOT (USECON OR BYEBDOS) LHLD CONOUT+1 ; Get conout address MOV A,H ; Zero if no local console ORA L JZ CARCK2 ENDIF ; MVI A,1 ; Print local only STA CONONL CALL ILPRT ; Report loss of carrier DB CR,LF,'++ Carrier lost in XMODEM ++',CR,LF,0 ; CARCK2: LDA OPTSAV ; Get option CPI 'R' ; If not receive JNZ EXIT ; Then abort now, else CALL DELFILE ; Get rid of the junk first JMP EXIT ; Else, abort to CP/M ; ; Delay - 100 millisecond delay. ; DELAY: PUSH B ; Save 'BC' ; WBW BEGIN: Use dynamic CPU speed ; Loop below is 105TS on Z80 and 96TS on Z180 ; Approx 1024 iter per 100ms per MHz ; Loop time below extended to accommodate CPU speeds up to 64MHz ; LXI B,MHZ*4167 ; Value for 100 ms. delay ; Init BC w/ CPU MHz * 1024 LDA CPUMHZ ; CPU MHz to A RLC ; * 2 RLC ; * 2, A now has MHz * 4 MOV B,A ; Use as high byte MVI C,0 ; Zero low byte, BC now has MHz * 1024 ; WBW END DELAY2: DCX B ; Update count MOV A,B ; Get MSP byte ORA C ; Count = zero? JNZ DELAY2 ; If not, continue CALL DELAY3 ; WBW: Extend loop time CALL DELAY3 ; WBW: Extend loop time CALL DELAY3 ; WBW: Extend loop time POP B ; Restore 'BC' DELAY3: RET ; Return to CARCK1 ; ;----------------------------------------------------------------------- ; ; Tells user to add description of an uploaded file ; IF DESCRIB ASK: LDA OPTSAV ; Get the option CPI 'R' RNZ ; If not receiving a file, exit LDA PRVTFL ; Sending to "private area"? ORA A RNZ ; If yes, do not ask for description ENDIF ; IF DESCRIB AND ZCPR2 AND (NOT ASKSYS) LDA WHEEL ORA A RNZ ENDIF ; IF DESCRIB MVI B,2 ; Short delay to wait for an input char. CALL RECV ENDIF ; IF DESCRIB AND ASKIND ASK1: CALL DELAY CALL SHONM ; Show the file name CALL DILPRT DB ' - this file is for:',CR,LF,CR,LF,0 MVI C,PRINT ; Display the file descriptors LXI D,KIND0 CALL BDOS CALL DILPRT DB CR,LF,'Select one: ',0 CALL INPUT ; Get a character CALL TYPE CPI '0' JC ASK1 CPI '9'+1 JNC ASK1 STA KIND ENDIF ; IF DESCRIB AND (NOT ASKIND) ASK1: CALL DELAY CALL SHONM ENDIF ; IF DESCRIB ASK2: LXI H,0 SHLD OUTPTR ; Initialize the output pointers CALL DILPRT DB CR,LF,CR,LF DB 'Please describe this file (7 lines or less). Tell ' DB 'what equipment can use',CR,LF,'it and what the ' DB 'program does. Extra RET to quit.',CR,LF,CR,LF,0 CALL SENBEL ; ; Get the file name from FCB, skip any blanks ; LXI H,HLINE CALL DSTOR1 MVI B,8 ; Get FILENAME LXI D,FCB+1 LXI H,OLINE CALL LOPFCB MVI M,'.' MOV A,M ; Separate FILENAME and EXTENT CALL TYPE INX H MVI B,3 ; Get EXTENT name CALL LOPFCB ENDIF ; IF DESCRIB AND ASKIND AFIND1: LDA KIND CPI '0' ; File category 0 LXI D,KIND0+4 CZ DKIND ; File category 1 CPI '1' LXI D,KIND1+4 CZ DKIND ; File category 1 CPI '2' LXI D,KIND2+4 CZ DKIND ; File category 2 CPI '3' LXI D,KIND3+4 CZ DKIND ; File category 3 CPI '4' LXI D,KIND4+4 CZ DKIND ; File category 4 CPI '5' LXI D,KIND5+4 CZ DKIND ; File category 5 CPI '6' LXI D,KIND6+4 CZ DKIND ; File category 6 CPI '7' LXI D,KIND7+4 CZ DKIND ; File category 7 CPI '8' LXI D,KIND8+4 CZ DKIND ; File category 8 CPI '9' LXI D,KIND9+4 CZ DKIND ; File category 9 ENDIF ; DESCRIB AND ASKIND ; IF DESCRIB AND (NOT ASKIND) MVI M,CR INX H MVI M,LF ENDIF ; IF DESCRIB CALL DSTOR ; Put FILENAME line into memory CALL DILPRT DB CR,LF,CR,LF,'0: ---------1---------2---------3' DB '---------4---------5---------6---------',CR,LF,0 XRA A STA ANYET ; Reset the flag for no information yet MVI C,'0' ; EXPLN: INR C MOV A,C CPI '7'+1 JNC EXPL1 CALL TYPE MVI A,' ' CALL OUTCHR CALL OUTCHR CALL OUTCHR CALL DILPRT DB ': ',0 CALL DESC ; Get a line of information CALL DSTOR JMP EXPLN ; EXPL1: MVI A,CR ; All finished, put in an extra CR-LF CALL OUTCHR MVI A,LF CALL OUTCHR MVI A,'$' CALL OUTCHR CALL DILPRT DB ' Repeating to verify:',CR,LF,CR,LF,0 LHLD OUTADR XCHG MVI C,PRINT CALL BDOS LHLD OUTPTR DCX H SHLD OUTPTR ; EXPL2: CALL DILPRT DB CR,LF,'Is this ok (Y/N)? ',0 CALL INPUT CALL TYPE ; Display answer ANI 5FH ; Change to upper case CPI 'N' JZ ASK1 ; If not, do it over CPI 'Y' JNZ EXPL2 ; If yes, finish up, else ask again ; ; Now open the file and put this at the beginning ; EXPL3: LDA 0004H ; Get current drive/user STA DRUSER ; Store ; ; Set drive/user to the area listed above ; MVI E,USER ; Set user to WHATSFOR.TXT area MVI C,SETUSR CALL BDOS MVI A,DRIVE ; Set drive to WHATSFOR.TXT area SUI 41H MOV E,A MVI C,SELDSK CALL BDOS ; ; Open source file ; CALL DILPRT DB CR,LF,0 LXI D,FILE ; Open WHATSFOR.TXT file MVI C,OPEN CALL BDOS INR A ; Check for no open JNZ OFILE ; File exists, exit MVI C,MAKE ; None exists, make a new file LXI D,FILE CALL BDOS INR A JZ NOROOM ; Exit if cannot open new file ; OFILE: LXI H,FILE ; Otherwise use same filename LXI D,DEST ; With .$$$ extent for now MVI B,9 CALL MOVE ; ; Open the destination file ; XRA A STA DEST+12 STA DEST+32 LXI H,BSIZE ; Get Buffer allocated size SHLD OUTSIZ ; Set for comparison MVI C,DELET ; Delete any existing file that name LXI D,DEST CALL BDOS MVI C,MAKE ; Now make a new file that name LXI D,DEST CALL BDOS INR A JZ NOROOM ; Cannot open file, no directory room CALL DILPRT DB CR,LF,'Wait a moment...',0 ; ; Read sector from source file ; READLP: LXI D,TBUF MVI C,SETDMA CALL BDOS LXI D,FILE ; Read from WHATSFOR.TXT MVI C,READ CALL BDOS ORA A ; Read ok? JNZ RERROR LXI H,TBUF ; Read buffer address ; ; Write sector to output file (with buffering) ; WRDLOP: MOV A,M ; Get byte from read buffer ANI 7FH ; Strip parity bit CPI 7FH ; Del (rubout)? JZ NEXT ; Yes, ignore it CPI EOF ; End of file marker? JZ TDONE ; Transfer done, close, exit CALL OUTCHR ; NEXT: INR L ; Done with sector? JZ READLP ; If yes get another sector JMP WRDLOP ; No, get another byte ; ; Handle a backspace character while entering a character string ; BCKSP: CALL TYPE MOV A,B ; Get position on line ORA A JNZ BCKSP1 ; Exit if at initial column CALL SENBEL ; Send a bell to the modem MVI A,' ' ; Delete the character JMP BCKSP3 ; BCKSP1: DCR B ; Show one less column used DCX H ; Decrease buffer location MVI A,' ' MOV M,A ; Clear memory at this point CALL TYPE ; Backspace the "CRT" ; BCKSP2: MVI A,BS ; Reset the "CRT" again ; BCKSP3: CALL TYPE ; Write to the "CRT" RET ; ; Asks for line of information ; DESC: MVI B,0 LXI H,OLINE ; DESC1: CALL INPUT ; Get keyboard character CPI CR JZ DESC4 CPI TAB JZ DESC6 CPI BS JNZ DESC2 CALL BCKSP JMP DESC1 ; Get the next character ; DESC2: CPI ' ' JC DESC1 ; If non-printing character, ignore JZ DESC3 ; If a space, continue STA ANYET ; Show a character has been sent now ; DESC3: MOV M,A CALL TYPE ; Display the character INX H INR B MOV A,B CPI 70 ; Do not exceed line length JC DESC1 CALL SENBEL ; Send a bell to the modem CALL BCKSP2 CALL BCKSP1 ; Do not allow a too-long line JMP DESC1 ; DESC4: LDA ANYET ; Any text typed on first line yet? ORA A JNZ DESC5 ; If yes, exit POP H JMP ASK1 ; Ask again for a description ; DESC5: MVI M,CR MOV A,M CALL TYPE INX H ; Ready for next character MVI M,LF MOV A,M CALL TYPE ; Display the line feed INX H MOV A,B ; See if at first of line ORA A RNZ ; If not, ask for next line POP H ; Clear "CALL" from stack JMP EXPL1 ; DESC6: MOV A,B ; At end of line now? CPI 68 JNC DESC1 ; If yes, disregard MVI M,' ' MOV A,M CALL TYPE INX H INR B MOV A,B ANI 7 JNZ DESC6 JMP DESC1 ; Ask for next character ; DSTOR: LXI H,OLINE ; DSTOR1: MOV A,M CALL OUTCHR CPI LF RZ INX H JMP DSTOR1 ; ; Print message then exit to CP/M ; DEXIT: POP D ; Get message address MVI C,PRINT ; Print message CALL BDOS CALL RESET ; Reset the drive/user JMP EXIT ; all done ; ; Inline print routine - prints string pointed to by stack until a zero ; is found. Returns to caller at the next address after the zero ter- ; minator. ; DILPRT: XTHL ; Save hl, get message address ; DILPLP: MOV A,M ; Get char CALL TYPE ; Output it INX H ; Point to next MOV A,M ; Test ORA A ; For end JNZ DILPLP XTHL ; Restore hl, ret address RET ; Return past the end of the message ; ; ; Disk is full, save original file, erase others. ; FULL: MVI C,DELET LXI D,DEST CALL BDOS CALL DEXIT DB CR,LF,'++ DISK FULL, ABORTING, SAVING ORIGINAL FILE','$' ; ; Get a character, if none ready wait up to 3 minutes, then abort pgm ; INPUT: PUSH H ; Save current values PUSH D PUSH B ; ; WBW BEGIN: Use dynamic CPU speed ;INPUT1: LXI D,1200 ; Outer loop count (about 2 minutes) ;; ;INPUT2: LXI B,MHZ*100 ; Roughly 100 ms. INPUT1: LXI D,468 ; Outer loop count (about 2 minutes) ; INPUT2: LDA CPUMHZ ; CPU MHz to A MOV B,A ; Put in B MVI C,0 ; Zero C, BC is now CPU MHz * 256, ~256ms ; WBW END ; INPUT3: PUSH D ; Save the outer delay count PUSH B ; Save the inner delay count MVI E,0FFH MVI C,DIRCON ; Get console status CALL BDOS ANI 7FH POP B ; Restore the inner delay count POP D ; Restore the outer delay count ORA A ; Have a character yet? JNZ INPUT4 ; If yes, exit and get it DCX B MOV A,C ; See if inner loop is finished ORA B JNZ INPUT3 ; If not loop again DCX D MOV A,E ORA D JNZ INPUT2 ; If not reset inner loop and go again MVI A,CR CALL OUTCHR MVI A,LF CALL OUTCHR LXI SP,STACK ; Restore the stack CALL EXPL3 ; Finish appending previous information JMP EXIT ; Finished ; INPUT4: POP B POP D POP H RET ; ; Stores the Filename/extent in the buffer temporarily ; LOPFCB: LDAX D ; Get FCB FILENAME/EXT character CPI ' '+1 JC LOPF1 MOV M,A ; Store in OLINE area CALL TYPE ; Display on CRT INX H ; Next OLINE position ; LOPF1: INX D ; Next FCB position DCR B ; One less to go JNZ LOPFCB ; If not done, get next one RET ; ; No room to open a new file ; NOROOM: CALL DEXIT DB CR,LF,'++ No DIR space: output ++$' ; ; Output error - cannot close destination file ; OERROR: CALL DEXIT DB CR,LF,'++ Cannot close output ++$' ; ; Output a character to the new file buffer - first, see if there is ; room in the buffer for this character. ; OUTCHR: PUSH H PUSH PSW ; Store the character for now LHLD OUTSIZ ; Get buffer size XCHG ; Put in 'DE' LHLD OUTPTR ; Now get the buffer pointers MOV A,L ; Check to see if room in buffer SUB E MOV A,H SBB D JC OUT3 ; If room, go store the character LXI H,0 ; Otherwise reset the pointers SHLD OUTPTR ; Store the new pointer address ; OUT1: XCHG ; Put pointer address into 'DE' LHLD OUTSIZ ; Get the buffer size into 'HL' MOV A,E ; See if buffer is max. length yet SUB L ; By subtracting 'HL' from 'DE' MOV A,D SBB H JNC OUT2 ; If less, exit and keep going ; ; No more room in buffer, stop and transfer to destination file ; LHLD OUTADR ; Get the buffer address DAD D ; Add pointer value XCHG ; Put into 'DE' MVI C,SETDMA CALL BDOS LXI D,DEST MVI C,WRITE CALL BDOS ORA A JNZ FULL ; Exit with error, if disk is full now LXI D,RLEN LHLD OUTPTR DAD D SHLD OUTPTR JMP OUT1 ; OUT2: LXI D,TBUF MVI C,SETDMA CALL BDOS LXI H,0 SHLD OUTPTR ; OUT3: XCHG LHLD OUTADR DAD D XCHG POP PSW ; Get the character back STAX D ; Store the character LHLD OUTPTR ; Get the buffer pointer INX H ; Increment them SHLD OUTPTR ; Store the new pointer address POP H RET ; RERROR: CPI 1 ; File finished? JZ TDONE ; Exit, then MVI C,DELET ; Erase destination file, keep original LXI D,DEST CALL BDOS CALL DEXIT DB '++ Source file read error ++$' ; ; Reset the Drive/User to original, then back to original caller ; RESET: LDA DRUSER ; Get original drive/user area back RAR RAR RAR RAR ANI 0FH ; Just look at the user area MOV E,A MVI C,SETUSR ; Restore original user area CALL BDOS LDA DRUSER ; Get the original drive/user back ANI 0FH ; Just look at the drive for now MOV E,A MVI C,SELDSK ; Restore original drive CALL BDOS CALL DILPRT ; Print CRLF before quitting DB CR,LF,0 RET ; Return to caller (Not JMP EXIT1) ; ; Send a bell just to the modem ; SENBEL: CALL SNDRDY ; Is modem ready for another character? JNZ SENBEL ; If not, wait MVI A,7 PUSH PSW ; Overlay has the "POP PSW" JMP SENDR ; Send to the modem only ; ;..... ; ; ; Shows the Filename/extent ; SHONM: CALL DILPRT DB CR,LF,CR,LF,0 LXI H,FCB+1 MVI B,8 ; Maximum size of file name CALL SHONM1 MOV A,M ; Get the next character CPI ' ' ; Any file extent? RZ ; If not, finished MVI A,'.' CALL TYPE MVI B,3 ; Maximum size of file extent ; SHONM1: MOV A,M ; Get FCB FILENAME/EXT character CPI ' '+1 ; Skip any blanks JC $+6 CALL TYPE ; Display on CRT INX H ; Next FCB position DCR B ; One less to go JNZ SHONM1 ; If not done, get next one RET ;..... ; ; Transfer is done - close destination file ; TDONE: LHLD OUTPTR MOV A,L ANI RLEN-1 JNZ TDONE1 SHLD OUTSIZ ; TDONE1: MVI A,EOF ; Fill remainder of record with ^Z's PUSH PSW CALL OUTCHR POP PSW JNZ TDONE MVI C,CLOSE ; Close WHATSFOR.TXT file LXI D,FILE CALL BDOS MVI C,CLOSE ; Close WHATSFOR.$$$ file LXI D,DEST CALL BDOS INR A JZ OERROR ; ; Rename both files as no destination file name was specified ; LXI H,FILE+1 ; Prepare to rename old file to new LXI D,DEST+17 MVI B,16 CALL MOVE MVI C,DELET ; Delete original WHATSFOR.TXT file LXI D,FILE CALL BDOS LXI D,DEST ; Rename WHATSFOR.$$$ to WHATSFOR.TXT MVI C,RENAME CALL BDOS JMP RESET ; Reset the drive/user, back to caller ; TYPE: PUSH B PUSH D PUSH H PUSH PSW MOV E,A ; Character to 'E' for CP/M MVI C,WRCON ; Write to console CALL BDOS POP PSW POP H POP D POP B RET ENDIF ; DESCRIB ; IF DESCRIB AND ASKIND DKIND: LDAX D ; Get the character from the string CALL TYPE ; Otherwise display the character MOV M,A ; Put in the buffer CPI LF ; Done yet? JZ DKIND1 ; Exit if a LF, done INX D ; Next position in the string INX H ; Next postion in the buffer JMP DKIND ; Keep going until a LF ; DKIND1: LDA KIND ; Get the kind of file back RET ; Finished ENDIF ;..... ; ;----------------------------------------------------------------------- ; ; Send a character to the modem ; SEND: PUSH PSW ; Save the character CALL UPDCRC ; Calculate CRC ADD C ; Calcculate checksum MOV C,A ; Save cksum ; SENDW: CALL SNDRDY ; Is transmit ready JZ SENDR ; Yes, go send ; ; Xmit status not ready, so test for carrier before looping - if lost, ; go to CARCK and give it up to 15 seconds to return. If it doesn't, ; return abort via EXIT. ; PUSH D ; Save 'DE' CALL CAROK ; Is carrier still on? CNZ CARCK ; If not, continue testing it POP D ; Restore 'DE' JMP SENDW ; Else, wait for xmit ready ; ; Waits for initial NAK - to ensure no data is sent until the receiving ; program is ready, this routine waits for the first timeout-nak or the ; letter 'C' for CRC from the receiver. If CRC is in effect then Cyclic ; Redundancy Checks are used instead of checksums. 'E' contains the ; number of seconds to wait. If the first character received is a CAN ; (CTL-X) then the send will be aborted as though it had timed out. ; Since 1K extensions require CRC, KFLAG is set to NULL if the receiver ; requests checksum ; WAITNAK: IF CONFUN ; Check for Sysop function key? CALL FUNCHK ; Yeah, go ahead.. Twit? ENDIF ; IF CONFUN AND SYSABT LDA SYSABF ; If SYSABT option, check ORA A ; to see if Abort JNZ ABORT ; If so, bail out now... ENDIF ; MVI B,1 ; Timeout delay CALL RECV ; Did we get CPI 'K' ; Did he send a "K" first? JZ SET1KX CPI CRC ; 'CRC' indicated? JZ SET1K ; Yes, send block CPI NAK ; A 'NAK' indicating checksum? JZ SETNAK ; Yes go put checksum in effect CPI CAN ; Was it a cancel (CTL-X)? JZ ABORT ; Yes, abort DCR E ; Finished yet? JZ ABORT ; Yes, abort JMP WAITNAK ; No, loop ; ; Turn on checksum flag ; SETNAK: XRA A STA KFLAG ; Make sure transfer uses small blocks MVI A,'C' ; Change to checksum STA CRCFLG RET ; ; Turn on 1k flag ; SET1K: MVI B,1 ; Wait up to 1 second to get "K" CALL RECV CPI 'K' ; Did we get a "K" or something else RNZ ; (or nothing) ; SET1KX: LDA MSPEED CPI 5 RC MVI A,'K' STA KFLAG ; Set 1k flag RET ; ; This routine moves the filename from the default command line buffer ; to the file control block (FCB). ; MOVEFCB:LHLD SAVEHL ; Get position on command line CALL GETB ; Get numeric position LXI D,FCB+1 CALL MOVENAM ; Move name to FCB XRA A STA FCBRNO ; Zero record number STA FCBEXT ; Zero extent LDA OPTSAV ; This going to be a library file? CPI 'L' RNZ ; If not, finished ; ; Handles library entries, first checks for proper .LBR extent. If no ; extent was included, it adds one itself. ; SHLD SAVEHL LXI H,FCB+9 ; 1st extent character MOV A,M CPI ' ' JZ NOEXT ; No extent, make one CPI 'L' ; Check 1st character in extent JNZ LBRERR INX H MOV A,M CPI 'B' ; Check 2nd character in extent JNZ LBRERR INX H MOV A,M CPI 'R' ; Check 3rd character in extent JNZ LBRERR ; ; Get the name of the desired file in the library ; MOVEF1: LHLD SAVEHL ; Get current position on command line CALL CHKMSP ; See if valid library member file name INR B ; Increment for move name LXI D,MEMFCB ; Store member name in special buffer JMP MOVENAM ; Move from command line to buffer, done ; ; Check for any spaces prior to library member file name, if none (or ; only spaces remaining), no name. ; CHKMSP: DCR B JZ MEMERR MOV A,M CPI ' '+1 RNC INX H JMP CHKMSP ; ; Gets the count of characters remaining on the command line ; GETB: MOV A,L SUI TBUF+2 ; Start location of 1st command MOV B,A ; Store for now LDA TBUF ; Find length of command line SUB B ; Subtract those already used MOV B,A ; Now have number of bytes remaining RET ; LBRERR: CALL ERXIT DB '++ Invalid library name ++$' ; MEMERR: CALL ILPRT DB CR,LF,'++ No library member file requested ++',CR,LF,0 JMP OPTERR ; ; Add .LBR extent to the library file name ; NOEXT: LXI H,FCB+9 ; Location of extent MVI M,'L' INX H MVI M,'B' INX H MVI M,'R' JMP MOVEF1 ; Now get the library member name ; ; Move a file name from the 'TBUF' command line buffer into FCB ; MOVENAM:MVI C,1 ; MOVEN1: MOV A,M CPI ' '+1 ; Name ends with space or return JC FILLSP ; Fill with spaces if needed CPI '.' JZ CHKFIL ; File name might be less than 8 chars. STAX D ; Store INX D ; Next position to store the character INR C ; One less to go MOV A,C CPI 12+1 JNC NONAME ; 11 chars. maximum filename plus extent ; MOVEN2: INX H ; Next char. in file name DCR B JZ OPTERR ; End of name, see if done yet JMP MOVEN1 ; ; See if any spaces needed between file name and .ext ; CHKFIL: CALL FILLSP ; Fill with spaces JMP MOVEN2 ; FILLSP: MOV A,C CPI 9 RNC ; Up to 1st character in .ext now MVI A,' ' ; Be sure there is a blank there now STAX D INR C INX D JMP FILLSP ; Go do another ; CTYPE: PUSH B ; Save all registers PUSH D PUSH H MOV E,A ; Character to 'E' in case BDOS (normal) LDA CONONL ; Want to bypass 'BYE' output to modem? ORA A JNZ CTYPEL ; Yes, go directly to CRT, then MVI C,WRCON ; BDOS console output, to CRT and modem CALL BDOS ; Since 'BYE' intercepts the char. POP H ; Restore all registers POP D POP B RET ; CTYPEL: MOV C,E ; BIOS needs it in 'C' CALL CONOUT ; BIOS console output routine, not BDOS POP H ; Restore all registers saved by 'CTYPE' POP D POP B RET ; HEXO: PUSH PSW ; Save for right digit RAR ; Right justify the left digit RAR RAR RAR CALL NIBBL ; Print left digit POP PSW ; Restore right ; NIBBL: ANI 0FH ; Isolate digit ADI 90H DAA ACI 40H DAA JMP CTYPE ; Type it ; ; Inline print of message, terminates with a 0 ; ILPRT: XTHL ; Save HL, get HL=message ; ILPLP: MOV A,M ; Get the character INX H ; To next character ORA A ; End of message? JZ ILPRET ; Yes, return CALL CTYPE ; Type the message JMP ILPLP ; Loop ; ILPRET: XTHL ; Restore HL RET ; Past message ; ; Exit printing message following call ; ERXIT: CALL ILPRT DB CR,LF,0 XRA A STA OPTSAV ; Reset option to zero for TELL ; ERXIT1: MVI C,DIRCON ; Use BDOS Direct MVI E,0FFH ; Console input function CALL BDOS ; To check for abort CPI 'C'-40H ; CTL-C JZ ERXITX ; Abort msg CPI 'K'-40H ; CTL-K JZ ERXITX ; Abort msg POP H ; Get address of next char MOV A,M ; Get char INX H ; Increment to next char PUSH H ; Save address CPI '$' ; End of message? JZ EXITXL ; If '$' is end of message CALL CTYPE ; Else print char on console JMP ERXIT1 ; And repeat until abort/end ; EXITXL: CALL ILPRT DB CR,LF,0 ; ERXITX: POP H ; Restore stack JMP EXIT ; Get out of here ; ; Restore the old user area and drive from a received file ; RECAREA:CALL RECDRV ; Ok set the drive to its place LDA PRVTFL ; Private area wanted? ORA A LDA XPRUSR ; Yes, set to private area JNZ RECARE LDA XUSR ; Ok now set the user area ; RECARE: MOV E,A ; Stuff it in E MVI C,SETUSR ; Tell BDOS what we want to do CALL BDOS ; Now do it RET ; RECDRV: LDA PRVTFL ORA A LDA XPRDRV ; Get private upload drive JNZ RECDR1 LDA XDRV ; Or forced upload drive ; RECDR1: SUI 'A' ; Adjust it ; RECDRX: MOV E,A ; Stuff it in E MVI C,SELDSK ; Tell BDOS CALL BDOS RET ; MOVE: MOV A,M ; Get a character STAX D ; Store it INX H ; To next 'from' INX D ; To next 'to' DCR B ; More? JNZ MOVE ; Yes, loop RET ; ;----------------------------------------------------------------------- ; ; CRC SUBROUTINES ; ;----------------------------------------------------------------------- ; CHKCRC: PUSH H ; Check 'CRC' bytes of received message LHLD CRCVAL MOV A,H ORA L POP H RZ MVI A,0FFH RET ; CLRCRC: PUSH H ; Reset 'CRC' store for a new message LXI H,0 SHLD CRCVAL POP H RET ; FINCRC: PUSH PSW ; Finish 'CRC' calculation XRA A CALL UPDCRC CALL UPDCRC PUSH H LHLD CRCVAL MOV D,H MOV E,L POP H POP PSW RET ; UPDCRC: PUSH PSW ; Update 'CRC' store with byte in 'A' PUSH B PUSH H MVI B,8 MOV C,A LHLD CRCVAL ; UPDLOOP:MOV A,C RLC MOV C,A MOV A,L RAL MOV L,A MOV A,H RAL MOV H,A JNC SKIPIT MOV A,H ; The generator is x^16 + x^12 + x^5 + 1 XRI 10H MOV H,A MOV A,L XRI 21H MOV L,A ; SKIPIT: DCR B JNZ UPDLOOP SHLD CRCVAL POP H POP B POP PSW RET ; ; end of CRC routines ;----------------------------------------------------------------------- ; start of LOGCAL routines ; ; The following allocations are used by the LOGCALL routines ; IF LOGCAL PGSIZE: DB 0,0,0 ; Program length in minutes and seconds LOGOPT: DB '?' ; Primary option stored here DEFAULT$DISK: DB 0 ; Disk for open stored here DEFAULT$USER: DB 0 ; User for open stored here FCBCALLER: DB 0,'LASTCALR???' ; Last caller file FCB DB 0,0,0,0,0,0,0,0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0 CALLERPTR: DW LOGBUF FCBLOG: DB 0 ; Log file FCB ENDIF ; IF LOGCAL AND NOT (LOGSYS OR KNET) DB 'XMODEM ' DB 'L','O'+80H,'G' ; (the +80H makes this a $SYS file) ENDIF ; IF LOGCAL AND LOGSYS AND NOT KNET DB 'LOG ' DB 'S','Y'+80H,'S' ENDIF ; IF LOGCAL AND KNET AND NOT LOGSYS DB 'XMODEM ' DB 'T','X'+80H,'#' ENDIF ; IF LOGCAL DB 0,0,0,0,0,0,0,0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0 LOGPTR: DW DBUF LOGCNT: DB 0 LOGK: DB 'k ' ENDIF ; IF LOGCAL OR MBFMSG OR MBDESC DSKSAV: DB 0 ; Up/download disk saved here USRSAV: DB 0 ; Up/download user saved here ENDIF ; IF LOGCAL AND (RTC OR B3RTC OR BYEBDOS) YYSAV: DB 0 MMSAV: DB 0 DDSAV: DB 0 MNSAV: DB 0 ENDIF ; ; Main log file routine, adds record to log file ; IF LOGCAL OR MBDESC OR MBFMSG LOGCALL: MVI C,CURDRV ; Get current disk CALL BDOS ; (where down/upload occurred) STA DSKSAV ; And save it... MVI C,SETUSR ; Get current user area MVI E,0FFH ; (where down/upload occurred) CALL BDOS STA USRSAV ; And save it... ENDIF ; IF (MBDESC OR MBFMSG) AND (NOT LOGCAL) RET ; Skip logging if no log ENDIF ; IF LOGCAL XRA A STA FCBCALLER+12 STA FCBCALLER+32 MVI A,LASTDRV-'A' STA DEFAULT$DISK MVI A,LASTUSR STA DEFAULT$USER LXI D,FCBCALLER CALL OPENF ; Open LASTCALR file JNZ LOGC1 CALL ERXIT DB '++ No last caller file found +++$' ; LOGC1: MVI C,SETRRD ; Get random record # LXI D,FCBCALLER ; (for first record in file) CALL BDOS LXI D,DBUF ; Set DMA to DBUF MVI C,SETDMA CALL BDOS LXI D,FCBCALLER ; Read first (& only) record MVI C,RRDM CALL BDOS ENDIF ;LOGCAL ; IF LOGCAL AND NOT (MBBS AND (RTC OR B3RTC OR BYEBDOS)) LXI H,DBUF ; Set pointer to beginning of record ENDIF ; IF LOGCAL AND (MBBS AND (RTC OR B3RTC OR BYEBDOS)) LXI H,DBUF+11 ; Set pointer to skip log on date ENDIF ; IF LOGCAL SHLD CALLERPTR LXI D,LOGBUF ; Set DMA address to LOGBUF MVI C,SETDMA CALL BDOS XRA A STA FCBLOG+12 STA FCBLOG+32 MVI A,LOGDRV-'A' STA DEFAULT$DISK MVI A,LOGUSR STA DEFAULT$USER LXI D,FCBLOG CALL OPENF ; Open log file JNZ LOGC4 ; If file exists, skip create LXI D,FCBLOG MVI C,MAKE ; Create a new file if needed CALL BDOS INR A JNZ LOGC2 ; No error, cont. CALL ERXIT ; File create error DB '++ No dir space: log ++$' ; LOGC2: MVI C,SETRRD ; Set random record # LXI D,FCBLOG ; (for first record in file) CALL BDOS ; LOGC3: MVI A,EOF STA LOGBUF JMP LOGC4B ; LOGC4: MVI C,CFSIZE ; Get file length LXI D,FCBLOG CALL BDOS ; (end+1) LHLD FCBLOG+33 ; Back up to last record MOV A,L ORA H JZ LOGC3 ; Unless zero length file DCX H SHLD FCBLOG+33 LXI D,FCBLOG MVI C,RRDM ; And read it CALL BDOS ; LOGC4B: CALL RSTLP ; Initialize LOGPTR and LOGCNT ; LOGC6: CALL GETLOG ; Get characters out of last record CPI EOF JNZ LOGC6 ; Until EOF LDA LOGCNT ; Then backup one character DCR A STA LOGCNT LHLD LOGPTR DCX H SHLD LOGPTR LDA LOGOPT ; Get option back and put in file CALL PUTLOG CALL SPEED ; Get speed factor ADI 30H CALL PUTLOG CALL PUTSP ; Blank LDA PGSIZE ; Now the program size in minutes.. CALL PNDEC ; Of transfer time (mins) MVI A,':' CALL PUTLOG ; ':' LDA PGSIZE+2 CALL PNDEC ; And secs.. CALL PUTSP ; Blank ; ; Log the drive and user area as a prompt ; LDA FCB ORA A JNZ WDRV LDA DSKSAV INR A ; WDRV: ADI 'A'-1 CALL PUTLOG LDA USRSAV CALL PNDEC MVI A,'>' ; Make it look like a prompt CALL PUTLOG LDA OPTSAV CPI 'L' JNZ WDRV1 LXI H,MEMFCB ; Name of file in library MVI B,11 CALL PUTSTR CALL PUTSP ; ' ' ; WDRV1: LXI H,FCB+1 ; Now the name of the file MVI B,11 CALL PUTSTR LDA OPTSAV CPI 'L' JNZ WDRV2 MVI C,1 JMP SPLOOP ; WDRV2: MVI C,13 ; SPLOOP: PUSH B CALL PUTSP ; Put ' ' POP B DCR C JNZ SPLOOP LHLD VRECNO ; Get VIRTUAL record count LXI D,8 ; Divide record count by 8 CALL DVHLDE ; To get # of 1024 byte blocks MOV A,H ORA L ; Check if remainder MOV H,B ; Get quotient MOV L,C JZ EXKB2 ; If 0 remainder, exact kb INX H ; Else increment to next kb ; EXKB2: CALL PNDEC3 ; Print to log file (right just xxxk) LXI H,LOGK ; 'k ' MVI B,2 CALL PUTSTR ENDIF ; IF LOGCAL AND BYEBDOS MVI C,BDSTOS ; Set max time to 0 so BYE won't MVI E,0 ; hang up when doing BYEBDOS calls CALL BDOS ; when getting time/date ENDIF ; IF LOGCAL AND (B3RTC OR RTC OR BYEBDOS) CALL GETDATE ; IF RTC, get current date PUSH B ; (save DD/YY) CALL PNDEC ; Print MM MVI A,'/' ; '/' CALL PUTLOG POP PSW ; Get DD/YY PUSH PSW ; Save YY CALL PNDEC ; Print DD MVI A,'/' ; '/' CALL PUTLOG POP B ; Get YY MOV A,C CALL PNDEC ; Print YY CALL PUTSP ; ' ' CALL GETTIME ; IF RTC, get current time STA MNSAV ; Save min MOV A,B ; Get current hour CALL PNDEC ; Print hr to file MVI A,':' ; With ':' CALL PUTLOG ; Between HH:MM LDA MNSAV ; Get min CALL PNDEC ; And print min CALL PUTSP ; Print a space ENDIF ; IF LOGCAL AND BYEBDOS LDA MAXTOS ; Reset time on system MOV E,A ; So BYE will hang up MVI C,BDSTOS ; If caller is over time limit CALL BDOS ENDIF ; IF LOGCAL AND OXGATE AND (B3RTC OR RTC OR BYEBDOS) XRA A STA CMMACNT ; Clear comma count ENDIF ; IF LOGCAL CLOOP: CALL GETCALLER ; And the caller CPI EOF JZ QUIT CPI CR ; Do not print 2nd line of 'LASTCALR' JNZ CLOP1 CALL PUTLOG MVI A,LF CALL PUTLOG ; And add a LF JMP QUIT ; CLOP1: CPI ',' ; Do not print the ',' between names JNZ CLOP2 ENDIF ; LOGCAL ; IF LOGCAL AND OXGATE AND (B3RTC OR RTC OR BYEBDOS) LDA CMMACNT ; Get comma count INR A STA CMMACNT CPI 2 ; If reached second comma, do CRLF exit JZ CLOPX ENDIF ; IF LOGCAL MVI A,' ' ; Instead send a ' ' CLOP2: CALL PUTLOG JMP CLOOP ENDIF ; IF LOGCAL AND OXGATE AND (B3RTC OR RTC OR BYEBDOS) CLOPX: MVI A,CR ; Cloop exit... do a CRLF and finish up. CALL PUTLOG MVI A,LF CALL PUTLOG ENDIF ; IF LOGCAL QUIT: MVI A,EOF ; Put in EOF CALL PUTLOG LDA LOGCNT ; Check count of chars in buffer CPI 1 JNZ QUIT ; Fill last buffer & write it LXI D,FCBCALLER ; Close lastcaller file MVI C,CLOSE CALL BDOS INR A JZ QUIT1 LHLD FCBLOG+33 ; Move pointer back to show DCX H ; Actual file size SHLD FCBLOG+33 LXI D,FCBLOG ; Close log file MVI C,CLOSE CALL BDOS INR A RNZ ; If OK, return now... ; QUIT1: CALL ERXIT ; If error, oops DB '++ Cannot close log ++$' ENDIF ; LOGCAL ; ;----------------------------------------------------------------------- ; ; Support routines for LOGCAL ; ; Gets a single byte from DBUF ; IF LOGCAL GETCALLER: LHLD CALLERPTR MOV A,M INX H SHLD CALLERPTR RET ; ; Gets a single byte from log file ; GETLOG: LDA LOGCNT INR A STA LOGCNT CPI 129 JZ EOLF LHLD LOGPTR MOV A,M INX H SHLD LOGPTR RET ; EOLF: LHLD FCBLOG+33 INX H SHLD FCBLOG+33 LXI H,LOGBUF+1 SHLD LOGPTR MVI A,1 STA LOGCNT MVI A,EOF RET ; ; Open file with FCB pointed to by DE (disk/user passed in DEFAULT$DISK ; and DEFAULT$USER) ; OPENF: PUSH D ; Save FCB address LDA DEFAULT$DISK ; Get disk for file CALL RECDRX ; Log into it LDA DEFAULT$USER ; Get default user CALL RECARE ; Log into it POP D ; Get FCB address MVI C,OPEN ; Open file CALL BDOS CPI 255 ; Not present? RET ; Return to caller ; ; Write character to log file ; PUTLOG: LHLD LOGPTR ; Get pointer ANI 7FH ; Mask off any high bits MOV M,A ; Put data INX H ; Increment pointer SHLD LOGPTR ; Update pointer MOV B,A ; Save character in B LDA LOGCNT ; Get count INR A ; Increment it STA LOGCNT ; Update count CPI 129 ; Check it RNZ ; If not EOB, return PUSH B ; Save character LXI D,FCBLOG ; Else, write this sector MVI C,WRDM CALL BDOS ORA A JZ ADVRCP ; If ok, cont. CALL ERXIT DB '++ Disk full - cannot add to log ++$' ; ADVRCP: LHLD FCBLOG+33 ; Advance record number INX H SHLD FCBLOG+33 CALL RSTLP ; Reset buffer pointers POP PSW ; Get saved character JMP PUTLOG ; Put it in buffer and return ; RSTLP: LXI H,LOGBUF ; Reset pointers SHLD LOGPTR ; And return MVI A,0 STA LOGCNT RET ; ; Print number in decimal format (into log file) ; IN: HL=binary number ; OUT: nnn=right justified with spaces ; PNDEC3: MOV A,H ; Check high byte ORA A JNZ DECOT ; If on, is at least 3 digits MOV A,L ; Else, check low byte CPI 100 JNC TEN CALL PUTSP ; TEN: CPI 10 JNC DECOT CALL PUTSP JMP DECOT ; ; Puts a single space in log file, saves PSW/HL ; PUTSP: PUSH PSW PUSH H MVI A,' ' CALL PUTLOG POP H POP PSW RET ; ; Print number in decimal format (into log file) ; PNDEC: CPI 10 ; Two column decimal format routine JC ONE ; One or two digits to area number? JMP TWO ; ONE: PUSH PSW MVI A,'0' CALL PUTLOG POP PSW ; TWO: MVI H,0 MOV L,A ; DECOT: PUSH B PUSH D PUSH H LXI B,-10 LXI D,-1 ; DECOT2: DAD B INX D JC DECOT2 LXI B,10 DAD B XCHG MOV A,H ORA L CNZ DECOT MOV A,E ADI '0' CALL PUTLOG POP H POP D POP B RET ; ; Put string to log file ; PUTSTR: MOV A,M PUSH H PUSH B CALL PUTLOG POP B POP H INX H DCR B JNZ PUTSTR RET ENDIF ; LOGCAL ; ; end of LOGCAL routine ;----------------------------------------------------------------------- ; start of TIMEON routine ; ; Calculate time on system and inform user. Log him off if =>MAXMIN ; unless STATUS is non-zero. ; IF TIMEON TIME: PUSH B ; Save BC pair CALL GETTIME ; Get time from system's RTC STA CMTEMP ; Save in current-hour-temp MOV A,B ; Get current hour POP B ; Restore BC ENDIF ; IF TIMEON AND BYEBDOS PUSH PSW ; save the current hour <== BUG FIX PUSH B ; Lhour was safely moved to highmem PUSH D ; in newer versions of BYE MVI C,BDGRTC CALL BDOS LXI D,11 ; Get address of LHOUR DAD D POP D POP B POP PSW ; Restore current hour...BDOS killed it ENDIF ; IF TIMEON AND NOT BYEBDOS LXI H,LHOUR ; Point to log-on hour (in low memory) ENDIF ; IF TIMEON CMP M ; Equal? INX H ; Point to logon minutes JNZ TIME1 ; No MOV D,M LDA CMTEMP ; Current minutes SUB D STA TON ; Store total time on JMP TIME2 ; TIME1: MOV D,M ; Get logon minutes MVI A,03CH ; 60 min into A SUB D LXI H,CMTEMP ; Point at current min ADD M ; Add current minutes STA TON ENDIF ; TIME2: IF ZCPR2 AND TIMEON LDA WHEEL ; Check wheel status if ZCPR ORA A ; Is it zero JNZ TIME3 ; If not then this is a special user ENDIF ; IF TIMEON LDA MAXTOS ORA A ; If maxtos is zero, guy is superuser JZ TIME3 ENDIF ; IF TIMEON AND NOT BYEBDOS ; BYEBDOS doesn't use status byte ORA A ; Special user? JNZ TIME3 ; Yes, skip log off check LDA TON SUI MAXMIN ; Subtract max time allowed ENDIF ; IF TIMEON AND BYEBDOS LDA MAXTOS MOV B,A LDA TON SUB B ENDIF ; IF TIMEON JC TIME3 ; Still time left CALL TIMEUP ; Time is up, inform user MVI A,0CDH ; Alter jump vector STA 0 ; At zero JMP 0000H ; And log him off ; TIME3: LXI H,MSG1+015H ; Point at message insert bytes LDA TON ; Convert to ASCII MVI B,0FFH ; TIME4: INR B SUI 0AH ; Subtract 10 JNC TIME4 ; Until done ADI 0AH ORI '0' ; Make ASCII MOV M,A DCX H MVI A,'0' ADD B MOV M,A CALL ILPRT ; MSG1: DB CR,LF,'Time on system is 00 minutes',CR,LF,0 ENDIF ; IF TIMEON AND NOT BYEBDOS LDA STATUS ; Check user status ORA A ; Special user? JNZ TIME5 ; Yes, reset TON ENDIF ; IF TIMEON RET ENDIF ; IF TIMEON AND NOT BYEBDOS TIME5: MVI A,0 ; Reset timeout for good guys STA TON RET ENDIF ; IF TIMEON TIMEUP: CALL ILPRT DB CR,LF,CR,LF DB 'Your time is up - wait 24 hours to call back',CR,LF,0 RET ; TON: DB 0 ; Storage for time on system CMTEMP: DB 0 ; Storage for current minute value ENDIF ; ; Get caller's time on system from BYE3 or MBYE and display on console. ; IF B3RTC AND B3TOS TIME: CALL ILPRT DB CR,LF,'Time on system is ',0 CALL GETTOS ; Get Time On System from MBYE's RTC CALL DECOUT ; Print it on the screen CALL ILPRT DB ' minutes',CR,LF,0 RET ENDIF ; ; Get caller's time on system (returned in HL). ; IF B3RTC AND (NOT BYEBDOS) GETTOS: LHLD RTCBUF ; Get RTCBUF addr MOV A,H ORA L RZ ; If 0000H, BYE not running so TOS=0 MOV A,M ; If hours = 99 CPI 099H LXI H,0 RZ ; Return with TOS=0 LHLD RTCBUF LXI D,B3CMOS ; Get offset to TOS word DAD D ; (addr in HL) MOV E,M ; Get minutes on system INX H MOV D,M ; Stuff into DE XCHG ; Swap into HL RET ENDIF ; IF BYEBDOS OR MXTOS MAXTOS: DB 0 ; Maximum time on system ENDIF ; ; end of TIMEON routine ;----------------------------------------------------------------------- ; GETDATE: IF (RTC AND LOGCAL) AND NOT (CPM3 OR BYEBDOS) LDA 45H ; Get the binary day number MOV B,A ; Set to return binary day # B reg. LDA 46H ; Get the binary year number MOV C,A ; Set to return binary year # in C reg. LDA 44H ; Get the binary month number RET ENDIF ; ;----------------------------------------------------------------------- ; start of CPM+ date routine IF RTC AND LOGCAL AND CPM3 MVI C,GETTIM ; BDOS function to get date and time LXI D,TIMEPB ; Get address of 4-byte data structure CALL BDOS ; Transfer the current date/time LHLD TIMEPB MVI B,78 ; Set years counter ; LOOP: CALL CKLEAP LXI D,-365 ; Set up for subtract JNZ NOLPY ; Skip if no leap year DCX D ; Set for leap year ; NOLPY: DAD D ; Subtract JNC YDONE ; Continue if years done MOV A,H ORA L JZ YDONE SHLD TIMEPB ; Else save days count INR B ; Increment years count JMP LOOP ; And do again ; ; The years are now finished, the years count is in 'B' and TIMEPB holds ; the days (HL is invalid) ; YDONE: MOV A,B STA YEAR CALL CKLEAP ; Check if leap year MVI A,-28 JNZ FEBNO ; February not 29 days MVI A,-29 ; Leap year ; FEBNO: STA FEB ; Set february LHLD TIMEPB ; Get days count LXI D,MTABLE ; Point to months table MVI B,0FFH ; Set up 'B' for subtract MVI A,0 ; Set a for # of months ; MLOOP: PUSH PSW LDAX D ; Get month MOV C,A ; Put in 'C' for subtract POP PSW SHLD TIMEPB ; Save days count DAD B ; Subtract INX D ; Increment months counter INR A JC MLOOP ; Loop for next month ; ; The months are finished, days count is on stack. First, calculate ; the month. ; MDONE: MOV B,A ; Save months LHLD TIMEPB MOV A,H ORA L JNZ NZD DCX D DCX D LDAX D CMA INR A MOV L,A DCR B ; NZD: MOV A,B STA MONTH MOV A,L STA DAY LDA YEAR MOV C,A LDA DAY MOV B,A LDA MONTH RET ; ; This routine checks for leap years. ; CKLEAP: MOV A,B ANI 0FCH CMP B RET ; ; This is the month's table ; MTABLE: DB -31 ; January FEB: DB -28 ; February DB -31,-30,-31,-30 ; Mar-Jun DB -31,-31,-30 ; Jul-Sep DB -31,-30,-31 ; Oct-Dec ; YEAR: DB 0 MONTH: DB 0 DAY: DB 0 ENDIF ; RTC AND LOGCAL AND CPM3 ; ; end of CPM+ date routine ;----------------------------------------------------------------------- ; IF LOGCAL AND B3RTC AND NOT BYEBDOS CALL BYECHK ; See if BYE is running JZ GETBDAT ; If so, get date from buffer & convert MVI A,0 ; Else, return 00/00/00 MOV B,A MOV C,A RET ENDIF ; IF LOGCAL AND B3RTC AND (NOT BYEBDOS) GETBDAT:LHLD RTCBUF ; Get RTC buffer in HL ENDIF ; IF LOGCAL AND BYEBDOS AND (NOT B3RTC) MVI C,BDGRTC ; Get RTC buffer in HL CALL BDOS ENDIF ; IF LOGCAL AND (BYEBDOS OR B3RTC) LXI D,4 ; Offset to YY DAD D ; HL=YY Address MOV A,M ; Get YY CALL BCDBIN ; Make it binary STA YYSAV ; Save YY INX H ; Point to MM MOV A,M ; Get MM CALL BCDBIN ; Convert BCD to binary STA MMSAV ; Save it INX H ; Point to DD MOV A,M ; Get DAY CALL BCDBIN ; Convert it to binary MOV B,A ; Stuff DD in B LDA YYSAV ; Get YY MOV C,A ; Put YY in C LDA MMSAV ; Get MM in A RET ; And return ENDIF ; ; ; The routine here should read your real-time clock and return with the ; following information: ; ; register: A - current minute (0-59) ; B - current hour (0-23) ; GETTIME: IF (TIMEON OR RTC) AND NOT (B3RTC OR CPM3 OR BYEBDOS) ; ;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;; (this example is for the Serria SBC-100) ;; ;;SBCHR EQU 040H ; Low memory area where stored ;;SBCMN EQU 041H ;; ;; LDA SBCHR ; Get hour from BIOS memory-clock ;; MOV B,A ;; LDA SBCMN ; Get minute from BIOS memory-clock ;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; ;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;; (this example is for <NAME>'s computer) ;; ;; LDA 43h ; Get the current binary hour number ;; MOV B,A ; Set to return binary hour number in Reg. B ;; LDA 42h ; Get the current binary minute number ;; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; RET ENDIF ; ; The following code is for CP/M Plus ; IF (TIMEON OR RTC) AND CPM3 MVI C,GETTIM ; BDOS function to get date and time LXI D,TIMEPB ; Get address of 4-byte data structure CALL BDOS ; Transfer the current date/time LDA TIMEPB+2 ; Get current hour CALL BCDBIN ; Convert BCD hour to binary MOV B,A ; Position hour for return PUSH B ; Save the binary hour LDA TIMEPB+3 ; Get current minute CALL BCDBIN ; Convert BCD minute to binary POP B ; Restore the binary hour RET ENDIF ; IF LOGCAL AND B3RTC AND (NOT BYEBDOS) CALL BYECHK ; See if BYE is running JZ GETBTIM ; If so, get time from buffer & convert MVI A,0 ; Else, return 00:00 MOV B,A RET ; GETBTIM:LHLD RTCBUF ; Get RTC buffer address ENDIF ; IF LOGCAL AND BYEBDOS AND (NOT B3RTC) MVI C,BDGRTC ; Get RTC buffer address CALL BDOS ENDIF ; IF LOGCAL AND (B3RTC OR BYEBDOS) MOV A,M ; Get hours on system CALL BCDBIN ; Convert BCD value to binary PUSH PSW ; Save hr on stack INX H ; Point to minute MOV A,M ; Get min CALL BCDBIN ; Convert BCD to binary POP B ; Get hr in B (min in A) RET ; And return ENDIF ; ; Convert BCD value in A to binary in A ; IF LOGCAL AND (B3RTC OR CPM3 OR BYEBDOS) BCDBIN: PUSH PSW ; Save A ANI 0F0H ; Mask high nibble RRC ; Move to low nibble RRC RRC RRC MOV C,A ; And stuff in C (C=A) MVI B,9 ; X10 (*9) ; BCDBL: ADD C ; Add orig value to A DCR B ; Decrement B JNZ BCDBL ; Loop nine times (A+(C*9)=A*10) MOV B,A ; Save result in B POP PSW ; Get original value ANI 0FH ; Mask low nibble ADD B ; +B gives binary value of BCD digit A RET ; Return ENDIF ; ; Check to see that HL register is at least 8 records. If it not, make ; sure 1K blocks are turned off ; CKKSIZ: MOV A,H ; Get high order byte ORA A ; Something there? RNZ ; Yes, certainly more than 8 MOV A,L ; Get low order byte CPI 8 ; Looking for at least this many records RNC ; Not Carry means 8 or more records XRA A ; Get nothing STA KFLAG ; Turn off 1K blocks RET ; ;----------------------------------------------------------------------- ; ; BYEBDOS access routines ; ;----------------------------------------------------------------------- ; IF BYEBDOS CONOUT: MOV E,C ; Get character into E MVI C,BDCONO ; Console output (local only) JMP BDOS ; Go to it... ; MINIT: UNINIT: RET ; Modem's already initialized ; SENDR: POP PSW ; Needed by specifications PUSH B PUSH D PUSH H MOV E,A ; Put character in E MVI C,BDMOUT CALL BDOS POP H POP D POP B RET ; GETCHR: MDIN: PUSH B PUSH D PUSH H MVI C,BDMINP CALL BDOS POP H POP D POP B RET ; ; The following 3 routines operate in differently than BYE does, so we ; must make things "backwards" ; CAROK: PUSH B PUSH D PUSH H MVI C,BDCSTA CALL BDOS JMP BKWDS ; RCVRDY: PUSH B PUSH D PUSH H MVI C,BDMIST CALL BDOS JMP BKWDS ; SNDRDY: PUSH B PUSH D PUSH H MVI C,BDMOST CALL BDOS ; ; Flip around bytes, if A>0 then make A zero & set flags ; if A=0 then make A =255 & set flags BKWDS: ORA A MVI A,255 JZ NOSIG XRA A ; NOSIG: ORA A POP H POP D POP B RET ; SPEED: LDA MSPEED RET ENDIF ; ;----------------------------------------------------------------------- ; ; Temporary storage area ; ;----------------------------------------------------------------------- ; IF DESCRIB FILE: DB 0,'WHATSFORTXT',0,0,0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0 DEST: DB 0,' $$$',0,0,0,0,0,0,0 DB 0,0,0,0,0,0,0,0,0,0,0,0,0,0 ENDIF ; ; Put this ram stuff in the RAM section at the end ; LZFLG: DB 0 ; For the free space printer BLKSHF: DB 0 BLKMAX: DB 0,0 ; IF B3RTC AND NOT BYEBDOS ; If BYE3/MBYE real-time clock RTCBUF: DW 0 ; Address of RTCBUF saved here ENDIF ; IF B3RTC AND NOT (MBMXT OR BYEBDOS) TOSSAV: DW 0 ENDIF ; IF LOGCAL AND OXGATE AND (B3RTC OR RTC OR BYEBDOS) CMMACNT:DB 0 ; Comma counter ENDIF ; IF TIMEON AND CPM3 TIMEPB: DS 4 ; Storage for the system date/time ENDIF ; MINUTE: DW 0 ; Transfer time in mins for MAXTIM MEMFCB: DB ' ' ; Library name (16 bytes required) ANYET: DB 0 ; Any description typed yet? BLKSIZ: DW 0 ; Number of bytes, 128 or 1024 CONONL: DB 0 ; CTYPE console-only flag CRCFLG: DB 0 ; Sets to 'C' if checksum requested CRCVAL: DW 0 ; Current CRC value DIRSZ: DW 0 ; Directory size DRUSER: DB 0 ; Original drive/user, for return DUD: DB 0 ; Specified disk DUSAVE: DB 0,0,0,0 ; Buffer for drive/user DUU: DB 0 ; Specified user ERRCT: DB 0 ; Error count FRSTIM: DB 0 ; Turned on after first 'SOH' received INDEX: DW 0 ; Index into directory KFLAG: DB 0 ; Non-zero if sending 1K blocks OUTPTR: DW 0 RCNT: DW 0 ; Record count RCVDRV: DB 0 ; Requested drive number RCVRNO: DB 0 ; Record number received RCVUSR: DB 0 ; Requested user number RECDNO: DW 0 ; Current record number KIND: DB 0 ; Asks what kind of file this is OLDDRV: DB 0 ; Save the original drive number OLDUSR: DB 0 ; Save the original user number OPTSAV: DB 0 ; Save option here for carrier loss PRVTFL: DB 0 ; Private user area option flag MSGFLG: DB 0 ; Message upload flag SAVEHL: DW 0 ; Saves TBUF command line address TOTERR: DW 0 ; Total errors for transmission attempt VRECNO: DW 0 ; Virtual record # in 128 byte records CPUMHZ: DB MHZ ; WBW: CPU speed in MHz RCVSCL: DW SCL ; WBW: Recv loop scalar ; EOFLG: DB 0 ; 'EOF' flag (1=yes) EOFCTR: DB 0 ; EOF send counter OUTADR: DW LOGBUF OUTSIZ: DW BSIZE RECPTR: DW DBUF RECNBF: DW 0 ; Number of records in the buffer ; IF CONFUN AND SYSABT SYSABF: DB 0 ; set if sysop uses ^X to abort ENDIF ; IF (DESCRIB OR MBDESC) AND NDESC NDSCFL: DB 0 ; Used to store "RN" option ENDIF ; to bypass upload descriptions ; IF DESCRIB HLINE: DB '-------------------',CR,LF OLINE: DS 80 ; Temporary buffer to store line ENDIF ; DS 80 ; Minimum stack area ; ; Disk buffer ; ORG ($+127)/128*128 ; DBUF EQU $ ; 16-record disk buffer STACK EQU DBUF-2 ; Save original stack address LOGBUF EQU DBUF+128 ; For use with LOGCAL ; ;----------------------------------------------------------------------- ; ; BDOS equates ; ;----------------------------------------------------------------------- ; RDCON EQU 1 ; Get character from console WRCON EQU 2 ; Output to console DIRCON EQU 6 ; Direct console output PRINT EQU 9 ; Print string function VERNO EQU 12 ; Get CP/M version number SELDSK EQU 14 ; Select drive OPEN EQU 15 ; 0FFH = not found CLOSE EQU 16 ; " " SRCHF EQU 17 ; " " SRCHN EQU 18 ; " " DELET EQU 19 ; Delete file READ EQU 20 ; 0=OK, 1=EOF WRITE EQU 21 ; 0=OK, 1=ERR, 2=?, 0FFH=no dir. space MAKE EQU 22 ; 0FFH=bad RENAME EQU 23 ; Rename a file CURDRV EQU 25 ; Get current drive SETDMA EQU 26 ; Set DMA SETATT EQU 30 ; Set file attributes SETUSR EQU 32 ; Set user area to receive file RRDM EQU 33 ; Read random WRDM EQU 34 ; Write random CFSIZE EQU 35 ; Compute file size SETRRD EQU 36 ; Set random record GETTIM EQU 105 ; CP/M Plus get date/time BDOS EQU 0005H TBUF EQU 0080H ; Default DMA address FCB EQU 005CH ; System FCB FCBEXT EQU FCB+12 ; File extent FCBRNO EQU FCB+32 ; Record number RANDOM EQU FCB+33 ; Random record field ; ; Extended BYEBDOS equates ; IF BYEBDOS BDMIST EQU 61 ; Modem raw input status BDMOST EQU 62 ; Modem raw output status BDMOUT EQU 63 ; Modem output 8 bit char BDMINP EQU 64 ; Modem input 8 bit char BDCSTA EQU 65 ; Modem carrier status BDCONS EQU 66 ; Local console input status BDCONI EQU 67 ; Local console input char BDCONO EQU 68 ; Local console output char BDMXDR EQU 69 ; Set/get maximum drive BDMXUS EQU 70 ; Set/get maximum user area BDNULL EQU 72 ; Set/get nulls BDTOUT EQU 71 ; Set/get idle timeout BDULCS EQU 73 ; Set/get upperlowercase switch BDLFMS EQU 74 ; Set/get line-feed mask BDHRDL EQU 76 ; Set/get hardlog BDWRTL EQU 75 ; Set/get writeloc BDMDMO EQU 77 ; Set/get mdmoff flag BDBELL EQU 78 ; Set/get bell mask flag BDGRTC EQU 79 ; Get address of rtc buffer BDGLCB EQU 80 ; Get address of lc buffer BDSTOS EQU 81 ; Maximum time on system BDSLGT EQU 82 ; Set login time BDPTOS EQU 83 ; Print Time on System ENDIF ; BYEBDOS ; END 
programs/oeis/076/A076826.asm
karttu/loda
0
172398
; A076826: a(n) = 2*(Sum_{k=0..n} A010060(k)) - n, where A010060 is a Thue-Morse sequence. ; 0,1,2,1,2,1,0,1,2,1,0,1,0,1,2,1,2,1,0,1,0,1,2,1,0,1,2,1,2,1,0,1,2,1,0,1,0,1,2,1,0,1,2,1,2,1,0,1,0,1,2,1,2,1,0,1,2,1,0,1,0,1,2,1,2,1,0,1,0,1,2,1,0,1,2,1,2,1,0,1,0,1,2,1,2,1,0,1,2,1,0,1,0,1,2,1,0,1,2,1,2,1,0,1,2,1,0,1,0,1,2,1,2,1,0,1,0,1,2,1,0,1,2,1,2,1,0,1,2,1,0,1,0,1,2,1,0,1,2,1,2,1,0,1,0,1,2,1,2,1,0,1,2,1,0,1,0,1,2,1,0,1,2,1,2,1,0,1,2,1,0,1,0,1,2,1,2,1,0,1,0,1,2,1,0,1,2,1,2,1,0,1,0,1,2,1,2,1,0,1,2,1,0,1,0,1,2,1,2,1,0,1,0,1,2,1,0,1,2,1,2,1,0,1,2,1,0,1,0,1,2,1,0,1,2,1,2,1,0,1,0,1,2,1,2,1,0,1,2,1 mov $1,$0 cal $0,115384 ; Partial sums of Thue-Morse numbers A010060. add $2,$1 mov $1,0 add $2,2 mov $3,$0 mul $3,2 sub $3,$2 add $1,$3 add $1,2
programs/oeis/073/A073216.asm
neoneye/loda
22
177858
; A073216: The terms of A055235 (sums of two powers of 3) divided by 2. ; 1,2,3,5,6,9,14,15,18,27,41,42,45,54,81,122,123,126,135,162,243,365,366,369,378,405,486,729,1094,1095,1098,1107,1134,1215,1458,2187 seq $0,131437 ; (A000012 * A131436) + (A131436 * A000012) - A000012. mul $0,2 seq $0,32924 ; Numbers whose ternary expansion contains no 0. div $0,9 add $0,1
alloy4fun_models/trashltl/models/4/JuQ6ArYLBpt4CmjBe.als
Kaixi26/org.alloytools.alloy
0
1128
open main pred idJuQ6ArYLBpt4CmjBe_prop5 { always some f : File | eventually f not in File } pred __repair { idJuQ6ArYLBpt4CmjBe_prop5 } check __repair { idJuQ6ArYLBpt4CmjBe_prop5 <=> prop5o }
alloy4fun_models/trashltl/models/15/rwrGXzkvYiAWb8iNW.als
Kaixi26/org.alloytools.alloy
0
3347
<filename>alloy4fun_models/trashltl/models/15/rwrGXzkvYiAWb8iNW.als<gh_stars>0 open main pred idrwrGXzkvYiAWb8iNW_prop16 { always ((some Protected) implies (historically some Protected)) } pred __repair { idrwrGXzkvYiAWb8iNW_prop16 } check __repair { idrwrGXzkvYiAWb8iNW_prop16 <=> prop16o }
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_833.asm
ljhsiun2/medusa
9
247886
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_WT_ht+0x19b9e, %rdi nop nop nop nop add %r14, %r14 mov $0x6162636465666768, %rax movq %rax, %xmm0 and $0xffffffffffffffc0, %rdi movaps %xmm0, (%rdi) nop xor %r14, %r14 lea addresses_normal_ht+0x626, %r13 nop nop nop nop nop sub $53871, %rcx movb $0x61, (%r13) nop nop nop and %rax, %rax lea addresses_UC_ht+0x64a6, %rsi lea addresses_WT_ht+0x17ca6, %rdi nop nop nop nop nop cmp %r14, %r14 mov $0, %rcx rep movsq nop nop nop nop cmp $56045, %r13 lea addresses_UC_ht+0x15fa6, %rsi lea addresses_normal_ht+0x2b26, %rdi clflush (%rsi) nop nop nop nop nop xor %rax, %rax mov $13, %rcx rep movsb nop nop nop add $58895, %rdi lea addresses_normal_ht+0x64a6, %rsi lea addresses_WT_ht+0x8796, %rdi nop nop nop cmp %r14, %r14 mov $23, %rcx rep movsw nop nop nop nop cmp %rcx, %rcx lea addresses_WT_ht+0x72a6, %rsi lea addresses_A_ht+0x98de, %rdi cmp $11385, %r15 mov $109, %rcx rep movsb nop nop nop inc %r13 lea addresses_WT_ht+0x28a6, %rax nop nop sub %rdi, %rdi movw $0x6162, (%rax) nop nop add %rdi, %rdi lea addresses_UC_ht+0x10aa6, %rdi add $49729, %r14 movl $0x61626364, (%rdi) nop nop nop nop nop xor $22300, %r13 lea addresses_A_ht+0x1aca6, %r15 nop sub $41547, %rax mov $0x6162636465666768, %rdi movq %rdi, %xmm4 and $0xffffffffffffffc0, %r15 movntdq %xmm4, (%r15) nop nop nop nop nop dec %rdi lea addresses_WC_ht+0x1c266, %rsi lea addresses_D_ht+0x17855, %rdi nop nop nop and %rbp, %rbp mov $14, %rcx rep movsb nop nop inc %rbp pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r8 push %r9 push %rbp push %rbx push %rcx // Faulty Load lea addresses_PSE+0x14a6, %rbp nop nop nop cmp $35404, %r8 vmovups (%rbp), %ymm4 vextracti128 $0, %ymm4, %xmm4 vpextrq $1, %xmm4, %rcx lea oracles, %r9 and $0xff, %rcx shlq $12, %rcx mov (%r9,%rcx,1), %rcx pop %rcx pop %rbx pop %rbp pop %r9 pop %r8 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_PSE', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} [Faulty Load] {'src': {'type': 'addresses_PSE', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 3, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 1, 'congruent': 6, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': True}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 2, 'congruent': 10, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_A_ht', 'same': False, 'size': 16, 'congruent': 11, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_WC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'} {'33': 21829} 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 */
cs61/assn6.asm
bmoya217/ucr
0
166800
;================================================= ; Name: <NAME> ; Username: <EMAIL> ; ; Assignment name: assn1 ; Lab section: 021 ; TA: <NAME> ; ; I hereby certify that I have not recieved ; assistance on this assignment, or used code, from ; ANY outside source other than the instuction team. ; ;================================================= .ORIG x3000 ; Program begins here ;Instructions LD R5, ASCII_UP LD R6, BUSYNESS_POINTER ;THESE WILL REMAIN UNCHANGED TOP JSR MENU_3200 ADD R1,R1,#-1 BRz CHOICE_1 ADD R1,R1,#-1 BRz CHOICE_2 ADD R1,R1,#-1 BRz CHOICE_3 ADD R1,R1,#-1 BRz CHOICE_4 ADD R1,R1,#-1 BRz CHOICE_5 ADD R1,R1,#-1 BRz CHOICE_6 BR QUIT CHOICE_1 LDR R0,R6,#1 JSRR R0 AND R2,R2,R2 BRp YEAH BR NAH CHOICE_2 LDR R0,R6,#2 JSRR R0 AND R2,R2,R2 BRp YEAH_2 BR NAH_2 CHOICE_3 LDR R0,R6,#3 JSRR R0 LEA R0, BUSY_MACHINES PUTS LDR R0,R6,#8 JSRR R0 LEA R0, BUSY_MACHINES_2 PUTS BR TOP CHOICE_4 LDR R0,R6,#4 JSRR R0 LEA R0, BUSY_MACHINES PUTS LDR R0,R6,#8 JSRR R0 LEA R0, FREE_MACHINES_2 PUTS BR TOP CHOICE_5 LDR R0,R6,#7 JSRR R0 LDR R0,R6,#5 JSRR R0 AND R2,R2,R2 BRz BUSY_0 BR FREE_0 CHOICE_6 LDR R0,R6,#6 JSRR R0 AND R1,R2,R2 BRn LOST BR FOUND YEAH_2 AND R2,R1,R1 LEA R0, ALL PUTS LEA R0, ARE_FREE PUTS BR TOP NAH_2 AND R2,R1,R1 LEA R0, NOT_ALL PUTS LEA R0, ARE_FREE PUTS BR TOP YEAH AND R2,R1,R1 LEA R0, ALL PUTS LEA R0, ARE_BUSY PUTS BR TOP NAH AND R2,R1,R1 LEA R0, NOT_ALL PUTS LEA R0, ARE_BUSY PUTS BR TOP FREE_0 LEA R0, FREE PUTS AND R2,R1,R1 LDR R0,R6,#8 JSRR R0 LEA R0, FREE_2 PUTS BR TOP BUSY_0 LEA R0, FREE PUTS AND R2,R1,R1 LDR R0,R6,#8 JSRR R0 LEA R0, BUSY_2 PUTS BR TOP LOST LEA R0, FIRST_0 PUTS BR TOP FOUND LEA R0, FIRST_1 PUTS LDR R0,R6,#8 JSRR R0 LD R0, NEWLINE OUT BR TOP QUIT LEA R0, GOODBYE PUTS HALT ;Data BUSYNESS_POINTER .FILL x5000 ASCII_UP .FILL #48 NEWLINE .FILL #10 ALL .STRINGZ "All" NOT_ALL .STRINGZ "Not all" ARE_FREE .STRINGZ " machines are free\n" ARE_BUSY .STRINGZ " machines are busy\n" BUSY_MACHINES .STRINGZ "There are " BUSY_MACHINES_2 .STRINGZ " busy machines\n" FREE_MACHINES_2 .STRINGZ " free machines\n" FREE .STRINGZ "Machine " FREE_2 .STRINGZ " is free\n" BUSY_2 .STRINGZ " is busy\n" FIRST_0 .STRINGZ "No machines are free\n" ;//fixme ADD NEWLINE AFTER NUMBER FIRST_1 .STRINGZ "The first available machine is number " GOODBYE .STRINGZ "Goodbye!\n" ;------------------------------------------------------------------------------- ; Subroutine: MENU ; Inputs: None ; Postcondition: The subroutine has printed out a menu with numerical options, allowed the ; user to select an option, and returned the selected option. ; Return Value (R1): The option selected: #1, #2, #3, #4, #5, #6 or #7 ; no other return value is possible ;------------------------------------------------------------------------------- .ORIG x3200 MENU_3200 ;Instructions ST R7, R7_3200 RESTART_3200 LD R1, ASCII_DOWN LEA R0, MENU_PROMPT ;GET INPUT PUTS GETC ADD R7,R0,#-10 BRz ERROR_3200 OUT ADD R1,R1,R0 ;CHECK INPUT BRnz ERROR_3200 ADD R7,R1,#-7 BRnz FINISH_3200 ERROR_3200 LEA R0, MENU_ERROR_MESSAGE PUTS BR RESTART_3200 FINISH_3200 LD R0, TENNNN OUT AND R0,R0,#0 LD R7, R7_3200 RET ;Subroutine data R7_3200 .BLKW #1 ASCII_DOWN .FILL #-48 TENNNN .FILL #10 MENU_ERROR_MESSAGE .STRINGZ "\nINVALID INPUT\n" MENU_PROMPT .STRINGZ "***********************\n* The Busyness Server *\n***********************\n1. Check to see whether all machines are busy\n2. Check to see whether all machines are free\n3. Report the number of busy machines\n4. Report the number of free machines\n5. Report the status of machine n\n6. Report the number of the first available machine\n7. Quit\n" ;------------------------------------------------------------------------------- ; Subroutine: ALL_MACHINES_BUSY ; Inputs: None ; Postcondition: The subroutine has returned a value indicating whether all machines are busy ; Return value (R2): 1 if all machines are busy, 0 otherwise ;------------------------------------------------------------------------------- .ORIG x3400 ALL_MACHINES_BUSY_3400 ;Instructions ST R7, R7_3400 AND R2,R2,#0 LDR R1,R6,#0 BRnp NOT_BUSY_3400 ADD R2,R2,#1 NOT_BUSY_3400 RET ;Subroutine data R7_3400 .BLKW #1 ;------------------------------------------------------------------------------- ; Subroutine: ALL_MACHINES_FREE ; Inputs: None ; Postcondition: The subroutine has returned a value indicating whether all machines are free ; Return value (R2): 1 if all machines are free, 0 otherwise ;------------------------------------------------------------------------------- .ORIG x3600 ALL_MACHINES_FREE_3600 ;Instructions ST R7, R7_3600 LDR R1,R6,#0 ADD R1,R1,#1 BRnp NOT_FREE_3600 ADD R2,R2,#1 NOT_FREE_3600 AND R1,R1,#0 LD R7,R7_3600 RET ;Subroutine data R7_3600 .BLKW #1 ;------------------------------------------------------------------------------- ; Subroutine: NUM_BUSY_MACHINES ; Inputs: None ; Postcondition: The subroutine has returned the number of busy machines. ; Return Value (R2): The number of machines that are busy ;------------------------------------------------------------------------------- .ORIG x3800 NUM_BUSY_MACHINES_3800 ;Instructions ST R7, R7_3800 AND R2,R2,#0 ADD R0,R2,#15 LDR R1,R6,#0 BRn LOOP_3800 ADD R2,R2,#1 LOOP_3800 ;IF R1 IS EVER POSITIVE THEN R2++ ADD R1,R1,R1 ;BECAUSE THAT MEANS THAT ITS BUSY BRn SKIP_3800 ADD R2,R2,#1 SKIP_3800 ADD R0,R0,#-1 BRp LOOP_3800 AND R1,R1,#0 LD R7,R7_3800 RET ;Subroutine data R7_3800 .BLKW #1 ;------------------------------------------------------------------------------- ; Subroutine: NUM_FREE_MACHINES ; Inputs: None ; Postcondition: The subroutine has returned the number of free machines ; Return Value (R2): The number of machines that are free ;------------------------------------------------------------------------------- .ORIG x3A00 NUM_FREE_MACHINES_3A00 ;Instructions ST R7, R7_3A00 JSR NUM_BUSY_MACHINES_3800 ;SUBTRACTS 16 AND NBMs TO GET THE FREE MACHINES ADD R2,R2,#-16 ;eg. 5-16=-11 NOT R2,R2 ; !-11=10 ADD R2,R2,#1 ; 10+1=11 LD R7,R7_3A00 RET ;Subroutine data R7_3A00 .BLKW #1 ;------------------------------------------------------------------------------- ; Subroutine: MACHINE_STATUS ; Input (R1): Which machine to check ; Postcondition: The subroutine has returned a value indicating whether the machine indicated ; by (R1) is busy or not. ; Return Value (R2): 0 if machine (R1) is busy, 1 if it is free ;------------------------------------------------------------------------------- .ORIG x3C00 MACHINE_STATUS_3C00 ;Instructions ST R1, R1_3C00 ST R7, R7_3C00 LDR R3,R6,#0 AND R2,R2,#0 ADD R1,R1,#-15 ;HOW MANY TIMES TO LEFT SHIFT NOT R1,R1 ADD R1,R1,#1 BRp LOOP_3C00 AND R3,R3,R3 BRzp FINISH_3C00 ADD R2,R2,#1 BR FINISH_3C00 LOOP_3C00 ADD R3,R3,R3 ADD R1,R1,#-1 BRp LOOP_3C00 AND R3,R3,R3 BRzp FINISH_3C00 ADD R2,R2,#1 FINISH_3C00 AND R1,R1,#0 AND R3,R3,#0 LD R1, R1_3C00 LD R7, R7_3C00 RET ;Subroutine data R1_3C00 .BLKW #1 R7_3C00 .BLKW #1 ;------------------------------------------------------------------------------- ; Subroutine: FIRST_FREE ; Inputs: None ; Postcondition: ; The subroutine has returned a value indicating the lowest numbered free machine ; Return Value (R2): the number of the free machine ;------------------------------------------------------------------------------- .ORIG x3E00 FIRST_FREE_3E00 ;Instructions ST R7, R7_3E00 AND R2,R2,#0 ADD R2,R2,#-1 ADD R0,R2,#15 LDR R1,R6,#0 BRzp LOOP_3E00 AND R2,R0,R0 LOOP_3E00 ;IF R1 IS EVER NEG THEN R2 <= (R0) ADD R1,R1,R1 ;BECAUSE THAT MEANS THAT ITS FREE BRzp SKIP_3E00 AND R2,R0,R0 SKIP_3E00 ADD R0,R0,#-1 BRzp LOOP_3E00 AND R1,R1,#0 LD R7,R7_3E00 RET ;Subroutine data R7_3E00 .BLKW #1 ;------------------------------------------------------------------------------- ; Subroutine: Get input ; Inputs: None ; Postcondition: ; The subroutine get up to a 5 digit input from the user within the range [-32768,32767] ; Return Value (R1): The value of the contructed input ; NOTE: This subroutine should be the same as the one that you did in assignment 5 ; to get input from the user, except the prompt is different. ;------------------------------------------------------------------------------- .ORIG x4000 GET_INPUT_4000 ST R2, R2_4000 ST R5, R5_4000 ST R6, R6_4000 ST R7, R7_4000 ;STORES R7,R2 VALUES FOR BACKUP LD R3, ONE_CHECK START AND R1,R1,#0 ;RESETS VALUES AND R4,R4,#0 ;SIGN CHECK ADD R5,R4,#-1 AND R6,R6,#0 ;NUM CHECK FOR ENTER LEA R0, PROMPT ;OUPUTS PROMPT PUTS GET_INPUT ;GETS INPUT AND CONVERTS IT TO A SINGLE NUMBER IN R1 GETC OUT AND R6,R6,R6 BRp NOT_FIRST LD R7, PLUS ADD R7,R7,R0 BRz SIGN LD R7, MINUS ADD R7,R7,R0 BRz NEGATIVE BR NOT_FIRST SIGN ADD R5,R5,#1 BRp ERROR BR GET_INPUT NOT_FIRST ADD R7,R0,#-10 ;CHECKS FOR ENTER BRnp NOT_ENTER AND R6,R6,R6 BRz ERROR_2 AND R4,R4,R4 BRp ERROR_2 BR FINISH NOT_ENTER ADD R0,R0,R3 ;CHECKS FOR < 0 BRn ERROR ADD R7,R0,#-9 ;CHECKS FOR > 9 BRp ERROR ADD R6,R1,#0 ;SETS R6 TO R0 FOR MULTIPLICATION LD R2, NINE INNER ;MULTIPLIES BY 10 ADD R1,R1,R6 BRn ERROR ADD R2,R2,#-1 BRp INNER ADD R1,R1,R0 ;ADDS THE NEXT NUMBER TO PRODUCT ADD R7,R1,#-16 BRzp ERROR ADD R6,R6,#1 BR GET_INPUT ERROR ;ERROR OUTPUT/RE-ASK FOR NUMBERS AND R0,R0,#0 ADD R0,R0,#10 OUT ERROR_2 LEA R0, WRONG PUTS BR START NEGATIVE ADD R4,R4,#1 BR SIGN FINISH LD R2, R2_4000 LD R5, R5_4000 LD R6, R6_4000 LD R7, R7_4000 ;RESETS VAULES RET ;Subroutine data R2_4000 .BLKW #1 R5_4000 .BLKW #1 R6_4000 .BLKW #1 R7_4000 .BLKW #1 PLUS .FILL #-43 MINUS .FILL #-45 ENTER .FILL #-10 ONE_CHECK .FILL #-48 ;TEST IF CHAR IS POSITIVE AFTER NINE .FILL #9 PROMPT .STRINGZ "Enter which machine you want the status of (0 - 15), followed by ENTER: " WRONG .STRINGZ "ERROR INVALID INPUT\n" ;------------------------------------------------------------------------------- ; Subroutine: print number ; Inputs: ; Postcondition: ; The subroutine prints the number that is in R2 ; Return Value : ; NOTE: This subroutine should be the same as the one that you did in assignment 5 ; to print the number to the user WITHOUT leading 0's and DOES NOT output the '+' ; for positive numbers. ;------------------------------------------------------------------------------- .orig x4200 PRINT_NUM_4200 ;Instructions ST R7, R7_4200 ADD R7,R2,#-10 BRn LESSTHANTEN ADD R0,R5,#1 OUT ADD R2,R2,#-10 LESSTHANTEN ADD R0,R2,R5 OUT LD R7, R7_4200 RET ;Instructions R7_4200 .BLKW #1 ;STORES R7,R5,R2 VALUES FOR BACKUP ;------------------------------------------------------------------------------- ;Remote data .ORIG x5000 ; Remote data BUSYNESS .FILL xABCD ; <----!!!VALUE FOR BUSYNESS VECTOR!!! SUBROUTINE_POINTER_1 .FILL x3400 SUBROUTINE_POINTER_2 .FILL x3600 SUBROUTINE_POINTER_3 .FILL x3800 SUBROUTINE_POINTER_4 .FILL x3A00 SUBROUTINE_POINTER_5 .FILL x3C00 SUBROUTINE_POINTER_6 .FILL x3E00 SUBROUTINE_POINTER_7 .FILL x4000 SUBROUTINE_POINTER_8 .FILL x4200 .END
ITS_Assembler/testSt.asm
RobertGageStroud/Portfolio
0
169674
<filename>ITS_Assembler/testSt.asm ;Test file for assembly of the ST instruction ;This is a comment .orig xA000 st R0, L9 st R1, L8 st R2, L7 st R3, L6 st R4, L5 st R5, L4 st R6, L3 st R7, L2 st R0, L1 st R1, L0 L0 .fill 0 L1 .fill 0 L2 .fill 0 L3 .fill 0 L4 .fill 0 L5 .fill 0 L6 .fill 0 L7 .fill 0 L8 .fill 0 L9 .fill 0 .END
libsrc/_DEVELOPMENT/font/fzx/fonts/kk/_ff_kk_MagdalenaLatin1.asm
jpoikela/z88dk
640
90501
SECTION rodata_font SECTION rodata_font_fzx PUBLIC _ff_kk_MagdalenaLatin1 _ff_kk_MagdalenaLatin1: BINARY "font/fzx/fonts/kk/Magdalena_Latin1.fzx"
Task/Loops-Foreach/Ada/loops-foreach-1.ada
LaudateCorpus1/RosettaCodeData
1
9799
<reponame>LaudateCorpus1/RosettaCodeData with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure For_Each is A : array (1..5) of Integer := (-1, 0, 1, 2, 3); begin for Num in A'Range loop Put( A (Num) ); end loop; end For_Each;
programs/oeis/225/A225569.asm
karttu/loda
0
102638
<reponame>karttu/loda ; A225569: Decimal expansion of Sum_{n>=0} 1/10^(3^n), a transcendental number. ; 1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 cal $0,38502 ; Remove 3's from n. lpb $0,1 mul $0,2 mov $1,$0 sub $0,2 lpe div $1,2
src/ordinal.agda
shinji-kono/zf-in-agda
5
11160
<reponame>shinji-kono/zf-in-agda<filename>src/ordinal.agda open import Level module ordinal where open import logic open import nat open import Data.Nat renaming ( zero to Zero ; suc to Suc ; ℕ to Nat ; _⊔_ to _n⊔_ ) open import Data.Empty open import Relation.Binary.PropositionalEquality open import Relation.Binary.Definitions open import Data.Nat.Properties open import Relation.Nullary open import Relation.Binary.Core ---- -- -- Countable Ordinals -- data OrdinalD {n : Level} : (lv : Nat) → Set n where Φ : (lv : Nat) → OrdinalD lv OSuc : (lv : Nat) → OrdinalD {n} lv → OrdinalD lv record Ordinal {n : Level} : Set n where constructor ordinal field lv : Nat ord : OrdinalD {n} lv data _d<_ {n : Level} : {lx ly : Nat} → OrdinalD {n} lx → OrdinalD {n} ly → Set n where Φ< : {lx : Nat} → {x : OrdinalD {n} lx} → Φ lx d< OSuc lx x s< : {lx : Nat} → {x y : OrdinalD {n} lx} → x d< y → OSuc lx x d< OSuc lx y open Ordinal _o<_ : {n : Level} ( x y : Ordinal ) → Set n _o<_ x y = (lv x < lv y ) ∨ ( ord x d< ord y ) s<refl : {n : Level } {lx : Nat } { x : OrdinalD {n} lx } → x d< OSuc lx x s<refl {n} {lv} {Φ lv} = Φ< s<refl {n} {lv} {OSuc lv x} = s< s<refl trio<> : {n : Level} → {lx : Nat} {x : OrdinalD {n} lx } { y : OrdinalD lx } → y d< x → x d< y → ⊥ trio<> {n} {lx} {.(OSuc lx _)} {.(OSuc lx _)} (s< s) (s< t) = trio<> s t trio<> {n} {lx} {.(OSuc lx _)} {.(Φ lx)} Φ< () d<→lv : {n : Level} {x y : Ordinal {n}} → ord x d< ord y → lv x ≡ lv y d<→lv Φ< = refl d<→lv (s< lt) = refl o∅ : {n : Level} → Ordinal {n} o∅ = record { lv = Zero ; ord = Φ Zero } open import Relation.Binary.HeterogeneousEquality using (_≅_;refl) ordinal-cong : {n : Level} {x y : Ordinal {n}} → lv x ≡ lv y → ord x ≅ ord y → x ≡ y ordinal-cong refl refl = refl ≡→¬d< : {n : Level} → {lv : Nat} → {x : OrdinalD {n} lv } → x d< x → ⊥ ≡→¬d< {n} {lx} {OSuc lx y} (s< t) = ≡→¬d< t trio<≡ : {n : Level} → {lx : Nat} {x : OrdinalD {n} lx } { y : OrdinalD lx } → x ≡ y → x d< y → ⊥ trio<≡ refl = ≡→¬d< trio>≡ : {n : Level} → {lx : Nat} {x : OrdinalD {n} lx } { y : OrdinalD lx } → x ≡ y → y d< x → ⊥ trio>≡ refl = ≡→¬d< triOrdd : {n : Level} → {lx : Nat} → Trichotomous _≡_ ( _d<_ {n} {lx} {lx} ) triOrdd {_} {lv} (Φ lv) (Φ lv) = tri≈ ≡→¬d< refl ≡→¬d< triOrdd {_} {lv} (Φ lv) (OSuc lv y) = tri< Φ< (λ ()) ( λ lt → trio<> lt Φ< ) triOrdd {_} {lv} (OSuc lv x) (Φ lv) = tri> (λ lt → trio<> lt Φ<) (λ ()) Φ< triOrdd {_} {lv} (OSuc lv x) (OSuc lv y) with triOrdd x y triOrdd {_} {lv} (OSuc lv x) (OSuc lv y) | tri< a ¬b ¬c = tri< (s< a) (λ tx=ty → trio<≡ tx=ty (s< a) ) ( λ lt → trio<> lt (s< a) ) triOrdd {_} {lv} (OSuc lv x) (OSuc lv x) | tri≈ ¬a refl ¬c = tri≈ ≡→¬d< refl ≡→¬d< triOrdd {_} {lv} (OSuc lv x) (OSuc lv y) | tri> ¬a ¬b c = tri> ( λ lt → trio<> lt (s< c) ) (λ tx=ty → trio>≡ tx=ty (s< c) ) (s< c) osuc : {n : Level} ( x : Ordinal {n} ) → Ordinal {n} osuc record { lv = lx ; ord = ox } = record { lv = lx ; ord = OSuc lx ox } <-osuc : {n : Level} { x : Ordinal {n} } → x o< osuc x <-osuc {n} {record { lv = lx ; ord = Φ .lx }} = case2 Φ< <-osuc {n} {record { lv = lx ; ord = OSuc .lx ox }} = case2 ( s< s<refl ) o<¬≡ : {n : Level } { ox oy : Ordinal {suc n}} → ox ≡ oy → ox o< oy → ⊥ o<¬≡ {_} {ox} {ox} refl (case1 lt) = =→¬< lt o<¬≡ {_} {ox} {ox} refl (case2 (s< lt)) = trio<≡ refl lt ¬x<0 : {n : Level} → { x : Ordinal {suc n} } → ¬ ( x o< o∅ {suc n} ) ¬x<0 {n} {x} (case1 ()) ¬x<0 {n} {x} (case2 ()) o<> : {n : Level} → {x y : Ordinal {n} } → y o< x → x o< y → ⊥ o<> {n} {x} {y} (case1 x₁) (case1 x₂) = nat-<> x₁ x₂ o<> {n} {x} {y} (case1 x₁) (case2 x₂) = nat-≡< (sym (d<→lv x₂)) x₁ o<> {n} {x} {y} (case2 x₁) (case1 x₂) = nat-≡< (sym (d<→lv x₁)) x₂ o<> {n} {record { lv = lv₁ ; ord = .(OSuc lv₁ _) }} {record { lv = .lv₁ ; ord = .(Φ lv₁) }} (case2 Φ<) (case2 ()) o<> {n} {record { lv = lv₁ ; ord = .(OSuc lv₁ _) }} {record { lv = .lv₁ ; ord = .(OSuc lv₁ _) }} (case2 (s< y<x)) (case2 (s< x<y)) = o<> (case2 y<x) (case2 x<y) orddtrans : {n : Level} {lx : Nat} {x y z : OrdinalD {n} lx } → x d< y → y d< z → x d< z orddtrans {_} {lx} {.(Φ lx)} {.(OSuc lx _)} {.(OSuc lx _)} Φ< (s< y<z) = Φ< orddtrans {_} {lx} {.(OSuc lx _)} {.(OSuc lx _)} {.(OSuc lx _)} (s< x<y) (s< y<z) = s< ( orddtrans x<y y<z ) osuc-≡< : {n : Level} { a x : Ordinal {n} } → x o< osuc a → (x ≡ a ) ∨ (x o< a) osuc-≡< {n} {a} {x} (case1 lt) = case2 (case1 lt) osuc-≡< {n} {record { lv = lv₁ ; ord = Φ .lv₁ }} {record { lv = .lv₁ ; ord = .(Φ lv₁) }} (case2 Φ<) = case1 refl osuc-≡< {n} {record { lv = lv₁ ; ord = OSuc .lv₁ ord₁ }} {record { lv = .lv₁ ; ord = .(Φ lv₁) }} (case2 Φ<) = case2 (case2 Φ<) osuc-≡< {n} {record { lv = lv₁ ; ord = Φ .lv₁ }} {record { lv = .lv₁ ; ord = .(OSuc lv₁ _) }} (case2 (s< ())) osuc-≡< {n} {record { lv = la ; ord = OSuc la oa }} {record { lv = la ; ord = (OSuc la ox) }} (case2 (s< lt)) with osuc-≡< {n} {record { lv = la ; ord = oa }} {record { lv = la ; ord = ox }} (case2 lt ) ... | case1 refl = case1 refl ... | case2 (case2 x) = case2 (case2( s< x) ) ... | case2 (case1 x) = ⊥-elim (¬a≤a x) osuc-< : {n : Level} { x y : Ordinal {n} } → y o< osuc x → x o< y → ⊥ osuc-< {n} {x} {y} y<ox x<y with osuc-≡< y<ox osuc-< {n} {x} {x} y<ox (case1 x₁) | case1 refl = ⊥-elim (¬a≤a x₁) osuc-< {n} {x} {x} (case1 x₂) (case2 x₁) | case1 refl = ⊥-elim (¬a≤a x₂) osuc-< {n} {x} {x} (case2 x₂) (case2 x₁) | case1 refl = ≡→¬d< x₁ osuc-< {n} {x} {y} y<ox (case1 x₂) | case2 (case1 x₁) = nat-<> x₂ x₁ osuc-< {n} {x} {y} y<ox (case1 x₂) | case2 (case2 x₁) = nat-≡< (sym (d<→lv x₁)) x₂ osuc-< {n} {x} {y} y<ox (case2 x<y) | case2 y<x = o<> (case2 x<y) y<x ordtrans : {n : Level} {x y z : Ordinal {n} } → x o< y → y o< z → x o< z ordtrans {n} {x} {y} {z} (case1 x₁) (case1 x₂) = case1 ( <-trans x₁ x₂ ) ordtrans {n} {x} {y} {z} (case1 x₁) (case2 x₂) with d<→lv x₂ ... | refl = case1 x₁ ordtrans {n} {x} {y} {z} (case2 x₁) (case1 x₂) with d<→lv x₁ ... | refl = case1 x₂ ordtrans {n} {x} {y} {z} (case2 x₁) (case2 x₂) with d<→lv x₁ | d<→lv x₂ ... | refl | refl = case2 ( orddtrans x₁ x₂ ) trio< : {n : Level } → Trichotomous {suc n} _≡_ _o<_ trio< a b with <-cmp (lv a) (lv b) trio< a b | tri< a₁ ¬b ¬c = tri< (case1 a₁) (λ refl → ¬b (cong ( λ x → lv x ) refl ) ) lemma1 where lemma1 : ¬ (Suc (lv b) ≤ lv a) ∨ (ord b d< ord a) lemma1 (case1 x) = ¬c x lemma1 (case2 x) = ⊥-elim (nat-≡< (sym ( d<→lv x )) a₁ ) trio< a b | tri> ¬a ¬b c = tri> lemma1 (λ refl → ¬b (cong ( λ x → lv x ) refl ) ) (case1 c) where lemma1 : ¬ (Suc (lv a) ≤ lv b) ∨ (ord a d< ord b) lemma1 (case1 x) = ¬a x lemma1 (case2 x) = ⊥-elim (nat-≡< (sym ( d<→lv x )) c ) trio< a b | tri≈ ¬a refl ¬c with triOrdd ( ord a ) ( ord b ) trio< record { lv = .(lv b) ; ord = x } b | tri≈ ¬a refl ¬c | tri< a ¬b ¬c₁ = tri< (case2 a) (λ refl → ¬b (lemma1 refl )) lemma2 where lemma1 : (record { lv = _ ; ord = x }) ≡ b → x ≡ ord b lemma1 refl = refl lemma2 : ¬ (Suc (lv b) ≤ lv b) ∨ (ord b d< x) lemma2 (case1 x) = ¬a x lemma2 (case2 x) = trio<> x a trio< record { lv = .(lv b) ; ord = x } b | tri≈ ¬a refl ¬c | tri> ¬a₁ ¬b c = tri> lemma2 (λ refl → ¬b (lemma1 refl )) (case2 c) where lemma1 : (record { lv = _ ; ord = x }) ≡ b → x ≡ ord b lemma1 refl = refl lemma2 : ¬ (Suc (lv b) ≤ lv b) ∨ (x d< ord b) lemma2 (case1 x) = ¬a x lemma2 (case2 x) = trio<> x c trio< record { lv = .(lv b) ; ord = x } b | tri≈ ¬a refl ¬c | tri≈ ¬a₁ refl ¬c₁ = tri≈ lemma1 refl lemma1 where lemma1 : ¬ (Suc (lv b) ≤ lv b) ∨ (ord b d< ord b) lemma1 (case1 x) = ¬a x lemma1 (case2 x) = ≡→¬d< x open _∧_ TransFinite : {n m : Level} → { ψ : Ordinal {suc n} → Set m } → ( ∀ (lx : Nat ) → ( (x : Ordinal {suc n} ) → x o< ordinal lx (Φ lx) → ψ x ) → ψ ( record { lv = lx ; ord = Φ lx } ) ) → ( ∀ (lx : Nat ) → (x : OrdinalD lx ) → ( (y : Ordinal {suc n} ) → y o< ordinal lx (OSuc lx x) → ψ y ) → ψ ( record { lv = lx ; ord = OSuc lx x } ) ) → ∀ (x : Ordinal) → ψ x TransFinite {n} {m} {ψ} caseΦ caseOSuc x = proj1 (TransFinite1 (lv x) (ord x) ) where TransFinite1 : (lx : Nat) (ox : OrdinalD lx ) → ψ (ordinal lx ox) ∧ ( ( (x : Ordinal {suc n} ) → x o< ordinal lx ox → ψ x ) ) TransFinite1 Zero (Φ 0) = ⟪ caseΦ Zero lemma , lemma1 ⟫ where lemma : (x : Ordinal) → x o< ordinal Zero (Φ Zero) → ψ x lemma x (case1 ()) lemma x (case2 ()) lemma1 : (x : Ordinal) → x o< ordinal Zero (Φ Zero) → ψ x lemma1 x (case1 ()) lemma1 x (case2 ()) TransFinite1 (Suc lx) (Φ (Suc lx)) = ⟪ caseΦ (Suc lx) (λ x → lemma (lv x) (ord x)) , (λ x → lemma (lv x) (ord x)) ⟫ where lemma0 : (ly : Nat) (oy : OrdinalD ly ) → ordinal ly oy o< ordinal lx (Φ lx) → ψ (ordinal ly oy) lemma0 ly oy lt = proj2 ( TransFinite1 lx (Φ lx) ) (ordinal ly oy) lt lemma : (ly : Nat) (oy : OrdinalD ly ) → ordinal ly oy o< ordinal (Suc lx) (Φ (Suc lx)) → ψ (ordinal ly oy) lemma lx1 ox1 (case1 lt) with <-∨ lt lemma lx (Φ lx) (case1 lt) | case1 refl = proj1 ( TransFinite1 lx (Φ lx) ) lemma lx (Φ lx) (case1 lt) | case2 lt1 = lemma0 lx (Φ lx) (case1 lt1) lemma lx (OSuc lx ox1) (case1 lt) | case1 refl = caseOSuc lx ox1 lemma2 where lemma2 : (y : Ordinal) → (Suc (lv y) ≤ lx) ∨ (ord y d< OSuc lx ox1) → ψ y lemma2 y lt1 with osuc-≡< lt1 lemma2 y lt1 | case1 refl = lemma lx ox1 (case1 a<sa) lemma2 y lt1 | case2 t = proj2 (TransFinite1 lx ox1) y t lemma lx1 (OSuc lx1 ox1) (case1 lt) | case2 lt1 = caseOSuc lx1 ox1 lemma2 where lemma2 : (y : Ordinal) → (Suc (lv y) ≤ lx1) ∨ (ord y d< OSuc lx1 ox1) → ψ y lemma2 y lt2 with osuc-≡< lt2 lemma2 y lt2 | case1 refl = lemma lx1 ox1 (ordtrans lt2 (case1 lt)) lemma2 y lt2 | case2 (case1 lt3) = proj2 (TransFinite1 lx (Φ lx)) y (case1 (<-trans lt3 lt1 )) lemma2 y lt2 | case2 (case2 lt3) with d<→lv lt3 ... | refl = proj2 (TransFinite1 lx (Φ lx)) y (case1 lt1) TransFinite1 lx (OSuc lx ox) = ⟪ caseOSuc lx ox lemma , lemma ⟫ where lemma : (y : Ordinal) → y o< ordinal lx (OSuc lx ox) → ψ y lemma y lt with osuc-≡< lt lemma y lt | case1 refl = proj1 ( TransFinite1 lx ox ) lemma y lt | case2 lt1 = proj2 ( TransFinite1 lx ox ) y lt1 -- record CountableOrdinal {n : Level} : Set (suc (suc n)) where -- field -- ctl→ : Nat → Ordinal {suc n} -- ctl← : Ordinal → Nat -- ctl-iso→ : { x : Ordinal } → ctl→ (ctl← x ) ≡ x -- ctl-iso← : { x : Nat } → ctl← (ctl→ x ) ≡ x -- -- is-C-Ordinal : {n : Level} → CountableOrdinal {n} -- is-C-Ordinal {n} = record { -- ctl→ = {!!} -- ; ctl← = λ x → TransFinite {n} (λ lx lt → Zero ) ctl01 x -- ; ctl-iso→ = {!!} -- ; ctl-iso← = {!!} -- } where -- ctl01 : (lx : Nat) (x : OrdinalD lx) → ((y : Ordinal) → y o< ordinal lx (OSuc lx x) → Nat) → Nat -- ctl01 Zero (Φ Zero) prev = Zero -- ctl01 Zero (OSuc Zero x) prev = Suc ( prev (ordinal Zero x) (ordtrans <-osuc <-osuc )) -- ctl01 (Suc lx) (Φ (Suc lx)) prev = Suc ( prev (ordinal lx {!!}) {!!}) -- ctl01 (Suc lx) (OSuc (Suc lx) x) prev = Suc ( prev (ordinal (Suc lx) x) (ordtrans <-osuc <-osuc )) open import Ordinals C-Ordinal : {n : Level} → Ordinals {suc n} C-Ordinal {n} = record { Ordinal = Ordinal {suc n} ; o∅ = o∅ ; osuc = osuc ; _o<_ = _o<_ ; next = next ; isOrdinal = record { ordtrans = ordtrans ; trio< = trio< ; ¬x<0 = ¬x<0 ; <-osuc = <-osuc ; osuc-≡< = osuc-≡< ; TransFinite = TransFinite2 ; Oprev-p = Oprev-p } ; isNext = record { x<nx = x<nx ; osuc<nx = λ {x} {y} → osuc<nx {x} {y} ; ¬nx<nx = ¬nx<nx } } where next : Ordinal {suc n} → Ordinal {suc n} next (ordinal lv ord) = ordinal (Suc lv) (Φ (Suc lv)) x<nx : { y : Ordinal } → (y o< next y ) x<nx = case1 a<sa osuc<nx : { x y : Ordinal } → x o< next y → osuc x o< next y osuc<nx (case1 lt) = case1 lt ¬nx<nx : {x y : Ordinal} → y o< x → x o< next y → ¬ ((z : Ordinal) → ¬ (x ≡ osuc z)) ¬nx<nx {x} {y} = lemma2 x where lemma2 : (x : Ordinal) → y o< x → x o< next y → ¬ ((z : Ordinal) → ¬ x ≡ osuc z) lemma2 (ordinal Zero (Φ 0)) (case2 ()) (case1 (s≤s z≤n)) not lemma2 (ordinal Zero (OSuc 0 dx)) (case2 Φ<) (case1 (s≤s z≤n)) not = not _ refl lemma2 (ordinal Zero (OSuc 0 dx)) (case2 (s< x)) (case1 (s≤s z≤n)) not = not _ refl lemma2 (ordinal (Suc lx) (OSuc (Suc lx) ox)) y<x (case1 (s≤s (s≤s lt))) not = not _ refl lemma2 (ordinal (Suc lx) (Φ (Suc lx))) (case1 x) (case1 (s≤s (s≤s lt))) not = lemma3 x lt where lemma3 : {n l : Nat} → (Suc (Suc n) ≤ Suc l) → l ≤ n → ⊥ lemma3 (s≤s sn≤l) (s≤s l≤n) = lemma3 sn≤l l≤n open Oprev Oprev-p : (x : Ordinal) → Dec ( Oprev (Ordinal {suc n}) osuc x ) Oprev-p (ordinal lv (Φ lv)) = no (λ not → lemma (oprev not) (oprev=x not) ) where lemma : (x : Ordinal) → osuc x ≡ (ordinal lv (Φ lv)) → ⊥ lemma x () Oprev-p (ordinal lv (OSuc lv ox)) = yes record { oprev = ordinal lv ox ; oprev=x = refl } ord1 : Set (suc n) ord1 = Ordinal {suc n} TransFinite2 : { ψ : ord1 → Set (suc (suc n)) } → ( (x : ord1) → ( (y : ord1 ) → y o< x → ψ y ) → ψ x ) → ∀ (x : ord1) → ψ x TransFinite2 {ψ} lt x = TransFinite {n} {suc (suc n)} {ψ} caseΦ caseOSuc x where caseΦ : (lx : Nat) → ((x₁ : Ordinal) → x₁ o< ordinal lx (Φ lx) → ψ x₁) → ψ (record { lv = lx ; ord = Φ lx }) caseΦ lx prev = lt (ordinal lx (Φ lx) ) prev caseOSuc : (lx : Nat) (x₁ : OrdinalD lx) → ((y : Ordinal) → y o< ordinal lx (OSuc lx x₁) → ψ y) → ψ (record { lv = lx ; ord = OSuc lx x₁ }) caseOSuc lx ox prev = lt (ordinal lx (OSuc lx ox)) prev
src/bootloader/stage1/disk.asm
StrBrkrs-NullException/NoolOS
5
4372
%ifndef _SOARE_DISK_ASM %define _SOARE_DISK_ASM CHS_cylinders db 0 CHS_heads db 0 CHS_sectors db 0 ;IN: ;AX = LBA ;OUT: ;CHS variables = CHS ;cylinders = LBA / (sectors per track * head count) ;heads = (LBA / sectors per track) % head count ;sectors = (LBA % sectors per track) + 1 LBA2CHS: push dx xor dx, dx div WORD [SectorsPerTrack] inc dl mov [CHS_sectors], dl xor dx, dx div WORD [HeadCount] mov [CHS_heads], dl mov [CHS_cylinders], al pop dx ret ;IN: ;AX = LBA ;DL = drive ;ES:BX = buffer segment:offset ;OUT: ;CF = 1 if error LoadSector: pusha call LBA2CHS mov ah, 2 mov al, 1 mov ch, [CHS_cylinders] mov cl, [CHS_sectors] mov dh, [CHS_heads] clc int 13h popa ret ;IN: ;AX = LBA ;CX = sector count ;DL = drive ;ES:BX = buffer segment:offset ;OUT: ;CF = 1 if error LoadSectors: pusha .readLoop: clc call LoadSector inc ax add bx, 512 jc .done loop .readLoop jmp .done .done: popa ret ;AX = cluster ;ES:BX = buffer LoadCluster: pusha sub ax, 2 add ax, [DiskDataStartLBA] mov dl, [BootDriveNum] movzx cx, BYTE [SectorsPerCluster] call LoadSectors popa ret %endif
agda/SelectSort/Everything.agda
bgbianchi/sorting
6
9129
open import Relation.Binary.Core module SelectSort.Everything {A : Set} (_≤_ : A → A → Set) (tot≤ : Total _≤_) (trans≤ : Transitive _≤_) where open import SelectSort.Correctness.Order _≤_ tot≤ trans≤ open import SelectSort.Correctness.Permutation _≤_ tot≤
PIC/ParallelCom2/ParallelCOM2.asm
MrRomo/Rbot-
1
167310
_main: ;ParallelCOM2.c,3 :: void main(){ ;ParallelCOM2.c,4 :: TRISB=0x00; CLRF TRISB+0 ;ParallelCOM2.c,5 :: PORTB=0X00; CLRF PORTB+0 ;ParallelCOM2.c,6 :: TRISC=0x00; CLRF TRISC+0 ;ParallelCOM2.c,7 :: PORTC=0X38; MOVLW 56 MOVWF PORTC+0 ;ParallelCOM2.c,8 :: delay_ms(100); MOVLW 2 MOVWF R11+0 MOVLW 4 MOVWF R12+0 MOVLW 186 MOVWF R13+0 L_main0: DECFSZ R13+0, 1 GOTO L_main0 DECFSZ R12+0, 1 GOTO L_main0 DECFSZ R11+0, 1 GOTO L_main0 NOP ;ParallelCOM2.c,9 :: while(1){ L_main1: ;ParallelCOM2.c,10 :: Transmiter = 0xf5; MOVLW 245 MOVWF PORTB+0 ;ParallelCOM2.c,11 :: delay_ms(10); MOVLW 26 MOVWF R12+0 MOVLW 248 MOVWF R13+0 L_main3: DECFSZ R13+0, 1 GOTO L_main3 DECFSZ R12+0, 1 GOTO L_main3 NOP ;ParallelCOM2.c,12 :: Data+= 1; INCF _Data+0, 1 ;ParallelCOM2.c,13 :: if(Data>=16){ MOVLW 16 SUBWF _Data+0, 0 BTFSS STATUS+0, 0 GOTO L_main4 ;ParallelCOM2.c,14 :: Data = 0; CLRF _Data+0 ;ParallelCOM2.c,15 :: } L_main4: ;ParallelCOM2.c,16 :: } GOTO L_main1 ;ParallelCOM2.c,17 :: } L_end_main: GOTO $+0 ; end of _main
src/nso-json-parameters_to_json.ads
SSOCsoft/Log_Reporter
0
21401
<reponame>SSOCsoft/Log_Reporter<gh_stars>0 Pragma Ada_2012; With Gnoga.Types; -------------------------- -- PARAMETERS_TO_JSON -- -------------------------------------------------------------------------------- -- This function takes the parameters collected from an HTML Form and returns -- -- a result of the JSON object. The parameters on the form should be indexed -- -- via square brackets, in the form of "BASE[INDEX_A][INDEX_B]" and values -- -- are text-encoded as either plain-strings or as an array of strings using -- -- the ASCII Unit_Seperator character (DEC 31, HEX 1F). -- -- -- -- NOTE: This function resets the Input to an empty map. -- -------------------------------------------------------------------------------- Function NSO.JSON.Parameters_to_JSON( Input : in out Gnoga.Types.Data_Map_Type ) return NSO.JSON.Instance'Class;
P6/data_P6/testpoint/testpoint10.asm
alxzzhou/BUAA_CO_2020
1
4141
<reponame>alxzzhou/BUAA_CO_2020 ori $1, $0, 1 ori $2, $0, 6 ori $3, $0, 0 ori $4, $0, 3 sw $3, 0($0) sw $3, 4($0) sw $3, 8($0) sw $1, 12($0) sw $2, 16($0) sw $2, 20($0) sw $3, 24($0) sw $1, 28($0) sw $1, 32($0) sw $3, 36($0) sw $3, 40($0) sw $4, 44($0) sw $4, 48($0) sw $2, 52($0) sw $4, 56($0) sw $1, 60($0) sw $4, 64($0) sw $1, 68($0) sw $3, 72($0) sw $2, 76($0) sw $4, 80($0) sw $1, 84($0) sw $3, 88($0) sw $1, 92($0) sw $1, 96($0) sw $1, 100($0) sw $2, 104($0) sw $1, 108($0) sw $3, 112($0) sw $1, 116($0) sw $1, 120($0) sw $4, 124($0) andi $1, $2, 14 lui $3, 12 mflo $1 blez $1, TAG1 TAG1: multu $1, $1 lhu $2, 0($1) bne $1, $1, TAG2 lui $1, 13 TAG2: bne $1, $1, TAG3 mthi $1 mtlo $1 mflo $3 TAG3: mtlo $3 mthi $3 sll $0, $0, 0 bgtz $4, TAG4 TAG4: lui $4, 12 sll $0, $0, 0 bne $1, $4, TAG5 lui $2, 9 TAG5: bgez $2, TAG6 lui $3, 8 lui $1, 11 beq $1, $1, TAG6 TAG6: sll $0, $0, 0 mfhi $3 lui $2, 10 lui $2, 12 TAG7: mflo $4 bgez $2, TAG8 mtlo $2 xori $3, $4, 3 TAG8: lui $1, 10 mtlo $3 sll $0, $0, 0 sll $0, $0, 0 TAG9: mthi $3 beq $3, $3, TAG10 lui $1, 9 lhu $4, 0($1) TAG10: mflo $2 ori $4, $4, 2 mfhi $2 sll $0, $0, 0 TAG11: sll $0, $0, 0 bltz $3, TAG12 subu $1, $3, $3 beq $3, $1, TAG12 TAG12: sh $1, 0($1) multu $1, $1 beq $1, $1, TAG13 lh $4, 0($1) TAG13: mtlo $4 lbu $1, 0($4) bne $1, $4, TAG14 mflo $2 TAG14: mfhi $1 lb $3, 0($2) mtlo $1 mflo $3 TAG15: lh $2, 0($3) bgez $3, TAG16 sb $2, 0($3) sb $3, 0($3) TAG16: or $1, $2, $2 lw $1, 0($2) beq $1, $1, TAG17 lui $3, 15 TAG17: mflo $4 add $3, $4, $3 mflo $3 sllv $4, $3, $3 TAG18: mtlo $4 srav $3, $4, $4 srl $1, $3, 12 mthi $1 TAG19: lui $4, 3 beq $4, $1, TAG20 multu $4, $1 multu $1, $1 TAG20: addu $3, $4, $4 sll $0, $0, 0 multu $4, $4 lui $2, 5 TAG21: bgtz $2, TAG22 mflo $1 bltz $1, TAG22 mtlo $2 TAG22: and $1, $1, $1 sb $1, 0($1) lui $4, 10 sll $0, $0, 0 TAG23: div $3, $3 sll $0, $0, 0 sll $0, $0, 0 lui $2, 11 TAG24: addiu $1, $2, 5 mflo $1 mfhi $2 beq $1, $1, TAG25 TAG25: sll $4, $2, 6 lhu $3, 0($2) multu $3, $2 bgez $2, TAG26 TAG26: lui $1, 0 sll $1, $1, 4 lh $4, 0($3) mult $1, $1 TAG27: sh $4, 0($4) mtlo $4 lbu $2, 0($4) blez $2, TAG28 TAG28: sw $2, 0($2) bne $2, $2, TAG29 mfhi $4 slt $3, $2, $4 TAG29: slti $4, $3, 10 beq $4, $3, TAG30 srl $1, $4, 2 beq $1, $3, TAG30 TAG30: multu $1, $1 mthi $1 lbu $3, 0($1) sh $1, 0($3) TAG31: sub $2, $3, $3 srlv $4, $3, $3 multu $4, $2 mtlo $4 TAG32: bltz $4, TAG33 lui $4, 10 mtlo $4 mult $4, $4 TAG33: sll $0, $0, 0 sll $0, $0, 0 ori $3, $4, 8 multu $4, $4 TAG34: blez $3, TAG35 slt $2, $3, $3 mthi $3 mflo $2 TAG35: sllv $3, $2, $2 add $1, $2, $3 mthi $2 bltz $3, TAG36 TAG36: lw $1, 0($1) sh $1, 0($1) lui $4, 9 lbu $3, 0($1) TAG37: bgtz $3, TAG38 lbu $2, 0($3) sra $4, $3, 9 sh $4, 0($4) TAG38: srlv $2, $4, $4 sh $4, 0($2) mflo $1 bne $1, $2, TAG39 TAG39: mflo $4 lb $4, 0($1) beq $1, $4, TAG40 mflo $4 TAG40: beq $4, $4, TAG41 sb $4, 0($4) beq $4, $4, TAG41 lui $2, 15 TAG41: lb $1, 0($2) mult $1, $1 slti $4, $2, 0 mflo $4 TAG42: mthi $4 subu $2, $4, $4 beq $4, $4, TAG43 lb $2, 0($2) TAG43: mtlo $2 lui $2, 4 sll $0, $0, 0 bne $2, $2, TAG44 TAG44: slt $4, $2, $2 sh $4, 0($4) sltiu $1, $2, 9 lh $2, 0($1) TAG45: mfhi $4 mult $4, $2 multu $4, $2 bgez $4, TAG46 TAG46: mfhi $2 addiu $4, $4, 1 xor $2, $4, $4 div $4, $4 TAG47: mthi $2 multu $2, $2 mult $2, $2 mthi $2 TAG48: or $4, $2, $2 mtlo $2 multu $4, $2 or $3, $2, $2 TAG49: sh $3, 0($3) mtlo $3 lui $1, 7 mthi $1 TAG50: lui $2, 15 lui $4, 13 xori $1, $2, 2 sll $2, $1, 7 TAG51: sll $0, $0, 0 sll $0, $0, 0 srl $4, $2, 11 lui $3, 6 TAG52: lui $3, 10 xor $3, $3, $3 mfhi $2 beq $3, $3, TAG53 TAG53: sra $4, $2, 7 or $4, $2, $2 mfhi $1 bgtz $4, TAG54 TAG54: mthi $1 sll $0, $0, 0 sll $0, $0, 0 bgtz $1, TAG55 TAG55: sll $0, $0, 0 lui $4, 11 sll $0, $0, 0 mult $1, $1 TAG56: srl $4, $3, 6 beq $3, $3, TAG57 slti $4, $3, 8 bgtz $4, TAG57 TAG57: divu $4, $4 slt $3, $4, $4 mfhi $1 mult $4, $1 TAG58: lui $1, 4 mtlo $1 divu $1, $1 sll $0, $0, 0 TAG59: bgtz $1, TAG60 lui $4, 4 ori $4, $4, 4 beq $4, $4, TAG60 TAG60: mflo $1 mfhi $3 sll $0, $0, 0 mtlo $3 TAG61: addu $1, $3, $3 mthi $1 lui $1, 6 bltz $1, TAG62 TAG62: mthi $1 beq $1, $1, TAG63 mthi $1 sw $1, 0($1) TAG63: beq $1, $1, TAG64 addiu $3, $1, 8 mthi $1 lui $4, 11 TAG64: and $2, $4, $4 mtlo $4 sll $0, $0, 0 mflo $1 TAG65: sll $0, $0, 0 bltz $1, TAG66 ori $1, $1, 0 lui $1, 2 TAG66: mfhi $3 mfhi $4 mtlo $4 sll $0, $0, 0 TAG67: mflo $3 mult $4, $3 divu $3, $3 beq $4, $4, TAG68 TAG68: mthi $3 sll $0, $0, 0 srlv $4, $2, $2 mult $4, $2 TAG69: mflo $3 sll $0, $0, 0 beq $3, $3, TAG70 divu $3, $4 TAG70: sb $3, 0($3) subu $1, $3, $3 sw $3, 0($1) lhu $4, 0($3) TAG71: sllv $2, $4, $4 mthi $4 mflo $2 beq $2, $2, TAG72 TAG72: sb $2, 0($2) beq $2, $2, TAG73 lhu $4, 0($2) sb $2, 0($4) TAG73: srav $4, $4, $4 mtlo $4 bgez $4, TAG74 mflo $4 TAG74: lui $4, 2 sll $0, $0, 0 and $1, $4, $4 bne $4, $1, TAG75 TAG75: slti $4, $1, 14 beq $4, $4, TAG76 sll $0, $0, 0 lui $4, 2 TAG76: sh $4, 0($4) lbu $3, 0($4) multu $4, $3 bne $4, $4, TAG77 TAG77: mult $3, $3 bgez $3, TAG78 multu $3, $3 mtlo $3 TAG78: mult $3, $3 mtlo $3 slti $2, $3, 6 xor $4, $3, $3 TAG79: sh $4, 0($4) beq $4, $4, TAG80 mflo $4 div $4, $4 TAG80: addu $1, $4, $4 mflo $1 mult $4, $1 bne $1, $1, TAG81 TAG81: sw $1, 0($1) bltz $1, TAG82 srl $2, $1, 6 sltu $4, $1, $2 TAG82: sh $4, 0($4) beq $4, $4, TAG83 lh $4, 0($4) mthi $4 TAG83: lh $3, 0($4) sub $1, $3, $3 sltu $1, $4, $3 sw $3, 0($1) TAG84: sw $1, 0($1) mult $1, $1 lui $3, 13 mthi $3 TAG85: bgez $3, TAG86 mthi $3 sb $3, 0($3) sltiu $4, $3, 14 TAG86: bne $4, $4, TAG87 mflo $4 bgez $4, TAG87 multu $4, $4 TAG87: andi $1, $4, 0 lbu $3, 0($1) sb $3, 0($3) bgtz $3, TAG88 TAG88: mult $3, $3 lbu $4, 0($3) sw $3, 0($3) sllv $1, $4, $4 TAG89: multu $1, $1 lui $1, 8 mfhi $3 mthi $3 TAG90: lh $2, 0($3) bne $3, $2, TAG91 lb $2, 0($2) slti $1, $3, 15 TAG91: andi $3, $1, 9 mfhi $4 bgez $3, TAG92 mthi $4 TAG92: nor $2, $4, $4 bgtz $2, TAG93 lbu $2, 0($4) bgez $2, TAG93 TAG93: lw $2, 0($2) sltiu $3, $2, 12 lb $1, 0($3) lb $4, 0($3) TAG94: srlv $4, $4, $4 beq $4, $4, TAG95 or $2, $4, $4 sh $4, 0($4) TAG95: sh $2, 0($2) lui $4, 5 bgtz $4, TAG96 mtlo $4 TAG96: sll $0, $0, 0 sll $0, $0, 0 bgtz $4, TAG97 srav $1, $4, $4 TAG97: mfhi $4 mult $4, $4 mthi $1 sll $0, $0, 0 TAG98: lhu $4, 0($4) lh $3, 0($4) bne $4, $4, TAG99 sllv $4, $3, $4 TAG99: mtlo $4 lui $3, 11 addu $3, $4, $3 mthi $4 TAG100: sll $0, $0, 0 blez $3, TAG101 sll $0, $0, 0 sll $0, $0, 0 TAG101: mfhi $3 bne $1, $3, TAG102 mflo $4 sh $3, 0($1) TAG102: addu $4, $4, $4 mfhi $2 nor $4, $4, $4 beq $4, $4, TAG103 TAG103: multu $4, $4 sltu $1, $4, $4 sllv $2, $4, $1 lhu $1, 1($2) TAG104: mtlo $1 bltz $1, TAG105 mthi $1 sra $2, $1, 7 TAG105: mtlo $2 bne $2, $2, TAG106 srav $4, $2, $2 mthi $2 TAG106: sw $4, 0($4) mult $4, $4 bltz $4, TAG107 multu $4, $4 TAG107: multu $4, $4 addi $3, $4, 3 addu $1, $3, $4 lui $1, 13 TAG108: mthi $1 srlv $3, $1, $1 divu $3, $1 srlv $3, $3, $3 TAG109: mfhi $2 sll $0, $0, 0 mthi $2 sra $1, $3, 2 TAG110: mult $1, $1 sll $0, $0, 0 lui $3, 11 bltz $3, TAG111 TAG111: mfhi $3 addiu $4, $3, 3 srl $4, $4, 4 div $3, $3 TAG112: mthi $4 or $1, $4, $4 lui $1, 8 sll $0, $0, 0 TAG113: sb $3, 0($3) mthi $3 mflo $4 div $4, $3 TAG114: subu $2, $4, $4 mthi $4 sw $4, 0($2) beq $4, $4, TAG115 TAG115: andi $4, $2, 0 mflo $3 mflo $2 addiu $3, $3, 4 TAG116: mflo $4 xor $2, $3, $3 addi $1, $2, 2 bgez $1, TAG117 TAG117: lhu $3, 0($1) mult $3, $1 addiu $3, $1, 14 divu $3, $1 TAG118: sll $2, $3, 10 bne $3, $2, TAG119 sll $3, $2, 8 beq $2, $3, TAG119 TAG119: mfhi $4 bgtz $4, TAG120 sh $3, 0($4) sll $0, $0, 0 TAG120: subu $4, $1, $1 lui $1, 11 bne $1, $1, TAG121 sll $0, $0, 0 TAG121: divu $1, $1 mthi $1 sll $0, $0, 0 divu $1, $3 TAG122: multu $3, $3 or $3, $3, $3 sll $0, $0, 0 sll $0, $0, 0 TAG123: mult $3, $3 srl $2, $3, 3 addiu $4, $2, 7 lui $4, 14 TAG124: sll $0, $0, 0 mtlo $4 mfhi $3 subu $4, $3, $4 TAG125: bgtz $4, TAG126 sra $4, $4, 12 mtlo $4 srav $3, $4, $4 TAG126: sll $0, $0, 0 beq $2, $3, TAG127 sll $0, $0, 0 mfhi $4 TAG127: lui $2, 8 mflo $3 divu $4, $2 mfhi $2 TAG128: sll $0, $0, 0 sll $0, $0, 0 lui $1, 0 bne $1, $1, TAG129 TAG129: srl $2, $1, 6 blez $1, TAG130 lui $1, 5 mtlo $1 TAG130: or $4, $1, $1 lui $2, 1 div $1, $4 mfhi $1 TAG131: sra $2, $1, 15 mfhi $2 subu $4, $2, $2 mflo $3 TAG132: lui $1, 10 sb $1, 0($3) lui $1, 2 srl $1, $1, 7 TAG133: sll $0, $0, 0 lh $4, -1024($1) lui $4, 7 sll $0, $0, 0 TAG134: sll $4, $4, 6 sll $2, $4, 5 bgez $4, TAG135 mflo $3 TAG135: srl $1, $3, 8 sllv $3, $3, $3 lui $4, 1 addiu $3, $3, 7 TAG136: lui $1, 3 mflo $1 mfhi $3 bne $3, $1, TAG137 TAG137: mult $3, $3 sh $3, 0($3) lhu $2, 0($3) mthi $3 TAG138: bgez $2, TAG139 xori $1, $2, 15 slti $2, $1, 12 sltiu $1, $1, 0 TAG139: lui $4, 14 lui $2, 5 slt $4, $4, $4 lb $2, 0($4) TAG140: mtlo $2 beq $2, $2, TAG141 lui $4, 10 lui $4, 9 TAG141: div $4, $4 beq $4, $4, TAG142 div $4, $4 divu $4, $4 TAG142: mtlo $4 mfhi $4 sra $3, $4, 0 mtlo $4 TAG143: mthi $3 slt $2, $3, $3 bne $3, $3, TAG144 slti $1, $2, 8 TAG144: lui $4, 2 mtlo $4 mflo $4 mthi $4 TAG145: blez $4, TAG146 lui $2, 6 mthi $4 sll $0, $0, 0 TAG146: mfhi $4 mtlo $4 bgez $4, TAG147 sll $0, $0, 0 TAG147: mtlo $2 sll $0, $0, 0 addu $3, $2, $2 divu $2, $3 TAG148: sllv $4, $3, $3 mfhi $2 mfhi $1 bne $1, $1, TAG149 TAG149: sll $0, $0, 0 sll $0, $0, 0 beq $1, $1, TAG150 slti $1, $3, 6 TAG150: mult $1, $1 mflo $3 lui $1, 2 mfhi $3 TAG151: sh $3, 0($3) lui $3, 14 blez $3, TAG152 sll $0, $0, 0 TAG152: bgtz $3, TAG153 slt $3, $3, $3 mflo $2 lb $3, 0($3) TAG153: mflo $1 srlv $2, $3, $1 or $2, $3, $2 bltz $2, TAG154 TAG154: mflo $3 mthi $3 mflo $3 bne $3, $3, TAG155 TAG155: mthi $3 bne $3, $3, TAG156 multu $3, $3 ori $2, $3, 14 TAG156: mflo $2 lb $3, 0($2) mult $2, $3 xori $1, $3, 11 TAG157: mthi $1 sb $1, 0($1) mthi $1 divu $1, $1 TAG158: multu $1, $1 bltz $1, TAG159 mfhi $1 sub $1, $1, $1 TAG159: srlv $2, $1, $1 lh $2, 0($2) lui $1, 15 add $3, $2, $1 TAG160: sll $0, $0, 0 beq $3, $3, TAG161 divu $3, $3 subu $3, $3, $3 TAG161: bgez $3, TAG162 mthi $3 mtlo $3 sw $3, 0($3) TAG162: beq $3, $3, TAG163 mfhi $2 mflo $1 div $2, $3 TAG163: div $1, $1 slti $4, $1, 8 mfhi $3 lui $4, 11 TAG164: or $1, $4, $4 sll $0, $0, 0 srlv $2, $4, $4 sll $0, $0, 0 TAG165: addiu $2, $2, 8 lui $4, 10 sll $0, $0, 0 lui $4, 2 TAG166: lui $2, 14 multu $2, $4 sll $3, $2, 6 bne $2, $3, TAG167 TAG167: sll $0, $0, 0 lui $2, 9 bne $2, $4, TAG168 subu $1, $2, $2 TAG168: mfhi $1 sh $1, 0($1) sb $1, 0($1) andi $3, $1, 14 TAG169: multu $3, $3 mfhi $3 mult $3, $3 mult $3, $3 TAG170: lui $1, 6 sll $0, $0, 0 bne $3, $1, TAG171 divu $3, $1 TAG171: bltz $1, TAG172 srlv $1, $1, $1 lui $1, 11 multu $1, $1 TAG172: xor $3, $1, $1 multu $1, $1 mtlo $3 mtlo $3 TAG173: sh $3, 0($3) subu $1, $3, $3 sh $3, 0($3) bne $1, $1, TAG174 TAG174: mtlo $1 lui $3, 15 mfhi $1 mult $1, $1 TAG175: lbu $4, 0($1) lui $1, 10 bne $1, $1, TAG176 srav $2, $1, $1 TAG176: sll $0, $0, 0 bgtz $2, TAG177 div $2, $2 mthi $2 TAG177: sll $0, $0, 0 srlv $4, $2, $2 beq $4, $2, TAG178 lui $3, 3 TAG178: sll $0, $0, 0 bne $3, $3, TAG179 mfhi $1 mtlo $3 TAG179: lui $3, 5 and $1, $1, $3 mflo $3 slt $2, $3, $1 TAG180: mthi $2 mult $2, $2 mflo $4 mthi $4 TAG181: lui $4, 12 div $4, $4 sll $0, $0, 0 multu $4, $4 TAG182: subu $2, $4, $4 addi $3, $2, 11 lui $3, 0 beq $3, $3, TAG183 TAG183: mtlo $3 slt $2, $3, $3 lb $3, 0($3) beq $3, $3, TAG184 TAG184: mult $3, $3 srav $3, $3, $3 addiu $2, $3, 10 lw $2, 0($3) TAG185: bne $2, $2, TAG186 lbu $1, 0($2) lui $3, 14 slti $4, $3, 15 TAG186: srlv $3, $4, $4 beq $4, $4, TAG187 andi $4, $3, 3 mtlo $4 TAG187: bne $4, $4, TAG188 mtlo $4 ori $1, $4, 8 sb $1, 0($4) TAG188: lui $4, 3 lui $1, 6 addiu $4, $1, 10 andi $1, $1, 1 TAG189: mflo $2 mtlo $1 subu $2, $1, $1 addiu $3, $2, 7 TAG190: slt $1, $3, $3 mflo $4 add $4, $4, $1 ori $4, $4, 8 TAG191: mfhi $3 beq $3, $3, TAG192 or $2, $4, $4 lhu $2, 0($4) TAG192: subu $4, $2, $2 sb $2, 0($4) lbu $2, 0($2) mult $2, $4 TAG193: sll $1, $2, 5 sh $1, 0($2) add $1, $1, $1 srav $4, $1, $1 TAG194: bgez $4, TAG195 sb $4, 0($4) div $4, $4 slti $1, $4, 6 TAG195: srl $1, $1, 6 bgtz $1, TAG196 sb $1, 0($1) lui $3, 12 TAG196: mfhi $1 slti $3, $3, 5 bgez $3, TAG197 lhu $2, 0($3) TAG197: mflo $4 mthi $4 lhu $4, 0($4) beq $2, $2, TAG198 TAG198: mthi $4 sh $4, 0($4) xor $3, $4, $4 mtlo $4 TAG199: beq $3, $3, TAG200 lui $1, 9 mfhi $1 mflo $3 TAG200: mult $3, $3 lbu $4, 0($3) bne $3, $3, TAG201 lhu $1, 0($4) TAG201: lui $4, 10 sll $0, $0, 0 beq $1, $1, TAG202 sltu $2, $4, $4 TAG202: bltz $2, TAG203 sb $2, 0($2) addi $3, $2, 14 blez $2, TAG203 TAG203: sh $3, 0($3) mtlo $3 multu $3, $3 sh $3, 0($3) TAG204: multu $3, $3 mthi $3 sh $3, 0($3) bgtz $3, TAG205 TAG205: divu $3, $3 mtlo $3 sltiu $4, $3, 15 lui $3, 11 TAG206: mflo $1 sll $0, $0, 0 bltz $1, TAG207 sra $3, $3, 3 TAG207: srlv $3, $3, $3 bne $3, $3, TAG208 sll $0, $0, 0 lui $3, 15 TAG208: mult $3, $3 sll $0, $0, 0 sll $0, $0, 0 bne $3, $3, TAG209 TAG209: sltiu $1, $3, 2 ori $4, $1, 2 sllv $2, $1, $1 sll $0, $0, 0 TAG210: lw $4, 0($1) mthi $4 lh $1, 0($1) mtlo $4 TAG211: multu $1, $1 mflo $1 sw $1, 0($1) and $2, $1, $1 TAG212: mult $2, $2 addiu $2, $2, 3 mtlo $2 srl $3, $2, 12 TAG213: mthi $3 blez $3, TAG214 multu $3, $3 mult $3, $3 TAG214: mtlo $3 bgez $3, TAG215 mtlo $3 xor $2, $3, $3 TAG215: sllv $4, $2, $2 ori $2, $2, 15 sllv $1, $2, $4 bltz $2, TAG216 TAG216: divu $1, $1 mtlo $1 divu $1, $1 beq $1, $1, TAG217 TAG217: lui $4, 2 mtlo $4 lui $4, 3 srav $2, $4, $4 TAG218: div $2, $2 sll $0, $0, 0 mthi $3 bgez $2, TAG219 TAG219: lui $2, 14 mtlo $3 bltz $3, TAG220 divu $2, $2 TAG220: sll $0, $0, 0 mtlo $2 and $1, $2, $2 lui $3, 10 TAG221: mfhi $4 sll $0, $0, 0 sll $1, $4, 0 sll $0, $0, 0 TAG222: ori $1, $1, 0 addiu $4, $1, 1 lui $1, 5 lui $4, 8 TAG223: divu $4, $4 multu $4, $4 mthi $4 mflo $4 TAG224: bgtz $4, TAG225 xor $2, $4, $4 bne $4, $2, TAG225 mtlo $2 TAG225: blez $2, TAG226 lh $1, 0($2) beq $1, $1, TAG226 sra $4, $1, 14 TAG226: beq $4, $4, TAG227 lh $1, 0($4) mthi $4 div $1, $1 TAG227: blez $1, TAG228 mult $1, $1 bne $1, $1, TAG228 addu $4, $1, $1 TAG228: lbu $3, 0($4) sub $4, $3, $3 sltiu $3, $4, 14 lb $1, 0($3) TAG229: bgtz $1, TAG230 slt $2, $1, $1 srav $1, $2, $1 beq $1, $1, TAG230 TAG230: multu $1, $1 bne $1, $1, TAG231 mtlo $1 lh $4, 0($1) TAG231: srlv $4, $4, $4 addiu $3, $4, 11 srav $1, $4, $4 lh $3, 0($1) TAG232: lb $1, 0($3) mtlo $3 lh $4, 0($1) addi $3, $4, 1 TAG233: addiu $1, $3, 2 or $1, $1, $3 sra $3, $3, 11 or $2, $1, $1 TAG234: sb $2, 0($2) beq $2, $2, TAG235 mfhi $4 mflo $2 TAG235: slt $3, $2, $2 blez $3, TAG236 sb $3, 0($3) mfhi $1 TAG236: lb $4, 0($1) mfhi $3 mthi $1 mtlo $3 TAG237: sltiu $1, $3, 15 lbu $2, 0($1) sb $2, 0($3) addi $2, $2, 6 TAG238: div $2, $2 sh $2, 0($2) div $2, $2 mult $2, $2 TAG239: mfhi $2 sw $2, 0($2) or $3, $2, $2 mult $2, $3 TAG240: addiu $2, $3, 11 divu $2, $2 srav $2, $3, $2 sll $3, $3, 8 TAG241: lbu $4, 0($3) sltiu $2, $4, 4 mtlo $4 sltiu $2, $4, 4 TAG242: mfhi $4 lbu $3, 0($4) lui $4, 10 sra $4, $4, 15 TAG243: mthi $4 mtlo $4 lw $3, 0($4) mflo $2 TAG244: bne $2, $2, TAG245 lh $2, 0($2) sh $2, 0($2) mtlo $2 TAG245: ori $4, $2, 9 lui $2, 15 subu $1, $2, $2 sll $0, $0, 0 TAG246: multu $1, $1 beq $1, $1, TAG247 mtlo $1 addi $2, $1, 5 TAG247: beq $2, $2, TAG248 sllv $2, $2, $2 blez $2, TAG248 lui $2, 2 TAG248: lui $3, 2 blez $2, TAG249 sllv $3, $3, $3 lui $1, 11 TAG249: sll $0, $0, 0 sll $0, $0, 0 mtlo $1 sllv $1, $1, $1 TAG250: sll $0, $0, 0 bne $1, $1, TAG251 sll $0, $0, 0 bne $1, $1, TAG251 TAG251: addiu $2, $1, 5 mfhi $1 bne $1, $2, TAG252 lbu $3, 0($1) TAG252: bgtz $3, TAG253 and $3, $3, $3 multu $3, $3 mult $3, $3 TAG253: sb $3, 0($3) sb $3, 0($3) bne $3, $3, TAG254 sb $3, 0($3) TAG254: mult $3, $3 srl $4, $3, 5 beq $3, $4, TAG255 mtlo $4 TAG255: bgez $4, TAG256 lui $4, 14 bltz $4, TAG256 div $4, $4 TAG256: mthi $4 lui $1, 3 lui $3, 0 mflo $3 TAG257: ori $3, $3, 13 bltz $3, TAG258 xori $1, $3, 1 sb $3, 0($3) TAG258: mtlo $1 lhu $4, 0($1) sw $4, 0($1) bne $1, $4, TAG259 TAG259: mfhi $4 mtlo $4 sll $0, $0, 0 nor $3, $4, $4 TAG260: mflo $1 mfhi $4 beq $1, $4, TAG261 lui $4, 14 TAG261: beq $4, $4, TAG262 sra $2, $4, 1 addi $2, $2, 13 divu $2, $2 TAG262: and $1, $2, $2 lui $3, 8 mult $2, $3 sll $0, $0, 0 TAG263: mult $2, $2 lui $3, 3 subu $2, $3, $2 sltiu $3, $2, 12 TAG264: mfhi $4 bne $3, $4, TAG265 divu $4, $4 mult $4, $4 TAG265: lbu $2, 0($4) mflo $1 bgtz $2, TAG266 mult $1, $2 TAG266: sb $1, 0($1) bne $1, $1, TAG267 sltiu $3, $1, 11 bgez $3, TAG267 TAG267: multu $3, $3 nor $1, $3, $3 mfhi $3 divu $1, $1 TAG268: sh $3, 0($3) add $1, $3, $3 ori $2, $3, 11 xori $3, $1, 14 TAG269: lui $4, 12 srl $2, $4, 1 sll $0, $0, 0 lui $2, 4 TAG270: sll $0, $0, 0 sll $0, $0, 0 bgtz $1, TAG271 mthi $1 TAG271: bgtz $1, TAG272 lui $3, 9 bne $3, $1, TAG272 srlv $3, $3, $1 TAG272: div $3, $3 sll $0, $0, 0 beq $3, $3, TAG273 mfhi $2 TAG273: mflo $4 lh $3, 0($2) nor $1, $4, $3 lb $4, 0($4) TAG274: lbu $2, 0($4) blez $4, TAG275 sw $2, 0($2) mult $4, $2 TAG275: mult $2, $2 sub $4, $2, $2 lhu $1, 0($2) lh $2, 0($4) TAG276: bgtz $2, TAG277 addu $2, $2, $2 bgez $2, TAG277 srav $4, $2, $2 TAG277: mult $4, $4 mult $4, $4 lw $2, 0($4) subu $1, $4, $4 TAG278: lui $3, 8 mtlo $1 bgtz $3, TAG279 sh $1, 0($1) TAG279: mtlo $3 addiu $2, $3, 7 bne $3, $2, TAG280 lui $1, 15 TAG280: mfhi $3 nor $1, $1, $3 multu $1, $1 mtlo $1 TAG281: mtlo $1 beq $1, $1, TAG282 mthi $1 bgez $1, TAG282 TAG282: lui $2, 14 sll $0, $0, 0 bltz $2, TAG283 mult $2, $2 TAG283: bne $2, $2, TAG284 mfhi $1 sra $2, $2, 3 sll $0, $0, 0 TAG284: slti $4, $4, 10 blez $4, TAG285 lui $1, 1 lui $4, 10 TAG285: mtlo $4 sll $0, $0, 0 sllv $4, $4, $3 sll $0, $0, 0 TAG286: addiu $4, $4, 12 mtlo $4 sll $0, $0, 0 sll $0, $0, 0 TAG287: lui $1, 13 beq $1, $1, TAG288 sll $0, $0, 0 mflo $4 TAG288: sll $0, $0, 0 mfhi $3 mtlo $4 bne $4, $3, TAG289 TAG289: sh $3, -196($3) div $3, $3 lhu $1, -196($3) mflo $2 TAG290: sb $2, 0($2) sb $2, 0($2) div $2, $2 sb $2, 0($2) TAG291: beq $2, $2, TAG292 sb $2, 0($2) addi $2, $2, 7 mtlo $2 TAG292: beq $2, $2, TAG293 lui $3, 13 lw $4, 0($2) lbu $2, 0($4) TAG293: mthi $2 mthi $2 lui $1, 0 multu $2, $1 TAG294: nor $2, $1, $1 sb $2, 0($1) mthi $2 multu $2, $2 TAG295: sll $0, $0, 0 beq $3, $2, TAG296 lui $4, 9 beq $3, $4, TAG296 TAG296: lui $2, 11 mtlo $2 mtlo $4 sll $3, $4, 1 TAG297: beq $3, $3, TAG298 mult $3, $3 blez $3, TAG298 mflo $1 TAG298: xor $3, $1, $1 beq $3, $3, TAG299 sra $2, $3, 4 slt $1, $2, $3 TAG299: lui $2, 1 lui $2, 12 sw $2, 0($1) sra $1, $2, 3 TAG300: beq $1, $1, TAG301 lui $4, 4 ori $3, $4, 1 multu $1, $4 TAG301: mflo $2 mtlo $2 slt $3, $3, $3 bne $3, $2, TAG302 TAG302: mflo $3 nor $2, $3, $3 xor $2, $3, $2 lui $2, 7 TAG303: xori $3, $2, 1 subu $4, $3, $2 or $1, $3, $2 bltz $4, TAG304 TAG304: sll $0, $0, 0 sll $0, $0, 0 mthi $1 mthi $1 TAG305: addiu $4, $1, 9 divu $4, $1 mtlo $1 lui $2, 12 TAG306: bne $2, $2, TAG307 multu $2, $2 bgtz $2, TAG307 addu $4, $2, $2 TAG307: bgez $4, TAG308 mthi $4 divu $4, $4 beq $4, $4, TAG308 TAG308: sll $0, $0, 0 blez $4, TAG309 sll $0, $0, 0 sll $0, $0, 0 TAG309: lui $1, 4 multu $1, $1 subu $3, $1, $1 mtlo $1 TAG310: sh $3, 0($3) sra $4, $3, 4 xori $2, $3, 9 sllv $4, $4, $4 TAG311: beq $4, $4, TAG312 sw $4, 0($4) add $1, $4, $4 lb $4, 0($4) TAG312: mtlo $4 and $3, $4, $4 lb $3, 0($4) mult $4, $4 TAG313: mfhi $4 xor $3, $3, $4 beq $3, $4, TAG314 slt $3, $3, $3 TAG314: sub $3, $3, $3 lui $1, 7 mtlo $3 mthi $3 TAG315: bgez $1, TAG316 mthi $1 multu $1, $1 beq $1, $1, TAG316 TAG316: lui $4, 1 mflo $3 lh $1, 0($3) and $2, $4, $3 TAG317: xor $4, $2, $2 blez $4, TAG318 mtlo $2 bgez $4, TAG318 TAG318: sllv $1, $4, $4 srl $3, $1, 12 lui $1, 8 mthi $1 TAG319: sll $0, $0, 0 bgtz $1, TAG320 mult $1, $2 srl $4, $1, 13 TAG320: slt $1, $4, $4 multu $4, $1 bgez $1, TAG321 sb $4, 0($1) TAG321: mflo $1 sb $1, 0($1) nor $2, $1, $1 lhu $1, 0($1) TAG322: sh $1, 0($1) lui $1, 0 nor $4, $1, $1 sh $4, 1($4) TAG323: sll $0, $0, 0 srl $3, $4, 13 sll $4, $3, 13 blez $3, TAG324 TAG324: mtlo $4 lbu $3, 8192($4) mtlo $3 bne $4, $3, TAG325 TAG325: sll $0, $0, 0 slti $1, $1, 1 lb $2, -255($3) xor $1, $3, $1 TAG326: sll $0, $0, 0 bltz $1, TAG327 lui $2, 5 divu $1, $1 TAG327: multu $2, $2 bne $2, $2, TAG328 sll $0, $0, 0 sll $0, $0, 0 TAG328: sh $3, -255($3) sltu $3, $3, $3 blez $3, TAG329 sltiu $4, $3, 9 TAG329: bgtz $4, TAG330 xori $4, $4, 10 bgtz $4, TAG330 lui $4, 7 TAG330: srlv $1, $4, $4 lui $2, 5 lui $3, 9 sh $2, 0($1) TAG331: or $2, $3, $3 mult $3, $2 bgez $3, TAG332 sll $0, $0, 0 TAG332: mtlo $4 sb $4, 0($4) addu $2, $4, $4 mflo $3 TAG333: bne $3, $3, TAG334 addu $2, $3, $3 lui $4, 0 lb $4, 0($3) TAG334: mthi $4 bgtz $4, TAG335 lb $4, 0($4) lhu $1, 0($4) TAG335: sub $4, $1, $1 sll $3, $4, 6 mthi $4 lb $4, 0($3) TAG336: beq $4, $4, TAG337 mflo $1 bne $1, $4, TAG337 lui $3, 11 TAG337: lui $2, 15 lhu $1, 0($3) slt $3, $2, $3 blez $2, TAG338 TAG338: lh $3, 0($3) blez $3, TAG339 multu $3, $3 beq $3, $3, TAG339 TAG339: lbu $3, 0($3) lh $2, 0($3) addu $3, $3, $3 mtlo $2 TAG340: mult $3, $3 lbu $4, 0($3) sb $3, 0($4) lui $2, 5 TAG341: mult $2, $2 subu $1, $2, $2 xori $4, $2, 4 mflo $2 TAG342: mtlo $2 addiu $4, $2, 7 div $2, $4 sb $4, 0($2) TAG343: sltiu $4, $4, 9 sb $4, 0($4) lui $3, 10 sb $4, 0($4) TAG344: mfhi $2 mflo $3 sub $4, $2, $3 bne $4, $3, TAG345 TAG345: lw $3, 0($4) mflo $2 mult $2, $2 lh $2, 0($2) TAG346: slt $1, $2, $2 lui $2, 8 srav $2, $2, $1 lui $4, 15 TAG347: multu $4, $4 xor $3, $4, $4 mtlo $3 mtlo $4 TAG348: mthi $3 bne $3, $3, TAG349 nor $4, $3, $3 xori $1, $3, 9 TAG349: sb $1, 0($1) blez $1, TAG350 lui $3, 11 addiu $1, $1, 7 TAG350: blez $1, TAG351 lui $3, 13 lw $1, 0($1) beq $1, $3, TAG351 TAG351: lhu $3, 0($1) sb $1, 0($3) lh $2, 0($1) mflo $1 TAG352: mthi $1 bgtz $1, TAG353 multu $1, $1 addi $1, $1, 2 TAG353: sll $0, $0, 0 xori $3, $1, 9 srlv $1, $1, $3 mflo $4 TAG354: lb $3, 0($4) sub $1, $4, $4 mtlo $1 lw $4, 0($1) TAG355: xori $2, $4, 5 mfhi $2 mult $4, $2 bgtz $2, TAG356 TAG356: sltu $1, $2, $2 andi $3, $1, 1 mfhi $4 sub $4, $3, $3 TAG357: sb $4, 0($4) mtlo $4 mtlo $4 blez $4, TAG358 TAG358: mtlo $4 lui $4, 7 blez $4, TAG359 mfhi $1 TAG359: mflo $3 mtlo $3 slti $4, $3, 1 sb $3, 0($4) TAG360: bne $4, $4, TAG361 lui $4, 5 slt $4, $4, $4 and $3, $4, $4 TAG361: or $3, $3, $3 sltu $1, $3, $3 blez $1, TAG362 mthi $3 TAG362: srl $4, $1, 11 mthi $4 or $1, $4, $1 srl $1, $1, 8 TAG363: lui $2, 12 addi $4, $1, 0 bne $4, $2, TAG364 addi $1, $4, 2 TAG364: lui $1, 6 sll $0, $0, 0 mfhi $2 bltz $1, TAG365 TAG365: sltiu $3, $2, 13 divu $2, $3 bltz $3, TAG366 sra $3, $2, 15 TAG366: sb $3, 0($3) mthi $3 lui $3, 1 sll $0, $0, 0 TAG367: beq $1, $1, TAG368 lui $4, 11 beq $4, $1, TAG368 mtlo $1 TAG368: sll $0, $0, 0 lw $1, 0($2) ori $4, $2, 5 bltz $4, TAG369 TAG369: nor $3, $4, $4 lb $3, 6($3) bgez $4, TAG370 mfhi $3 TAG370: andi $3, $3, 6 mtlo $3 mult $3, $3 beq $3, $3, TAG371 TAG371: lbu $4, 0($3) lui $3, 5 mult $4, $4 blez $3, TAG372 TAG372: mult $3, $3 beq $3, $3, TAG373 sll $0, $0, 0 mult $3, $3 TAG373: beq $3, $3, TAG374 sll $0, $0, 0 lbu $3, 0($3) beq $3, $3, TAG374 TAG374: mfhi $2 bne $2, $2, TAG375 lui $1, 5 sll $0, $0, 0 TAG375: sll $0, $0, 0 divu $1, $1 mthi $1 beq $1, $1, TAG376 TAG376: or $2, $1, $1 sll $0, $0, 0 srav $2, $1, $2 lui $1, 13 TAG377: mtlo $1 mtlo $1 mflo $2 mflo $4 TAG378: bgez $4, TAG379 lui $4, 1 lh $4, 0($4) mfhi $1 TAG379: subu $2, $1, $1 bne $1, $2, TAG380 sll $0, $0, 0 mthi $1 TAG380: lw $4, 0($2) bgtz $2, TAG381 sb $2, 0($4) blez $2, TAG381 TAG381: lui $4, 5 addu $1, $4, $4 beq $1, $4, TAG382 mthi $1 TAG382: multu $1, $1 beq $1, $1, TAG383 addiu $4, $1, 3 sw $4, 0($4) TAG383: mflo $1 bne $1, $4, TAG384 mult $1, $1 lw $3, 0($4) TAG384: mflo $4 bgez $3, TAG385 lw $4, 0($4) lui $2, 4 TAG385: bgez $2, TAG386 addi $1, $2, 1 mtlo $2 mflo $3 TAG386: sll $0, $0, 0 div $3, $3 sll $0, $0, 0 sllv $3, $3, $3 TAG387: mfhi $2 mult $3, $3 multu $3, $2 beq $3, $3, TAG388 TAG388: addiu $2, $2, 9 blez $2, TAG389 sh $2, 0($2) lhu $1, 0($2) TAG389: mtlo $1 bltz $1, TAG390 lui $1, 10 mthi $1 TAG390: sll $0, $0, 0 lui $1, 13 mflo $2 lui $4, 5 TAG391: bne $4, $4, TAG392 lui $3, 5 sll $0, $0, 0 mfhi $2 TAG392: lui $3, 0 bgtz $2, TAG393 lui $4, 9 sw $4, 0($3) TAG393: sll $0, $0, 0 sra $4, $4, 13 sw $4, 0($4) lw $4, 0($4) TAG394: mflo $1 bgez $1, TAG395 addu $3, $1, $4 lui $1, 2 TAG395: mtlo $1 ori $3, $1, 4 sra $4, $1, 6 sh $1, 0($1) TAG396: addu $3, $4, $4 sw $3, 0($4) bgtz $3, TAG397 mflo $1 TAG397: lui $1, 10 mthi $1 mthi $1 sll $0, $0, 0 TAG398: andi $4, $2, 15 srl $1, $4, 3 lui $4, 6 xor $2, $2, $4 TAG399: sllv $4, $2, $2 sll $0, $0, 0 bgtz $2, TAG400 lui $4, 4 TAG400: mthi $4 sll $0, $0, 0 slt $2, $1, $1 lhu $2, 0($2) TAG401: bltz $2, TAG402 mflo $3 mfhi $1 srl $4, $3, 0 TAG402: lui $4, 4 sll $0, $0, 0 mtlo $4 sll $0, $0, 0 TAG403: addu $2, $1, $1 mthi $1 divu $2, $1 sll $0, $0, 0 TAG404: sll $0, $0, 0 bne $2, $2, TAG405 sll $0, $0, 0 sll $0, $0, 0 TAG405: bgez $3, TAG406 multu $3, $3 sh $3, 0($3) sllv $2, $3, $3 TAG406: sra $2, $2, 10 bne $2, $2, TAG407 mtlo $2 nor $4, $2, $2 TAG407: blez $4, TAG408 lbu $1, 513($4) beq $4, $1, TAG408 addiu $2, $1, 9 TAG408: mfhi $3 lui $2, 12 bltz $2, TAG409 divu $2, $2 TAG409: bne $2, $2, TAG410 mtlo $2 sll $0, $0, 0 mfhi $1 TAG410: ori $4, $1, 1 beq $4, $1, TAG411 srav $2, $1, $1 andi $4, $2, 14 TAG411: lb $2, 0($4) bgez $4, TAG412 mthi $2 mfhi $4 TAG412: add $3, $4, $4 lh $2, 0($3) sw $2, 0($4) mthi $4 TAG413: lhu $1, 0($2) bgtz $1, TAG414 srl $1, $1, 5 sh $1, 0($1) TAG414: mflo $2 mflo $2 bgez $2, TAG415 addu $1, $2, $2 TAG415: mthi $1 bne $1, $1, TAG416 sll $0, $0, 0 lui $4, 4 TAG416: beq $4, $4, TAG417 lui $1, 5 lhu $3, 0($4) lui $2, 12 TAG417: lui $4, 13 divu $4, $2 slti $3, $2, 4 lui $1, 12 TAG418: sll $0, $0, 0 bne $1, $1, TAG419 mtlo $1 mfhi $4 TAG419: and $4, $4, $4 sll $0, $0, 0 lui $3, 4 beq $3, $3, TAG420 TAG420: divu $3, $3 bne $3, $3, TAG421 sll $0, $0, 0 mthi $3 TAG421: divu $3, $3 blez $3, TAG422 sll $0, $0, 0 mflo $4 TAG422: lui $2, 10 and $1, $2, $4 mtlo $1 bne $2, $4, TAG423 TAG423: and $1, $1, $1 mflo $4 bltz $1, TAG424 sra $1, $1, 8 TAG424: lhu $4, 0($1) lw $4, 0($1) xori $1, $4, 1 divu $4, $1 TAG425: bgez $1, TAG426 lb $2, 0($1) mtlo $1 lui $4, 12 TAG426: mthi $4 mflo $3 multu $3, $3 bgtz $3, TAG427 TAG427: sltiu $4, $3, 7 ori $4, $3, 13 mflo $1 lbu $4, 0($4) TAG428: bltz $4, TAG429 mult $4, $4 bgez $4, TAG429 lui $3, 7 TAG429: lui $2, 9 mfhi $4 bgez $2, TAG430 lui $2, 9 TAG430: sltu $2, $2, $2 lui $3, 4 mtlo $2 mthi $2 TAG431: mtlo $3 sll $0, $0, 0 mthi $2 sll $0, $0, 0 TAG432: lbu $4, 0($2) lbu $3, 0($4) lui $3, 14 lui $4, 8 TAG433: mflo $4 sll $0, $0, 0 andi $3, $4, 10 mthi $4 TAG434: mult $3, $3 or $2, $3, $3 lui $1, 11 lb $2, 0($2) TAG435: lui $3, 3 mfhi $2 mthi $2 lui $1, 12 TAG436: bltz $1, TAG437 sll $0, $0, 0 bgtz $4, TAG437 sll $0, $0, 0 TAG437: mfhi $1 sb $4, 0($1) sltu $2, $1, $1 lb $3, 0($2) TAG438: sb $3, 0($3) multu $3, $3 lbu $1, 0($3) lb $3, 0($3) TAG439: mtlo $3 mthi $3 sw $3, 0($3) mult $3, $3 TAG440: slti $2, $3, 15 lhu $4, 0($3) mfhi $2 lw $1, 0($2) TAG441: lui $2, 4 srlv $4, $2, $1 nor $1, $4, $4 sllv $4, $1, $1 TAG442: and $3, $4, $4 srl $4, $3, 5 bltz $3, TAG443 sll $0, $0, 0 TAG443: sll $0, $0, 0 div $1, $4 bne $4, $4, TAG444 mult $4, $4 TAG444: bne $1, $1, TAG445 mfhi $1 sll $0, $0, 0 mthi $1 TAG445: sll $0, $0, 0 bltz $2, TAG446 sll $0, $0, 0 bgtz $2, TAG446 TAG446: mthi $2 lui $2, 0 mtlo $2 lw $2, 0($2) TAG447: bgtz $2, TAG448 add $3, $2, $2 sb $2, 0($2) blez $2, TAG448 TAG448: lui $3, 9 mult $3, $3 lui $1, 2 lui $4, 14 TAG449: lui $2, 8 beq $4, $2, TAG450 div $2, $2 sll $0, $0, 0 TAG450: subu $2, $2, $2 sw $2, 0($2) multu $2, $2 mfhi $1 TAG451: sb $1, 0($1) xor $1, $1, $1 sh $1, 0($1) srlv $2, $1, $1 TAG452: lbu $1, 0($2) subu $3, $1, $2 andi $1, $2, 6 mtlo $1 TAG453: lui $4, 8 mtlo $4 mflo $4 lui $4, 8 TAG454: mfhi $3 divu $3, $4 sll $0, $0, 0 lui $2, 9 TAG455: mflo $3 addi $2, $3, 8 blez $2, TAG456 lui $2, 9 TAG456: lui $4, 4 divu $4, $4 sll $0, $0, 0 addu $3, $4, $4 TAG457: lui $2, 10 sll $0, $0, 0 slti $3, $3, 0 lw $1, 0($3) TAG458: sw $1, 0($1) mthi $1 sub $3, $1, $1 beq $1, $3, TAG459 TAG459: sw $3, 0($3) bgtz $3, TAG460 mtlo $3 addi $3, $3, 9 TAG460: ori $2, $3, 5 mflo $2 bltz $2, TAG461 mthi $2 TAG461: bgez $2, TAG462 lb $3, 0($2) and $3, $3, $2 or $2, $3, $3 TAG462: lb $3, 0($2) mthi $3 xori $3, $3, 0 mtlo $3 TAG463: lbu $1, 0($3) mflo $2 sltiu $3, $2, 3 slt $1, $3, $1 TAG464: sltiu $3, $1, 8 sltiu $1, $3, 0 bgez $3, TAG465 multu $1, $1 TAG465: nor $2, $1, $1 multu $1, $2 lbu $3, 0($1) divu $1, $2 TAG466: beq $3, $3, TAG467 sltiu $2, $3, 9 divu $2, $2 srlv $3, $3, $3 TAG467: mtlo $3 lui $4, 11 sb $4, 0($3) mflo $3 TAG468: mthi $3 mfhi $2 mtlo $2 xor $2, $2, $2 TAG469: mflo $4 mfhi $3 lw $1, 0($2) mfhi $4 TAG470: lui $2, 5 div $4, $2 mflo $1 bne $1, $2, TAG471 TAG471: srlv $2, $1, $1 slt $4, $1, $2 mtlo $2 mtlo $4 TAG472: lui $4, 2 divu $4, $4 sltiu $3, $4, 7 bne $4, $4, TAG473 TAG473: lui $4, 0 sh $4, 0($4) slt $4, $4, $3 lui $4, 9 TAG474: lui $4, 0 multu $4, $4 mtlo $4 xori $1, $4, 1 TAG475: div $1, $1 divu $1, $1 bltz $1, TAG476 multu $1, $1 TAG476: beq $1, $1, TAG477 addiu $1, $1, 6 blez $1, TAG477 lui $4, 12 TAG477: beq $4, $4, TAG478 mfhi $1 mthi $1 mtlo $1 TAG478: mult $1, $1 bgtz $1, TAG479 lb $4, 0($1) bne $1, $1, TAG479 TAG479: mult $4, $4 slt $2, $4, $4 beq $2, $2, TAG480 ori $1, $4, 10 TAG480: mthi $1 mtlo $1 mfhi $3 bltz $1, TAG481 TAG481: lh $3, 0($3) sll $1, $3, 2 lh $3, -2826($3) mtlo $1 TAG482: multu $3, $3 mtlo $3 sllv $4, $3, $3 bne $4, $3, TAG483 TAG483: mult $4, $4 lui $4, 7 sll $0, $0, 0 lui $1, 6 TAG484: lui $3, 10 bgtz $1, TAG485 mtlo $3 lw $1, 0($1) TAG485: mflo $4 sll $0, $0, 0 bne $1, $1, TAG486 sll $0, $0, 0 TAG486: sll $0, $0, 0 bltz $4, TAG487 mtlo $4 slti $3, $4, 12 TAG487: slt $1, $3, $3 slti $3, $1, 2 lbu $3, 0($3) mthi $1 TAG488: add $3, $3, $3 multu $3, $3 sw $3, 0($3) mthi $3 TAG489: bne $3, $3, TAG490 sltiu $1, $3, 4 lui $1, 14 bltz $1, TAG490 TAG490: mflo $3 lui $3, 2 bltz $3, TAG491 and $1, $1, $3 TAG491: mfhi $4 lui $4, 14 sra $1, $4, 2 lui $4, 14 TAG492: bltz $4, TAG493 srav $4, $4, $4 and $1, $4, $4 beq $4, $4, TAG493 TAG493: sll $0, $0, 0 subu $1, $1, $1 lui $3, 5 mfhi $1 TAG494: blez $1, TAG495 sb $1, 0($1) lh $4, 0($1) add $4, $1, $4 TAG495: mthi $4 bne $4, $4, TAG496 lui $2, 14 mult $4, $2 TAG496: sllv $1, $2, $2 mthi $1 srlv $3, $1, $2 bne $1, $3, TAG497 TAG497: sll $0, $0, 0 divu $2, $2 lui $1, 12 ori $1, $1, 9 TAG498: bne $1, $1, TAG499 mflo $1 mflo $2 addu $4, $1, $2 TAG499: sh $4, 0($4) or $2, $4, $4 lbu $4, 0($2) xor $4, $4, $4 TAG500: lui $1, 8 bne $1, $1, TAG501 sllv $3, $1, $4 sll $0, $0, 0 TAG501: bne $2, $2, TAG502 xori $1, $2, 15 lb $4, 0($2) div $1, $1 TAG502: lui $4, 11 bltz $4, TAG503 subu $1, $4, $4 mfhi $2 TAG503: lb $3, 0($2) addiu $4, $2, 2 subu $2, $3, $2 mthi $2 TAG504: sllv $4, $2, $2 mtlo $2 multu $4, $4 lui $2, 0 TAG505: sb $2, 0($2) lb $3, 0($2) mthi $2 blez $2, TAG506 TAG506: mtlo $3 lui $3, 12 bltz $3, TAG507 addiu $3, $3, 5 TAG507: sll $0, $0, 0 mflo $3 mtlo $3 lb $3, 0($3) TAG508: lui $1, 14 sll $0, $0, 0 add $4, $3, $2 bne $4, $1, TAG509 TAG509: srl $4, $4, 5 mthi $4 srl $1, $4, 1 lhu $4, 0($4) TAG510: sb $4, 0($4) lui $2, 7 mflo $1 mflo $3 TAG511: addiu $4, $3, 12 slti $2, $4, 7 lhu $3, 0($4) slt $4, $4, $2 TAG512: mult $4, $4 mfhi $3 sb $3, 0($4) mtlo $3 TAG513: lui $2, 0 multu $2, $2 mult $3, $2 slti $4, $3, 7 TAG514: divu $4, $4 sb $4, 0($4) blez $4, TAG515 or $3, $4, $4 TAG515: sb $3, 0($3) bne $3, $3, TAG516 srl $1, $3, 8 addu $2, $1, $3 TAG516: mthi $2 bltz $2, TAG517 sb $2, 0($2) bgez $2, TAG517 TAG517: mfhi $3 mfhi $1 andi $4, $1, 13 ori $1, $1, 11 TAG518: lui $3, 14 mthi $3 mfhi $3 sll $0, $0, 0 TAG519: lui $1, 10 mthi $1 sltiu $2, $1, 0 mflo $2 TAG520: beq $2, $2, TAG521 mflo $3 mult $2, $3 lhu $2, 0($3) TAG521: sb $2, 0($2) addiu $3, $2, 0 srav $2, $3, $2 mflo $1 TAG522: divu $1, $1 beq $1, $1, TAG523 lui $4, 12 srl $3, $1, 14 TAG523: beq $3, $3, TAG524 mtlo $3 lui $1, 4 lui $4, 12 TAG524: addiu $3, $4, 5 sll $0, $0, 0 bltz $3, TAG525 multu $4, $3 TAG525: sll $0, $0, 0 lui $4, 14 addu $2, $4, $4 sltiu $3, $4, 5 TAG526: multu $3, $3 lui $1, 15 blez $1, TAG527 multu $3, $1 TAG527: mflo $3 div $3, $1 mflo $2 mfhi $4 TAG528: mthi $4 lui $4, 15 lui $4, 0 lui $2, 11 TAG529: nor $1, $2, $2 sll $0, $0, 0 bgtz $1, TAG530 ori $4, $1, 4 TAG530: sll $0, $0, 0 mthi $3 mtlo $3 mfhi $4 TAG531: sh $4, 0($4) beq $4, $4, TAG532 lui $1, 9 or $4, $4, $4 TAG532: blez $4, TAG533 mtlo $4 bgtz $4, TAG533 or $4, $4, $4 TAG533: sra $3, $4, 3 lui $3, 4 addiu $3, $3, 13 beq $3, $3, TAG534 TAG534: div $3, $3 sra $2, $3, 12 subu $1, $3, $2 bgez $2, TAG535 TAG535: mfhi $3 beq $3, $1, TAG536 slt $1, $3, $3 sw $3, 0($1) TAG536: ori $1, $1, 2 bgez $1, TAG537 sh $1, 0($1) bne $1, $1, TAG537 TAG537: lui $4, 9 lui $2, 1 srlv $1, $4, $1 lui $3, 4 TAG538: lui $2, 14 bne $3, $3, TAG539 mflo $2 mfhi $2 TAG539: lui $4, 9 lui $2, 12 mthi $2 sll $4, $2, 7 TAG540: bltz $4, TAG541 sll $0, $0, 0 mtlo $4 sll $0, $0, 0 TAG541: xor $1, $4, $4 lui $3, 12 bgtz $4, TAG542 lh $2, 0($1) TAG542: sh $2, 0($2) lhu $3, 0($2) slt $4, $2, $2 bne $3, $4, TAG543 TAG543: lw $1, 0($4) lh $4, 0($4) sll $4, $4, 12 sub $2, $1, $4 TAG544: sll $0, $0, 0 slt $1, $4, $4 bgtz $4, TAG545 sll $0, $0, 0 TAG545: lui $4, 10 sll $0, $0, 0 bltz $3, TAG546 sll $4, $3, 0 TAG546: multu $4, $4 bne $4, $4, TAG547 xori $1, $4, 10 sh $4, 0($4) TAG547: sh $1, 0($1) lui $3, 6 beq $1, $1, TAG548 and $3, $1, $1 TAG548: mfhi $4 sb $3, 0($4) sb $3, 0($4) mthi $4 TAG549: slt $1, $4, $4 sllv $2, $1, $1 mthi $2 srav $4, $4, $1 TAG550: sh $4, 0($4) sb $4, 0($4) beq $4, $4, TAG551 mflo $4 TAG551: sll $1, $4, 2 mflo $3 sub $1, $4, $3 slt $1, $4, $1 TAG552: mflo $4 sw $4, 0($4) sra $4, $1, 11 mthi $4 TAG553: sub $1, $4, $4 mfhi $3 lhu $3, 0($1) lhu $3, 0($4) TAG554: slt $2, $3, $3 bne $2, $2, TAG555 sw $2, 0($3) lb $2, 0($2) TAG555: multu $2, $2 and $3, $2, $2 srlv $4, $3, $3 mthi $4 TAG556: addi $1, $4, 7 divu $4, $1 mfhi $3 lb $4, 0($1) TAG557: lbu $1, 0($4) lhu $3, 0($4) lui $2, 8 beq $1, $3, TAG558 TAG558: slti $2, $2, 0 blez $2, TAG559 lui $4, 15 beq $4, $2, TAG559 TAG559: andi $2, $4, 5 mflo $2 bltz $4, TAG560 sw $2, 0($2) TAG560: lb $3, 0($2) addi $4, $3, 0 lhu $1, 0($3) multu $4, $2 TAG561: lui $4, 11 sw $4, 0($1) sll $0, $0, 0 mthi $1 TAG562: addu $2, $4, $4 slti $3, $4, 11 bgez $4, TAG563 mthi $3 TAG563: nor $3, $3, $3 bltz $3, TAG564 sb $3, 1($3) div $3, $3 TAG564: sll $0, $0, 0 mflo $3 sb $3, 0($3) bgtz $3, TAG565 TAG565: sh $3, 0($3) bne $3, $3, TAG566 lui $3, 15 mtlo $3 TAG566: lui $2, 0 beq $3, $2, TAG567 mflo $2 slti $2, $3, 13 TAG567: lui $2, 2 beq $2, $2, TAG568 lui $3, 6 sw $2, 0($3) TAG568: beq $3, $3, TAG569 div $3, $3 lui $4, 3 sh $3, 0($4) TAG569: div $4, $4 mfhi $2 blez $4, TAG570 div $2, $4 TAG570: and $4, $2, $2 blez $2, TAG571 mthi $4 mflo $4 TAG571: mflo $1 xori $3, $4, 9 mflo $2 lui $3, 9 TAG572: bgez $3, TAG573 mflo $4 nor $3, $4, $4 slti $3, $3, 3 TAG573: mfhi $1 sll $4, $3, 1 sb $4, 0($1) sll $0, $0, 0 TAG574: sll $0, $0, 0 bne $4, $4, TAG575 sll $0, $0, 0 mfhi $2 TAG575: beq $2, $2, TAG576 slt $2, $2, $2 blez $2, TAG576 mtlo $2 TAG576: beq $2, $2, TAG577 mtlo $2 mult $2, $2 lui $4, 9 TAG577: sll $0, $0, 0 bltz $4, TAG578 sll $0, $0, 0 divu $4, $4 TAG578: sll $0, $0, 0 addu $4, $4, $4 sll $0, $0, 0 lb $1, 0($1) TAG579: mfhi $1 sh $1, 0($1) lui $2, 12 bne $1, $1, TAG580 TAG580: mfhi $4 lb $4, 0($4) lb $1, 0($4) multu $1, $1 TAG581: bgtz $1, TAG582 mfhi $2 beq $2, $1, TAG582 mthi $2 TAG582: mtlo $2 beq $2, $2, TAG583 srl $1, $2, 7 divu $2, $2 TAG583: lhu $1, 0($1) lui $2, 1 multu $1, $1 mtlo $1 TAG584: sll $0, $0, 0 nor $4, $2, $2 mfhi $3 lb $4, 0($3) TAG585: sllv $4, $4, $4 slti $3, $4, 4 beq $4, $4, TAG586 add $4, $4, $4 TAG586: sw $4, 0($4) mthi $4 bltz $4, TAG587 lhu $1, 0($4) TAG587: lui $3, 4 sh $1, 0($1) lhu $3, 0($1) srlv $3, $3, $1 TAG588: and $3, $3, $3 bltz $3, TAG589 sh $3, 0($3) mtlo $3 TAG589: sll $1, $3, 9 mfhi $2 sw $2, 0($3) mfhi $2 TAG590: lhu $4, 0($2) bltz $2, TAG591 slt $2, $4, $2 beq $4, $4, TAG591 TAG591: lw $1, 0($2) sub $3, $1, $1 andi $4, $2, 12 mfhi $4 TAG592: mflo $3 bltz $3, TAG593 mtlo $4 subu $3, $4, $3 TAG593: sra $1, $3, 13 lbu $3, 0($3) lui $1, 4 mult $3, $3 TAG594: bne $1, $1, TAG595 mult $1, $1 sll $0, $0, 0 sll $0, $0, 0 TAG595: bne $2, $2, TAG596 mtlo $2 add $3, $2, $2 mtlo $2 TAG596: sh $3, 0($3) bltz $3, TAG597 sb $3, 0($3) mtlo $3 TAG597: ori $2, $3, 10 lh $1, 0($2) sra $2, $1, 9 bne $3, $1, TAG598 TAG598: slti $2, $2, 5 lui $1, 5 srlv $3, $1, $2 bne $2, $3, TAG599 TAG599: andi $2, $3, 5 sh $2, 0($2) addu $3, $3, $2 sll $4, $3, 12 TAG600: bgtz $4, TAG601 mtlo $4 mthi $4 lbu $4, 0($4) TAG601: bltz $4, TAG602 lui $2, 0 mfhi $1 multu $1, $2 TAG602: ori $4, $1, 1 lbu $2, 0($4) lw $1, 0($2) mult $1, $1 TAG603: sltiu $2, $1, 10 lbu $4, 0($2) lui $4, 4 sll $0, $0, 0 TAG604: lbu $1, 0($2) sb $2, 0($2) bgtz $2, TAG605 mflo $3 TAG605: bne $3, $3, TAG606 mult $3, $3 bgez $3, TAG606 xori $2, $3, 6 TAG606: div $2, $2 mflo $2 lbu $2, 0($2) lui $3, 4 TAG607: beq $3, $3, TAG608 sll $0, $0, 0 mthi $1 mthi $1 TAG608: lui $4, 2 mfhi $2 lui $3, 5 sw $4, 0($2) TAG609: mthi $3 lui $1, 14 lui $3, 7 mthi $3 TAG610: lui $4, 4 sll $0, $0, 0 divu $3, $3 sll $0, $0, 0 TAG611: mfhi $2 bne $4, $2, TAG612 mthi $4 mtlo $2 TAG612: sltiu $3, $2, 12 srav $2, $3, $3 sb $2, 0($3) lui $3, 8 TAG613: addu $4, $3, $3 blez $3, TAG614 sltu $4, $3, $4 sb $3, 0($4) TAG614: lui $1, 8 blez $4, TAG615 multu $1, $1 sll $0, $0, 0 TAG615: sll $2, $2, 5 mthi $2 mtlo $2 mthi $2 TAG616: lhu $2, 0($2) mflo $1 mthi $2 sb $2, 0($1) TAG617: lui $2, 6 lui $4, 15 blez $2, TAG618 mflo $3 TAG618: mfhi $1 lui $3, 9 mthi $3 mfhi $4 TAG619: lui $3, 3 div $4, $3 sll $0, $0, 0 srlv $1, $4, $3 TAG620: mtlo $1 sll $0, $0, 0 bne $1, $1, TAG621 sll $0, $0, 0 TAG621: mflo $3 mfhi $3 bgez $3, TAG622 addiu $3, $1, 15 TAG622: mult $3, $3 mtlo $3 andi $2, $3, 8 mtlo $3 TAG623: sll $2, $2, 10 sra $1, $2, 11 mtlo $2 lui $1, 8 TAG624: srav $3, $1, $1 lui $4, 5 slt $3, $4, $1 bne $4, $1, TAG625 TAG625: divu $3, $3 mfhi $3 lui $1, 14 lbu $2, 0($3) TAG626: multu $2, $2 mflo $3 bgtz $3, TAG627 multu $2, $3 TAG627: sll $3, $3, 6 ori $4, $3, 11 blez $4, TAG628 mult $3, $3 TAG628: lb $2, 0($4) mult $4, $2 mflo $2 bne $2, $2, TAG629 TAG629: multu $2, $2 lw $2, 0($2) sll $0, $0, 0 mthi $2 TAG630: slti $2, $1, 11 blez $2, TAG631 lui $2, 13 lw $1, 0($1) TAG631: mflo $2 multu $1, $1 mflo $2 addi $2, $2, 4 TAG632: sw $2, 0($2) mtlo $2 blez $2, TAG633 srlv $4, $2, $2 TAG633: mflo $1 lui $2, 10 beq $4, $1, TAG634 lb $3, 0($1) TAG634: or $1, $3, $3 lhu $4, 0($3) sh $1, 0($1) beq $1, $4, TAG635 TAG635: div $4, $4 sb $4, 0($4) lb $4, 0($4) mult $4, $4 TAG636: mtlo $4 subu $1, $4, $4 lw $4, 0($4) beq $4, $1, TAG637 TAG637: sh $4, 0($4) addiu $4, $4, 2 bgez $4, TAG638 lh $3, 0($4) TAG638: mfhi $2 sb $3, 0($2) lui $4, 6 mthi $3 TAG639: sll $0, $0, 0 lui $3, 11 sll $0, $0, 0 bgez $4, TAG640 TAG640: sll $0, $0, 0 mtlo $3 sll $0, $0, 0 sll $0, $0, 0 TAG641: addu $2, $3, $3 lui $1, 1 mflo $1 bltz $3, TAG642 TAG642: multu $1, $1 mtlo $1 sll $0, $0, 0 mthi $1 TAG643: sll $0, $0, 0 lui $3, 2 sll $0, $0, 0 mfhi $2 TAG644: nor $1, $2, $2 beq $1, $2, TAG645 multu $2, $1 sll $0, $0, 0 TAG645: mthi $1 sll $0, $0, 0 div $1, $1 divu $1, $1 TAG646: mthi $1 lui $4, 1 div $1, $4 mflo $3 TAG647: ori $4, $3, 14 multu $3, $4 div $3, $3 lui $3, 10 TAG648: bgez $3, TAG649 div $3, $3 srav $2, $3, $3 mflo $3 TAG649: srav $1, $3, $3 sll $0, $0, 0 mtlo $1 slt $3, $1, $1 TAG650: nor $3, $3, $3 xor $2, $3, $3 lui $2, 0 mfhi $2 TAG651: mfhi $4 sh $2, 0($4) sh $2, 0($2) xor $4, $4, $4 TAG652: sw $4, 0($4) blez $4, TAG653 sh $4, 0($4) bne $4, $4, TAG653 TAG653: sll $1, $4, 7 sltu $3, $1, $4 bne $1, $4, TAG654 mflo $4 TAG654: sll $0, $0, 0 mult $4, $4 divu $4, $4 bgez $4, TAG655 TAG655: lui $4, 1 multu $4, $4 beq $4, $4, TAG656 sra $2, $4, 2 TAG656: bne $2, $2, TAG657 sh $2, -16384($2) sh $2, -16384($2) srav $4, $2, $2 TAG657: mfhi $1 lui $1, 9 subu $2, $1, $4 beq $2, $2, TAG658 TAG658: mfhi $4 sltiu $3, $2, 1 mflo $4 mfhi $4 TAG659: lui $1, 10 lbu $4, 0($4) lb $1, 0($4) beq $1, $4, TAG660 TAG660: lui $2, 7 sll $0, $0, 0 lbu $1, 0($1) and $1, $1, $2 TAG661: srlv $2, $1, $1 lui $2, 11 multu $1, $2 beq $1, $2, TAG662 TAG662: sll $0, $0, 0 sra $1, $2, 12 lb $2, -176($1) mthi $2 TAG663: mfhi $4 lui $2, 1 beq $4, $2, TAG664 lui $3, 14 TAG664: bgtz $3, TAG665 sll $0, $0, 0 lhu $2, 0($3) slti $4, $3, 9 TAG665: beq $4, $4, TAG666 multu $4, $4 mfhi $4 lui $1, 1 TAG666: multu $1, $1 subu $4, $1, $1 bgez $4, TAG667 addiu $2, $1, 15 TAG667: sb $2, -191($2) andi $1, $2, 1 div $2, $2 mflo $3 TAG668: mthi $3 mflo $1 bne $3, $1, TAG669 multu $3, $1 TAG669: mthi $1 mthi $1 mthi $1 bne $1, $1, TAG670 TAG670: mfhi $4 mflo $2 mfhi $2 lbu $3, 0($4) TAG671: mflo $4 mult $3, $3 mfhi $4 lb $4, 0($4) TAG672: srl $4, $4, 0 addiu $3, $4, 6 bne $3, $4, TAG673 lw $1, 59($3) TAG673: sll $0, $0, 0 lui $3, 7 blez $3, TAG674 mtlo $3 TAG674: multu $3, $3 slti $3, $3, 6 lui $1, 7 multu $3, $3 TAG675: sll $0, $0, 0 lui $2, 9 mult $2, $1 slti $1, $2, 8 TAG676: mult $1, $1 andi $3, $1, 15 andi $3, $1, 9 sh $3, 0($3) TAG677: mflo $3 blez $3, TAG678 mtlo $3 xori $3, $3, 7 TAG678: subu $3, $3, $3 mthi $3 mflo $1 beq $3, $3, TAG679 TAG679: nor $3, $1, $1 mult $3, $3 bgez $3, TAG680 andi $3, $1, 10 TAG680: mtlo $3 lh $4, 0($3) beq $4, $3, TAG681 sb $4, 0($3) TAG681: andi $2, $4, 2 lw $2, 0($2) bne $2, $2, TAG682 mtlo $4 TAG682: bltz $2, TAG683 mthi $2 srav $2, $2, $2 lbu $3, 0($2) TAG683: mflo $4 lbu $1, 0($4) bgez $4, TAG684 mfhi $4 TAG684: addi $4, $4, 13 subu $3, $4, $4 lui $3, 6 mflo $4 TAG685: multu $4, $4 mult $4, $4 bgtz $4, TAG686 srav $4, $4, $4 TAG686: lui $3, 5 mfhi $1 mult $4, $1 sb $3, 0($1) TAG687: beq $1, $1, TAG688 mfhi $2 bltz $1, TAG688 lb $2, 0($2) TAG688: mult $2, $2 mthi $2 mtlo $2 add $2, $2, $2 TAG689: mtlo $2 mult $2, $2 lw $1, 0($2) lhu $3, 0($2) TAG690: mfhi $4 mthi $4 beq $3, $4, TAG691 mthi $3 TAG691: lbu $2, 0($4) multu $2, $2 mtlo $2 sb $4, 0($4) TAG692: lui $4, 13 lhu $4, 0($2) mtlo $4 bltz $4, TAG693 TAG693: lui $1, 12 mult $1, $4 div $4, $1 bgez $4, TAG694 TAG694: mflo $1 bne $1, $1, TAG695 mflo $2 sb $1, 0($2) TAG695: sw $2, 0($2) xori $3, $2, 15 mult $2, $2 lui $4, 8 TAG696: bltz $4, TAG697 sll $0, $0, 0 xor $1, $4, $4 mtlo $4 TAG697: bne $1, $1, TAG698 multu $1, $1 lb $2, 0($1) add $4, $2, $1 TAG698: ori $4, $4, 14 divu $4, $4 sb $4, 0($4) sh $4, 0($4) TAG699: divu $4, $4 sh $4, 0($4) lhu $4, 0($4) lui $4, 10 TAG700: sll $0, $0, 0 lui $3, 13 mflo $2 sra $1, $4, 7 TAG701: mthi $1 lb $2, -5120($1) multu $2, $2 sb $2, -5120($1) TAG702: lui $1, 5 beq $1, $1, TAG703 andi $3, $1, 8 bne $2, $3, TAG703 TAG703: mthi $3 beq $3, $3, TAG704 mult $3, $3 bgez $3, TAG704 TAG704: lui $4, 2 blez $4, TAG705 mtlo $3 lhu $2, 0($3) TAG705: mthi $2 bgez $2, TAG706 mfhi $2 mfhi $4 TAG706: blez $4, TAG707 lui $1, 14 mfhi $1 mflo $3 TAG707: beq $3, $3, TAG708 mfhi $4 div $3, $4 bgtz $4, TAG708 TAG708: lui $4, 14 beq $4, $4, TAG709 lui $2, 5 sw $4, 0($4) TAG709: sll $0, $0, 0 multu $2, $2 xor $4, $2, $2 srl $1, $2, 0 TAG710: mfhi $3 xor $2, $3, $1 sb $2, 0($3) lui $1, 15 TAG711: blez $1, TAG712 sll $0, $0, 0 bgez $1, TAG712 addiu $2, $1, 11 TAG712: bne $2, $2, TAG713 mult $2, $2 mtlo $2 bne $2, $2, TAG713 TAG713: sll $0, $0, 0 mfhi $3 lw $2, -225($3) sw $2, 0($2) TAG714: lw $4, 0($2) sll $1, $2, 4 sh $1, 0($2) lui $4, 15 TAG715: xor $1, $4, $4 sll $1, $4, 10 lui $1, 2 divu $1, $4 TAG716: bltz $1, TAG717 srlv $4, $1, $1 lui $4, 5 sll $0, $0, 0 TAG717: sll $0, $0, 0 lui $4, 13 mtlo $4 mthi $1 TAG718: multu $4, $4 lui $3, 11 slt $1, $3, $3 or $4, $4, $3 TAG719: multu $4, $4 blez $4, TAG720 and $1, $4, $4 mflo $3 TAG720: mthi $3 lb $4, 0($3) andi $1, $3, 9 mflo $3 TAG721: mflo $3 lw $2, 0($3) ori $3, $3, 3 mflo $1 TAG722: beq $1, $1, TAG723 or $1, $1, $1 mult $1, $1 bne $1, $1, TAG723 TAG723: mthi $1 sh $1, 0($1) slti $4, $1, 0 lb $2, 0($1) TAG724: bne $2, $2, TAG725 lbu $1, 0($2) xor $2, $2, $2 multu $1, $1 TAG725: mult $2, $2 sw $2, 0($2) beq $2, $2, TAG726 sub $1, $2, $2 TAG726: bne $1, $1, TAG727 mtlo $1 mthi $1 beq $1, $1, TAG727 TAG727: mtlo $1 mfhi $4 bgtz $1, TAG728 mflo $3 TAG728: lui $1, 13 sb $1, 0($3) srlv $4, $3, $3 mthi $1 TAG729: mflo $1 mthi $1 mult $4, $1 multu $1, $1 TAG730: mult $1, $1 mfhi $4 add $1, $1, $1 bltz $4, TAG731 TAG731: multu $1, $1 multu $1, $1 sllv $3, $1, $1 srlv $1, $1, $1 TAG732: bgez $1, TAG733 nor $1, $1, $1 srav $1, $1, $1 lui $2, 1 TAG733: mthi $2 bne $2, $2, TAG734 lui $1, 14 sh $2, 0($2) TAG734: ori $1, $1, 10 lui $2, 9 slti $4, $2, 2 mthi $4 TAG735: lui $4, 15 multu $4, $4 lui $1, 7 sll $0, $0, 0 TAG736: mfhi $1 div $1, $1 sb $1, -225($1) bltz $1, TAG737 TAG737: sw $1, -225($1) xor $3, $1, $1 mthi $1 bltz $3, TAG738 TAG738: sh $3, 0($3) mfhi $4 mflo $1 mult $4, $3 TAG739: lui $4, 2 mflo $4 addi $3, $4, 14 bne $4, $4, TAG740 TAG740: sh $3, 0($3) sb $3, 0($3) divu $3, $3 sh $3, 0($3) TAG741: and $4, $3, $3 beq $4, $3, TAG742 div $4, $4 bne $4, $4, TAG742 TAG742: mtlo $4 bne $4, $4, TAG743 srl $2, $4, 13 mfhi $1 TAG743: mfhi $4 addi $1, $1, 4 lui $4, 8 addu $1, $1, $1 TAG744: bgtz $1, TAG745 lh $2, 0($1) subu $2, $1, $1 addiu $1, $1, 4 TAG745: multu $1, $1 sb $1, 0($1) mflo $2 mtlo $1 TAG746: bne $2, $2, TAG747 mtlo $2 and $2, $2, $2 lui $4, 11 TAG747: bgez $4, TAG748 divu $4, $4 beq $4, $4, TAG748 divu $4, $4 TAG748: sll $0, $0, 0 lui $3, 3 bne $3, $4, TAG749 sra $3, $4, 8 TAG749: multu $3, $3 beq $3, $3, TAG750 mtlo $3 mflo $2 TAG750: nop nop test_end: beq $0, $0, test_end nop
src/Relation/Ternary/Separation/Monad/Reader.agda
laMudri/linear.agda
34
2164
<filename>src/Relation/Ternary/Separation/Monad/Reader.agda module Relation.Ternary.Separation.Monad.Reader where open import Level open import Function using (_∘_; case_of_) open import Relation.Binary.PropositionalEquality using (refl) open import Relation.Unary open import Relation.Unary.PredicateTransformer using (PT) open import Relation.Ternary.Separation open import Relation.Ternary.Separation.Morphisms open import Relation.Ternary.Separation.Monad open import Relation.Ternary.Separation.Allstar open import Data.Product open import Data.List hiding (concat; lookup) open import Data.Unit private variable ℓv : Level A : Set ℓv Γ Γ₁ Γ₂ Γ₃ : List A {- Something not unlike a indexed relative monad transformer in a bicartesian closed category -} module ReaderTransformer {ℓ} -- types {T : Set ℓ} -- runtime resource {C : Set ℓ} {{rc : RawSep C}} {u} {{sc : IsUnitalSep rc u}} {{cc : IsConcattative rc}} -- {B : Set ℓ} {{rb : RawSep B}} (j : Morphism C B) {{sb : IsUnitalSep rb (Morphism.j j u)}} (V : T → Pred C ℓ) -- values (M : PT C B ℓ ℓ) {{monad : Monads.Monad {{jm = j}} ⊤ ℓ (λ _ _ → M) }} where open Morphism j hiding (j) public open Monads {{jm = j}} using (Monad; str; typed-str) open import Relation.Ternary.Separation.Construct.List T module _ where open Monad monad variable P Q R : Pred C ℓ Reader : ∀ (Γ₁ Γ₂ : List T) (P : Pred C ℓ) → Pred B ℓ Reader Γ₁ Γ₂ P = J (Allstar V Γ₁) ─✴ M (P ✴ Allstar V Γ₂) instance reader-monad : Monad (List T) _ Reader app (Monad.return reader-monad px) (inj e) s = return px &⟨ s ⟩ e app (app (Monad.bind reader-monad f) mp σ₁) env σ₂ = let _ , σ₃ , σ₄ = ⊎-assoc σ₁ σ₂ in app (bind (wand λ where (px ×⟨ σ₅ ⟩ env') σ₆ → let _ , τ₁ , τ₂ = ⊎-unassoc σ₆ (j-⊎ σ₅) in app (app f px τ₁) (inj env') τ₂)) (app mp env σ₄) σ₃ frame : Γ₁ ⊎ Γ₃ ≣ Γ₂ → ∀[ Reader Γ₁ ε P ⇒ Reader Γ₂ Γ₃ P ] app (frame sep c) (inj env) σ = do let E₁ ×⟨ σ₁ ⟩ E₂ = repartition sep env let Φ , σ₂ , σ₃ = ⊎-unassoc σ (j-⊎ σ₁) (v ×⟨ σ₄ ⟩ nil) ×⟨ σ₅ ⟩ E₃ ← app c (inj E₁) σ₂ &⟨ Allstar _ _ ∥ σ₃ ⟩ E₂ case ⊎-id⁻ʳ σ₄ of λ where refl → return (v ×⟨ σ₅ ⟩ E₃) ask : ε[ Reader Γ ε (Allstar V Γ) ] app ask (inj env) σ with ⊎-id⁻ˡ σ ... | refl = return (env ×⟨ ⊎-idʳ ⟩ nil) prepend : ∀[ Allstar V Γ₁ ⇒ⱼ Reader Γ₂ (Γ₁ ∙ Γ₂) Emp ] app (prepend env₁) (inj env₂) s with j-⊎⁻ s ... | _ , refl , s' = return (empty ×⟨ ⊎-idˡ ⟩ (concat (env₁ ×⟨ s' ⟩ env₂))) append : ∀[ Allstar V Γ₁ ⇒ⱼ Reader Γ₂ (Γ₂ ∙ Γ₁) Emp ] app (append env₁) (inj env₂) s with j-⊎⁻ s ... | _ , refl , s' = return (empty ×⟨ ⊎-idˡ ⟩ (concat (✴-swap (env₁ ×⟨ s' ⟩ env₂)))) liftM : ∀[ M P ⇒ Reader Γ Γ P ] app (liftM mp) (inj env) σ = do mp &⟨ σ ⟩ env runReader : ∀[ Allstar V Γ ⇒ⱼ Reader Γ ε P ─✴ M P ] app (runReader env) mp σ = do px ×⟨ σ ⟩ nil ← app mp (inj env) (⊎-comm σ) case ⊎-id⁻ʳ σ of λ where refl → return px module _ where open Monad reader-monad lookup : ∀ {a} → ε[ Reader [ a ] [] (V a) ] lookup = do v :⟨ σ ⟩: nil ← ask case ⊎-id⁻ʳ σ of λ where refl → return v module ReaderMonad {ℓ} -- types {T : Set ℓ} -- runtime resource {C : Set ℓ} {{rc : RawSep C}} {u} {{sc : IsUnitalSep rc u}} {{cc : IsConcattative rc}} -- values (V : T → Pred C ℓ) where open import Relation.Ternary.Separation.Monad.Identity open ReaderTransformer id-morph V Identity.Id {{ monad = Identity.id-monad }} public
src/main/antlr/io/georocket/index/Properties.g4
tobias93/georocket
0
3515
grammar Properties; @header { package io.georocket.index; import org.apache.commons.text.StringEscapeUtils; import io.georocket.query.ThrowingErrorListener; } @members { public static java.util.Map<String, Object> parse(String properties) { PropertiesLexer lexer = new PropertiesLexer(CharStreams.fromString(properties.trim())); lexer.removeErrorListeners(); lexer.addErrorListener(new ThrowingErrorListener()); CommonTokenStream tokens = new CommonTokenStream(lexer); PropertiesParser parser = new PropertiesParser(tokens); parser.removeErrorListeners(); parser.addErrorListener(new ThrowingErrorListener()); return parser.properties().result; } } properties returns [java.util.Map<String, Object> result] @init { $result = new java.util.LinkedHashMap<String, Object>(); } : a=keyvalue { $result.put($a.result.getFirst(), $a.result.getSecond()); } ( ',' b=keyvalue { $result.put($b.result.getFirst(), $b.result.getSecond()); } )* EOF ; keyvalue returns [kotlin.Pair<String, Object> result] : string ':' value { $result = new kotlin.Pair<>($string.result, $value.result); } ; value returns [Object result] : number { $result = $number.result; } | string { $result = $string.result; } ; number returns [Number result] : NUMBER { try { $result = Long.parseLong($NUMBER.text); } catch (NumberFormatException e) { $result = Double.parseDouble($NUMBER.text); } } ; string returns [String result] : QUOTED_STRING { $result = $QUOTED_STRING.text; } | STRING { $result = $STRING.text; } ; QUOTED_STRING : ( '"' ( '\\"' | ~('\n'|'\r') )*? '"' | '\'' ( '\\\'' | ~('\n'|'\r') )*? '\'' ) { String s = getText(); s = s.substring(1, s.length() - 1); s = StringEscapeUtils.unescapeJava(s); setText(s); } ; NUMBER : [+-]? ( [0-9]+ ( '.' [0-9]* )? ( [eE] [+-]? [0-9]+ )? | '.' [0-9]+ ( [eE] [+-]? [0-9]+ )? ) ; STRING : ~[ ,:\n\r"']+ ;
src/Recursion-without-rec.agda
nad/chi
2
10087
<filename>src/Recursion-without-rec.agda ------------------------------------------------------------------------ -- The rec construction can be encoded using λ-terms ------------------------------------------------------------------------ module Recursion-without-rec where open import Equality.Propositional.Cubical open import Prelude hiding (id; swap) import Finite-subset.Listed equality-with-paths as S -- To simplify the development, let's work with actual natural numbers -- as variables and constants (see -- Atom.one-can-restrict-attention-to-χ-ℕ-atoms). open import Atom open import Alpha-equivalence χ-ℕ-atoms open import Chi χ-ℕ-atoms open import Compatibility χ-ℕ-atoms open import Constants χ-ℕ-atoms open import Free-variables χ-ℕ-atoms open import Reasoning χ-ℕ-atoms open import Substitution χ-ℕ-atoms open import Values χ-ℕ-atoms open χ-atoms χ-ℕ-atoms open import Combinators using (id; id-closed) private variable A : Type R : A → A → Type x y z z₁ z₂ : Var e e′ v : Exp ------------------------------------------------------------------------ -- "Plain" lambda terms -- A predicate that holds for plain lambda terms, i.e. terms that are -- built up using only var, lambda and apply. Plain : Exp → Type Plain (var _) = ⊤ Plain (lambda _ e) = Plain e Plain (apply e₁ e₂) = Plain e₁ × Plain e₂ Plain (case _ _) = ⊥ Plain (rec _ _) = ⊥ Plain (const _ _) = ⊥ -- Plain is preserved by substitutions. plain-subst : ∀ e → Plain e → Plain e′ → Plain (e [ x ← e′ ]) plain-subst (apply e₁ e₂) (e₁-ok , e₂-ok) e′-ok = plain-subst e₁ e₁-ok e′-ok , plain-subst e₂ e₂-ok e′-ok plain-subst {x = x} (lambda y e) e-ok e′-ok with x V.≟ y … | yes _ = e-ok … | no _ = plain-subst e e-ok e′-ok plain-subst {x = x} (var y) _ e′-ok with x V.≟ y … | yes _ = e′-ok … | no _ = _ ------------------------------------------------------------------------ -- A variant of a fixpoint combinator -- A variant of the call-by-value fixpoint combinator Θᵥ that (at the -- time of writing) is presented on the Wikipedia page about -- fixed-point combinators -- (https://en.wikipedia.org/wiki/Fixed-point_combinator). There Θᵥ is -- defined to be the application of λxy.y(λz.xxyz) to itself. I have -- dropped the final z, and made the choice of variable name for z -- customisable. mutual F : Var → Exp F z = apply (f z) (f z) f : Var → Exp f z = lambda v-x (lambda v-y ( apply (var v-y) ( lambda z ( apply (apply (var v-x) (var v-x)) (var v-y))))) -- The expressions f z, F z and id are closed. f-closed : Closed (f z) f-closed = Closed′-closed-under-lambda $ Closed′-closed-under-lambda $ Closed′-closed-under-apply (from-⊎ (closed′? (var v-y) (v-y ∷ v-x ∷ []))) (Closed′-closed-under-lambda $ Closed′-closed-under-apply (Closed′-closed-under-apply (Closed′-closed-under-var (inj₂ (inj₂ (inj₁ refl)))) (Closed′-closed-under-var (inj₂ (inj₂ (inj₁ refl))))) (Closed′-closed-under-var (inj₂ (inj₁ refl)))) F-closed : Closed (F z) F-closed = Closed′-closed-under-apply f-closed f-closed -- F z₁ and f z₁ are α-equivalent to F z₂ and f z₂, respectively, -- assuming that z₁ and z₂ are distinct from v-x and v-y. f≈αf : z₁ ≢ v-x → z₁ ≢ v-y → z₂ ≢ v-x → z₂ ≢ v-y → Alpha R (f z₁) (f z₂) f≈αf {z₁ = z₁} {z₂ = z₂} {R = R} z₁≢x z₁≢y z₂≢x z₂≢y = lambda ( lambda ( apply (var y∼y₁) ( lambda ( apply ( apply (var x∼x) (var x∼x)) ( var y∼y₂))))) where x∼x : (R [ v-x ∼ v-x ] [ v-y ∼ v-y ] [ z₁ ∼ z₂ ]) v-x v-x x∼x = inj₂ (z₁≢x , z₂≢x , inj₂ ((λ ()) , (λ ()) , inj₁ (refl , refl))) y∼y₁ : (R [ v-x ∼ v-x ] [ v-y ∼ v-y ]) v-y v-y y∼y₁ = inj₁ (refl , refl) y∼y₂ : (R [ v-x ∼ v-x ] [ v-y ∼ v-y ] [ z₁ ∼ z₂ ]) v-y v-y y∼y₂ = inj₂ (z₁≢y , z₂≢y , y∼y₁) F≈αF : z₁ ≢ v-x → z₁ ≢ v-y → z₂ ≢ v-x → z₂ ≢ v-y → Alpha R (F z₁) (F z₂) F≈αF z₁≢x z₁≢y z₂≢x z₂≢y = apply (f≈αf z₁≢x z₁≢y z₂≢x z₂≢y) (f≈αf z₁≢x z₁≢y z₂≢x z₂≢y) ------------------------------------------------------------------------ -- A plain alternative to rec -- An expression former that has the same semantics as rec, but that -- takes plain expressions to plain expressions. -- -- Note that substitution does not necessarily behave in the same way -- for plain-rec as for rec (see below). plain-rec : Var → Exp → Exp plain-rec x e = let z , _ = fresh′ (S.from-List (v-x ∷ v-y ∷ [])) e in apply (lambda z (apply (F z) (lambda x (e [ x ← apply (var x) id ])))) id -- If e is a plain lambda term, then plain-rec x e is a plain -- lambda term. plain-rec-plain : ∀ e → Plain e → Plain (plain-rec x e) plain-rec-plain e ok = (_ , plain-subst e ok _) , _ -- The semantic rule given for rec is admissible for plain-rec. plain-rec-⇓ : ∀ e → e [ x ← plain-rec x e ] ⇓ v → plain-rec x e ⇓ v plain-rec-⇓ {x = x} {v = v} e ⇓v = plain-rec x e ⟶⟨⟩ apply (lambda z′ (apply (F z′) (lambda x (e [ x ← apply (var x) id ])))) id ⟶⟨ apply lambda lambda ⟩ apply (F z′) (lambda x (e [ x ← apply (var x) id ])) [ z′ ← id ] ≡⟨ subst-∉ z′ _ z∉apply ⟩⟶ apply (F z′) (lambda x (e [ x ← apply (var x) id ])) ⟶⟨ []⇓ (apply← ∙) F⇓ ⟩ apply (lambda v-y (apply (var v-y) (lambda z′ (apply (F z′) (var v-y))))) (lambda x (e [ x ← apply (var x) id ])) ⟶⟨ apply lambda lambda ⟩ apply (var v-y) (lambda z′ (apply (F z′) (var v-y))) [ v-y ← lambda x (e [ x ← apply (var x) id ]) ] ≡⟨ cong (apply _) (lambda-step-≢ y≢z) ⟩⟶ apply (lambda x (e [ x ← apply (var x) id ])) (lambda z′ (apply (F z′) (lambda x (e [ x ← apply (var x) id ])))) ⟶⟨ apply lambda lambda ⟩ e [ x ← apply (var x) id ] [ x ← lambda z′ (apply (F z′) (lambda x (e [ x ← apply (var x) id ]))) ] ≡⟨ fusion e ⟩⟶ e [ x ← apply (var x) id [ x ← lambda z′ (apply (F z′) (lambda x (e [ x ← apply (var x) id ]))) ] ] ≡⟨ cong₂ (λ e₁ e₂ → e [ x ← apply e₁ e₂ ]) (var-step-≡ (refl {x = x})) (subst-closed x _ id-closed) ⟩⟶ e [ x ← plain-rec x e ] ⇓⟨ ⇓v ⟩■ v where z,f = fresh′ (S.from-List (v-x ∷ v-y ∷ [])) e z′ : Var z′ = proj₁ z,f z∉e : ¬ z′ ∈FV e z∉e = proj₁ (proj₂ z,f) x≢z : v-x ≢ z′ x≢z x≡z = proj₂ (proj₂ z,f) (S.≡→∈∷ (sym x≡z)) y≢z : v-y ≢ z′ y≢z y≡z = proj₂ (proj₂ z,f) (S.∈→∈∷ (S.≡→∈∷ (sym y≡z))) F⇓ : F z′ ⇓ lambda v-y (apply (var v-y) (lambda z′ (apply (F z′) (var v-y)))) F⇓ = apply lambda lambda (lambda v-y (apply (var v-y) (lambda z′ (apply (apply (var v-x) (var v-x)) (var v-y)))) [ v-x ← f z′ ] ⟶⟨⟩ lambda v-y (apply (var v-y) (lambda z′ (apply (apply (var v-x) (var v-x)) (var v-y)) [ v-x ← f z′ ])) ≡⟨ cong (lambda _) $ cong (apply _) $ lambda-step-≢ x≢z ⟩⟶ lambda v-y (apply (var v-y) (lambda z′ (apply (F z′) (var v-y)))) ■⟨ lambda _ _ ⟩) z∉apply : ¬ z′ ∈FV apply (F z′) (lambda x (e [ x ← apply (var x) id ])) z∉apply (apply-left z∈Fz) = F-closed z′ (λ ()) z∈Fz z∉apply (apply-right (lambda z≢x z∈)) with subst-∈FV x e z∈ … | inj₁ (z∈e , _) = z∉e z∈e … | inj₂ (apply-left (var z≡x)) = z≢x z≡x … | inj₂ (apply-right z∈id) = id-closed z′ (λ ()) z∈id -- Substitution of closed expressions is not in general defined in the -- same way for plain-rec as for rec. ¬-plain-rec-subst : ¬ (∀ y e x e′ → Closed e′ → plain-rec y e [ x ← e′ ] ≡ plain-rec y (if x V.≟ y then e else e [ x ← e′ ])) ¬-plain-rec-subst plain-rec-subst = not-equal (plain-rec-subst y′ e₁ x′ e₂ id-closed) where y′ = v-y x′ = v-z e₂ = id e₁ = var x′ not-equal : plain-rec y′ e₁ [ x′ ← e₂ ] ≢ plain-rec y′ (if x′ V.≟ y′ then e₁ else e₁ [ x′ ← e₂ ]) not-equal () -- However, it is defined in the same way /up to α-equivalence/. plain-rec-subst : ∀ x → Closed e′ → plain-rec y e [ x ← e′ ] ≈α plain-rec y (if x V.≟ y then e else e [ x ← e′ ]) plain-rec-subst {e′ = e′} {y = y} {e = e} x cl-e′ = apply (lambda z¹ (apply (F z¹) (lambda y (e [ y ← apply (var y) id ])))) id [ x ← e′ ] ≡⟨ cong (apply _) $ subst-closed x _ id-closed ⟩α apply (lambda z¹ (apply (F z¹) (lambda y (e [ y ← apply (var y) id ]))) [ x ← e′ ]) id ≡⟨ cong (λ e → apply (lambda z¹ e) id) $ lemma₁ (x V.≟ z¹) (x V.≟ y) ⟩α apply (lambda z¹ (apply (F z¹) (lambda y ((if x V.≟ y then e else e [ x ← e′ ]) [ y ← apply (var y) id ])))) id ≈⟨ apply (lambda (apply (F≈αF z¹≢x z¹≢y z²≢x z²≢y) (refl-Alpha _ lemma₂))) refl-α ⟩α∎ apply (lambda z² (apply (F z²) (lambda y ((if x V.≟ y then e else e [ x ← e′ ]) [ y ← apply (var y) id ])))) id ∎ where z¹,f₁ = fresh′ (S.from-List (v-x ∷ v-y ∷ [])) e z¹ : Var z¹ = proj₁ z¹,f₁ z¹∉e : ¬ z¹ ∈FV e z¹∉e = proj₁ (proj₂ z¹,f₁) z¹≢x : z¹ ≢ v-x z¹≢x z¹≡x = proj₂ (proj₂ z¹,f₁) (S.≡→∈∷ z¹≡x) z¹≢y : z¹ ≢ v-y z¹≢y z¹≡y = proj₂ (proj₂ z¹,f₁) (S.∈→∈∷ (S.≡→∈∷ z¹≡y)) z²,f₂ = fresh′ (S.from-List (v-x ∷ v-y ∷ [])) (if x V.≟ y then e else e [ x ← e′ ]) z² : Var z² = proj₁ z²,f₂ z²∉ : ¬ z² ∈FV if x V.≟ y then e else e [ x ← e′ ] z²∉ = proj₁ (proj₂ z²,f₂) z²≢x : z² ≢ v-x z²≢x z²≡x = proj₂ (proj₂ z²,f₂) (S.≡→∈∷ z²≡x) z²≢y : z² ≢ v-y z²≢y z²≡y = proj₂ (proj₂ z²,f₂) (S.∈→∈∷ (S.≡→∈∷ z²≡y)) x∉y-id : x ≢ y → ¬ x ∈FV apply (var y) id x∉y-id x≢y (apply-left (var x≡y)) = x≢y x≡y x∉y-id _ (apply-right x∈id) = id-closed x (λ ()) x∈id lemma₁ : (x≟z¹ : Dec (x ≡ z¹)) (x≟y : Dec (x ≡ y)) → if x≟z¹ then apply (F z¹) (lambda y (e [ y ← apply (var y) id ])) else apply (F z¹) (lambda y (e [ y ← apply (var y) id ])) [ x ← e′ ] ≡ apply (F z¹) (lambda y ((if x≟y then e else e [ x ← e′ ]) [ y ← apply (var y) id ])) lemma₁ (yes _) (yes _) = refl lemma₁ (yes x≡z¹) (no _) = apply (F z¹) (lambda y (e [ y ← apply (var y) id ])) ≡⟨ cong (apply _) $ cong (lambda _) $ cong (_[ _ ← _ ]) $ sym $ subst-∉ x e (z¹∉e ∘ subst (_∈FV _) x≡z¹) ⟩∎ apply (F z¹) (lambda y (e [ x ← e′ ] [ y ← apply (var y) id ])) ∎ lemma₁ (no _) (yes x≡y) = apply (F z¹ [ x ← e′ ]) (lambda y (e [ y ← apply (var y) id ]) [ x ← e′ ]) ≡⟨ cong (λ e″ → apply e″ (lambda y (e [ y ← apply (var y) id ]) [ x ← e′ ])) $ subst-closed x e′ F-closed ⟩ apply (F z¹) (lambda y (e [ y ← apply (var y) id ]) [ x ← e′ ]) ≡⟨ cong (apply (F z¹)) $ lambda-step-≡ x≡y ⟩∎ apply (F z¹) (lambda y (e [ y ← apply (var y) id ])) ∎ lemma₁ (no _) (no x≢y) = apply (F z¹ [ x ← e′ ]) (lambda y (e [ y ← apply (var y) id ]) [ x ← e′ ]) ≡⟨ cong (λ e″ → apply e″ (lambda y (e [ y ← apply (var y) id ]) [ x ← e′ ])) $ subst-closed x e′ F-closed ⟩ apply (F z¹) (lambda y (e [ y ← apply (var y) id ]) [ x ← e′ ]) ≡⟨ cong (apply (F z¹)) $ lambda-step-≢ x≢y ⟩ apply (F z¹) (lambda y (e [ y ← apply (var y) id ] [ x ← e′ ])) ≡⟨ cong (apply _) $ cong (lambda _) $ sym $ swap x≢y (x∉y-id x≢y) (cl-e′ _ (λ ())) e ⟩∎ apply (F z¹) (lambda y (e [ x ← e′ ] [ y ← apply (var y) id ])) ∎ lemma₂ : ∀ z → z ∈FV lambda y ((if x V.≟ y then e else e [ x ← e′ ]) [ y ← apply (var y) id ]) → (_≡_ [ z¹ ∼ z² ]) z z lemma₂ z (lambda z≢y z∈) = case subst-∈FV y _ z∈ of λ where (inj₁ (z∈ , _)) → inj₂ ( z¹≢ (x V.≟ y) z∈ , z²∉ ∘ flip (subst (_∈FV _)) z∈ ∘ sym , refl ) (inj₂ (apply-left (var z≡y))) → ⊥-elim $ z≢y z≡y (inj₂ (apply-right ∈id)) → ⊥-elim $ id-closed _ (λ ()) ∈id where z¹≢ : ∀ x≟y → z ∈FV if x≟y then e else e [ x ← e′ ] → z¹ ≢ z z¹≢ (yes _) z∈ = z¹∉e ∘ flip (subst (_∈FV _)) z∈ ∘ sym z¹≢ (no _) z∈ = case subst-∈FV x e z∈ of λ where (inj₁ (z∈ , _)) → z¹∉e ∘ flip (subst (_∈FV _)) z∈ ∘ sym (inj₂ z∈e′) → ⊥-elim $ cl-e′ _ (λ ()) z∈e′
oeis/147/A147965.asm
neoneye/loda-programs
11
27524
<gh_stars>10-100 ; A147965: a(n) = n + 1 - A001223(n) = n - A046933(n). In words, a(n) is the difference between n+1 and the n-th gap between primes. ; 1,1,2,1,4,3,6,5,4,9,6,9,12,11,10,11,16,13,16,19,16,19,18,17,22,25,24,27,26,17,28,27,32,25,34,31,32,35,34,35,40,33,42,41,44,35,36,45,48,47,46,51,44,49,50,51,56,53,56,59 mov $1,$0 add $1,1 seq $1,40 ; The prime numbers. div $1,2 mul $1,2 sub $1,1 seq $1,64722 ; a(1) = 0; for n >= 2, a(n) = n - (largest prime <= n). sub $0,$1 add $0,1
Interprete/ANTLR/ChemsLexer.g4
bram814/-OLC2-P1_201800937
0
2130
lexer grammar ChemsLexer; // Tokens /* RESERVADAS */ R_PRINT: 'print!'; R_PRINTLN: 'println!'; P_NUMBER: 'number'; R_AS_DOUBLE: 'as f64'; R_AS_INTEGER: 'as i64'; R_LET: 'let'; R_MUT: 'mut'; R_IF: 'if'; R_ELSE: 'else'; R_MATCH: 'match'; R_WHILE: 'while'; R_BREAK: 'break'; R_CONTINUE: 'continue'; R_RETURN: 'return'; R_LOOP: 'loop'; R_FOR: 'for'; R_IN: 'in'; R_MAIN: 'main'; R_FUNCTION: 'fn'; /* TIPOS */ R_INT: 'i64'; R_FLOAT: 'f64'; R_STRING: 'String'; R_BOOL: 'bool'; R_STR: '&str'; // P_IF: 'if'; // P_WHILE: 'while'; NUMBER: [0-9]+; DOUBLE: [0-9]+'.'[0-9]+; CHAR: '\''~["]'\''; STRING: '"'~["]*'"'; BOOLEAN: ('true'|'false'); ID: ([a-zA-Z_])[a-zA-Z0-9_]*; // R_FORMATO_LLAVE: '"'('{}')+'"'; // R_FORMATO_LLAVE: '"{}"'; TK_DOBLEPUNTO: '..'; TK_PUNTO: '.'; TK_PUNTOCOMA: ';'; TK_COMA: ','; TK_DOSPUNTOS: ':'; TK_IGUAL: '='; TK_IGUALIGUAL: '=='; TK_MAYORIGUAL: '>='; TK_IGUALMAYOR: '=>'; TK_MENOSMAYOR: '->'; TK_MENORIGUAL: '<='; TK_DIFIGUAL: '!='; TK_MAYOR: '>'; TK_MENOR: '<'; TK_MULT: '*'; TK_DIV: '/'; TK_MODULO: '%'; TK_MAS: '+'; TK_MENOS: '-'; TK_PARA: '('; TK_PARC: ')'; TK_LLAVEA: '{'; TK_LLAVEC: '}'; TK_CORA: '['; TK_CORC: ']'; TK_AND: '&&'; TK_OR: '||'; TK_BARRA: '|'; TK_NOT: '!'; // TK_GUIONBAJO: '_ =>'; WHITESPACE: [ \r\n\t]+ -> skip; TK_MULTI: '/*' (~[/])+ '*/' -> skip; TK_LINE: '//'(~[\n])+ -> skip; fragment ESC_SEQ : '\\' ('\\'|'@'|'['|']'|'.'|'#'|'+'|'-'|'!'|':'|' ') ;
alloy4fun_models/trashltl/models/0/Z8wyAzBirEoChfRtu.als
Kaixi26/org.alloytools.alloy
0
1202
open main pred idZ8wyAzBirEoChfRtu_prop1 { no Trash } pred __repair { idZ8wyAzBirEoChfRtu_prop1 } check __repair { idZ8wyAzBirEoChfRtu_prop1 <=> prop1o }
oeis/057/A057092.asm
neoneye/loda-programs
11
102652
; A057092: Scaled Chebyshev U-polynomials evaluated at i*3/2. Generalized Fibonacci sequence. ; Submitted by <NAME> ; 1,9,90,891,8829,87480,866781,8588349,85096170,843160671,8354311569,82777250160,820184055561,8126651751489,80521522263450,797833566134451,7905195795581109,78327264255440040,776092140459190341,7689774642431673429,76192801046017773930,754943181196045026231,7480223840178565201449,74116503192371492049120,734370543292950515255121,7276383418367898065738169,72096785654947637228939610,714358521659839817652100011,7078097765833087093929356589,70132106587436342204233109400,694891839179424863683462193901 mov $3,1 lpb $0 sub $0,1 mov $2,$3 add $3,$1 mov $1,$2 mul $3,9 lpe mov $0,$3
unittests/32Bit_ASM/X87/D9_EE.asm
cobalt2727/FEX
628
164390
%ifdef CONFIG { "RegData": { "MM7": ["0", "0"] }, "Mode": "32BIT" } %endif fldz hlt
Working Disassembly/Levels/ICZ/Misc Object Data/Map - Miniboss.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
5
166036
<reponame>TeamASM-Blur/Sonic-3-Blue-Balls-Edition<gh_stars>1-10 Map_363344: dc.w Frame_363362-Map_363344 dc.w Frame_36337C-Map_363344 dc.w Frame_363384-Map_363344 dc.w Frame_36338C-Map_363344 dc.w Frame_36339A-Map_363344 dc.w Frame_3633A8-Map_363344 dc.w Frame_3633B0-Map_363344 dc.w Frame_3633B8-Map_363344 dc.w Frame_3633C0-Map_363344 dc.w Frame_3633C8-Map_363344 dc.w Frame_3633D0-Map_363344 dc.w Frame_3633D8-Map_363344 dc.w Frame_3633E0-Map_363344 dc.w Frame_3633E8-Map_363344 dc.w Frame_3633F0-Map_363344 Frame_363362: dc.w 4 dc.b $E8, $A, 0, 0,$FF,$E8 dc.b 0, $A, 0, 9,$FF,$E8 dc.b $E8, $A, 8, 0, 0, 0 dc.b 0, $A, 8, 9, 0, 0 Frame_36337C: dc.w 1 dc.b $F8, 5, 0,$12,$FF,$F8 Frame_363384: dc.w 1 dc.b $F8, 5, 0,$16,$FF,$F8 Frame_36338C: dc.w 2 dc.b $FC, 4, 0,$1A,$FF,$F0 dc.b $FC, 4, 8,$1A, 0, 0 Frame_36339A: dc.w 2 dc.b $F4, 2, 0,$1C,$FF,$F8 dc.b $F4, 2, 8,$1C, 0, 0 Frame_3633A8: dc.w 1 dc.b $F4, $A, 0,$1F,$FF,$F4 Frame_3633B0: dc.w 1 dc.b $F4, $A, 0,$28,$FF,$F4 Frame_3633B8: dc.w 1 dc.b $F4, $A, 0,$31,$FF,$F4 Frame_3633C0: dc.w 1 dc.b $F4, $A, 0,$3A,$FF,$F4 Frame_3633C8: dc.w 1 dc.b $F8, 5, 8,$12,$FF,$F8 Frame_3633D0: dc.w 1 dc.b $F8, 5, 8,$16,$FF,$F8 Frame_3633D8: dc.w 1 dc.b $F4, $A, 0, 0,$FF,$F4 Frame_3633E0: dc.w 1 dc.b $F4, $A, 8, 0,$FF,$F4 Frame_3633E8: dc.w 1 dc.b $F4, $A, 0, 9,$FF,$F4 Frame_3633F0: dc.w 1 dc.b $F4, $A, 8, 9,$FF,$F4
ejercicios1/factorial.adb
iyan22/AprendeAda
0
2930
<reponame>iyan22/AprendeAda<gh_stars>0 with ada.text_io, ada.integer_text_io; use ada.text_io, ada.integer_text_io; function factorial (n1: in Integer) return Integer is resultado : Integer := 1; n1c := Integer; begin n1c := n1; if n1c > 0 then loop exit when n1c = 0; resultado:=resultado*n1c; n1c := n1c-1; end loop; end if; return resultado; end factorial;
programs/oeis/178/A178248.asm
neoneye/loda
22
243509
<reponame>neoneye/loda ; A178248: a(n) = 12^n + 1. ; 2,13,145,1729,20737,248833,2985985,35831809,429981697,5159780353,61917364225,743008370689,8916100448257,106993205379073,1283918464548865,15407021574586369,184884258895036417,2218611106740436993,26623333280885243905,319479999370622926849,3833759992447475122177,46005119909369701466113,552061438912436417593345,6624737266949237011120129,79496847203390844133441537,953962166440690129601298433,11447545997288281555215581185,137370551967459378662586974209,1648446623609512543951043690497,19781359483314150527412524285953,237376313799769806328950291431425,2848515765597237675947403497177089,34182189187166852111368841966125057,410186270246002225336426103593500673 mov $1,12 pow $1,$0 add $1,1 mov $0,$1
commands/media/apple-music/apple-music-next.applescript
kastnerorz/script-commands
1
3746
<filename>commands/media/apple-music/apple-music-next.applescript #!/usr/bin/osascript # @raycast.schemaVersion 1 # @raycast.title Next # @raycast.mode silent # @raycast.author <NAME> # @raycast.authorURL https://github.com/crstauf # @raycast.description Next track in Music # @raycast.packageName Music # @raycast.icon images/apple-music-logo.png tell application "Music" next track end tell do shell script "echo Next track"
programs/oeis/074/A074609.asm
neoneye/loda
22
90918
; A074609: a(n) = 3^n + 8^n. ; 2,11,73,539,4177,33011,262873,2099339,16783777,134237411,1073800873,8590111739,68720008177,549757408211,4398051294073,35184386437739,281475019757377,2251799942825411,18014398896902473,144115189238117339 mov $1,8 pow $1,$0 mov $2,3 pow $2,$0 add $1,$2 mov $0,$1
tpantlr2-code/code/reference/Nested.g4
cgonul/antlr-poc
25
6302
<filename>tpantlr2-code/code/reference/Nested.g4<gh_stars>10-100 grammar Nested; import G1, G2; s : X ;
oeis/157/A157803.asm
neoneye/loda-programs
11
1079
; A157803: 8984250*n - 8464830. ; 519420,9503670,18487920,27472170,36456420,45440670,54424920,63409170,72393420,81377670,90361920,99346170,108330420,117314670,126298920,135283170,144267420,153251670,162235920,171220170,180204420,189188670,198172920,207157170,216141420,225125670,234109920,243094170,252078420,261062670,270046920,279031170,288015420,296999670,305983920,314968170,323952420,332936670,341920920,350905170,359889420,368873670,377857920,386842170,395826420,404810670,413794920,422779170,431763420,440747670,449731920 mul $0,8984250 add $0,519420
Transynther/x86/_processed/NONE/_zr_/i7-8650U_0xd2.log_6480_1585.asm
ljhsiun2/medusa
9
15517
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r14 push %r8 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x3b2c, %rax nop nop nop nop nop and $52214, %rbx vmovups (%rax), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $0, %xmm7, %rsi nop nop nop nop dec %rbx lea addresses_D_ht+0x558c, %r8 and %r10, %r10 mov $0x6162636465666768, %r13 movq %r13, (%r8) nop nop nop cmp $50655, %rax lea addresses_normal_ht+0xaec, %rax nop dec %r14 mov (%rax), %r10d nop nop nop nop nop xor %rbx, %rbx lea addresses_normal_ht+0x253b, %rsi lea addresses_normal_ht+0x3e2c, %rdi nop nop cmp %r14, %r14 mov $4, %rcx rep movsq and %rcx, %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r8 pop %r14 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r14 push %r8 push %r9 push %rax push %rbp push %rbx push %rsi // Store lea addresses_A+0xf58c, %rbp nop nop nop nop add $678, %r9 mov $0x5152535455565758, %rsi movq %rsi, %xmm1 movups %xmm1, (%rbp) nop cmp $19386, %rsi // Faulty Load lea addresses_WC+0x822c, %rax clflush (%rax) nop xor %r14, %r14 mov (%rax), %bx lea oracles, %r8 and $0xff, %rbx shlq $12, %rbx mov (%r8,%rbx,1), %rbx pop %rsi pop %rbx pop %rbp pop %rax pop %r9 pop %r8 pop %r14 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}} {'00': 6480} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
examples/signals/signal_example.adb
glencornell/ada-object-framework
0
3019
with Aof.Core.Root_Objects; with Aof.Core.Generic_Signals; with Aof.Core.Signals; with Slots; -- In this example, we will create two signals, one with no arguments -- and another with one argument. We use the "Connect" method to -- connect a slot (A.K.A. callback) to a signal. We then invoke the -- signal's "Emit" method to subsequently invoke all slots connected -- to the signal. procedure Signal_Example is -- Create a signal class containing one argument of type integer package S1_Pkg is new Aof.Core.Generic_Signals.S1 (Object => Aof.Core.Root_Objects.Root_Object, Access_Object => Aof.Core.Root_Objects.Access_Object, Param_1 => Integer); S0 : Aof.Core.Signals.Empty.Signal; S1 : S1_Pkg.Signal; begin -- Connect the slots S0.Connect(Slots.Xaa'access); S0.Connect(Slots.Xab'access); S0.Connect(Slots.Xac'access); -- Emit the signal S0.Emit; -- Connect the slots to the single argument signal. Note that the -- argument count and type must match that of the signal or you -- will get a compiler error. S1.Connect(Slots.S1a'access); S1.Connect(Slots.S1b'access); S1.Connect(Slots.S1c'access); -- Emit the signal with different values for I in 1 .. 3 loop S1.Emit(I); end loop; end Signal_Example;
solutions/43 - Multiplication Table/size-10_speed-48.asm
michaelgundlach/7billionhumans
45
179475
-- 7 Billion Humans (2087) -- -- 43: Multiplication Table -- -- Author: landfillbaby -- Size: 10 -- Speed: 48 a: step n if c != nothing or s == nothing: jump a endif mem1 = nearest datacube b: mem2 = calc mem2 + mem1 step s pickup c write mem2 drop jump b
examples/simple_example.adb
jhumphry/aLua
0
28077
-- Simple_Example -- A simple example of using the Ada 2012 interface to Lua -- Copyright (c) 2015, <NAME> - see LICENSE for terms with Ada.Text_IO; use Ada.Text_IO; with Ada.Long_Float_Text_IO; use Ada.Long_Float_Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; with Lua; use Lua; with Lua.Util; use Lua.Util; procedure Simple_Example is L : Lua_State; begin Put_Line("A simple example of using Lua from within Ada"); Put("Lua version: "); Put(Item => L.Version, Aft => 0, Exp => 0); New_Line; Put_Line("Lua state status: " & Thread_Status'Image(L.Status)); New_Line; Put_Line("Basic stack manipulation."); Put("Initial stack size: "); Put(L.GetTop); New_Line; Put_Line("Pushing 3.0, 7.5, 2.3, 'Hello, World!', True, 5"); L.PushNumber(3.0); L.PushNumber(7.5); L.PushNumber(2.3); L.PushString("Hello, World!"); L.PushBoolean(True); L.PushInteger(5); Put("Stack size now: "); Put(L.GetTop); New_Line; Print_Stack(L); Put("Get top element as string: "); Put(L.ToString(-1)); New_Line; Print_Stack(L); Put_Line("Pop top three elements"); L.Pop(3); Print_Stack(L); Put_Line("Is Stack(-2) <= Stack(-1)? " & (if L.Compare(index1 => -2, index2 => -1, op => OPLE) then "Yes" else "No")); Put_Line("Duplicating element at index 2. "); L.PushValue(2); Print_Stack(L); Put_Line("Adding top two elements."); L.Arith(OPADD); Print_Stack(L); Put_Line("Is Stack(-2) <= Stack(-1)? " & (if L.Compare(index1 => -2, index2 => -1, op => OPLE) then "Yes" else "No")); New_Line; Put_Line("Setting global foobar to 5"); L.PushNumber(5.0); L.SetGlobal("foobar"); L.GetGlobal("foobar"); Put("Global foobar = "); Put(L.ToNumber(-1), Aft => 0, Exp => 0); New_Line; New_Line; Put_Line("Manually triggering garbage collection..."); L.GC(what => GCCOLLECT); New_Line; Put("Checking type of main thread: "); L.Geti(index => RegistryIndex, i => RIDX_MainThread); Put(L.TypeName(-1)); New_Line; end Simple_Example;
oeis/168/A168623.asm
neoneye/loda-programs
11
86780
<reponame>neoneye/loda-programs ; A168623: Table T(n,k) read by rows: Coefficients [x^k] of the polynomial 9*(x+1)^n -8*(x^n+1); T(0,0)=1. ; Submitted by <NAME>(s1.) ; 1,1,1,1,18,1,1,27,27,1,1,36,54,36,1,1,45,90,90,45,1,1,54,135,180,135,54,1,1,63,189,315,315,189,63,1,1,72,252,504,630,504,252,72,1,1,81,324,756,1134,1134,756,324,81,1,1,90,405,1080,1890,2268,1890,1080,405,90,1 seq $0,7318 ; Pascal's triangle read by rows: C(n,k) = binomial(n,k) = n!/(k!*(n-k)!), 0 <= k <= n. lpb $0 mul $0,9 mov $2,$0 mod $0,2 sub $2,1 lpe mov $0,$2 add $0,1
oeis/158/A158667.asm
neoneye/loda-programs
11
93110
<gh_stars>10-100 ; A158667: 841*n^2 - 29. ; 812,3335,7540,13427,20996,30247,41180,53795,68092,84071,101732,121075,142100,164807,189196,215267,243020,272455,303572,336371,370852,407015,444860,484387,525596,568487,613060,659315,707252,756871,808172,861155,915820,972167,1030196,1089907,1151300,1214375,1279132,1345571,1413692,1483495,1554980,1628147,1702996,1779527,1857740,1937635,2019212,2102471,2187412,2274035,2362340,2452327,2543996,2637347,2732380,2829095,2927492,3027571,3129332,3232775,3337900,3444707,3553196,3663367,3775220,3888755 mov $1,2 add $1,$0 mul $1,$0 mul $1,841 add $1,812 mov $0,$1
data/pokemon/base_stats/weezing.asm
opiter09/ASM-Machina
1
12230
db DEX_WEEZING ; pokedex id db 65, 90, 120, 60, 85 ; hp atk def spd spc db POISON, POISON ; type db 60 ; catch rate db 173 ; base exp INCBIN "gfx/pokemon/front/weezing.pic", 0, 1 ; sprite dimensions dw WeezingPicFront, WeezingPicBack db TACKLE, SMOG, POISON_GAS, NO_MOVE ; level 1 learnset db GROWTH_MEDIUM_FAST ; growth rate ; tm/hm learnset tmhm TOXIC, HYPER_BEAM, RAGE, THUNDERBOLT, THUNDER, \ MIMIC, DOUBLE_TEAM, BIDE, SELFDESTRUCT, FIRE_BLAST, \ REST, EXPLOSION, SUBSTITUTE ; end db 0 ; padding
libsrc/_DEVELOPMENT/adt/wa_priority_queue/c/sccz80/wa_priority_queue_top.asm
meesokim/z88dk
0
169387
; void *wa_priority_queue_top(wa_priority_queue_t *q) SECTION code_adt_wa_priority_queue PUBLIC wa_priority_queue_top wa_priority_queue_top: INCLUDE "adt/wa_priority_queue/z80/asm_wa_priority_queue_top.asm"
source/asis/spec/system-address_to_access_conversions.ads
faelys/gela-asis
4
910
------------------------------------------------------------------------------ -- A d a r u n - t i m e s p e c i f i c a t i o n -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of ada.ads file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ generic type Object (<>) is limited private; package System.Address_To_Access_Conversions is pragma Preelaborate (Address_To_Access_Conversions); type Object_Pointer is access all Object; function To_Pointer (Value : Address) return Object_Pointer; function To_Address (Value : Object_Pointer) return Address; pragma Convention (Intrinsic, To_Pointer); pragma Convention (Intrinsic, To_Address); end System.Address_To_Access_Conversions;
src/coreclr/vm/arm/thunktemplates.asm
berkansasmaz/runtime
8
19086
; Licensed to the .NET Foundation under one or more agreements. ; The .NET Foundation licenses this file to you under the MIT license. #include "ksarm.h" #include "asmconstants.h" #include "asmmacros.h" TEXTAREA ALIGN 4 #define DATA_SLOT(stub, field) stub##Code + PAGE_SIZE + stub##Data__##field LEAF_ENTRY StubPrecodeCode ldr r12, DATA_SLOT(StubPrecode, MethodDesc) ldr pc, DATA_SLOT(StubPrecode, Target) LEAF_END_MARKED StubPrecodeCode ALIGN 4 LEAF_ENTRY FixupPrecodeCode ldr pc, DATA_SLOT(FixupPrecode, Target) ldr r12, DATA_SLOT(FixupPrecode, MethodDesc) ldr pc, DATA_SLOT(FixupPrecode, PrecodeFixupThunk) LEAF_END_MARKED FixupPrecodeCode ALIGN 4 LEAF_ENTRY CallCountingStubCode push {r0} ldr r12, DATA_SLOT(CallCountingStub, RemainingCallCountCell) ldrh r0, [r12] subs r0, r0, #1 strh r0, [r12] pop {r0} beq CountReachedZero ldr pc, DATA_SLOT(CallCountingStub, TargetForMethod) CountReachedZero ldr pc, DATA_SLOT(CallCountingStub, TargetForThresholdReached) LEAF_END_MARKED CallCountingStubCode END
ada-blinky-full/src/morse.adb
hfegran/efx32_ada_examples
0
29975
<reponame>hfegran/efx32_ada_examples package body Morse is Dot_Duration : constant Time_Span := Milliseconds(100); Dash_Duration : constant Time_Span := Milliseconds(200); procedure Blink_Morse(LED: Led_No; Led_Color : Color; Duration : Time_Span) is Timeout : Time := Clock; begin Led_Set(LED, Led_Color); Timeout := Timeout + Duration; delay until Timeout; Led_Set(LED, Black); Timeout := Timeout + Dot_Duration; delay until Timeout; end Blink_Morse; procedure Dot is begin Blink_Morse(LED0, Yellow, Dot_Duration); end Dot; procedure Dash is begin Blink_Morse(LED0, Blue, Dash_Duration); end Dash; procedure Morse_Display (S : String) is Timeout : Time := Clock; begin for I of S loop case I is when 'a' => Dot; Dash; when 'b' => Dash; Dot; Dot; Dot; when 'c' => Dash; Dot; Dash; Dot; when 'd' => Dash; Dot; Dot; when 'e' => Dot; when 'f' => Dot; Dot; Dash; Dot; when 'g' => Dash; Dash; Dot; when 'h' => Dot; Dot; Dot; Dot; when 'i' => Dot; Dot; when 'j' => Dash; Dot; Dash; when 'k' => Dash; Dot; Dash; when 'l' => Dot; Dash; Dot; Dot; when 'm' => Dash; Dash; when 'n' => Dash; Dot; when 'o' => Dash; Dash; Dash; when 'p' => Dot; Dash; Dash; Dot; when 'q' => Dash; Dash; Dot; Dash; when 'r' => Dot; Dash; Dot; when 's' => Dot; Dot; Dot; when 't' => Dash; when 'u' => Dot; Dot; Dash; when 'v' => Dot; Dot; Dot; Dash; when 'w' => Dot; Dash; Dash; when 'x' => Dash; Dot; Dot; Dash; when 'y' => Dash; Dot; Dash; Dash; when 'z' => Dash; Dash; Dot; Dot; when 'A' => Dot; Dash; when 'B' => Dash; Dot; Dot; Dot; when 'C' => Dash; Dot; Dash; Dot; when 'D' => Dash; Dot; Dot; when 'E' => Dot; when 'F' => Dot; Dot; Dash; Dot; when 'G' => Dash; Dash; Dot; when 'H' => Dot; Dot; Dot; Dot; when 'I' => Dot; Dot; when 'J' => Dash; Dot; Dash; when 'K' => Dash; Dot; Dash; when 'L' => Dot; Dash; Dot; Dot; when 'M' => Dash; Dash; when 'N' => Dash; Dot; when 'O' => Dash; Dash; Dash; when 'P' => Dot; Dash; Dash; Dot; when 'Q' => Dash; Dash; Dot; Dash; when 'R' => Dot; Dash; Dot; when 'S' => Dot; Dot; Dot; when 'T' => Dash; when 'U' => Dot; Dot; Dash; when 'V' => Dot; Dot; Dot; Dash; when 'W' => Dot; Dash; Dash; when 'X' => Dash; Dot; Dot; Dash; when 'Y' => Dash; Dot; Dash; Dash; when 'Z' => Dash; Dash; Dot; Dot; when '1' => Dot; Dash; Dash; Dash; Dash; when '2' => Dot; Dot; Dash; Dash; Dash; when '3' => Dot; Dot; Dot; Dash; Dash; when '4' => Dot; Dot; Dot; Dot; Dash; when '5' => Dot; Dot; Dot; Dot; Dot; when '6' => Dash; Dot; Dot; Dot; Dot; when '7' => Dash; Dash; Dot; Dot; Dot; when '8' => Dash; Dash; Dash; Dot; Dot; when '9' => Dash; Dash; Dash; Dash; Dot; when '0' => Dash; Dash; Dash; Dash; Dash; when others => null; end case; Timeout := Clock; if I in 'a' .. 'z' or I in 'A' .. 'Z' or I in '0' .. '9' then delay until Timeout + 2 * Dot_Duration; elsif I = ' ' then delay until Timeout + 6 * Dot_Duration; end if; end loop; end Morse_Display; end Morse;
Task/Walk-a-directory-Non-recursively/AppleScript/walk-a-directory-non-recursively-3.applescript
LaudateCorpus1/RosettaCodeData
1
3670
tell application "Finder" to return name of every item in (path to documents folder from user domain) whose name does not contain "about" and name ends with "pdf" --> RETURNS: {"Test.pdf"}
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/s-aomoar.adb
djamal2727/Main-Bearing-Analytical-Model
0
4955
<filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/s-aomoar.adb ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- System.Atomic_Operations.Modular_Arithmetic -- -- -- -- B o d y -- -- -- -- Copyright (C) 2019-2020, 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. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ with System.Atomic_Primitives; use System.Atomic_Primitives; with System.Atomic_Operations.Exchange; with Interfaces.C; use Interfaces; package body System.Atomic_Operations.Modular_Arithmetic is package Exchange is new System.Atomic_Operations.Exchange (Atomic_Type); ---------------- -- Atomic_Add -- ---------------- procedure Atomic_Add (Item : aliased in out Atomic_Type; Value : Atomic_Type) is Ignore : constant Atomic_Type := Atomic_Fetch_And_Add (Item, Value); begin null; end Atomic_Add; --------------------- -- Atomic_Subtract -- --------------------- procedure Atomic_Subtract (Item : aliased in out Atomic_Type; Value : Atomic_Type) is Ignore : constant Atomic_Type := Atomic_Fetch_And_Subtract (Item, Value); begin null; end Atomic_Subtract; -------------------------- -- Atomic_Fetch_And_Add -- -------------------------- function Atomic_Fetch_And_Add (Item : aliased in out Atomic_Type; Value : Atomic_Type) return Atomic_Type is pragma Warnings (Off); function Atomic_Fetch_Add_1 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Add_1, "__atomic_fetch_add_1"); function Atomic_Fetch_Add_2 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Add_2, "__atomic_fetch_add_2"); function Atomic_Fetch_Add_4 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Add_4, "__atomic_fetch_add_4"); function Atomic_Fetch_Add_8 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Add_8, "__atomic_fetch_add_8"); pragma Warnings (On); begin -- Use the direct intrinsics when possible, and fallback to -- compare-and-exchange otherwise. -- Also suppress spurious warnings. pragma Warnings (Off); if Atomic_Type'Base'Last = Atomic_Type'Last and then Atomic_Type'First = 0 and then Atomic_Type'Last in 2 ** 8 - 1 | 2 ** 16 - 1 | 2 ** 32 - 1 | 2 ** 64 - 1 then pragma Warnings (On); case Unsigned_64 (Atomic_Type'Last) is when 2 ** 8 - 1 => return Atomic_Fetch_Add_1 (Item'Address, Value); when 2 ** 16 - 1 => return Atomic_Fetch_Add_2 (Item'Address, Value); when 2 ** 32 - 1 => return Atomic_Fetch_Add_4 (Item'Address, Value); when 2 ** 64 - 1 => return Atomic_Fetch_Add_8 (Item'Address, Value); when others => raise Program_Error; end case; else declare Old_Value : aliased Atomic_Type := Item; New_Value : Atomic_Type := Old_Value + Value; begin -- Keep iterating until the exchange succeeds while not Exchange.Atomic_Compare_And_Exchange (Item, Old_Value, New_Value) loop New_Value := Old_Value + Value; end loop; return Old_Value; end; end if; end Atomic_Fetch_And_Add; ------------------------------- -- Atomic_Fetch_And_Subtract -- ------------------------------- function Atomic_Fetch_And_Subtract (Item : aliased in out Atomic_Type; Value : Atomic_Type) return Atomic_Type is pragma Warnings (Off); function Atomic_Fetch_Sub_1 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Sub_1, "__atomic_fetch_sub_1"); function Atomic_Fetch_Sub_2 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Sub_2, "__atomic_fetch_sub_2"); function Atomic_Fetch_Sub_4 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Sub_4, "__atomic_fetch_sub_4"); function Atomic_Fetch_Sub_8 (Ptr : System.Address; Val : Atomic_Type; Model : Mem_Model := Seq_Cst) return Atomic_Type; pragma Import (Intrinsic, Atomic_Fetch_Sub_8, "__atomic_fetch_sub_8"); pragma Warnings (On); begin -- Use the direct intrinsics when possible, and fallback to -- compare-and-exchange otherwise. -- Also suppress spurious warnings. pragma Warnings (Off); if Atomic_Type'Base'Last = Atomic_Type'Last and then Atomic_Type'First = 0 and then Atomic_Type'Last in 2 ** 8 - 1 | 2 ** 16 - 1 | 2 ** 32 - 1 | 2 ** 64 - 1 then pragma Warnings (On); case Unsigned_64 (Atomic_Type'Last) is when 2 ** 8 - 1 => return Atomic_Fetch_Sub_1 (Item'Address, Value); when 2 ** 16 - 1 => return Atomic_Fetch_Sub_2 (Item'Address, Value); when 2 ** 32 - 1 => return Atomic_Fetch_Sub_4 (Item'Address, Value); when 2 ** 64 - 1 => return Atomic_Fetch_Sub_8 (Item'Address, Value); when others => raise Program_Error; end case; else declare Old_Value : aliased Atomic_Type := Item; New_Value : Atomic_Type := Old_Value - Value; begin -- Keep iterating until the exchange succeeds while not Exchange.Atomic_Compare_And_Exchange (Item, Old_Value, New_Value) loop New_Value := Old_Value - Value; end loop; return Old_Value; end; end if; end Atomic_Fetch_And_Subtract; ------------------ -- Is_Lock_Free -- ------------------ function Is_Lock_Free (Item : aliased Atomic_Type) return Boolean is pragma Unreferenced (Item); use type Interfaces.C.size_t; begin return Boolean (Atomic_Always_Lock_Free (Atomic_Type'Object_Size / 8)); end Is_Lock_Free; end System.Atomic_Operations.Modular_Arithmetic;
Library/Kernel/IM/imPen.asm
steakknife/pcgeos
504
242066
<reponame>steakknife/pcgeos COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) GeoWorks 1991 -- All Rights Reserved PROJECT: Config MODULE: FILE: imPen.asm AUTHOR: <NAME>, Nov 15, 1991 ROUTINES: Name Description ---- ----------- REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/15/91 Initial revision lester 12/11/96 added support for digitizer coords ink DESCRIPTION: This file contains code to implement the various pen support routines. The pen support works like this: If pen mode is off, then PC/GEOS functions normally (no pen data is ever saved). If the UI has requested that the IM start monitoring Pen input, then whenever a START_SELECT comes in, we begin adding non-collinear points to the buffer supplied by the UI. If the UI has determined that the mouse movements should be treated as ink it calls ImInkReply with AX=TRUE,and the currently entered data will be drawn to the screen, and data entered after that will also be drawn until either the buffer gets full or the timeout period elapses (the mouse is up for INK_TIMEOUT_TICKS). If the UI determines that the mouse movements should *not* be ink, then the IM discards the first START_SELECT to END_SELECT series. Note that if the mouse is not down, the IM does not save the data, and that once the UI replies that the current drag series is not ink, the IM does not save the data either. Exception cases: There are a few places where the buffer can fill up: 1) While entering ink (the most common case). 2) If the UI is blocked or not responding to our mouse events (in which case the buffer fills up with unprocessed mouse events). If it fills up while entering ink, we stop allowing ink to be entered, terminate the current segment, and pass it off to the UI when the next END_SELECT is encountered. If it fills up while not entering ink, there are 2 cases: 1) It fills up when processing a START_SELECT. In this case, we do *not* pass the START_SELECT off to the UI, and instead just eat the mouse events (don't pass them off or store them) until we get an END_SELECT. 2) It fills up when processing a MSG_META_PTR. In this case, we terminate the current segment, stop storing data, but continue passing the mouse events off to the UI. $Id: imPen.asm,v 1.1 97/04/05 01:17:20 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ IMResident segment resource if NO_PEN_SUPPORT global NoPenSupportError:far NoPenSupportError proc far EC < ERROR NO_PEN_SUPPORT_IN_THIS_KERNEL > NEC < stc > NEC < ret > NoPenSupportError endp else COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ImInkReply %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This is the routine to call depending upon whether or not the current routine is ink or not. It sends a method off to the IM thread to handle it. CALLED BY: GLOBAL PASS: AX = TRUE if the last select series was Ink FALSE if it was not Ink BP = gstate to draw ink through (or 0 if none) (if AX=TRUE) BX = width/height of brush CX:DX = vfptr to callback routine RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/18/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ImInkReply proc far uses ax, cx, di, bx, ds, si class IMClass .enter tst ax mov ax, MSG_IM_INK_REPLY_NEGATIVE jz sendMessage mov ax, MSG_IM_INK_REPLY_POSITIVE mov si, bx ;SI <- brush width/height sendMessage: mov di, mask MF_FORCE_QUEUE or mask MF_INSERT_AT_FRONT LoadVarSeg ds, bx mov bx, ds:[imThread] call ObjMessage .leave ret ImInkReply endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ImInkReplyMsg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This is the method handler invoked when the UI determines whether or not the last mouse input should be ink or not. CALLED BY: GLOBAL PASS: ax - method BP = gstate to draw ink through (or 0 if none) (if AX=TRUE) SI = width/height of brush CX:DX = callback routine RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/20/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ImInkReplyMsg method IMClass, MSG_IM_INK_REPLY_POSITIVE, MSG_IM_INK_REPLY_NEGATIVE tst ds:[inkCallVector].segment jz exit CallToInkSegment InkReplyHandler exit: ret ImInkReplyMsg endp endif ;NO_PEN_SUPPORT IMResident ends ife NO_PEN_SUPPORT IMPenCode segment resource COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawInkCallback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This callback routine draws the ink in the buffer CALLED BY: GLOBAL PASS: ax, bx - old point values cx, dx - new point values RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawInkCallback proc far uses ds .enter LoadVarSeg ds, bx tst_clc ax js startNewSegment 10$: call DrawInkLine mov_tr ax, cx mov bx, dx clc .leave ret startNewSegment: mov ds:[inkCurPoint].P_x, cx andnf ds:[inkCurPoint].P_x, 0x7fff mov ds:[inkCurPoint].P_y, dx jmp 10$ DrawInkCallback endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FindLengthOfSegmentCallback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine updates the count of points and returns carry set when the end of the segment is reached CALLED BY: GLOBAL PASS: ax - # points so far cx, dx - new points RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ FindLengthOfSegmentCallback proc far inc ax shl cx ;Sets carry if end of segment ret FindLengthOfSegmentCallback endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TrySaveUnder %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine tries to do a save under of the passed height centered around the first point in the ink array. CALLED BY: GLOBAL PASS: dx - height of save under bp - max Y coord of window ax, cx - left and right bounds of saveunder region es - P-locked window RETURN: if save under was successful: carry clear ax, bx, cx, dx - bounds of saveunder else: carry set ax, bx, cx, dx - unchanged DESTROYED: di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 12/ 4/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ TrySaveUnder proc near .enter push bx, dx push ds mov ds, ds:[inkData] mov di, ds:[CBS_start] mov bx, dx shr bx, 1 neg bx ;BX = -1/2 * height of save under add bx, ds:[di].P_y ; jns 10$ ;BX = first point in ink - 1/2 height clr bx ;If this is negative, start at top ; of screen 10$: ; BX <- top coordinate of screen to try to save under ; DX <- height of the saveunder area ; BP <- bottom coordinate of screen to try to saveunder mov di, dx ;DI <- height of saveunder area add dx, bx cmp dx, bp jbe 20$ ;If saveunder area is entirely on screen, ; branch mov dx, bp ;Else, have the saveunder area end at the mov bx, dx ; bottom of the screen, and recalculate the sub bx, di ; top of the saveunder area jnc 20$ clr bx 20$: pop ds push ax push ds, es, bx, cx, dx, si, bp mov di, DR_VID_SAVE_UNDER EC < tstdw ds:pointerDriver > EC < ERROR_Z NO_VIDEO_DRIVER_LOADED_YET > call ds:pointerDriver pop ds, es, bx, cx, dx, si, bp jnc saveUnderWorked pop ax pop bx, dx exit: .leave ret saveUnderWorked: mov es:[W_saveUnder], al pop ax add sp, size word * 2 ;Don't bother restoring original top/ ; bottom - return area that we saved jmp exit TrySaveUnder endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SetupSaveUnder %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Tries to setup a save under for the ink to be drawn. CALLED BY: GLOBAL PASS: ds - kdata RETURN: nada DESTROYED: bx, es, ax, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/27/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SetupSaveUnder proc near uses bp .enter clr ds:[inkWinHasSaveUnder] mov ax, ds:[lockedInkGState] ;If we aren't drawing to the cmp ax, ds:[inkDefaultGState] ; default gstate, then just jnz exit ; exit. mov bx, ds:[lockedInkWin] call MemDerefES mov ax, es:[W_winRect].R_left mov cx, es:[W_winRect].R_right mov dx, es:[W_winRect].R_bottom mov bp, dx ;BP <- bottom of window sub dx, ds:[W_winRect].R_top ;DX <- height of window mov bx, 4 ;Loop through this 4 times loopTop: call TrySaveUnder jnc gotSaveUnder shr dx, 1 ;Cut height in half. dec bx jnz loopTop exit: .leave ret gotSaveUnder: ; Save upper/lower bounds of the ink mov ds:[saveUnderUpperBound], bx mov ds:[saveUnderLowerBound], dx mov ds:[inkWinHasSaveUnder], TRUE jmp exit SetupSaveUnder endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RestoreSaveUnder %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine tries to restore any previous saveunder area. CALLED BY: GLOBAL PASS: ds - kdata RETURN: carry set if save under has been nuked DESTROYED: es, ax, di, bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/27/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RestoreSaveUnder proc near mov bx, ds:[inkWin] call MemPLock mov es, ax ; make sure that the save under was not nuked tst es:[W_saveUnder] stc jz afterRestore mov di, DR_VID_RESTORE_UNDER call CallPtrDriver clr es:[W_saveUnder] clc afterRestore: call MemUnlockV ret RestoreSaveUnder endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% InkReplyHandler %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This is the routine called when the UI has responded about the ink. CALLED BY: GLOBAL PASS: ax - MSG_IM_INK_REPLY_NEGATIVE, MSG_IM_INK_REPLY_POSITIVE BP = gstate to draw ink through (or 0 if none) (if AX=TRUE) SI = width/height of brush CX:DX = vfptr to callback routine ds - kdata RETURN: nada DESTROYED: ax, bx, cx, dx, dp, di, es, perhaps others PSEUDO CODE/STRATEGY: See description of states in header of InkInputMonitor()... When the UI tells us the status of a START_SELECT: If they say that the START_SELECT is INK, we create a gstate to draw through, and draw all the current ink. If we are in state 1, we start the timeout timer and go to state 4 Else, we go to state 3. If they say that the START_SELECT is not ink: We delete the first START_SELECT to END_SELECT pair. If we haven't received an END_SELECT for the first START_SELECT yet, then we delete what we have and goto state #1. Else, we stay in the same state we were in. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/20/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ InkReplyHandler proc far class IMClass cmp ax, MSG_IM_INK_REPLY_NEGATIVE LONG jz notInk EC < cmp ax, MSG_IM_INK_REPLY_POSITIVE > EC < ERROR_NZ INVALID_MSG_PASSED_TO_INK_REPLY_HANDLER > movdw ds:[inkGestureCallback], cxdx ; tell the mouse driver to not combine events mov cl, MCM_NO_COMBINE call SetMouseCombineMode mov cx, ds:[inkDefaultWidthAndHeight] mov ds:[inkBrushSize], cx tst si jz noPassedBrushSize mov ds:[inkBrushSize], si noPassedBrushSize: mov di, ds:[inkDefaultGState] tst bp jz doDraw mov di, bp doDraw: mov ds:[lockedInkGState], di ; ; The problem we have here is if we are drawing to an app-supplied ; gstate - this gstate will be hooked to a window, and hence will have ; some funky transformation associated with it. We just want to draw ; in screen coordinates, so we lock the gstate/windows and call the ; video driver ourselves. Since the window will be P-Locked, we don't ; have to worry about any stupid apps trying to do things to the window ; while we are drawing to it either... ; mov bx, ds:[lockedInkGState] call MemPLock mov es, ax mov bx, es:[GS_window] EC < tst bx > EC < ERROR_Z WIN_PASSED_GSTATE_HAS_NO_WINDOW > call MemPLock mov ds:[lockedInkWin], bx mov es, ax ; Validate the window, as it may not have valid clip regions, etc. push ds mov bx, ds:[lockedInkGState] call MemDerefDS call WinValWinStrucFar test es:[W_grFlags], mask WGF_MASK_NULL pop ds jnz windowNull ; Grab the graphics exclusive, so nobody will draw to the screen. clr bx call GrGrabExclusive ; Try to setup save under for the root window call SetupSaveUnder mov di, DR_VID_HIDEPTR call CallPtrDriver ; Draw the current ink mov bp, ds:[lockedInkGState] ;BP <- gstate to draw through EC < tst bp > EC < ERROR_Z NO_INK_GSTATE > ; Put ink bounds in invalid state so they will get updated by ; DrawInkLine() mov ds:[inkUpperLeftBounds].P_x, 0x7fff ; Draw all the ink, but first munge the data so brush is centered. call PointBufferModify mov ah, -1 mov bh, ah mov cx, cs mov dx, offset DrawInkCallback call PointBufferEnum clr ds:[haveCalledGestureCallback] cmp ds:[inkStatus], ICS_SKIP_UNTIL_START_SELECT mov ds:[inkStatus], ICS_COLLECT_AND_DRAW_UNTIL_END_SELECT jnz exit ; The user is currently between strokes ; so we check to see if the already-entered ink is a gesture. ; ; If so, send off the ink and exit ; ; If not, start up the timeout timer and await the entry of the next ; ink stroke. ; We treat all the data that the user has entered up to this point as ; a single stroke, so the text object gesture routine will still try ; to recognize it as a gesture. call CheckIfGesture jnc notGesture mov ds:[inkStatus], ICS_SEND_CLEAR ; We just set the im monitor finite state machine to ; ICS_JUST_SEND_INK, now we send it message so it will send ; the ink off to the UI. mov ax, MSG_META_NOTIFY mov bx, ds:[imThread] mov di, mask MF_FORCE_QUEUE or mask MF_INSERT_AT_FRONT call ObjMessage jmp exit notGesture: call StartTimeoutTimerAndWaitForStartSelect exit: ret windowNull: ; ; The window was still in the process of coming up (or was suspended) ; when the user tried to draw ink in it. Clean up after ourselves, ; and pretend that the reply was "NO_INK". ; ; This is fairly tricky, since the flow object has discarded all the ; mouse events we've sent it up to this point. We nuke all of our ; points, and either wait ; EC < WARNING DISCARDING_MOUSE_INPUT > mov bx, ds:[lockedInkWin] call MemUnlockV mov bx, ds:[lockedInkGState] call MemUnlockV mov cl, MCM_COMBINE call SetMouseCombineMode ; ; The flow object is stupidly hanging out waiting for a MSG_INK. ; Send it one (with BP=0), and nuke all the points we've collected. ; mov ax, MSG_META_NOTIFY_WITH_DATA_BLOCK clr bp mov cx, MANUFACTURER_ID_GEOWORKS mov dx, GWNT_INK mov bx, ds:[imThread] mov di, mask MF_FORCE_QUEUE or mask MF_INSERT_AT_FRONT call ObjMessage ; ; Don't collect any data until the next start select. ; mov ds:[inkStatus], ICS_SKIP_UNTIL_START_SELECT ; ; Nuke any and all points that we've collected. ; clr bx mov ds:[inkNumStrokes], bx xchg ds:[inkHandle], bx tst bx jz clearBuffer call MemFree clearBuffer: call PointBufferGetCount call PointBufferDelete if INK_DIGITIZER_COORDS clr bx xchg ds:[inkCoordsBlockHan], bx tst bx jz noInkCoords call MemFree noInkCoords: endif ; INK_DIGITIZER_COORDS jmp exit notInk: ; tell the mouse driver to combine events mov cl, MCM_COMBINE call SetMouseCombineMode clr ax mov cx, cs mov dx, offset FindLengthOfSegmentCallback call PointBufferEnum ;Returns AX = # items in buffer. ;Carry set if we've already collected an END_SELECT jc 30$ ;Else, we're in the middle of ; a select, so go back to ; "non-collecting" mode mov ds:[inkStatus], ICS_SKIP_UNTIL_START_SELECT inc ds:[inkNumStrokes] ;We increment the # strokes, ; because we haven't gotten an ; end select for this stroke ; yet. 30$: EC < tst ds:[inkNumStrokes] > EC < ERROR_Z INK_NUM_STROKES_MUST_BE_NON_ZERO > mov_tr cx, ax ;CX <- # items to delete call PointBufferDelete dec ds:[inkNumStrokes] if INK_DIGITIZER_COORDS ; ; Delete the digitizer coords in the first segment. ; clr ax mov cx, cs mov dx, offset FindLengthOfSegmentCallback CheckHack <segment FindLengthOfSegmentCallback eq @CurSeg> CheckHack <segment FindLengthOfSegmentCallback eq IMPenCode> CheckHack <segment DigitizerCoordsEnum eq @CurSeg> call DigitizerCoordsEnum ; Returns AX = # items in first segment. mov_tr cx, ax ;CX <- # items to delete call DigitizerCoordsDelete endif ; INK_DIGITIZER_COORDS jmp exit InkReplyHandler endp COMMENT @---------------------------------------------------------------------- FUNCTION: SetMouseCombineMode DESCRIPTION: Set the combine mode in the mouse driver CALLED BY: INTERNAL PASS: cl - MouseCombineMode RETURN: none DESTROYED: none REGISTER/STACK USAGE: PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- Tony 2/17/92 Initial version Don 11/13/93 Do nothing if no default driver, to handle problems with pen driver input arriving while registering interrupt handler ------------------------------------------------------------------------------@ SetMouseCombineMode proc near uses ax, bx, si, di, ds .enter mov ax, GDDT_MOUSE call GeodeGetDefaultDriver tst ax jz done mov_tr bx, ax call GeodeInfoDriver mov di, DR_MOUSE_SET_COMBINE_MODE call ds:[si].DIS_strategy done: .leave ret SetMouseCombineMode endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CopyPenResource %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Copies the IMPenCode resource into a fixed segment. CALLED BY: GLOBAL PASS: ds - idata RETURN: cx - segment of block bx - handle of block - or - carry set if couldn't allocate it DESTROYED: ax, di, si PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/19/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ if not KERNEL_EXECUTE_IN_PLACE and (not FULL_EXECUTE_IN_PLACE) EC <cat char 'input',0 > EC <key char 'debugInk',0 > CopyPenResource proc near uses es, ds .enter if ERROR_CHECK segmov ds, cs, cx mov dx, offset key mov si, offset cat clr ax call InitFileReadBoolean tst ax jz doCopy WARNING INK_DEBUGGING_TURNED_ON mov bx, handle IMPenCode call MemLock mov cx, ax clr bx clc jmp exit doCopy: endif ; Get the size of this resource mov ax, MGIT_SIZE mov bx, handle IMPenCode call MemGetInfo ;AX <- size of this resource ; Allocate a similarly-sized fixed block push ax mov bx, handle 0 mov cx,mask HF_FIXED or (mask HAF_READ_ONLY or mask HAF_CODE) shl 8 call MemAllocSetOwnerFar ; pop cx jc exit mov es, ax ;ES:DI <- ptr to dest clr di segmov ds, cs ;DS:SI <- ptr to src clr si shr cx, 1 ;CX is *never* odd rep movsw ;Copy data over mov cx, es ;Carry should be cleared by "shr" ; above... EC < ERROR_C SIZE_OF_PEN_CODE_BLOCK_WAS_ODD > exit: .leave ret CopyPenResource endp endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DoInvalBounds %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine invalidates the passed bounds CALLED BY: GLOBAL PASS: ax, bx, cx, dx - bounds RETURN: nada DESTROYED: ax, bx, cx, dx, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 12/ 4/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DoInvalBounds proc near class IMClass sub sp, size Rectangle mov bp, sp mov ss:[bp].R_left, ax mov ss:[bp].R_top, bx mov ss:[bp].R_right, cx mov ss:[bp].R_bottom, dx mov dx, size Rectangle mov ax, MSG_IM_REDRAW_AREA mov bx, ds:[imThread] mov di, mask MF_FORCE_QUEUE or mask MF_INSERT_AT_FRONT or mask MF_STACK call ObjMessage add sp, dx ret DoInvalBounds endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EraseInk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine erases the ink on the screen, either by restoring from save-under, or by generating a MSG_META_INVAL_BOUNDS... If we were drawing through a user-supplied gstate, don't erase the ink CALLED BY: GLOBAL PASS: ds - kdata RETURN: nada DESTROYED: ax, bx, cx, dx, bp, di, es PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ EraseInk proc near ; Unlock the window/gstate mov bx, ds:[lockedInkGState] call MemDerefES mov bx, es:[GS_window] call MemUnlockV mov bx, ds:[lockedInkGState] mov di, bx call MemUnlockV ; Allow drawing again clr bx call GrReleaseExclusive ; will return bogus (offscreen) coords ; of no drawing operations aborted ; during the time we had the exclusive tst ax js 20$ ; if offscreen, skip invalidation push di call DoInvalBounds ; else do it baby pop di 20$: cmp di, ds:[inkDefaultGState] jnz notDefaultGState ; Bump lower right bounds as our ink is 2 pixels wide/tall... inc ds:[inkLowerRightBounds].P_x inc ds:[inkLowerRightBounds].P_y ; Restore the save under area, if any tst ds:[inkWinHasSaveUnder] jz invalEntireInk call RestoreSaveUnder jc invalEntireInk ; The ink may have been drawn outside the save under area. If so, ; expose those areas. mov bx, ds:[inkUpperLeftBounds].P_y cmp bx, ds:[saveUnderUpperBound] jge inkNotAboveSaveUnder mov ax, ds:[inkUpperLeftBounds].P_x mov cx, ds:[inkLowerRightBounds].P_x mov dx, ds:[saveUnderUpperBound] dec dx call DoInvalBounds inkNotAboveSaveUnder: mov dx, ds:[inkLowerRightBounds].P_y cmp dx, ds:[saveUnderLowerBound] jle exit mov bx, ds:[saveUnderLowerBound] inc bx jmp invalAndExit invalEntireInk: ; Get the bounds of the ink, and send a method to the UI to invalidate ; them. mov bx, ds:[inkUpperLeftBounds].P_y mov dx, ds:[inkLowerRightBounds].P_y invalAndExit: mov ax, ds:[inkUpperLeftBounds].P_x mov cx, ds:[inkLowerRightBounds].P_x call DoInvalBounds exit: ; Draw the cursor again. mov di, DR_VID_SHOWPTR call CallPtrDriver ret notDefaultGState: call GrDestroyState jmp exit EraseInk endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DestroyInkWinAndGState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine destroys the current ink window and gstate, and restores the screen from the ink if necessary. CALLED BY: GLOBAL PASS: nada RETURN: nada DESTROYED: ax, bx, dx, bp, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DestroyInkWinAndGState proc near .enter cmp ds:[inkStatus], ICS_COLLECT_UNTIL_END_SELECT jbe noErase call EraseInk noErase: mov di, ds:[inkDefaultGState] tst di jz noInkState call GrDestroyState noInkState: mov di, ds:[inkWin] tst di jz noInkWin call WinClose noInkWin: .leave ret DestroyInkWinAndGState endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CreateInkWinAndGState %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Creates a root window to draw ink to and a gstate to draw with. CALLED BY: GLOBAL PASS: ds - kdata RETURN: inkWin, inkDefaultGState - set to values DESTROYED: ax, bx, dx, bp, di, si PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CreateInkWinAndGState proc near uses cx .enter mov di, ds:[pointerWin] call WinGetWinScreenBounds mov bp, handle 0 push bp ;Layer ID push bp ;Process to own window push ds:[pointerDriverHandle] clr bp push bp push bp push dx ;Push bounds of window push cx push bx push ax mov ax, (mask WCF_TRANSPARENT or mask WCF_PLAIN) shl 8 clrdw cxdx ;No Output ODs clr di ; mov si, mask WPF_ROOT or WIN_PRIO_STD or mask WPF_CREATE_GSTATE call WinOpen mov ds:[inkWin], bx mov ds:[inkDefaultGState], di ; Init the separator, which is used when drawing line segments later mov ds:[inkSeparator].P_x, 8000h mov ds:[inkSeparator].P_y, 8000h .leave ret CreateInkWinAndGState endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ImStartPenMode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine tells the IM to begin storing ink. CALLED BY: GLOBAL PASS: nothing RETURN: carry set if error (could not allocate memory to store ink data) DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/18/91 Initial version lester 11/24/96 added call to AllocateDigitizerCoordsBuffer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ImStartPenMode proc far uses ds, ax, bx, cx, dx, di, si .enter ; Before we add the input monitor to collect the ink data, allocate ; and initialize the buffer. We allocate the buffer "FIXED" so we don't ; have the overhead of locking the block with every ptr event, and so ; it never gets swapped (which would be a bad thing). LoadVarSeg ds, cx mov bx, handle 0 mov cx, mask HF_FIXED mov ax, INK_DATA_BUFFER_SIZE call MemAllocSetOwnerFar jc exit EC < tst ds:[inkData] > EC < ERROR_NZ IM_START_PEN_MODE_WAS_CALLED_TWICE > mov ds:[inkStatus], ICS_SKIP_UNTIL_START_SELECT mov ds:[inkData], ax mov ds:[inkDataHan], bx call PointBufferInit ;Init the buffer passed in AX if INK_DIGITIZER_COORDS ; Allocate circular buffer for absolute digitizer coordinates ; if the appropriate ini entry is set. call AllocateDigitizerCoordsBuffer ; carry set on failure jc freeExit endif ; INK_DIGITIZER_COORDS ; Input monitors and the associated pen code must be in a fixed block, ; so copy this resource into one. AXIP< mov cx, cs > NOAXIP< call CopyPenResource ;Returns CX <- segment of fixed > ; copy of pen resource NOAXIP< jc freeExit > NOAXIP< mov ds:[inkCodeBlock], bx > mov ds:[inkCallVector].segment, cx ; Create a window and a gstate to draw ink to call CreateInkWinAndGState ; Add an input monitor to collect ink data. mov bx, offset inkMonitor ;DS:BX <- ptr to Monitor<> structure ;CX:DX <- fptr to monitor routine mov dx, offset InkInputMonitor mov al, ML_INK ;AL <- Monitor level (Ink comes after ; everything but before the data is ; sent through the OD) call ImAddMonitor clc exit: .leave ret if (not KERNEL_EXECUTE_IN_PLACE and not FULL_EXECUTE_IN_PLACE) \ or INK_DIGITIZER_COORDS freeExit: clr bx mov ds:[inkData], bx xchg bx, ds:[inkDataHan] tst bx jz noInk call MemFree noInk: if INK_DIGITIZER_COORDS clr bx mov ds:[inkCoordsBuffer], bx xchg bx, ds:[inkCoordsBufferHan] tst bx jz noInkCoords call MemFree noInkCoords: endif ; INK_DIGITIZER_COORDS stc jmp exit endif ImStartPenMode endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ImExitPenMode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This exits pen mode. We do this on the IM thread to ensure that nobody is running in the copied code resource when we free it. CALLED BY: GLOBAL PASS: nada RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/20/91 Initial version lester 11/25/96 added call to RemoveDigitizerCoordsBuffer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ImExitPenMode method IMClass, MSG_IM_EXIT_PEN_MODE mov al, mask MF_REMOVE_IMMEDIATE mov bx, offset inkMonitor call ImRemoveMonitor mov bx, ds:[inkDataHan] tst bx jz noInk call MemFree noInk: if INK_DIGITIZER_COORDS mov bx, ds:[inkCoordsBufferHan] tst bx jz noInkCoords call RemoveDigitizerCoordsBuffer noInkCoords: endif ; INK_DIGITIZER_COORDS NOAXIP< mov bx, ds:[inkCodeBlock] > NOAXIP< tst bx > NOAXIP< jz noFree > NOAXIP< call MemFree > NOAXIP<noFree: > mov bx, ds:[inkTimerHan] mov ax, ds:[inkTimerID] tst bx jz 10$ call TimerStop clr bx 10$: mov ds:[inkTimerHan], bx mov ds:[inkTimerID], bx mov ds:[inkDataHan], bx mov ds:[inkData], bx mov ds:[inkCodeBlock], bx mov ds:[inkCallVector].segment, bx ; Free up any gstate we may have been using to draw ink call DestroyInkWinAndGState ret ImExitPenMode endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ImRedrawArea %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This method handler forces a redraw of a portion of the screen CALLED BY: GLOBAL PASS: ss:bp - Bounds of area to invalidate (in screen coords) RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 6/15/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ImRedrawArea method IMClass, MSG_IM_REDRAW_AREA mov ax, MSG_META_INVAL_BOUNDS mov bx, ds:[uiHandle] mov cx, ds:[pointerWin] ;CX <- root window to inval mov di, mask MF_STACK GOTO ObjMessage ImRedrawArea endm COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ImEndPenMode %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine takes the input manager out of the mode where it captures ink and into its normal mode. CALLED BY: GLOBAL PASS: nada RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/18/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ImEndPenMode proc far uses ax, bx, cx, dx, bp, di, ds class IMClass .enter ; Send a message to the IM thread to do this, so we can be certain that ; nobody is doing anything in the copied code block when we free it. LoadVarSeg ds, bx mov ax, MSG_IM_EXIT_PEN_MODE mov bx, ds:[imThread] mov di, mask MF_FORCE_QUEUE or mask MF_INSERT_AT_FRONT call ObjMessage .leave ret ImEndPenMode endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% StoreInkCallback %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Callback routine that stores ink points CALLED BY: GLOBAL PASS: cx, dx - ink point es:bp - ptr to store it RETURN: carry clear bp updated to point to where to store next point DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ StoreInkCallback proc far mov es:[bp].P_x, cx mov es:[bp].P_y, dx add bp, size Point ;Should never set carry EC < ERROR_C INK_ENUM_EXCEEDED_END_OF_BUFFER > ret StoreInkCallback endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LimitPtrToScreenLimits %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Limits the pointer event to the limits of the screen. CALLED BY: GLOBAL PASS: ds - dgroup cx, dx - point RETURN: cx, dx - changed to lie onscreen, if necessary DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 6/30/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ LimitPtrToScreenLimits proc near .enter cmp cx, ds:[screenXMin] jl setXMin cmp cx, ds:[screenXMax] jg setXMax checkY: cmp dx, ds:[screenYMin] jl setYMin cmp dx, ds:[screenYMax] jg setYMax exit: .leave ret setXMin: mov cx, ds:[screenXMin] jmp checkY setXMax: mov cx, ds:[screenXMax] jmp checkY setYMin: mov dx, ds:[screenYMin] jmp exit setYMax: mov dx, ds:[screenYMax] jmp exit LimitPtrToScreenLimits endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% InkInputMonitor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This is the routine through which all mouse events travel and are converted into ink. CALLED BY: GLOBAL PASS: di - event type (method) cx, dx, bp, si - event data ss:sp - IM stack frame RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: There are a number of ink-collection states that we can be in: 1) We can be doing nothing, and waiting for a START_SELECT When a START_SELECT comes in, we store it and go to state #2 In the meantime, we just pass on all events. 2) We can be collecting possible ink and waiting until an END_SELECT We hang around and collect ink until the UI tells us the status of the START_SELECTs we've collected or until we've received an END_SELECT. When we receive an END_SELECT, we go back to state #1 If the UI replies that the user is entering ink, we can move to these states: 3) We can be collecting ink and waiting for an END_SELECT If a START_SELECT comes in here, we crash, as you can't get multiple START_SELECTs... If a MSG_META_PTR comes in, we draw to the screen, and buffer it up. When an END_SELECT comes in, we start our timeout timer and goto state 4. 4) We can be waiting for a START_SELECT When a START_SELECT comes in, we kill the current timeout timer, draw a point at the current position, and goto state 3 When the timeout timer hits: We compare it to the current timeout timer, and if it doesn't match (it's been killed but somehow managed to squeak into the queue) we ignore it. Otherwise, we grab all the ink data we've collected so far, send it off to the UI, and go back to state #1 KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/19/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ InkInputMonitor proc far class IMClass LoadVarSeg ds, bx ; Determine our status, and call through the associated handler routine cmp di, MSG_IM_INK_TIMEOUT je timeout mov bx, ds:[inkStatus] cmp bx, ICS_SEND_CACHED_START_SELECT je noCheckBounds ;Don't trash inkPenSavedXX values if ; we are sending a cached start select. if INK_DIGITIZER_COORDS cmp bx, ICS_SEND_INK_AND_THEN_SEND_CACHED_START_SELECT je noCheckBounds ;Don't trash inkPenSavedXX values if ; we are sending the ink prior to ; sending a cached start select. endif mov ds:[inkPenSavedCX], cx mov ds:[inkPenSavedDX], dx mov ds:[inkPenSavedBP], bp cmp bx, ICS_COLLECT_AND_DRAW_AFTER_START_SELECT jae noCheckBounds cmp di, MSG_META_MOUSE_PTR je checkBounds cmp di, MSG_META_MOUSE_BUTTON jne callHandler checkBounds: ; The event hasn't been restricted to the screen limits yet (this ; happens in OutputMonitor). We want to restrict them here, for our ; uses. call LimitPtrToScreenLimits callHandler: call cs:[inputFSMTable][bx] cmp di, MSG_META_NOTIFY_WITH_DATA_BLOCK ;Don't restore cx,dx je exit ; if we are sending ; ink off. mov cx, ds:[inkPenSavedCX] mov dx, ds:[inkPenSavedDX] exit: ; Check for illegal flags being set EC < test al, not (mask MF_MORE_TO_DO or mask MF_DATA) > EC < ERROR_NZ IM_BAD_FLAGS_RETURNED_FROM_MONITOR > ret noCheckBounds: call cs:[inputFSMTable][bx] jmp exit timeout: clr al ;Assume that we don't want ; to process this message... cmp bp, ds:[inkTimerID] ;If this isn't the current jne exit ; timer, exit clr ds:[inkTimerID] clr ds:[inkTimerHan] if INK_DIGITIZER_COORDS call SendInkCoords else call SendInk endif jmp exit InkInputMonitor endp inputFSMTable label nptr nptr SkipUntilStartSelect nptr CollectUntilEndSelect nptr CollectAndDrawUntilEndSelect nptr CollectAndDrawAfterStartSelect nptr EatEventsUntilEndSelect nptr SendInkOnEndSelect nptr SendInk nptr SendCachedStartSelect nptr SendClear if INK_DIGITIZER_COORDS nptr SendInkCoords nptr SendInkAndThenSendCachedStartSelect endif COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% AppendPointsToInkBlock %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine appends all the current points in the ink buffer to the ink block. CALLED BY: GLOBAL PASS: ds - kdata RETURN: carry set if error, bp=0 -else- bx, bp = handle of locked ink block cx - # points just added es - segment of locked ink block DESTROYED: ax, dx, di PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 2/27/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ AppendPointsToInkBlock proc near .enter call PointBufferGetCount tst ds:[inkHandle] jnz haveInkHandle ; Get the # points in the ink, and allocate a buffer big enough to hold ; it. This is pretty bad to do (allocate memory on the IM thread), but ; there isn't much to be done about it (sigh). mov_tr ax, cx ;AX <- # points to allocate shl ax, 1 ;AX <- # bytes shl ax, 1 add ax, size InkHeader ; mov bx, handle 0 mov cx, ALLOC_DYNAMIC_LOCK or mask HF_SHARABLE call MemAllocSetOwnerFar jc exit mov ds:[inkHandle], bx mov es, ax clr es:[IH_count] common: mov es, ax mov bp, es:[IH_count] shl bp, 1 shl bp, 1 add bp, offset IH_data ;ES:BP <- ptr to store next pt push ds:[inkHandle] clr ds:[inkHandle] ;We only care about the ink mov cx, cs ; in the local buffer, not ; the ink in the global buffer, ; so temporarily nuke handle mov dx, offset StoreInkCallback call PointBufferEnum pop ds:[inkHandle] call PointBufferGetCount ;CX <- # points in the buffer add es:[IH_count], cx ;Clears carry EC < ERROR_C -1 > EC < tst es:[IH_count] > EC < ERROR_Z NUM_INK_POINTS_IS_ZERO > exit: mov bp, ds:[inkHandle] .leave ret haveInkHandle: mov bx, ds:[inkHandle] call MemLock mov es, ax add cx, es:[IH_count] mov_tr ax, cx ;AX <- # points to allocate shl ax, 1 shl ax, 1 add ax, size InkHeader ;AX <- new size of block clr ch call MemReAlloc jnc common clr bx ;If we couldn't resize the xchg bx, ds:[inkHandle] ; block, return an error. call MemFree stc jmp exit AppendPointsToInkBlock endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SendClear %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: send an empty ink message off to the flow object, so that it clears the FF_PROCESSING_INK flag. This is needed because sending a gesture should not clear the FF_PROCESSING_INK flag because more than one gesture might have to be sent. So after all of the gestures are sent, SendClear is called to clear FF_PROCESSING_INK flag. CALLED BY: PASS: ds - kdata RETURN: di - MSG_META_NOTIFY_WITH_DATA_BLOCK to send to output bp - 0 al - MF_DATA DESTROYED: cx, dx SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- IP 5/12/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SendClear proc near .enter if INK_DIGITIZER_COORDS EC < cmp di, MSG_IM_READ_DIGITIZER_COORDS > EC < ERROR_E INK_RECEIVED_UNEXPECTED_MSG_IM_READ_DIGITIZER_COORDS > endif mov ds:[inkStatus], ICS_SKIP_UNTIL_START_SELECT clr bp mov di, MSG_META_NOTIFY_WITH_DATA_BLOCK mov cx, MANUFACTURER_ID_GEOWORKS mov dx, GWNT_INK mov al, mask MF_DATA .leave ret SendClear endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SendInk %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sends the ink off to the UI. CALLED BY: GLOBAL PASS: ds - kdata RETURN: di - MSG_META_NOTIFY_WITH_DATA_BLOCK to send to output bp - data to send with MSG_META_NOTIFY_WITH_DATA_BLOCK al - MF_DATA DESTROYED: es, ah, bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/27/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SendInk proc near if INK_DIGITIZER_COORDS EC < cmp di, MSG_IM_READ_DIGITIZER_COORDS > EC < ERROR_E INK_RECEIVED_UNEXPECTED_MSG_IM_READ_DIGITIZER_COORDS > endif mov ds:[inkStatus], ICS_SKIP_UNTIL_START_SELECT call AppendPointsToInkBlock ;es<- segment locked ;ink block ;bx <- handle ink block pushf clr ds:[inkHandle] clr ds:[inkNumStrokes] call PointBufferGetCount call PointBufferDelete ;Delete the data from the ; buffer. popf jc sendMessage ;If error, branch to pass bp=0 ; Init InkHeader<> mov ax, 1 call MemInitRefCount ; Init ref count to one, ; for usage of sending out ; MSG_META_NOTIFY_WITH_DATA_BLOCK ; (recipient must dec count) EC < tst es:[IH_count] > EC < ERROR_Z NUM_INK_POINTS_IS_ZERO > mov ax, ds:[inkUpperLeftBounds].P_x mov es:[IH_bounds].R_left, ax mov ax, ds:[inkUpperLeftBounds].P_y mov es:[IH_bounds].R_top, ax mov ax, ds:[inkLowerRightBounds].P_x mov es:[IH_bounds].R_right, ax mov ax, ds:[inkLowerRightBounds].P_y mov es:[IH_bounds].R_bottom, ax call MemUnlock ;Unlock the data block sendMessage: push bp call EraseInk ;Erase the ink... pop bp ; Pass the MSG_META_NOTIFY_WITH_DATA_BLOCK to the output... mov di, MSG_META_NOTIFY_WITH_DATA_BLOCK mov cx, MANUFACTURER_ID_GEOWORKS mov dx, GWNT_INK mov al, mask MF_DATA ret SendInk endp if INK_DIGITIZER_COORDS COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SendInkCoords %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sends the ink digitizer coords notification off to the UI and then switches to the ICS_JUST_SEND_INK state to send the ink screen points notification. CALLED BY: (INTERNAL) InkInputMonitor, CollectAndDrawAfterStartSelect PASS: ds - kdata RETURN: di - MSG_META_NOTIFY_WITH_DATA_BLOCK to send to output bp - data to send with MSG_META_NOTIFY_WITH_DATA_BLOCK al - mask MF_DATA or mask MF_MORE_TO_DO DESTROYED: ah, bx SIDE EFFECTS: inkStatus changed to ICS_JUST_SEND_INK. PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 11/27/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SendInkCoords proc near mov ds:[inkStatus], ICS_JUST_SEND_INK clr bp xchg bp, ds:[inkCoordsBlockHan] tst bp jz sendNotification mov bx, bp mov ax, 1 call MemInitRefCount ; Init ref count to one, ; for usage of sending out ; MSG_META_NOTIFY_WITH_DATA_BLOCK ; (recipient must dec count) ; Pass the MSG_META_NOTIFY_WITH_DATA_BLOCK to the output... sendNotification: mov di, MSG_META_NOTIFY_WITH_DATA_BLOCK mov cx, MANUFACTURER_ID_GEOWORKS mov dx, GWNT_INK_DIGITIZER_COORDS mov al, mask MF_DATA or mask MF_MORE_TO_DO ret SendInkCoords endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SendInkAndThenSendCachedStartSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Sends the ink screen points notification off to the UI and then switches to the ICS_SEND_CACHED_START_SELECT state to send the cached start select. CALLED BY: (INTERNAL) InkInputMonitor PASS: ds - kdata RETURN: di - MSG_META_NOTIFY_WITH_DATA_BLOCK to send to output bp - data to send with MSG_META_NOTIFY_WITH_DATA_BLOCK al - mask MF_DATA or mask MF_MORE_TO_DO DESTROYED: es, ah, bx SIDE EFFECTS: inkStatus changed to ICS_SEND_CACHED_START_SELECT PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 12/ 3/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SendInkAndThenSendCachedStartSelect proc near ; ; Send off the screen points notification. ; call SendInk ; ; Switch to the ICS_SEND_CACHED_START_SELECT state to send ; the cached start select. ; ornf al, mask MF_MORE_TO_DO mov ds:[inkStatus], ICS_SEND_CACHED_START_SELECT ret SendInkAndThenSendCachedStartSelect endp endif ; INK_DIGITIZER_COORDS COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SkipUntilStartSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This monitor routine skips all ptr events until a START_SELECT is encountered. CALLED BY: GLOBAL PASS: same as an InputMonitor routine if MSG_META_MOUSE_BUTTON or MSG_META_MOUSE_PTR cx,dx - ptr position bp - ButtonInfo if MSG_IM_READ_DIGITIZER_COORDS bp = ReadDigitizerCoordsFlags If RDCF_STROKE_DROPPED is clear: cx = number of coordinates to read (may be zero) ds - kdata RETURN: same as an InputMonitor routine DESTROYED: bx? PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/19/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SkipUntilStartSelect proc near if INK_DIGITIZER_COORDS cmp di, MSG_IM_READ_DIGITIZER_COORDS je eatCoords endif cmp di, MSG_META_MOUSE_BUTTON jne exit test bp, mask BI_B0_DOWN ;First, make sure button 0 is down jz exit ;Exit if not. ;If any other mouse buttons down, ; exit (isn't a START_SELECT) test bp, mask BI_B1_DOWN or mask BI_B2_DOWN or mask BI_B3_DOWN jnz exit ; tell the mouse driver to not combine events (so that we don't ; lose any) push cx mov cl, MCM_NO_COMBINE call SetMouseCombineMode pop cx test bp, mask BI_BUTTON ;Now, check if it had changed from last jnz exit ; time. Exit if not (this was not a ; start select) EC < tst cx > EC < ERROR_S PTR_EVENT_WITH_NEGATIVE_COORDINATE > EC < tst dx > EC < ERROR_S PTR_EVENT_WITH_NEGATIVE_COORDINATE > call PointBufferAppend jc isError mov ds:[inkStatus], ICS_COLLECT_UNTIL_END_SELECT exit: ret isError: ; If this is an error, put us in error mode. We eat all ptr events from ; the start select to the end select. clr bx xchg bx, ds:[inkHandle] tst bx jz noBlock call MemFree noBlock: mov ds:[inkStatus], ICS_EAT_EVENTS_UNTIL_END_SELECT and al, not mask MF_DATA jmp exit if INK_DIGITIZER_COORDS eatCoords: ; Eat the digitizer coords since we're not currently collecting ink. call DigitizerCoordsEat clr al ; Indicate data consumed jmp exit endif SkipUntilStartSelect endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CollectUntilEndSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Collects data until an END_SELECT is reached. CALLED BY: GLOBAL PASS: di - event type if MSG_META_MOUSE_BUTTON or MSG_META_MOUSE_PTR cx,dx - ptr position bp - ButtonInfo if MSG_IM_READ_DIGITIZER_COORDS bp = ReadDigitizerCoordsFlags If RDCF_STROKE_DROPPED is clear: cx = number of coordinates to read (may be zero) ds - kdata RETURN: same as monitor DESTROYED: bx? PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/19/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CollectUntilEndSelect proc near cmp di, MSG_META_MOUSE_PTR je addPoint if INK_DIGITIZER_COORDS cmp di, MSG_IM_READ_DIGITIZER_COORDS je storeCoords endif cmp di, MSG_META_MOUSE_BUTTON jne exit EC < tst cx > EC < ERROR_S PTR_EVENT_WITH_NEGATIVE_COORDINATE > EC < tst dx > EC < ERROR_S PTR_EVENT_WITH_NEGATIVE_COORDINATE > test bp, mask BI_B0_DOWN jne addPoint ornf cx, 0x8000 ;If this is an END_SELECT, ; then set high bit in coord ; to signify that it is the ; end of a stroke. inc ds:[inkNumStrokes] mov ds:[inkStatus], ICS_SKIP_UNTIL_START_SELECT addPoint: call PointBufferAppend jnc noError call PointBufferTerminate noError: andnf cx, 0x7fff exit: ret if INK_DIGITIZER_COORDS storeCoords: ; Store the digitizer coords in the notification block clr al ; Indicate data consumed call DigitizerCoordsStore ; ignore any error jmp exit endif CollectUntilEndSelect endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SendCachedStartSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine returns the cached start select msg. CALLED BY: GLOBAL PASS: nada RETURN: di, ax, cx, dx, bp - appropriate data to return. DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 2/21/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SendCachedStartSelect proc near if INK_DIGITIZER_COORDS EC < cmp di, MSG_IM_READ_DIGITIZER_COORDS > EC < ERROR_E INK_RECEIVED_UNEXPECTED_MSG_IM_READ_DIGITIZER_COORDS > endif mov di, MSG_META_MOUSE_BUTTON mov cx, ds:[inkPenSavedCX] mov dx, ds:[inkPenSavedDX] mov bp, ds:[inkPenSavedBP] call LimitPtrToScreenLimits mov al, mask MF_DATA GOTO SkipUntilStartSelect SendCachedStartSelect endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DrawInkLine %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine draws a line from the old "inkCurPoint" to the point passed in. CALLED BY: GLOBAL PASS: cx, dx - new point to draw to ds - kdata inkCurPoint - old point to draw from RETURN: inkCurPoint - updated to point to this DESTROYED: nothing PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: Setting the bounds of the ink was changed to include the width of the ink. This has the advantage of allowing anyone who uses the ink, to use the bounds of the ink to invalidate the ink. However, it has the disadvantage of having the bound be slightly larger then the actual ink. REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/20/91 Initial version IP 05/04/94 modified to handle ink width %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DrawInkLine proc near uses ax, bx, cx, dx, di, si .enter EC < call AssertDSKdata > shl cx ;Sign-extend the 15-bit value in CX sar cx ; to be 16 bits ; Update the bounds of the ink ; add ink width/2 + 1 and height/2 + 1 to ink bounds ; mov ax, ds:[inkBrushSize] clr bx mov bl, ah shr bx, 1 inc bx clr ah shr ax, 1 inc ax cmp ds:[inkUpperLeftBounds].P_x, 0x7fff je doSet sub cx, bx cmp cx, ds:[inkUpperLeftBounds].P_x jg 3$ mov ds:[inkUpperLeftBounds].P_x, cx 3$: sub dx, ax cmp dx, ds:[inkUpperLeftBounds].P_y jg 5$ mov ds:[inkUpperLeftBounds].P_y, dx 5$: shl bx, 1 add cx, bx cmp cx, ds:[inkLowerRightBounds].P_x jl 7$ mov ds:[inkLowerRightBounds].P_x, cx 7$: shl ax, 1 add dx, ax cmp dx, ds:[inkLowerRightBounds].P_y jl 20$ mov ds:[inkLowerRightBounds].P_y, dx 20$: shr bx, 1 sub cx, bx shr ax, 1 sub dx, ax ; Update the inkCurPoint and inkOldPoint variables mov ax, ds:[inkCurPoint].P_x mov ds:[inkOldPoint].P_x, ax mov ax, ds:[inkCurPoint].P_y mov ds:[inkOldPoint].P_y, ax mov ds:[inkCurPoint].P_x, cx mov ds:[inkCurPoint].P_y, dx ; Draw this line segment push ds, bp mov si, offset inkOldPoint ; mov ax, ds:[inkBrushSize] ;AX <- width/height of brush mov bx, ds:[lockedInkWin] call MemDerefES ;ES <- locked window push ds mov bx, ds:[lockedInkGState] ;DS <- locked gstate call MemDerefDS pop bx ;BX:SI <- array of points mov di, DR_VID_POLYLINE call es:[W_driverStrategy] ;Call video driver pop ds, bp .leave ret doSet: ; ; add ink width and height to ink bounds ; mov ds:[inkUpperLeftBounds].P_x, cx sub ds:[inkUpperLeftBounds].P_x, bx mov ds:[inkUpperLeftBounds].P_y, dx sub ds:[inkUpperLeftBounds].P_y, ax mov ds:[inkLowerRightBounds].P_x, cx add ds:[inkLowerRightBounds].P_x, bx mov ds:[inkLowerRightBounds].P_y, dx add ds:[inkLowerRightBounds].P_y, ax jmp 20$ DrawInkLine endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% StartTimeoutTimerAndWaitForStartSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine starts the timeout timer and goes to the COLLECT_AND_DRAW_AFTER_START_SELECT state CALLED BY: GLOBAL PASS: ds - kdata RETURN: inkTimer* variables set DESTROYED: bx PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/20/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ StartTimeoutTimerAndWaitForStartSelect proc near uses ax, cx, dx class IMClass .enter EC < call AssertDSKdata > mov ds:[inkStatus], ICS_COLLECT_AND_DRAW_AFTER_START_SELECT mov al, TIMER_EVENT_ONE_SHOT mov bx, ds:[imThread] mov cx, ds:[penTimeout] mov dx, MSG_IM_INK_TIMEOUT call TimerStart mov ds:[inkTimerHan], bx mov ds:[inkTimerID], ax .leave ret StartTimeoutTimerAndWaitForStartSelect endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GetWidthAndHeightAdjustment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Gets the width and height to subtract from the current position to center the brush drawing on the pen. CALLED BY: GLOBAL PASS: ds - kdata RETURN: ah - width, al - height DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 6/21/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ GetWidthAndHeightAdjustment proc near .enter EC < call AssertDSKdata > mov ax, ds:[inkBrushSize] ; ah = width, al = height sub ax, 101h ; round down shr ah, 1 ; shr al, 1 ; .leave ret GetWidthAndHeightAdjustment endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CollectAndDrawUntilEndSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Collect points as they come in and draw them. CALLED BY: GLOBAL PASS: same as InputMonitor Routine if MSG_META_MOUSE_BUTTON or MSG_META_MOUSE_PTR cx,dx - ptr position bp - ButtonInfo if MSG_IM_READ_DIGITIZER_COORDS bp = ReadDigitizerCoordsFlags If RDCF_STROKE_DROPPED is clear: cx = number of coordinates to read (may be zero) RETURN: nada DESTROYED: bx, si PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/19/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CollectAndDrawUntilEndSelect proc near cmp di, MSG_META_MOUSE_BUTTON je noIgnore if INK_DIGITIZER_COORDS cmp di, MSG_IM_READ_DIGITIZER_COORDS je storeCoords endif cmp di, MSG_META_MOUSE_PTR jne exit noIgnore: push ax call GetWidthAndHeightAdjustment ;AH = width, al = height sub cl, ah sbb ch, 0 sub dl, al sbb dh, 0 pop ax call DrawInkLine EC < test ch, 0xc0 > EC < ERROR_PO COORDINATE_VALUE_OVERFLOW > andnf cx, 0x7fff ;Convert 16-bit signed x coord ; to 15 bit signed x coord cmp di, MSG_META_MOUSE_PTR je addPoint test bp, mask BI_B0_DOWN jnz addPoint ;Branch if was not end select ornf cx, 0x8000 inc ds:[inkNumStrokes] addPoint: call PointBufferAppend jc isError tst cx js wasEndSelect exit: ret wasEndSelect: ; This is an END_SELECT, so terminate the current segment, start a ; timeout timer, and move into "wait until the next start select and ; then continue collecting ink" mode. call CheckIfGesture jc sendClear call StartTimeoutTimerAndWaitForStartSelect jmp exit isError: call PointBufferTerminate mov ds:[inkStatus], ICS_SEND_INK_ON_END_SELECT tst cx ;We've run out of memory. Send the ink jns exit ; off at the next end select. ; All the ink was recognized as a gesture and therefore ; deleted... However, we still need to send a message to the ; flow object so that is will stop processing ink. sendClear: ornf al, mask MF_MORE_TO_DO mov ds:[inkStatus], ICS_SEND_CLEAR jmp exit if INK_DIGITIZER_COORDS storeCoords: ; Store the digitizer coords in the notification block clr al ; Indicate data consumed call DigitizerCoordsStore jc stopCollecting ; store failed so stop collecting and ; drawing ink ; Check if digitizer coords circular buffer is full test bp, mask RDCF_STROKE_TRUNCATED or mask RDCF_STROKE_DROPPED jz exit ; not full, so continue collecting stopCollecting: mov ds:[inkStatus], ICS_SEND_INK_ON_END_SELECT jmp exit endif ; INK_DIGITIZER_COORDS CollectAndDrawUntilEndSelect endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CheckIfGesture %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks to see if the current data is a gesture. CALLED BY: GLOBAL PASS: ds - kdata RETURN: carry set if gesture DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 1/18/93 Initial version lester 12/16/96 Fixed bug where PointBufferGetNumStrokes was being called with # points just deleted not the # points left after the delete. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CheckIfGesture proc near .enter tst_clc ds:[inkGestureCallback].high jz noCallback ;Exit with carry clear if no gesture ; callback. ; Move all of the points from the local buffer to the global buffer push ax, bx, cx, dx, bp, di, si, es clr di ;Force a bunch of stack to be free call ThreadBorrowStackSpace push di call AppendPointsToInkBlock cmc jnc popExit ;Exit no-gesture if couldn't copy ; points to buffer. clr ds:[inkHandle] call PointBufferGetCount call PointBufferDelete mov ds:[inkHandle], bx mov ax, offset IH_data pushdw esax ;These args are popped by the callback push es:[IH_count] ; routine mov ax, ds:[inkNumStrokes] cmp ax, 1 je 10$ tst ds:[haveCalledGestureCallback] jnz 10$ ornf ax, mask GCF_FIRST_CALL 10$: push ax movdw bxax, ds:[inkGestureCallback] call ProcCallFixedOrMovable mov ds:[haveCalledGestureCallback], TRUE tst_clc ax jnz deleteGestures ; delete found gestures unlock: mov bx, ds:[inkHandle] call MemUnlock popExit: ; ; we've likely just unlocked the ES block above, and we'll be pop'ing ; ES from the stack anyway so let's defeat the damn EC segment ; checking ; EC < mov di, NULL_SEGMENT > EC < mov es, di > pop di call ThreadReturnStackSpace pop ax, bx, cx, dx, bp, di, si, es noCallback: .leave ret deleteGestures: ; ax = # points recognized as a gesture by the gesture callback cmp ax, es:[IH_count] jne cont push ax, dx, es call EraseInk pop ax, dx, es cont: if INK_DIGITIZER_COORDS if ERROR_CHECK ; This code expects that the points recognized as a gesture ; by the gesture callback will always be a full stroke or ; multiple full strokes. push di mov di, ax Assert ne di, 0 dec di CheckHack <size Point eq 4> shl di shl di test es:[di].IH_data.P_x, mask IXC_TERMINATE_STROKE WARNING_Z WARNING_INK_GESTURE_NOT_FULL_STROKE pop di endif ; ERROR_CHECK ; ; Delete the digitizer coords that correspond to the ; screen coords recognized as a gesture. ; ; Note that there is not a one-to-one correspondence between the ; screen points and the digitizer coords so we need to delete the ; digitizer coords based on the number of strokes recognized as a ; gesture. ; mov cx, ax call PointBufferGetNumStrokes ; dx <- # strokes recognized as gesture call DigitizerCoordsDeleteStrokes endif ; INK_DIGITIZER_COORDS mov cx, ax call PointBufferDelete ; delete all the points ; recognized as a gesture mov cx, es:[IH_count] ; cx <- # points left after delete call PointBufferGetNumStrokes mov ds:[inkNumStrokes], dx tst_clc dx jnz unlock ;It was not all gestures stc jmp popExit ;It was all gestures so inkHandle is null CheckIfGesture endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PointBufferGetNumStrokes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Goes through the list of points in the global buffer and returns the number of strokes CALLED BY: CheckIfGesture PASS: cx - num of points ds idata RETURN: dx - num of strokes DESTROYED: bx SIDE EFFECTS: PSEUDO CODE/STRATEGY: for all points in the global buffer if x coord has high bit set (indicates end of stroke) increment count of strokes return count of strokes REVISION HISTORY: Name Date Description ---- ---- ----------- IP 5/11/94 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PointBufferGetNumStrokes proc near uses di, ax, cx, es .enter clr dx mov bx, ds:[inkHandle]; tst bx jz exit call MemLock jc exit mov es, ax mov di, offset IH_data sub di, size Point jcxz done loopPoints: add di, size Point test es:[di], mask IXC_TERMINATE_STROKE loopz loopPoints inc dx jcxz done jmp loopPoints done: call MemUnlock exit: .leave ret PointBufferGetNumStrokes endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CheckIfPointInVisibleRegion %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Checks if the passed point is in the visible region of the window associated with the passed gstate. CALLED BY: GLOBAL PASS: ds - kdata cx, dx - point to test RETURN: carry set if point is in the region. DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 2/21/92 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CheckIfPointInVisibleRegion proc near uses ax, bx, ds, si .enter mov bx, ds:[lockedInkWin] call MemDerefDS mov si, ds:[W_visReg] mov si, ds:[si] ;DS:SI <- visible region call GrTestPointInReg .leave ret CheckIfPointInVisibleRegion endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CollectAndDrawAfterStartSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine waits for a START_SELECT to come in. If one does, it kills the timeout timer, stores the point, draws it, and goes to the COLLECT_AND_DRAW_UNTIL_END_SELECT. CALLED BY: GLOBAL PASS: same as InputMonitor Routine if MSG_META_MOUSE_BUTTON or MSG_META_MOUSE_PTR cx,dx - ptr position bp - ButtonInfo RETURN: nada DESTROYED: ax, bx, si PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/20/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CollectAndDrawAfterStartSelect proc near if INK_DIGITIZER_COORDS EC < cmp di, MSG_IM_READ_DIGITIZER_COORDS > EC < ERROR_E INK_RECEIVED_UNEXPECTED_MSG_IM_READ_DIGITIZER_COORDS > endif cmp di, MSG_META_MOUSE_BUTTON jne exit test bp, mask BI_B0_DOWN ;If the button isn't down, branch jz exit ; The user just continued drawing ink before the timeout period. ; Stop the timeout timer. clr bx xchg bx, ds:[inkTimerHan] clr ax xchg ax, ds:[inkTimerID] call TimerStop ; If we are drawing through an app-supplied gstate, then any clicks ; outside of the associated window should terminate the ink. mov di, ds:[lockedInkGState] cmp di, ds:[inkDefaultGState] je continue call CheckIfPointInVisibleRegion jnc pointOutsideRegion continue: ; Save the point and draw it. mov ds:[inkStatus], ICS_SEND_INK_ON_END_SELECT call GetWidthAndHeightAdjustment sub cl, ah sbb ch, 0 sub dl, al sbb dh, 0 andnf cx, 0x7fff ;Turn into a 15-bit signed ; value call PointBufferAppend ; jc exit ; mov ds:[inkStatus], ICS_COLLECT_AND_DRAW_UNTIL_END_SELECT mov ds:[inkCurPoint].P_x, cx ;Draw a point at this coord. mov ds:[inkCurPoint].P_y, dx call DrawInkLine ; exit: ret pointOutsideRegion: if INK_DIGITIZER_COORDS ; ; Send off the ink digitizer coordinates notification and then ; switch to the ICS_SEND_INK_AND_THEN_SEND_CACHED_START_SELECT ; state to send off the ink screen points notification and then ; send the cached start select. ; call SendInkCoords Assert bitSet al, MF_MORE_TO_DO mov ds:[inkStatus], ICS_SEND_INK_AND_THEN_SEND_CACHED_START_SELECT else call SendInk ornf al, mask MF_MORE_TO_DO mov ds:[inkStatus], ICS_SEND_CACHED_START_SELECT endif ; INK_DIGITIZER_COORDS jmp exit CollectAndDrawAfterStartSelect endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EatEventsUntilEndSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine eats all events until the next "end select". CALLED BY: GLOBAL PASS: ds - kdata if MSG_IM_READ_DIGITIZER_COORDS bp = ReadDigitizerCoordsFlags If RDCF_STROKE_DROPPED is clear: cx = number of coordinates to read (may be zero) RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/27/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ EatEventsUntilEndSelect proc near cmp di, MSG_META_MOUSE_PTR ;Eat all ptr events je eat cmp di, MSG_META_MOUSE_DRAG ;Eat all drag events je eat if INK_DIGITIZER_COORDS cmp di, MSG_IM_READ_DIGITIZER_COORDS je eatCoords endif cmp di, MSG_META_MOUSE_BUTTON ;Eat all button events until jne exit ; button 0 goes up test bp, mask BI_B0_DOWN jnz eat mov ds:[inkStatus], ICS_SKIP_UNTIL_START_SELECT eat: clr al ; Indicate data consumed exit: ret if INK_DIGITIZER_COORDS eatCoords: ; Eat the digitizer coords since we're not currently collecting ink. call DigitizerCoordsEat jmp eat endif ; INK_DIGITIZER_COORDS EatEventsUntilEndSelect endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SendInkOnEndSelect %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine waits until an end select happens, then sends the ink off. CALLED BY: GLOBAL PASS: ds - kdata RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/27/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ SendInkOnEndSelect proc near if INK_DIGITIZER_COORDS cmp di, MSG_IM_READ_DIGITIZER_COORDS je storeCoords endif cmp di, MSG_META_MOUSE_BUTTON jne exit test bp, mask BI_B0_DOWN ;Wait until button 0 goes back up jne exit ; (an END_SELECT). ornf al, mask MF_MORE_TO_DO if INK_DIGITIZER_COORDS mov ds:[inkStatus], ICS_SEND_INK_COORDS else mov ds:[inkStatus], ICS_JUST_SEND_INK endif exit: ret if INK_DIGITIZER_COORDS storeCoords: ; We're in this state because either the screen points block is full ; or the digitizer coords block is full. It would be nice to only ; store the digitizer coordinates that correspond to screen points ; that we have collected but we don't know what digitizer correspond ; to what screen points, so we'll just store all the digitizer ; coordinates we can and ignore any error. call DigitizerCoordsStore ; ignore any error clr al ; Indicate data consumed jmp exit endif ; INK_DIGITIZER_COORDS SendInkOnEndSelect endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PointBufferInit %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Initializes the point buffer so it is ready to get data. CALLED BY: GLOBAL PASS: ds - kdata RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PointBufferInit proc near uses ax, es .enter EC < call AssertDSKdata > mov es, ds:[inkData] clr es:[CBS_count] clr ds:[inkNumStrokes] EC < mov es:[CBS_start], -1 > EC < mov es:[CBS_last], -1 > .leave ret PointBufferInit endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PointBufferAppend %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Appends a point to the point buffer. CALLED BY: GLOBAL PASS: cx, dx - point to append ds - idata RETURN: carry set if points could not fit DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PointBufferAppend proc near uses ax, di, es .enter EC < call AssertDSKdata > ; Check if too many points, or no points yet mov es, ds:[inkData] cmp es:[CBS_count], MAX_INK_POINTS je bufferFull EC < ERROR_A TOO_MANY_INK_POINTS > tst es:[CBS_count] jz noPoints ; Point to the next place to blast points. mov di, es:[CBS_last] add di, size Point cmp di, INK_DATA_BUFFER_SIZE je doWrap EC < ERROR_A INK_DATA_EXCEEDED_BOUNDS_OF_BUFFER > doStoreAndInc: mov es:[CBS_last], di inc es:[CBS_count] mov es:[di].P_x, cx mov es:[di].P_y, dx clc exit: .leave ret doWrap: mov di, offset CBS_data jmp doStoreAndInc bufferFull: ; Our local buffer is full, so append the points to the global block push es push cx, dx, bp call AppendPointsToInkBlock pop cx, dx, bp jc popESExit ;If we couldn't alloc the global ; block, branch to exit cmp es:[IH_count], TOTAL_MAX_INK_POINTS pop es call MemUnlock ;Unlock the block mov es:[CBS_count], 0 jae tooManyPoints ;If we already have a huge # of ; pts in the buffer, branch to stop ; storing any. noPoints: mov di, offset CBS_data mov es:[CBS_start], di jmp doStoreAndInc tooManyPoints: stc jmp exit popESExit: pop es jmp exit PointBufferAppend endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PointBufferGetCount %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine returns the # points in the point buffer (the circular buffer) CALLED BY: GLOBAL PASS: ds - idata RETURN: cx - # points DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PointBufferGetCount proc near uses es .enter EC < call AssertDSKdata > mov es, ds:[inkData] mov cx, es:[CBS_count] .leave ret PointBufferGetCount endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PointBufferDelete %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine deletes the first cx points from the point buffer if inkHandle is not 0 then from inkHandle buffer, otherwise from the inkdata buffer and then any leftovers from the inkHandle buffer. Shifting the remaining points to the beginning of the buffer CALLED BY: GLOBAL PASS: cx - # points to delete ds - idata RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PointBufferDelete proc near uses es, bx, cx .enter EC < call AssertDSKdata > tst cx LONG jz exit tst ds:[inkHandle] jz noGlobalBuffer mov bx, ds:[inkHandle] call MemLock mov es, ax cmp cx, es:[IH_count] jae freeBlock sub es:[IH_count], cx ; ; Move the points from the end of the point buffer to the current point. ; push ds, si, di, cx segmov ds, es mov si, cx shl si, 1 shl si, 1 mov di, offset IH_data ;ES:DI <- ptr to place for first point add si, di ;DS:SI <- ptr to new first point (after ; delete) mov cx, es:[IH_count] shl cx, 1 ;CX <- size of points (in words) EC < call ECCheckBounds > rep movsw EC < dec si > EC < call ECCheckBounds > pop ds, si, di, cx call MemUnlock jmp exit freeBlock: sub cx, es:[IH_count] ;CX <- # points left to ; delete clr ds:[inkHandle] call MemFree jcxz exit noGlobalBuffer: mov es, ds:[inkData] cmp cx, es:[CBS_count] je justClearCount EC < ERROR_A CANNOT_DELETE_MORE_POINTS_THAN_EXIST > push cx shl cx, 1 ;CX <- size of a Point shl cx, 1 add es:[CBS_start], cx cmp es:[CBS_start], INK_DATA_BUFFER_SIZE jb 10$ sub es:[CBS_start], (INK_DATA_BUFFER_SIZE - size CircularBufferStruct) 10$: pop cx justClearCount: sub es:[CBS_count], cx exit: .leave ret PointBufferDelete endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PointBufferEnum %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine calls the passed callback routine with each point in the buffer. CALLED BY: GLOBAL PASS: ds - idata cx:dx - vfptr to routine to call AX, BX, BP,ES - data for routine Callback routine gets passed: CX, DX - Point values AX,BX,BP,ES - data passed in to PointBufferEnum (possibly modified by previous callback routines) Callback routine returns: AX,BX,BP - modified if desired carry set if we want to stop the enumeration Can destroy: cx, dx RETURN: AX, BX, BP, ES - data returned. carry set if enumeration was aborted DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/21/91 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PointBufferEnum proc near uses ds, di, si .enter EC < call AssertDSKdata > pushdw cxdx mov si, sp tst ds:[inkHandle] jz afterOverflow ; ; Some of the collected points have been moved to a global block. ; Process them first. ; push ds push bx, ax mov bx, ds:[inkHandle] call MemLock mov ds, ax pop bx, ax push ds:[IH_count] mov di, offset IH_data ;Carry should always be clear from MemLock above EC < ERROR_C -1 > nextPoint: dec ds:[IH_count] js unlock mov cx, ds:[di].P_x mov dx, ds:[di].P_y add di, size Point ; We need to call the callback with ProcCallFixedOrMovable, ; since we can be XIP'ed. ; -- todd mov ss:[TPD_dataAX], ax mov ss:[TPD_dataBX], bx movdw bxax, ss:[si] call ProcCallFixedOrMovable jnc nextPoint unlock: pop ds:[IH_count] pop ds push bx mov bx, ds:[inkHandle] call MemUnlock pop bx jc exit afterOverflow: mov ds, ds:[inkData] tst ds:[CBS_count] je exit ; Set up a call vector on the stack mov di, ds:[CBS_start] loopTop: ; ; Loop variables: ; ES:DI - ptr to next point to pass to callback routine ; ES:0 - CircularBufferStruct ; SS:SI - ptr to callback routine ; mov cx, ds:[di].P_x mov dx, ds:[di].P_y ; We need to call the callback with ProcCallFixedOrMovable, ; since we can be XIP'ed. ; -- todd mov ss:[TPD_dataAX], ax mov ss:[TPD_dataBX], bx movdw bxax, ss:[si] call ProcCallFixedOrMovable jc exit cmp di, ds:[CBS_last] je exit ;This clears the carry add di, size Point cmp di, INK_DATA_BUFFER_SIZE EC < ERROR_A INK_ENUM_EXCEEDED_END_OF_BUFFER > jne loopTop mov di, offset CBS_data jmp loopTop exit: popdw cxdx .leave ret PointBufferEnum endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PointBufferTerminate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine terminates the most-recently-appended point. This is only called if there was an error. If so, we terminate the ink data that has been stored in the global block. CALLED BY: GLOBAL PASS: ds - kdata RETURN: nada DESTROYED: nada PSEUDO CODE/STRATEGY: KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- atw 11/27/91 Initial version lester 12/15/96 Fixed to terminate the last point in the global block not the point after the last one. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PointBufferTerminate proc near uses es, di, bx .enter ; Change this to terminate the ink buffer. mov bx, ds:[inkHandle] tst bx jz noGlobalBlock push ax call MemLock mov es, ax mov di, es:[IH_count] Assert ne di, 0 dec di shl di, 1 shl di, 1 ornf es:[di].IH_data.P_x, 0x8000 call MemUnlock pop ax exit: .leave ret noGlobalBlock: mov es, ds:[inkData] tst es:[CBS_count] jz exit mov di, es:[CBS_last] ornf es:[di].P_x, 0x8000 jmp exit PointBufferTerminate endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PointBufferModify %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Modify the points in the buffer CALLED BY: INTERNAL InkReplyHandler PASS: ds - idata RETURN: nothing DESTROYED: nothing PSEUDO CODE/STRATEGY: This routine centers each of the data points around the digitized point, by subtracting half of the Brush size from each point, in both X and Y. KNOWN BUGS/SIDE EFFECTS/IDEAS: REVISION HISTORY: Name Date Description ---- ---- ----------- jim 6/10/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ PointBufferModify proc near uses ax, bx, cx, dx, di, ds .enter EC < call AssertDSKdata > ; Some of the collected points have been moved to a global ; block. Process them first. call GetWidthAndHeightAdjustment tst ax ; if nothing to do, exit LONG jz exit mov dl, ah ; setup ax and dx as mod clr ah, dh ; values. xchg dx, ax ; ax = width, dx = height tst ds:[inkHandle] ; see if there is an extra jz afterOverflow ; data block ; lock the block and modify those values first. push ds push bx, ax mov bx, ds:[inkHandle] call MemLock mov ds, ax pop bx, ax mov cx, ds:[IH_count] jcxz unlock mov di, offset IH_data ; ds:di -> Points nextPoint: call modifyPoint add di, size Point jc unlock ; shouldn't wrap around loop nextPoint ; done modifying the block, unlock it. unlock: pop ds ; restore ds -> kdata push bx ; release the block mov bx, ds:[inkHandle] call MemUnlock pop bx jc exit ; bail on strange errors ; done with block, so do the circular buffer. afterOverflow: mov ds, ds:[inkData] ; ds -> circular buffer tst ds:[CBS_count] ; if no points there, done jz exit mov di, ds:[CBS_start] ; start at beginning :-) loopTop: call modifyPoint cmp di, ds:[CBS_last] ; if done, bail. je exit add di, size Point cmp di, INK_DATA_BUFFER_SIZE ; if last, wrap around jne loopTop mov di, offset CBS_data jmp loopTop exit: .leave ret modifyPoint: ; ; DS:DI - ptr to Point structure ; AX - value to modify X coord ; (high bit is end-of-stroke flag) ; DX - value to modify Y coord ; sub ds:[di].P_y, dx ; Convert the 15-bit signed value in AX (the high bit is set if the ; point ends a stroke) to a 16-bit signed value, perform the ; modification, and restore the end-of-stroke flag. shl ds:[di].P_x ;CARRY <- end of stro pushf sar ds:[di].P_x ;Sign extend X coord sub ds:[di].P_x, ax EC < test ds:[di].P_x.high, 0xc0 > EC < ERROR_PO COORDINATE_VALUE_OVERFLOW > ; Set the high bit (end of stroke flag) appropriately shl ds:[di].P_x ; popf rcr ds:[di].P_x retn PointBufferModify endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ImSetMouseBuffer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Tell the mouse driver to start storing digitizer coordinates in the digitizer coords circular buffer if it exists. CALLED BY: GLOBAL PASS: nothing RETURN: carry set if mouse driver does not support storing digitizer coordinates DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 11/25/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ ImSetMouseBuffer proc far if INK_DIGITIZER_COORDS uses cx,di,ds .enter ; ; Tell the mouse driver to start storing digitizer coordinates ; in the circular buffer. ; LoadVarSeg ds, cx mov cx, ds:[inkCoordsBuffer] ; cx - buffer segment tst_clc cx jz exit ; no buffer, exit w/carry clear mov di, DR_MOUSE_ESC_SET_MOUSE_COORD_BUFFER call CallMouseStrategy EC < WARNING_C WARNING_MOUSE_DR_DOES_NOT_SUPPORT_SET_BUFFER > jc error exit: .leave ret error: ; ; Error, free the buffer ; push bx clr bx mov ds:[inkCoordsBuffer], bx xchg bx, ds:[inkCoordsBufferHan] ; bx - buffer handle call MemFree pop bx jmp exit else ; Ink digitizer coords not supported stc ret endif ; INK_DIGITIZER_COORDS ImSetMouseBuffer endp if INK_DIGITIZER_COORDS COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% AllocateDigitizerCoordsBuffer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: If the appropriate ini entry is true, allocate a circular buffer which we'll share with the mouse driver to store digitizer coordinates. CALLED BY: (INTERNAL) ImStartPenMode PASS: ds - kdata RETURN: carry set if couldn't allocate buffer DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: It would be nice to call the mouse driver with MOUSE_ESC_SET_BUFFER in this routine but the mouse driver is not loaded at this point in time. So, we provide a global routine, ImSetMouseBuffer, that the UI can call after it loads the mouse driver. REVISION HISTORY: Name Date Description ---- ---- ----------- lester 11/24/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ inkCoordsCategory char "system",0 inkCoordsKey char "inkDigitizerCoords",0 AllocateDigitizerCoordsBuffer proc near uses ax,bx,cx,dx,si .enter ; ; Check if ini flag is set ; push ds segmov ds, cs, cx ; ds, cx <= cs mov si, offset inkCoordsCategory mov dx, offset inkCoordsKey clr ax call InitFileReadBoolean pop ds tst_clc ax jnz allocateBuffer exit: .leave ret allocateBuffer: ; ; Allocate fixed circular buffer ; EC < call AssertDSKdata > mov bx, handle 0 mov cx, mask HF_FIXED mov ax, size MouseCoordsCircularBufferStruct call MemAllocSetOwnerFar jc exit EC < tst_clc ds:[inkCoordsBuffer] > EC < ERROR_NZ IM_SETUP_DIGITIZER_COORDS_BUFFER_WAS_CALLED_TWICE> mov ds:[inkCoordsBuffer], ax mov ds:[inkCoordsBufferHan], bx Assert carryClear jmp exit AllocateDigitizerCoordsBuffer endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% RemoveDigitizerCoordsBuffer %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Tell the mouse driver to stop collecting digitizer coordinates and then free the circular buffer. CALLED BY: (INTERNAL) ImExitPenMode PASS: ds - kdata RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 11/24/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ RemoveDigitizerCoordsBuffer proc near uses bx,di .enter EC < call AssertDSKdata > ; ; Tell the mouse driver to stop using the buffer ; mov di, DR_MOUSE_ESC_REMOVE_MOUSE_COORD_BUFFER call CallMouseStrategy EC < ERROR_C ERROR_REMOVING_DIGITIZER_COORDS_BUFFER > ; ; Now, free the buffer ; clr bx mov ds:[inkCoordsBuffer], bx xchg bx, ds:[inkCoordsBufferHan] ; bx - buffer handle call MemFree .leave ret RemoveDigitizerCoordsBuffer endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CallMouseStrategy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Call the mouse driver strategy CALLED BY: (INTERNAL) AllocateDigitizerCoordsBuffer, RemoveDigitizerCoordsBuffer PASS: di - MouseFunction to call others - arguments to pass MouseFunction RETURN: carry set if no mouse driver loaded whatever MouseFunction returns DESTROYED: whatever MouseFunction destroys SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 12/ 3/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ CallMouseStrategy proc near uses ds, si .enter ; ; save the args to the strategy call ; push ax, bx ; ; get the mouse handle ; mov ax, GDDT_MOUSE call GeodeGetDefaultDriver ; ; bail if there's none ; tst ax jz noMouseDriver ; ; get the strategy and call it ; mov_tr bx, ax call GeodeInfoDriver pop ax, bx call ds:[si].DIS_strategy exit: .leave ret noMouseDriver: pop ax, bx stc jmp exit CallMouseStrategy endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DigitizerCoordsEat %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Update the circular buffer to indicate that we've read the coordinates but don't store them in the notification block. CALLED BY: (INTERNAL) SkipUntilStartSelect PASS: bp - ReadDigitizerCoordsFlags If RDCF_STROKE_DROPPED is clear: cx = number of coordinates to read (may be zero) ds - kdata ds:[inkCoordsBuffer] - segment of fixed circular buffer RETURN: nothing DESTROYED: nothing SIDE EFFECTS: The MCCBS_nextRead field of the digitizer coordinates circular buffer is updated to indicate the coordinates have been read. PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 11/26/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DigitizerCoordsEat proc near uses cx,es .enter EC < call AssertDSKdata > test bp, mask RDCF_STROKE_DROPPED jnz exit ; ; Calculate the new MCCBS_lastRead offset ; Assert ne ds:[inkCoordsBuffer], 0 Assert segment ds:[inkCoordsBuffer] mov es, ds:[inkCoordsBuffer] ; es - segemnt of circular buffer Assert be cx, MAX_MOUSE_COORDS ; sanity check CheckHack <MAX_MOUSE_COORDS lt 0xc000> ; ok to shift left twice CheckHack <size InkPoint eq 4> ; cx - # coords to read if ERROR_CHECK ; Replace the eaten coords with 0x1111 for your debugging pleasure ; cx - # coords to eat push bx, cx mov bx, es:[MCCBS_nextRead] loopTop: mov es:[bx].IP_x, 0x1111 ; eat X coord mov es:[bx].IP_y, 0x1111 ; eat Y coord add bx, size InkPoint cmp bx, offset MCCBS_data + size MCCBS_data jb noWrap EC < ERROR_A ASSERTION_FAILED > mov bx, offset MCCBS_data ; wrap to front of circular buffer noWrap: loop loopTop ; still hungry? pop bx, cx endif ; ERROR_CHECK shl cx, 1 shl cx, 1 ; cx - # bytes to read add cx, es:[MCCBS_nextRead] ; cx - new next read offset ; wrap around end of circular buffer if necessary cmp cx, offset MCCBS_data + size MCCBS_data jb storeOffset sub cx, size MCCBS_data ; wrap to the buffer front storeOffset: ; store the new MCCBS_lastRead offset mov es:[MCCBS_nextRead], cx exit: .leave ret DigitizerCoordsEat endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DigitizerCoordsStore %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Reads the digitizer coordinates from the circular buffer and appends them to the notification block. Terminates the last digitizer coordinates if the block is full or if the ReadDigitizerCoordsFlags indicate the circular buffer has filled up. CALLED BY: (INTERNAL) CollectUntilEndSelect, CollectAndDrawUntilEndSelect, SendInkOnEndSelect PASS: bp - ReadDigitizerCoordsFlags If RDCF_STROKE_DROPPED is clear: cx = number of coordinates to read (may be zero) ds - kdata ds:[inkCoordsBuffer] - segment of fixed circular buffer ds:[inkCoordsBlockHan] - handle of notification block or 0 RETURN: carry set if error if allocation failure, bx=0 if coords could not fit, bx=handle of notification block -else- bx = handle of notification block DESTROYED: nothing SIDE EFFECTS: If there is no notification block, one is created and the handle is stored in ds:[inkCoordsBlockHan]. Otherwise, the notification block is expanded to hold the new coordinates. If the coords could not fit in the notification block, they are eaten. The MCCBS_nextRead field of the digitizer coordinates circular buffer is update to indicate the coordinates have been read. PSEUDO CODE/STRATEGY: KNOWN BUGS: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 11/26/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DigitizerCoordsStore proc near uses ax,cx,si,di,ds,es .enter test bp, mask RDCF_STROKE_DROPPED LONG jnz exit EC < call AssertDSKdata > ; sanity check on the number of coords Assert be cx, MAX_MOUSE_COORDS ; Check if we have a notification block mov bx, ds:[inkCoordsBlockHan] tst bx LONG jz allocateNewBlock ; bx - handle of notification block ; Lock the notification block call MemLock mov es, ax ; es - segemnt of notification block ; ; Check if the block is already full ; mov ax, es:[IDCH_count] ; ax - old count cmp ax, TOTAL_MAX_INK_COORDS; already full? LONG jae blockFull add ax, cx ; ax - new count ; ; Expand the block to hold the new coords ; ; ax - # coords block should hold ; bx - handle of notification block push cx, ax CheckHack <size InkPoint eq 4> shl ax, 1 shl ax, 1 ; ax - # bytes for coords add ax, size InkDigitizerCoordsHeader ; ax - new size of block clr ch call MemReAlloc mov_tr es, ax ; es - segment of notification block pop cx, ax ; cx - # coords to read, ax - total # of coords jc reallocFailed ; ; Copy the coordinates into the notification block ; copyCoords: ; es - segment of notification block ; ds - kdata ; cx - # coords to copy ; ax - # coords block will hold after copy ; Get segment of circular buffer Assert ne ds:[inkCoordsBuffer], 0 Assert segment ds:[inkCoordsBuffer] mov ds, ds:[inkCoordsBuffer] ; ds - segemnt of circular buffer ; setup for copy mov si, ds:[MCCBS_nextRead] ; ds:si - ptr to source mov di, es:[IDCH_count] ; di - # coords in notification block shl di, 1 shl di, 1 ; di - # bytes of coords in block add di, offset IDCH_data ; es:di - ptr to dest ; save the new coord count mov_tr es:[IDCH_count], ax loopTop: ; cx - # coords to copy ; ds:si - ptr to source ; es:di - ptr to dest movsw ; copy X coord movsw ; copy Y coord ; Replace the read coords with a special value to indicate ; that they have been read for your debugging pleasure EC < mov ds:[si-4].IP_x, 0x4444 ; replace read X coord > EC < mov ds:[si-4].IP_y, 0x4444 ; replace read Y coord > cmp si, offset MCCBS_data + size MCCBS_data jb noWrap EC < ERROR_A ASSERTION_FAILED > mov si, offset MCCBS_data ; wrap to front of circular buffer noWrap: loop loopTop ; go back for more... afterLoop:: ; Update MCCBS_lastRead mov ds:[MCCBS_nextRead], si ; Unlock notification block call MemUnlock ; If circular buffer is full, terminate the last digitizer coords test bp, mask RDCF_STROKE_TRUNCATED or mask RDCF_STROKE_DROPPED jz circularBufferNotFull call DigitizerCoordsTerminate circularBufferNotFull: clc ; return success ; bx - handle of notification block exit: .leave ret reallocFailed: ; bx - handle of notification block clr ds:[inkCoordsBlockHan] call MemFree allocFailed: EC < WARNING WARNING_INK_DIGITIZER_COORDS_BLOCK_ALLOC_FAILED > clr bx ; indicate allocation failure stcExit: stc ; return failure jmp exit blockFull: ; bx - handle of notification block ; cx - # coords to read ; ds - kdata EC < WARNING WARNING_INK_DIGITIZER_COORDS_BLOCK_FULL > call MemUnlock ; unlock the notification block ; eat the coordinates since they would not fit call DigitizerCoordsEat call DigitizerCoordsTerminate jmp stcExit ; ; Allocate new notification block and initialize it ; allocateNewBlock: ; cx - number of coordinates to read push cx mov_tr ax, cx ; ax - # coords to allocate CheckHack <size InkPoint eq 4> shl ax, 1 shl ax, 1 ; ax - # bytes add ax, size InkDigitizerCoordsHeader ; ax - size of block mov bx, handle 0 mov cx, ALLOC_DYNAMIC_LOCK or mask HF_SHARABLE call MemAllocSetOwnerFar ; ax - segment, bx - handle pop cx jc allocFailed mov ds:[inkCoordsBlockHan], bx mov_tr es, ax ; es - segment of notification block clr es:[IDCH_count] ; initialize count mov ax, cx ; ax, cx - # coords jmp copyCoords DigitizerCoordsStore endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DigitizerCoordsReplaceDummyCoords %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Replaces the dummy digitizer coords that were just stored in the ink digitizer coords notification block with values based on the last X and Y screen positions. CALLED BY: (INTERNAL) DigitizerCoordsStore PASS: ds:si - ptr just after source coords es:di - ptr just after dest coords RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 12/ 8/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DigitizerCoordsTerminate %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Terminates the most-recently-stored digitizer coords. CALLED BY: (INTERNAL) DigitizerCoordsStore PASS: ds - kdata ds:[inkCoordsBlockHan] - handle of notification block or 0 RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 11/26/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DigitizerCoordsTerminate proc near uses bx .enter EC < call AssertDSKdata > ; Check if we have a notification block mov bx, ds:[inkCoordsBlockHan] tst bx jz exit ; ; Terminate the last InkPoint ; push ax, es, di call MemLock mov es, ax mov di, es:[IDCH_count] Assert ne di, 0 dec di shl di, 1 shl di, 1 ; di <- offset to last coords ornf es:[di].IDCH_data.IP_x, mask IXC_TERMINATE_STROKE call MemUnlock pop ax, es, di exit: .leave ret DigitizerCoordsTerminate endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DigitizerCoordsDelete %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete the first CX digitizer coordinates from the notification block and shift the remaining points to the beginning of the block. CALLED BY: (INTERNAL) InkReplyHandler, CheckIfGesture PASS: cx - # coords to delete ds - kdata ds:[inkCoordsBlockHan] - handle of notification block RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 11/26/96 Initial version (copied from PointBufferDelete) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DigitizerCoordsDelete proc near uses ax, bx, cx, es .enter EC < call AssertDSKdata > tst cx jz exit mov bx, ds:[inkCoordsBlockHan] tst bx jz exit call MemLock mov es, ax cmp cx, es:[IDCH_count] jae freeBlock sub es:[IDCH_count], cx ; ; Move the points from the end of the block to the front. ; push ds, si, di, cx segmov ds, es mov si, cx shl si, 1 shl si, 1 mov di, offset IDCH_data ;ES:DI <- ptr to place for first point add si, di ;DS:SI <- ptr to new first point (after ; delete) mov cx, es:[IDCH_count] shl cx, 1 ;CX <- size of points (in words) EC < call ECCheckBounds > rep movsw EC < dec si > EC < call ECCheckBounds > pop ds, si, di, cx call MemUnlock exit: .leave ret freeBlock: clr ds:[inkCoordsBlockHan] call MemFree jmp exit DigitizerCoordsDelete endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DigitizerCoordsEnum %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: This routine calls the passed callback routine with each digitizer coord in the notification block. CALLED BY: (INTERNAL) PASS: ds - idata cx:dx - vfptr to routine to call AX, BX, BP,ES - data for routine Callback routine gets passed: CX, DX - Point values AX,BX,BP,ES - data passed in to DigitizerCoordsEnum (possibly modified by previous callback routines) Callback routine returns: AX,BX,BP - modified if desired carry set if we want to stop the enumeration Can destroy: cx, dx RETURN: AX, BX, BP, ES - data returned. carry set if enumeration was aborted DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: Some code in the IMPenCode resource calls this routine with a fptr instead of a vfptr which is an optimization that is possible because the caller, callback, and this routine are all in the IMPenCode resource which is fixed. REVISION HISTORY: Name Date Description ---- ---- ----------- lester 12/15/96 Initial version (copied from PointBufferEnum) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DigitizerCoordsEnum proc near uses ds, di, si .enter EC < call AssertDSKdata > pushdw cxdx mov si, sp tst ds:[inkCoordsBlockHan] clc jz exit push ds push bx, ax mov bx, ds:[inkCoordsBlockHan] call MemLock mov ds, ax pop bx, ax push ds:[IDCH_count] mov di, offset IDCH_data ;Carry should always be clear from MemLock above EC < ERROR_C -1 > nextPoint: dec ds:[IDCH_count] js unlock mov cx, ds:[di].IP_x mov dx, ds:[di].IP_y add di, size InkPoint mov ss:[TPD_dataAX], ax mov ss:[TPD_dataBX], bx movdw bxax, ss:[si] call ProcCallFixedOrMovable jnc nextPoint unlock: pop ds:[IDCH_count] pop ds push bx mov bx, ds:[inkCoordsBlockHan] call MemUnlock pop bx exit: popdw cxdx .leave ret DigitizerCoordsEnum endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DigitizerCoordsDeleteStrokes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Delete the first DX strokes of digitizer coordinates from the notification block and shift the remaining points to the beginning of the block. CALLED BY: (INTERNAL) CheckIfGesture PASS: dx - # strokes to delete ds - kdata ds:[inkCoordsBlockHan] - handle of notification block RETURN: nothing DESTROYED: nothing SIDE EFFECTS: PSEUDO CODE/STRATEGY: REVISION HISTORY: Name Date Description ---- ---- ----------- lester 12/16/96 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DigitizerCoordsDeleteStrokes proc near uses ax,bx,cx,dx .enter tst dx jz exit mov bx, dx ; bx <- # strokes to delete loopTop: clr ax mov cx, cs mov dx, offset FindLengthOfSegmentCallback CheckHack <segment FindLengthOfSegmentCallback eq @CurSeg> CheckHack <segment FindLengthOfSegmentCallback eq IMPenCode> CheckHack <segment DigitizerCoordsEnum eq @CurSeg> call DigitizerCoordsEnum ; Returns AX = # items in first segment. mov_tr cx, ax ; cx <- # coords to delete call DigitizerCoordsDelete dec bx jnz loopTop exit: .leave ret DigitizerCoordsDeleteStrokes endp endif ; INK_DIGITIZER_COORDS IMPenCode ends endif ;NO_PEN_SUPPORT
extern/game_support/stm32f4/src/stm32f4.ads
AdaCore/training_material
15
19329
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Hardware Abstraction Layer for STM32 Targets -- -- -- -- Copyright (C) 2014, 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. -- -- -- -- As a special exception under Section 7 of GPL version 3, you are granted -- -- additional permissions described in the GCC Runtime Library Exception, -- -- version 3.1, as published by the Free Software Foundation. -- -- -- -- You should have received a copy of the GNU General Public License and -- -- a copy of the GCC Runtime Library Exception along with this program; -- -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- -- <http://www.gnu.org/licenses/>. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This file provides type definitions for the STM32F4 (ARM Cortex M4F) -- microcontrollers from ST Microelectronics. pragma Restrictions (No_Elaboration_Code); with Interfaces; package STM32F4 is type Word is new Interfaces.Unsigned_32; -- for shift/rotate type Half_Word is new Interfaces.Unsigned_16; -- for shift/rotate type Byte is new Interfaces.Unsigned_8; -- for shift/rotate type Bits_1 is mod 2**1 with Size => 1; type Bits_2 is mod 2**2 with Size => 2; type Bits_3 is mod 2**3 with Size => 3; type Bits_4 is mod 2**4 with Size => 4; type Bits_5 is mod 2**5 with Size => 5; type Bits_6 is mod 2**6 with Size => 6; type Bits_7 is mod 2**7 with Size => 7; type Bits_8 is mod 2**8 with Size => 8; type Bits_9 is mod 2**9 with Size => 9; type Bits_11 is mod 2**11 with Size => 11; type Bits_12 is mod 2**12 with Size => 12; type Bits_13 is mod 2**13 with Size => 13; type Bits_16 is mod 2**16 with Size => 16; type Bits_21 is mod 2**21 with Size => 21; type Bits_24 is mod 2**24 with Size => 24; type Bits_27 is mod 2**27 with Size => 27; type Bits_28 is mod 2**28 with Size => 28; type Bits_30 is mod 2**30 with Size => 30; type Bits_32x1 is array (0 .. 31) of Bits_1 with Pack, Size => 32; type Bits_16x2 is array (0 .. 15) of Bits_2 with Pack, Size => 32; type Bits_8x4 is array (0 .. 7) of Bits_4 with Pack, Size => 32; -- Define address bases for the various system components Peripheral_Base : constant := 16#4000_0000#; APB1_Peripheral_Base : constant := Peripheral_Base; APB2_Peripheral_Base : constant := Peripheral_Base + 16#0001_0000#; AHB1_Peripheral_Base : constant := Peripheral_Base + 16#0002_0000#; AHB2_Peripheral_Base : constant := Peripheral_Base + 16#1000_0000#; GPIOA_Base : constant := AHB1_Peripheral_Base + 16#0000#; GPIOB_Base : constant := AHB1_Peripheral_Base + 16#0400#; GPIOC_Base : constant := AHB1_Peripheral_Base + 16#0800#; GPIOD_Base : constant := AHB1_Peripheral_Base + 16#0C00#; GPIOE_Base : constant := AHB1_Peripheral_Base + 16#1000#; GPIOF_Base : constant := AHB1_Peripheral_Base + 16#1400#; GPIOG_Base : constant := AHB1_Peripheral_Base + 16#1800#; GPIOH_Base : constant := AHB1_Peripheral_Base + 16#1C00#; GPIOI_Base : constant := AHB1_Peripheral_Base + 16#2000#; GPIOJ_Base : constant := AHB1_Peripheral_Base + 16#2400#; GPIOK_Base : constant := AHB1_Peripheral_Base + 16#2800#; RCC_Base : constant := AHB1_Peripheral_Base + 16#3800#; FLASH_Base : constant := AHB1_Peripheral_Base + 16#3C00#; DMA1_Base : constant := AHB1_Peripheral_Base + 16#6000#; DMA2_Base : constant := AHB1_Peripheral_Base + 16#6400#; ETH_Base : constant := AHB1_Peripheral_Base + 16#8000#; ETH_MAC_Base : constant := ETH_Base; ETH_MMC_Base : constant := ETH_Base + 16#0100#; ETH_PTP_Base : constant := ETH_Base + 16#0700#; ETH_DMA_Base : constant := ETH_Base + 16#1000#; DMA2D_BASE : constant := AHB1_Peripheral_Base + 16#B000#; TIM2_Base : constant := APB1_Peripheral_Base + 16#0000#; TIM3_Base : constant := APB1_Peripheral_Base + 16#0400#; TIM4_Base : constant := APB1_Peripheral_Base + 16#0800#; TIM5_Base : constant := APB1_Peripheral_Base + 16#0C00#; TIM6_Base : constant := APB1_Peripheral_Base + 16#1000#; TIM7_Base : constant := APB1_Peripheral_Base + 16#1400#; TIM12_Base : constant := APB1_Peripheral_Base + 16#1800#; TIM13_Base : constant := APB1_Peripheral_Base + 16#1C00#; TIM14_Base : constant := APB1_Peripheral_Base + 16#2000#; RTC_Base : constant := APB1_Peripheral_Base + 16#2800#; WWDG_Base : constant := APB1_Peripheral_Base + 16#2C00#; IWDG_Base : constant := APB1_Peripheral_Base + 16#3000#; I2S2ext_Base : constant := APB1_Peripheral_Base + 16#3400#; SPI2_Base : constant := APB1_Peripheral_Base + 16#3800#; SPI3_Base : constant := APB1_Peripheral_Base + 16#3C00#; I2S3ext_Base : constant := APB1_Peripheral_Base + 16#4000#; USART2_Base : constant := APB1_Peripheral_Base + 16#4400#; USART3_Base : constant := APB1_Peripheral_Base + 16#4800#; UART4_Base : constant := APB1_Peripheral_Base + 16#4C00#; UART5_Base : constant := APB1_Peripheral_Base + 16#5000#; I2C1_Base : constant := APB1_Peripheral_Base + 16#5400#; I2C2_Base : constant := APB1_Peripheral_Base + 16#5800#; I2C3_Base : constant := APB1_Peripheral_Base + 16#5C00#; CAN1_Base : constant := APB1_Peripheral_Base + 16#6400#; CAN2_Base : constant := APB1_Peripheral_Base + 16#6800#; PWR_Base : constant := APB1_Peripheral_Base + 16#7000#; DAC_Base : constant := APB1_Peripheral_Base + 16#7400#; UART7_BASE : constant := APB1_Peripheral_Base + 16#7800#; UART8_BASE : constant := APB1_Peripheral_Base + 16#7C00#; TIM1_Base : constant := APB2_Peripheral_Base + 16#0000#; TIM8_Base : constant := APB2_Peripheral_Base + 16#0400#; USART1_Base : constant := APB2_Peripheral_Base + 16#1000#; USART6_Base : constant := APB2_Peripheral_Base + 16#1400#; ADC1_Base : constant := APB2_Peripheral_Base + 16#2000#; ADC2_Base : constant := APB2_Peripheral_Base + 16#2100#; ADC3_Base : constant := APB2_Peripheral_Base + 16#2200#; ADC_Base : constant := APB2_Peripheral_Base + 16#2300#; SDIO_Base : constant := APB2_Peripheral_Base + 16#2C00#; SPI1_Base : constant := APB2_Peripheral_Base + 16#3000#; SPI4_BASE : constant := APB2_Peripheral_Base + 16#3400#; SYSCFG_Base : constant := APB2_Peripheral_Base + 16#3800#; EXTI_Base : constant := APB2_Peripheral_Base + 16#3C00#; TIM9_Base : constant := APB2_Peripheral_Base + 16#4000#; TIM10_Base : constant := APB2_Peripheral_Base + 16#4400#; TIM11_Base : constant := APB2_Peripheral_Base + 16#4800#; SPI5_BASE : constant := APB2_Peripheral_Base + 16#5000#; SPI6_BASE : constant := APB2_Peripheral_Base + 16#5400#; SAI1_BASE : constant := APB2_Peripheral_Base + 16#5800#; LTDC_BASE : constant := APB2_Peripheral_Base + 16#6800#; end STM32F4;
Experiment/Outrageous/#02.agda
rei1024/agda-misc
3
13852
{-# OPTIONS --without-K --safe #-} -- https://personal.cis.strath.ac.uk/conor.mcbride/pub/DepRep/DepRep.pdf module Experiment.Outrageous.#02 where data Zero : Set where magic : Zero → (X : Set) → X magic () record 𝟏 : Set where constructor void data 𝟐 : Set where tt : 𝟐 ff : 𝟐 If : 𝟐 → Set → Set → Set If tt T F = T If ff T F = F if : (b : 𝟐) → (P : 𝟐 → Set) → P tt → P ff → P b if tt P t f = t if ff P t f = f data ℕ : Set where ze : ℕ su : ℕ → ℕ rec : (n : ℕ) → (P : ℕ → Set) → P ze → ((n : ℕ) → P n → P (su n)) → P n rec ze P z s = z rec (su n) P z s = s n (rec n P z s) record Σ (S : Set) (T : S → Set) : Set where constructor _,_ field fst : S snd : T fst
kill.asm
sparsh99/xv6
0
88450
<filename>kill.asm _kill: file format elf32-i386 Disassembly of section .text: 00000000 <main>: #include "stat.h" #include "user.h" int main(int argc, char **argv) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 53 push %ebx e: 51 push %ecx f: 83 ec 10 sub $0x10,%esp 12: 89 cb mov %ecx,%ebx int i; if(argc < 2){ 14: 83 3b 01 cmpl $0x1,(%ebx) 17: 7f 17 jg 30 <main+0x30> printf(2, "usage: kill pid...\n"); 19: 83 ec 08 sub $0x8,%esp 1c: 68 90 09 00 00 push $0x990 21: 6a 02 push $0x2 23: e8 b2 05 00 00 call 5da <printf> 28: 83 c4 10 add $0x10,%esp exit(); 2b: e8 33 04 00 00 call 463 <exit> } for(i=1; i<argc; i++) 30: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) 37: eb 2d jmp 66 <main+0x66> kill(atoi(argv[i])); 39: 8b 45 f4 mov -0xc(%ebp),%eax 3c: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 43: 8b 43 04 mov 0x4(%ebx),%eax 46: 01 d0 add %edx,%eax 48: 8b 00 mov (%eax),%eax 4a: 83 ec 0c sub $0xc,%esp 4d: 50 push %eax 4e: e8 e4 01 00 00 call 237 <atoi> 53: 83 c4 10 add $0x10,%esp 56: 83 ec 0c sub $0xc,%esp 59: 50 push %eax 5a: e8 34 04 00 00 call 493 <kill> 5f: 83 c4 10 add $0x10,%esp if(argc < 2){ printf(2, "usage: kill pid...\n"); exit(); } for(i=1; i<argc; i++) 62: 83 45 f4 01 addl $0x1,-0xc(%ebp) 66: 8b 45 f4 mov -0xc(%ebp),%eax 69: 3b 03 cmp (%ebx),%eax 6b: 7c cc jl 39 <main+0x39> kill(atoi(argv[i])); exit(); 6d: e8 f1 03 00 00 call 463 <exit> 00000072 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 72: 55 push %ebp 73: 89 e5 mov %esp,%ebp 75: 57 push %edi 76: 53 push %ebx asm volatile("cld; rep stosb" : 77: 8b 4d 08 mov 0x8(%ebp),%ecx 7a: 8b 55 10 mov 0x10(%ebp),%edx 7d: 8b 45 0c mov 0xc(%ebp),%eax 80: 89 cb mov %ecx,%ebx 82: 89 df mov %ebx,%edi 84: 89 d1 mov %edx,%ecx 86: fc cld 87: f3 aa rep stos %al,%es:(%edi) 89: 89 ca mov %ecx,%edx 8b: 89 fb mov %edi,%ebx 8d: 89 5d 08 mov %ebx,0x8(%ebp) 90: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 93: 90 nop 94: 5b pop %ebx 95: 5f pop %edi 96: 5d pop %ebp 97: c3 ret 00000098 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 98: 55 push %ebp 99: 89 e5 mov %esp,%ebp 9b: 83 ec 10 sub $0x10,%esp char *os; os = s; 9e: 8b 45 08 mov 0x8(%ebp),%eax a1: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) a4: 90 nop a5: 8b 45 08 mov 0x8(%ebp),%eax a8: 8d 50 01 lea 0x1(%eax),%edx ab: 89 55 08 mov %edx,0x8(%ebp) ae: 8b 55 0c mov 0xc(%ebp),%edx b1: 8d 4a 01 lea 0x1(%edx),%ecx b4: 89 4d 0c mov %ecx,0xc(%ebp) b7: 0f b6 12 movzbl (%edx),%edx ba: 88 10 mov %dl,(%eax) bc: 0f b6 00 movzbl (%eax),%eax bf: 84 c0 test %al,%al c1: 75 e2 jne a5 <strcpy+0xd> ; return os; c3: 8b 45 fc mov -0x4(%ebp),%eax } c6: c9 leave c7: c3 ret 000000c8 <strcmp>: int strcmp(const char *p, const char *q) { c8: 55 push %ebp c9: 89 e5 mov %esp,%ebp while(*p && *p == *q) cb: eb 08 jmp d5 <strcmp+0xd> p++, q++; cd: 83 45 08 01 addl $0x1,0x8(%ebp) d1: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) d5: 8b 45 08 mov 0x8(%ebp),%eax d8: 0f b6 00 movzbl (%eax),%eax db: 84 c0 test %al,%al dd: 74 10 je ef <strcmp+0x27> df: 8b 45 08 mov 0x8(%ebp),%eax e2: 0f b6 10 movzbl (%eax),%edx e5: 8b 45 0c mov 0xc(%ebp),%eax e8: 0f b6 00 movzbl (%eax),%eax eb: 38 c2 cmp %al,%dl ed: 74 de je cd <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; ef: 8b 45 08 mov 0x8(%ebp),%eax f2: 0f b6 00 movzbl (%eax),%eax f5: 0f b6 d0 movzbl %al,%edx f8: 8b 45 0c mov 0xc(%ebp),%eax fb: 0f b6 00 movzbl (%eax),%eax fe: 0f b6 c0 movzbl %al,%eax 101: 29 c2 sub %eax,%edx 103: 89 d0 mov %edx,%eax } 105: 5d pop %ebp 106: c3 ret 00000107 <strlen>: uint strlen(char *s) { 107: 55 push %ebp 108: 89 e5 mov %esp,%ebp 10a: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 10d: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 114: eb 04 jmp 11a <strlen+0x13> 116: 83 45 fc 01 addl $0x1,-0x4(%ebp) 11a: 8b 55 fc mov -0x4(%ebp),%edx 11d: 8b 45 08 mov 0x8(%ebp),%eax 120: 01 d0 add %edx,%eax 122: 0f b6 00 movzbl (%eax),%eax 125: 84 c0 test %al,%al 127: 75 ed jne 116 <strlen+0xf> ; return n; 129: 8b 45 fc mov -0x4(%ebp),%eax } 12c: c9 leave 12d: c3 ret 0000012e <memset>: void* memset(void *dst, int c, uint n) { 12e: 55 push %ebp 12f: 89 e5 mov %esp,%ebp stosb(dst, c, n); 131: 8b 45 10 mov 0x10(%ebp),%eax 134: 50 push %eax 135: ff 75 0c pushl 0xc(%ebp) 138: ff 75 08 pushl 0x8(%ebp) 13b: e8 32 ff ff ff call 72 <stosb> 140: 83 c4 0c add $0xc,%esp return dst; 143: 8b 45 08 mov 0x8(%ebp),%eax } 146: c9 leave 147: c3 ret 00000148 <strchr>: char* strchr(const char *s, char c) { 148: 55 push %ebp 149: 89 e5 mov %esp,%ebp 14b: 83 ec 04 sub $0x4,%esp 14e: 8b 45 0c mov 0xc(%ebp),%eax 151: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 154: eb 14 jmp 16a <strchr+0x22> if(*s == c) 156: 8b 45 08 mov 0x8(%ebp),%eax 159: 0f b6 00 movzbl (%eax),%eax 15c: 3a 45 fc cmp -0x4(%ebp),%al 15f: 75 05 jne 166 <strchr+0x1e> return (char*)s; 161: 8b 45 08 mov 0x8(%ebp),%eax 164: eb 13 jmp 179 <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 166: 83 45 08 01 addl $0x1,0x8(%ebp) 16a: 8b 45 08 mov 0x8(%ebp),%eax 16d: 0f b6 00 movzbl (%eax),%eax 170: 84 c0 test %al,%al 172: 75 e2 jne 156 <strchr+0xe> if(*s == c) return (char*)s; return 0; 174: b8 00 00 00 00 mov $0x0,%eax } 179: c9 leave 17a: c3 ret 0000017b <gets>: char* gets(char *buf, int max) { 17b: 55 push %ebp 17c: 89 e5 mov %esp,%ebp 17e: 83 ec 18 sub $0x18,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 181: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 188: eb 42 jmp 1cc <gets+0x51> cc = read(0, &c, 1); 18a: 83 ec 04 sub $0x4,%esp 18d: 6a 01 push $0x1 18f: 8d 45 ef lea -0x11(%ebp),%eax 192: 50 push %eax 193: 6a 00 push $0x0 195: e8 e1 02 00 00 call 47b <read> 19a: 83 c4 10 add $0x10,%esp 19d: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 1a0: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1a4: 7e 33 jle 1d9 <gets+0x5e> break; buf[i++] = c; 1a6: 8b 45 f4 mov -0xc(%ebp),%eax 1a9: 8d 50 01 lea 0x1(%eax),%edx 1ac: 89 55 f4 mov %edx,-0xc(%ebp) 1af: 89 c2 mov %eax,%edx 1b1: 8b 45 08 mov 0x8(%ebp),%eax 1b4: 01 c2 add %eax,%edx 1b6: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1ba: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 1bc: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1c0: 3c 0a cmp $0xa,%al 1c2: 74 16 je 1da <gets+0x5f> 1c4: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1c8: 3c 0d cmp $0xd,%al 1ca: 74 0e je 1da <gets+0x5f> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1cc: 8b 45 f4 mov -0xc(%ebp),%eax 1cf: 83 c0 01 add $0x1,%eax 1d2: 3b 45 0c cmp 0xc(%ebp),%eax 1d5: 7c b3 jl 18a <gets+0xf> 1d7: eb 01 jmp 1da <gets+0x5f> cc = read(0, &c, 1); if(cc < 1) break; 1d9: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1da: 8b 55 f4 mov -0xc(%ebp),%edx 1dd: 8b 45 08 mov 0x8(%ebp),%eax 1e0: 01 d0 add %edx,%eax 1e2: c6 00 00 movb $0x0,(%eax) return buf; 1e5: 8b 45 08 mov 0x8(%ebp),%eax } 1e8: c9 leave 1e9: c3 ret 000001ea <stat>: int stat(char *n, struct stat *st) { 1ea: 55 push %ebp 1eb: 89 e5 mov %esp,%ebp 1ed: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 1f0: 83 ec 08 sub $0x8,%esp 1f3: 6a 00 push $0x0 1f5: ff 75 08 pushl 0x8(%ebp) 1f8: e8 a6 02 00 00 call 4a3 <open> 1fd: 83 c4 10 add $0x10,%esp 200: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 203: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 207: 79 07 jns 210 <stat+0x26> return -1; 209: b8 ff ff ff ff mov $0xffffffff,%eax 20e: eb 25 jmp 235 <stat+0x4b> r = fstat(fd, st); 210: 83 ec 08 sub $0x8,%esp 213: ff 75 0c pushl 0xc(%ebp) 216: ff 75 f4 pushl -0xc(%ebp) 219: e8 9d 02 00 00 call 4bb <fstat> 21e: 83 c4 10 add $0x10,%esp 221: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 224: 83 ec 0c sub $0xc,%esp 227: ff 75 f4 pushl -0xc(%ebp) 22a: e8 5c 02 00 00 call 48b <close> 22f: 83 c4 10 add $0x10,%esp return r; 232: 8b 45 f0 mov -0x10(%ebp),%eax } 235: c9 leave 236: c3 ret 00000237 <atoi>: int atoi(const char *s) { 237: 55 push %ebp 238: 89 e5 mov %esp,%ebp 23a: 83 ec 10 sub $0x10,%esp int n; n = 0; 23d: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 244: eb 25 jmp 26b <atoi+0x34> n = n*10 + *s++ - '0'; 246: 8b 55 fc mov -0x4(%ebp),%edx 249: 89 d0 mov %edx,%eax 24b: c1 e0 02 shl $0x2,%eax 24e: 01 d0 add %edx,%eax 250: 01 c0 add %eax,%eax 252: 89 c1 mov %eax,%ecx 254: 8b 45 08 mov 0x8(%ebp),%eax 257: 8d 50 01 lea 0x1(%eax),%edx 25a: 89 55 08 mov %edx,0x8(%ebp) 25d: 0f b6 00 movzbl (%eax),%eax 260: 0f be c0 movsbl %al,%eax 263: 01 c8 add %ecx,%eax 265: 83 e8 30 sub $0x30,%eax 268: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 26b: 8b 45 08 mov 0x8(%ebp),%eax 26e: 0f b6 00 movzbl (%eax),%eax 271: 3c 2f cmp $0x2f,%al 273: 7e 0a jle 27f <atoi+0x48> 275: 8b 45 08 mov 0x8(%ebp),%eax 278: 0f b6 00 movzbl (%eax),%eax 27b: 3c 39 cmp $0x39,%al 27d: 7e c7 jle 246 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 27f: 8b 45 fc mov -0x4(%ebp),%eax } 282: c9 leave 283: c3 ret 00000284 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 284: 55 push %ebp 285: 89 e5 mov %esp,%ebp 287: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 28a: 8b 45 08 mov 0x8(%ebp),%eax 28d: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 290: 8b 45 0c mov 0xc(%ebp),%eax 293: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 296: eb 17 jmp 2af <memmove+0x2b> *dst++ = *src++; 298: 8b 45 fc mov -0x4(%ebp),%eax 29b: 8d 50 01 lea 0x1(%eax),%edx 29e: 89 55 fc mov %edx,-0x4(%ebp) 2a1: 8b 55 f8 mov -0x8(%ebp),%edx 2a4: 8d 4a 01 lea 0x1(%edx),%ecx 2a7: 89 4d f8 mov %ecx,-0x8(%ebp) 2aa: 0f b6 12 movzbl (%edx),%edx 2ad: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 2af: 8b 45 10 mov 0x10(%ebp),%eax 2b2: 8d 50 ff lea -0x1(%eax),%edx 2b5: 89 55 10 mov %edx,0x10(%ebp) 2b8: 85 c0 test %eax,%eax 2ba: 7f dc jg 298 <memmove+0x14> *dst++ = *src++; return vdst; 2bc: 8b 45 08 mov 0x8(%ebp),%eax } 2bf: c9 leave 2c0: c3 ret 000002c1 <historyAdd>: void historyAdd(char *buf1){ 2c1: 55 push %ebp 2c2: 89 e5 mov %esp,%ebp 2c4: 53 push %ebx 2c5: 81 ec f4 07 00 00 sub $0x7f4,%esp int fd; char hist[10]={'h','\0'}; 2cb: c7 45 e6 00 00 00 00 movl $0x0,-0x1a(%ebp) 2d2: c7 45 ea 00 00 00 00 movl $0x0,-0x16(%ebp) 2d9: 66 c7 45 ee 00 00 movw $0x0,-0x12(%ebp) 2df: c6 45 e6 68 movb $0x68,-0x1a(%ebp) //printf(1,"here\n"); char buf[1000],buf2[1000]; if((fd = open(hist, 0)) < 0){ 2e3: 83 ec 08 sub $0x8,%esp 2e6: 6a 00 push $0x0 2e8: 8d 45 e6 lea -0x1a(%ebp),%eax 2eb: 50 push %eax 2ec: e8 b2 01 00 00 call 4a3 <open> 2f1: 83 c4 10 add $0x10,%esp 2f4: 89 45 f0 mov %eax,-0x10(%ebp) 2f7: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 2fb: 79 1b jns 318 <historyAdd+0x57> printf(1, "History: cannot open %s\n", hist); 2fd: 83 ec 04 sub $0x4,%esp 300: 8d 45 e6 lea -0x1a(%ebp),%eax 303: 50 push %eax 304: 68 a4 09 00 00 push $0x9a4 309: 6a 01 push $0x1 30b: e8 ca 02 00 00 call 5da <printf> 310: 83 c4 10 add $0x10,%esp exit(); 313: e8 4b 01 00 00 call 463 <exit> } int i=0; 318: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) while(buf1[i]!=0) 31f: eb 1c jmp 33d <historyAdd+0x7c> { //printf(1,"%d has %d\n",i,buf1[i]); buf[i]=buf1[i]; 321: 8b 55 f4 mov -0xc(%ebp),%edx 324: 8b 45 08 mov 0x8(%ebp),%eax 327: 01 d0 add %edx,%eax 329: 0f b6 00 movzbl (%eax),%eax 32c: 8d 8d fe fb ff ff lea -0x402(%ebp),%ecx 332: 8b 55 f4 mov -0xc(%ebp),%edx 335: 01 ca add %ecx,%edx 337: 88 02 mov %al,(%edx) i++; 339: 83 45 f4 01 addl $0x1,-0xc(%ebp) printf(1, "History: cannot open %s\n", hist); exit(); } int i=0; while(buf1[i]!=0) 33d: 8b 55 f4 mov -0xc(%ebp),%edx 340: 8b 45 08 mov 0x8(%ebp),%eax 343: 01 d0 add %edx,%eax 345: 0f b6 00 movzbl (%eax),%eax 348: 84 c0 test %al,%al 34a: 75 d5 jne 321 <historyAdd+0x60> { //printf(1,"%d has %d\n",i,buf1[i]); buf[i]=buf1[i]; i++; } buf[i]=0; 34c: 8d 95 fe fb ff ff lea -0x402(%ebp),%edx 352: 8b 45 f4 mov -0xc(%ebp),%eax 355: 01 d0 add %edx,%eax 357: c6 00 00 movb $0x0,(%eax) // int n; while((read(fd, buf2, 1000)) > 0){ 35a: eb 5a jmp 3b6 <historyAdd+0xf5> //printf(1,"%d %d\n",strlen(buf),strlen(buf2)); while(i<strlen(buf2)+strlen(buf1)){ //printf(1,"%c\n",buf2[i]); buf[i]=buf2[i-strlen(buf1)]; 35c: 8b 5d f4 mov -0xc(%ebp),%ebx 35f: 83 ec 0c sub $0xc,%esp 362: ff 75 08 pushl 0x8(%ebp) 365: e8 9d fd ff ff call 107 <strlen> 36a: 83 c4 10 add $0x10,%esp 36d: 29 c3 sub %eax,%ebx 36f: 89 d8 mov %ebx,%eax 371: 0f b6 84 05 16 f8 ff movzbl -0x7ea(%ebp,%eax,1),%eax 378: ff 379: 8d 8d fe fb ff ff lea -0x402(%ebp),%ecx 37f: 8b 55 f4 mov -0xc(%ebp),%edx 382: 01 ca add %ecx,%edx 384: 88 02 mov %al,(%edx) i++; 386: 83 45 f4 01 addl $0x1,-0xc(%ebp) //buf[1001]=0; //int i=0; //printf(1,"%d %d\n",strlen(buf),strlen(buf2)); while(i<strlen(buf2)+strlen(buf1)){ 38a: 83 ec 0c sub $0xc,%esp 38d: 8d 85 16 f8 ff ff lea -0x7ea(%ebp),%eax 393: 50 push %eax 394: e8 6e fd ff ff call 107 <strlen> 399: 83 c4 10 add $0x10,%esp 39c: 89 c3 mov %eax,%ebx 39e: 83 ec 0c sub $0xc,%esp 3a1: ff 75 08 pushl 0x8(%ebp) 3a4: e8 5e fd ff ff call 107 <strlen> 3a9: 83 c4 10 add $0x10,%esp 3ac: 8d 14 03 lea (%ebx,%eax,1),%edx 3af: 8b 45 f4 mov -0xc(%ebp),%eax 3b2: 39 c2 cmp %eax,%edx 3b4: 77 a6 ja 35c <historyAdd+0x9b> buf[i]=buf1[i]; i++; } buf[i]=0; // int n; while((read(fd, buf2, 1000)) > 0){ 3b6: 83 ec 04 sub $0x4,%esp 3b9: 68 e8 03 00 00 push $0x3e8 3be: 8d 85 16 f8 ff ff lea -0x7ea(%ebp),%eax 3c4: 50 push %eax 3c5: ff 75 f0 pushl -0x10(%ebp) 3c8: e8 ae 00 00 00 call 47b <read> 3cd: 83 c4 10 add $0x10,%esp 3d0: 85 c0 test %eax,%eax 3d2: 7f b6 jg 38a <historyAdd+0xc9> } //printf(1,"strlen: %d %s\n",strlen(buf),buf); } //history(fd); close(fd); 3d4: 83 ec 0c sub $0xc,%esp 3d7: ff 75 f0 pushl -0x10(%ebp) 3da: e8 ac 00 00 00 call 48b <close> 3df: 83 c4 10 add $0x10,%esp if((fd = open(hist,O_CREATE|O_RDWR)) < 0){ 3e2: 83 ec 08 sub $0x8,%esp 3e5: 68 02 02 00 00 push $0x202 3ea: 8d 45 e6 lea -0x1a(%ebp),%eax 3ed: 50 push %eax 3ee: e8 b0 00 00 00 call 4a3 <open> 3f3: 83 c4 10 add $0x10,%esp 3f6: 89 45 f0 mov %eax,-0x10(%ebp) 3f9: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 3fd: 79 1b jns 41a <historyAdd+0x159> printf(1, "History: cannot open %s\n", hist); 3ff: 83 ec 04 sub $0x4,%esp 402: 8d 45 e6 lea -0x1a(%ebp),%eax 405: 50 push %eax 406: 68 a4 09 00 00 push $0x9a4 40b: 6a 01 push $0x1 40d: e8 c8 01 00 00 call 5da <printf> 412: 83 c4 10 add $0x10,%esp exit(); 415: e8 49 00 00 00 call 463 <exit> } if(write(fd, buf, 1000) != 1000){ 41a: 83 ec 04 sub $0x4,%esp 41d: 68 e8 03 00 00 push $0x3e8 422: 8d 85 fe fb ff ff lea -0x402(%ebp),%eax 428: 50 push %eax 429: ff 75 f0 pushl -0x10(%ebp) 42c: e8 52 00 00 00 call 483 <write> 431: 83 c4 10 add $0x10,%esp 434: 3d e8 03 00 00 cmp $0x3e8,%eax 439: 74 1a je 455 <historyAdd+0x194> printf(1, "error: write aa %d new file failed\n", i); 43b: 83 ec 04 sub $0x4,%esp 43e: ff 75 f4 pushl -0xc(%ebp) 441: 68 c0 09 00 00 push $0x9c0 446: 6a 01 push $0x1 448: e8 8d 01 00 00 call 5da <printf> 44d: 83 c4 10 add $0x10,%esp exit(); 450: e8 0e 00 00 00 call 463 <exit> } } 455: 90 nop 456: 8b 5d fc mov -0x4(%ebp),%ebx 459: c9 leave 45a: c3 ret 0000045b <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 45b: b8 01 00 00 00 mov $0x1,%eax 460: cd 40 int $0x40 462: c3 ret 00000463 <exit>: SYSCALL(exit) 463: b8 02 00 00 00 mov $0x2,%eax 468: cd 40 int $0x40 46a: c3 ret 0000046b <wait>: SYSCALL(wait) 46b: b8 03 00 00 00 mov $0x3,%eax 470: cd 40 int $0x40 472: c3 ret 00000473 <pipe>: SYSCALL(pipe) 473: b8 04 00 00 00 mov $0x4,%eax 478: cd 40 int $0x40 47a: c3 ret 0000047b <read>: SYSCALL(read) 47b: b8 05 00 00 00 mov $0x5,%eax 480: cd 40 int $0x40 482: c3 ret 00000483 <write>: SYSCALL(write) 483: b8 10 00 00 00 mov $0x10,%eax 488: cd 40 int $0x40 48a: c3 ret 0000048b <close>: SYSCALL(close) 48b: b8 15 00 00 00 mov $0x15,%eax 490: cd 40 int $0x40 492: c3 ret 00000493 <kill>: SYSCALL(kill) 493: b8 06 00 00 00 mov $0x6,%eax 498: cd 40 int $0x40 49a: c3 ret 0000049b <exec>: SYSCALL(exec) 49b: b8 07 00 00 00 mov $0x7,%eax 4a0: cd 40 int $0x40 4a2: c3 ret 000004a3 <open>: SYSCALL(open) 4a3: b8 0f 00 00 00 mov $0xf,%eax 4a8: cd 40 int $0x40 4aa: c3 ret 000004ab <mknod>: SYSCALL(mknod) 4ab: b8 11 00 00 00 mov $0x11,%eax 4b0: cd 40 int $0x40 4b2: c3 ret 000004b3 <unlink>: SYSCALL(unlink) 4b3: b8 12 00 00 00 mov $0x12,%eax 4b8: cd 40 int $0x40 4ba: c3 ret 000004bb <fstat>: SYSCALL(fstat) 4bb: b8 08 00 00 00 mov $0x8,%eax 4c0: cd 40 int $0x40 4c2: c3 ret 000004c3 <link>: SYSCALL(link) 4c3: b8 13 00 00 00 mov $0x13,%eax 4c8: cd 40 int $0x40 4ca: c3 ret 000004cb <mkdir>: SYSCALL(mkdir) 4cb: b8 14 00 00 00 mov $0x14,%eax 4d0: cd 40 int $0x40 4d2: c3 ret 000004d3 <chdir>: SYSCALL(chdir) 4d3: b8 09 00 00 00 mov $0x9,%eax 4d8: cd 40 int $0x40 4da: c3 ret 000004db <dup>: SYSCALL(dup) 4db: b8 0a 00 00 00 mov $0xa,%eax 4e0: cd 40 int $0x40 4e2: c3 ret 000004e3 <getpid>: SYSCALL(getpid) 4e3: b8 0b 00 00 00 mov $0xb,%eax 4e8: cd 40 int $0x40 4ea: c3 ret 000004eb <sbrk>: SYSCALL(sbrk) 4eb: b8 0c 00 00 00 mov $0xc,%eax 4f0: cd 40 int $0x40 4f2: c3 ret 000004f3 <sleep>: SYSCALL(sleep) 4f3: b8 0d 00 00 00 mov $0xd,%eax 4f8: cd 40 int $0x40 4fa: c3 ret 000004fb <uptime>: SYSCALL(uptime) 4fb: b8 0e 00 00 00 mov $0xe,%eax 500: cd 40 int $0x40 502: c3 ret 00000503 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 503: 55 push %ebp 504: 89 e5 mov %esp,%ebp 506: 83 ec 18 sub $0x18,%esp 509: 8b 45 0c mov 0xc(%ebp),%eax 50c: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 50f: 83 ec 04 sub $0x4,%esp 512: 6a 01 push $0x1 514: 8d 45 f4 lea -0xc(%ebp),%eax 517: 50 push %eax 518: ff 75 08 pushl 0x8(%ebp) 51b: e8 63 ff ff ff call 483 <write> 520: 83 c4 10 add $0x10,%esp } 523: 90 nop 524: c9 leave 525: c3 ret 00000526 <printint>: static void printint(int fd, int xx, int base, int sgn) { 526: 55 push %ebp 527: 89 e5 mov %esp,%ebp 529: 53 push %ebx 52a: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 52d: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 534: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 538: 74 17 je 551 <printint+0x2b> 53a: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 53e: 79 11 jns 551 <printint+0x2b> neg = 1; 540: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 547: 8b 45 0c mov 0xc(%ebp),%eax 54a: f7 d8 neg %eax 54c: 89 45 ec mov %eax,-0x14(%ebp) 54f: eb 06 jmp 557 <printint+0x31> } else { x = xx; 551: 8b 45 0c mov 0xc(%ebp),%eax 554: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 557: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 55e: 8b 4d f4 mov -0xc(%ebp),%ecx 561: 8d 41 01 lea 0x1(%ecx),%eax 564: 89 45 f4 mov %eax,-0xc(%ebp) 567: 8b 5d 10 mov 0x10(%ebp),%ebx 56a: 8b 45 ec mov -0x14(%ebp),%eax 56d: ba 00 00 00 00 mov $0x0,%edx 572: f7 f3 div %ebx 574: 89 d0 mov %edx,%eax 576: 0f b6 80 5c 0c 00 00 movzbl 0xc5c(%eax),%eax 57d: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 581: 8b 5d 10 mov 0x10(%ebp),%ebx 584: 8b 45 ec mov -0x14(%ebp),%eax 587: ba 00 00 00 00 mov $0x0,%edx 58c: f7 f3 div %ebx 58e: 89 45 ec mov %eax,-0x14(%ebp) 591: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 595: 75 c7 jne 55e <printint+0x38> if(neg) 597: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 59b: 74 2d je 5ca <printint+0xa4> buf[i++] = '-'; 59d: 8b 45 f4 mov -0xc(%ebp),%eax 5a0: 8d 50 01 lea 0x1(%eax),%edx 5a3: 89 55 f4 mov %edx,-0xc(%ebp) 5a6: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 5ab: eb 1d jmp 5ca <printint+0xa4> putc(fd, buf[i]); 5ad: 8d 55 dc lea -0x24(%ebp),%edx 5b0: 8b 45 f4 mov -0xc(%ebp),%eax 5b3: 01 d0 add %edx,%eax 5b5: 0f b6 00 movzbl (%eax),%eax 5b8: 0f be c0 movsbl %al,%eax 5bb: 83 ec 08 sub $0x8,%esp 5be: 50 push %eax 5bf: ff 75 08 pushl 0x8(%ebp) 5c2: e8 3c ff ff ff call 503 <putc> 5c7: 83 c4 10 add $0x10,%esp buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 5ca: 83 6d f4 01 subl $0x1,-0xc(%ebp) 5ce: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 5d2: 79 d9 jns 5ad <printint+0x87> putc(fd, buf[i]); } 5d4: 90 nop 5d5: 8b 5d fc mov -0x4(%ebp),%ebx 5d8: c9 leave 5d9: c3 ret 000005da <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 5da: 55 push %ebp 5db: 89 e5 mov %esp,%ebp 5dd: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 5e0: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 5e7: 8d 45 0c lea 0xc(%ebp),%eax 5ea: 83 c0 04 add $0x4,%eax 5ed: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 5f0: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 5f7: e9 59 01 00 00 jmp 755 <printf+0x17b> c = fmt[i] & 0xff; 5fc: 8b 55 0c mov 0xc(%ebp),%edx 5ff: 8b 45 f0 mov -0x10(%ebp),%eax 602: 01 d0 add %edx,%eax 604: 0f b6 00 movzbl (%eax),%eax 607: 0f be c0 movsbl %al,%eax 60a: 25 ff 00 00 00 and $0xff,%eax 60f: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 612: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 616: 75 2c jne 644 <printf+0x6a> if(c == '%'){ 618: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 61c: 75 0c jne 62a <printf+0x50> state = '%'; 61e: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 625: e9 27 01 00 00 jmp 751 <printf+0x177> } else { putc(fd, c); 62a: 8b 45 e4 mov -0x1c(%ebp),%eax 62d: 0f be c0 movsbl %al,%eax 630: 83 ec 08 sub $0x8,%esp 633: 50 push %eax 634: ff 75 08 pushl 0x8(%ebp) 637: e8 c7 fe ff ff call 503 <putc> 63c: 83 c4 10 add $0x10,%esp 63f: e9 0d 01 00 00 jmp 751 <printf+0x177> } } else if(state == '%'){ 644: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 648: 0f 85 03 01 00 00 jne 751 <printf+0x177> if(c == 'd'){ 64e: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 652: 75 1e jne 672 <printf+0x98> printint(fd, *ap, 10, 1); 654: 8b 45 e8 mov -0x18(%ebp),%eax 657: 8b 00 mov (%eax),%eax 659: 6a 01 push $0x1 65b: 6a 0a push $0xa 65d: 50 push %eax 65e: ff 75 08 pushl 0x8(%ebp) 661: e8 c0 fe ff ff call 526 <printint> 666: 83 c4 10 add $0x10,%esp ap++; 669: 83 45 e8 04 addl $0x4,-0x18(%ebp) 66d: e9 d8 00 00 00 jmp 74a <printf+0x170> } else if(c == 'x' || c == 'p'){ 672: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 676: 74 06 je 67e <printf+0xa4> 678: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 67c: 75 1e jne 69c <printf+0xc2> printint(fd, *ap, 16, 0); 67e: 8b 45 e8 mov -0x18(%ebp),%eax 681: 8b 00 mov (%eax),%eax 683: 6a 00 push $0x0 685: 6a 10 push $0x10 687: 50 push %eax 688: ff 75 08 pushl 0x8(%ebp) 68b: e8 96 fe ff ff call 526 <printint> 690: 83 c4 10 add $0x10,%esp ap++; 693: 83 45 e8 04 addl $0x4,-0x18(%ebp) 697: e9 ae 00 00 00 jmp 74a <printf+0x170> } else if(c == 's'){ 69c: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 6a0: 75 43 jne 6e5 <printf+0x10b> s = (char*)*ap; 6a2: 8b 45 e8 mov -0x18(%ebp),%eax 6a5: 8b 00 mov (%eax),%eax 6a7: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 6aa: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 6ae: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 6b2: 75 25 jne 6d9 <printf+0xff> s = "(null)"; 6b4: c7 45 f4 e4 09 00 00 movl $0x9e4,-0xc(%ebp) while(*s != 0){ 6bb: eb 1c jmp 6d9 <printf+0xff> putc(fd, *s); 6bd: 8b 45 f4 mov -0xc(%ebp),%eax 6c0: 0f b6 00 movzbl (%eax),%eax 6c3: 0f be c0 movsbl %al,%eax 6c6: 83 ec 08 sub $0x8,%esp 6c9: 50 push %eax 6ca: ff 75 08 pushl 0x8(%ebp) 6cd: e8 31 fe ff ff call 503 <putc> 6d2: 83 c4 10 add $0x10,%esp s++; 6d5: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 6d9: 8b 45 f4 mov -0xc(%ebp),%eax 6dc: 0f b6 00 movzbl (%eax),%eax 6df: 84 c0 test %al,%al 6e1: 75 da jne 6bd <printf+0xe3> 6e3: eb 65 jmp 74a <printf+0x170> putc(fd, *s); s++; } } else if(c == 'c'){ 6e5: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 6e9: 75 1d jne 708 <printf+0x12e> putc(fd, *ap); 6eb: 8b 45 e8 mov -0x18(%ebp),%eax 6ee: 8b 00 mov (%eax),%eax 6f0: 0f be c0 movsbl %al,%eax 6f3: 83 ec 08 sub $0x8,%esp 6f6: 50 push %eax 6f7: ff 75 08 pushl 0x8(%ebp) 6fa: e8 04 fe ff ff call 503 <putc> 6ff: 83 c4 10 add $0x10,%esp ap++; 702: 83 45 e8 04 addl $0x4,-0x18(%ebp) 706: eb 42 jmp 74a <printf+0x170> } else if(c == '%'){ 708: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 70c: 75 17 jne 725 <printf+0x14b> putc(fd, c); 70e: 8b 45 e4 mov -0x1c(%ebp),%eax 711: 0f be c0 movsbl %al,%eax 714: 83 ec 08 sub $0x8,%esp 717: 50 push %eax 718: ff 75 08 pushl 0x8(%ebp) 71b: e8 e3 fd ff ff call 503 <putc> 720: 83 c4 10 add $0x10,%esp 723: eb 25 jmp 74a <printf+0x170> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 725: 83 ec 08 sub $0x8,%esp 728: 6a 25 push $0x25 72a: ff 75 08 pushl 0x8(%ebp) 72d: e8 d1 fd ff ff call 503 <putc> 732: 83 c4 10 add $0x10,%esp putc(fd, c); 735: 8b 45 e4 mov -0x1c(%ebp),%eax 738: 0f be c0 movsbl %al,%eax 73b: 83 ec 08 sub $0x8,%esp 73e: 50 push %eax 73f: ff 75 08 pushl 0x8(%ebp) 742: e8 bc fd ff ff call 503 <putc> 747: 83 c4 10 add $0x10,%esp } state = 0; 74a: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 751: 83 45 f0 01 addl $0x1,-0x10(%ebp) 755: 8b 55 0c mov 0xc(%ebp),%edx 758: 8b 45 f0 mov -0x10(%ebp),%eax 75b: 01 d0 add %edx,%eax 75d: 0f b6 00 movzbl (%eax),%eax 760: 84 c0 test %al,%al 762: 0f 85 94 fe ff ff jne 5fc <printf+0x22> putc(fd, c); } state = 0; } } } 768: 90 nop 769: c9 leave 76a: c3 ret 0000076b <free>: static Header base; static Header *freep; void free(void *ap) { 76b: 55 push %ebp 76c: 89 e5 mov %esp,%ebp 76e: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 771: 8b 45 08 mov 0x8(%ebp),%eax 774: 83 e8 08 sub $0x8,%eax 777: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 77a: a1 78 0c 00 00 mov 0xc78,%eax 77f: 89 45 fc mov %eax,-0x4(%ebp) 782: eb 24 jmp 7a8 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 784: 8b 45 fc mov -0x4(%ebp),%eax 787: 8b 00 mov (%eax),%eax 789: 3b 45 fc cmp -0x4(%ebp),%eax 78c: 77 12 ja 7a0 <free+0x35> 78e: 8b 45 f8 mov -0x8(%ebp),%eax 791: 3b 45 fc cmp -0x4(%ebp),%eax 794: 77 24 ja 7ba <free+0x4f> 796: 8b 45 fc mov -0x4(%ebp),%eax 799: 8b 00 mov (%eax),%eax 79b: 3b 45 f8 cmp -0x8(%ebp),%eax 79e: 77 1a ja 7ba <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 7a0: 8b 45 fc mov -0x4(%ebp),%eax 7a3: 8b 00 mov (%eax),%eax 7a5: 89 45 fc mov %eax,-0x4(%ebp) 7a8: 8b 45 f8 mov -0x8(%ebp),%eax 7ab: 3b 45 fc cmp -0x4(%ebp),%eax 7ae: 76 d4 jbe 784 <free+0x19> 7b0: 8b 45 fc mov -0x4(%ebp),%eax 7b3: 8b 00 mov (%eax),%eax 7b5: 3b 45 f8 cmp -0x8(%ebp),%eax 7b8: 76 ca jbe 784 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 7ba: 8b 45 f8 mov -0x8(%ebp),%eax 7bd: 8b 40 04 mov 0x4(%eax),%eax 7c0: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 7c7: 8b 45 f8 mov -0x8(%ebp),%eax 7ca: 01 c2 add %eax,%edx 7cc: 8b 45 fc mov -0x4(%ebp),%eax 7cf: 8b 00 mov (%eax),%eax 7d1: 39 c2 cmp %eax,%edx 7d3: 75 24 jne 7f9 <free+0x8e> bp->s.size += p->s.ptr->s.size; 7d5: 8b 45 f8 mov -0x8(%ebp),%eax 7d8: 8b 50 04 mov 0x4(%eax),%edx 7db: 8b 45 fc mov -0x4(%ebp),%eax 7de: 8b 00 mov (%eax),%eax 7e0: 8b 40 04 mov 0x4(%eax),%eax 7e3: 01 c2 add %eax,%edx 7e5: 8b 45 f8 mov -0x8(%ebp),%eax 7e8: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 7eb: 8b 45 fc mov -0x4(%ebp),%eax 7ee: 8b 00 mov (%eax),%eax 7f0: 8b 10 mov (%eax),%edx 7f2: 8b 45 f8 mov -0x8(%ebp),%eax 7f5: 89 10 mov %edx,(%eax) 7f7: eb 0a jmp 803 <free+0x98> } else bp->s.ptr = p->s.ptr; 7f9: 8b 45 fc mov -0x4(%ebp),%eax 7fc: 8b 10 mov (%eax),%edx 7fe: 8b 45 f8 mov -0x8(%ebp),%eax 801: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 803: 8b 45 fc mov -0x4(%ebp),%eax 806: 8b 40 04 mov 0x4(%eax),%eax 809: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 810: 8b 45 fc mov -0x4(%ebp),%eax 813: 01 d0 add %edx,%eax 815: 3b 45 f8 cmp -0x8(%ebp),%eax 818: 75 20 jne 83a <free+0xcf> p->s.size += bp->s.size; 81a: 8b 45 fc mov -0x4(%ebp),%eax 81d: 8b 50 04 mov 0x4(%eax),%edx 820: 8b 45 f8 mov -0x8(%ebp),%eax 823: 8b 40 04 mov 0x4(%eax),%eax 826: 01 c2 add %eax,%edx 828: 8b 45 fc mov -0x4(%ebp),%eax 82b: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 82e: 8b 45 f8 mov -0x8(%ebp),%eax 831: 8b 10 mov (%eax),%edx 833: 8b 45 fc mov -0x4(%ebp),%eax 836: 89 10 mov %edx,(%eax) 838: eb 08 jmp 842 <free+0xd7> } else p->s.ptr = bp; 83a: 8b 45 fc mov -0x4(%ebp),%eax 83d: 8b 55 f8 mov -0x8(%ebp),%edx 840: 89 10 mov %edx,(%eax) freep = p; 842: 8b 45 fc mov -0x4(%ebp),%eax 845: a3 78 0c 00 00 mov %eax,0xc78 } 84a: 90 nop 84b: c9 leave 84c: c3 ret 0000084d <morecore>: static Header* morecore(uint nu) { 84d: 55 push %ebp 84e: 89 e5 mov %esp,%ebp 850: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if(nu < 4096) 853: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 85a: 77 07 ja 863 <morecore+0x16> nu = 4096; 85c: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 863: 8b 45 08 mov 0x8(%ebp),%eax 866: c1 e0 03 shl $0x3,%eax 869: 83 ec 0c sub $0xc,%esp 86c: 50 push %eax 86d: e8 79 fc ff ff call 4eb <sbrk> 872: 83 c4 10 add $0x10,%esp 875: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 878: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 87c: 75 07 jne 885 <morecore+0x38> return 0; 87e: b8 00 00 00 00 mov $0x0,%eax 883: eb 26 jmp 8ab <morecore+0x5e> hp = (Header*)p; 885: 8b 45 f4 mov -0xc(%ebp),%eax 888: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 88b: 8b 45 f0 mov -0x10(%ebp),%eax 88e: 8b 55 08 mov 0x8(%ebp),%edx 891: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 894: 8b 45 f0 mov -0x10(%ebp),%eax 897: 83 c0 08 add $0x8,%eax 89a: 83 ec 0c sub $0xc,%esp 89d: 50 push %eax 89e: e8 c8 fe ff ff call 76b <free> 8a3: 83 c4 10 add $0x10,%esp return freep; 8a6: a1 78 0c 00 00 mov 0xc78,%eax } 8ab: c9 leave 8ac: c3 ret 000008ad <malloc>: void* malloc(uint nbytes) { 8ad: 55 push %ebp 8ae: 89 e5 mov %esp,%ebp 8b0: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 8b3: 8b 45 08 mov 0x8(%ebp),%eax 8b6: 83 c0 07 add $0x7,%eax 8b9: c1 e8 03 shr $0x3,%eax 8bc: 83 c0 01 add $0x1,%eax 8bf: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 8c2: a1 78 0c 00 00 mov 0xc78,%eax 8c7: 89 45 f0 mov %eax,-0x10(%ebp) 8ca: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8ce: 75 23 jne 8f3 <malloc+0x46> base.s.ptr = freep = prevp = &base; 8d0: c7 45 f0 70 0c 00 00 movl $0xc70,-0x10(%ebp) 8d7: 8b 45 f0 mov -0x10(%ebp),%eax 8da: a3 78 0c 00 00 mov %eax,0xc78 8df: a1 78 0c 00 00 mov 0xc78,%eax 8e4: a3 70 0c 00 00 mov %eax,0xc70 base.s.size = 0; 8e9: c7 05 74 0c 00 00 00 movl $0x0,0xc74 8f0: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 8f3: 8b 45 f0 mov -0x10(%ebp),%eax 8f6: 8b 00 mov (%eax),%eax 8f8: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 8fb: 8b 45 f4 mov -0xc(%ebp),%eax 8fe: 8b 40 04 mov 0x4(%eax),%eax 901: 3b 45 ec cmp -0x14(%ebp),%eax 904: 72 4d jb 953 <malloc+0xa6> if(p->s.size == nunits) 906: 8b 45 f4 mov -0xc(%ebp),%eax 909: 8b 40 04 mov 0x4(%eax),%eax 90c: 3b 45 ec cmp -0x14(%ebp),%eax 90f: 75 0c jne 91d <malloc+0x70> prevp->s.ptr = p->s.ptr; 911: 8b 45 f4 mov -0xc(%ebp),%eax 914: 8b 10 mov (%eax),%edx 916: 8b 45 f0 mov -0x10(%ebp),%eax 919: 89 10 mov %edx,(%eax) 91b: eb 26 jmp 943 <malloc+0x96> else { p->s.size -= nunits; 91d: 8b 45 f4 mov -0xc(%ebp),%eax 920: 8b 40 04 mov 0x4(%eax),%eax 923: 2b 45 ec sub -0x14(%ebp),%eax 926: 89 c2 mov %eax,%edx 928: 8b 45 f4 mov -0xc(%ebp),%eax 92b: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 92e: 8b 45 f4 mov -0xc(%ebp),%eax 931: 8b 40 04 mov 0x4(%eax),%eax 934: c1 e0 03 shl $0x3,%eax 937: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 93a: 8b 45 f4 mov -0xc(%ebp),%eax 93d: 8b 55 ec mov -0x14(%ebp),%edx 940: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 943: 8b 45 f0 mov -0x10(%ebp),%eax 946: a3 78 0c 00 00 mov %eax,0xc78 return (void*)(p + 1); 94b: 8b 45 f4 mov -0xc(%ebp),%eax 94e: 83 c0 08 add $0x8,%eax 951: eb 3b jmp 98e <malloc+0xe1> } if(p == freep) 953: a1 78 0c 00 00 mov 0xc78,%eax 958: 39 45 f4 cmp %eax,-0xc(%ebp) 95b: 75 1e jne 97b <malloc+0xce> if((p = morecore(nunits)) == 0) 95d: 83 ec 0c sub $0xc,%esp 960: ff 75 ec pushl -0x14(%ebp) 963: e8 e5 fe ff ff call 84d <morecore> 968: 83 c4 10 add $0x10,%esp 96b: 89 45 f4 mov %eax,-0xc(%ebp) 96e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 972: 75 07 jne 97b <malloc+0xce> return 0; 974: b8 00 00 00 00 mov $0x0,%eax 979: eb 13 jmp 98e <malloc+0xe1> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 97b: 8b 45 f4 mov -0xc(%ebp),%eax 97e: 89 45 f0 mov %eax,-0x10(%ebp) 981: 8b 45 f4 mov -0xc(%ebp),%eax 984: 8b 00 mov (%eax),%eax 986: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 989: e9 6d ff ff ff jmp 8fb <malloc+0x4e> } 98e: c9 leave 98f: c3 ret
alloy4fun_models/trashltl/models/17/ouGMhazjAtaXbmEXi.als
Kaixi26/org.alloytools.alloy
0
3895
<reponame>Kaixi26/org.alloytools.alloy open main pred idouGMhazjAtaXbmEXi_prop18 { all p: Protected | p in Protected until p in Trash } pred __repair { idouGMhazjAtaXbmEXi_prop18 } check __repair { idouGMhazjAtaXbmEXi_prop18 <=> prop18o }
programs/oeis/154/A154990.asm
karttu/loda
0
167312
<reponame>karttu/loda<gh_stars>0 ; A154990: Triangle read by rows. Main diagonal is positive. The rest of the terms are negative. ; 1,-1,1,-1,-1,1,-1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,-1,-1,-1 lpb $0,1 sub $0,1 add $2,1 sub $0,$2 lpe lpb $0,1 div $0,11 sub $1,1 lpe mul $1,2 add $1,1
racket/src/worksp/libffi/win32.asm
lkh01/racket
4
81962
<gh_stars>1-10 #ifdef _WIN64 # include "../../foreign/libffi/src/x86/win64.S" #else # include "../../foreign/libffi/src/x86/win32.S" #endif
Transynther/x86/_processed/NC/_zr_/i7-7700_9_0x48_notsx.log_21829_1642.asm
ljhsiun2/medusa
9
176102
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %rbp push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_normal_ht+0x5cb3, %rbx dec %rdx mov $0x6162636465666768, %rsi movq %rsi, %xmm2 and $0xffffffffffffffc0, %rbx vmovntdq %ymm2, (%rbx) nop nop sub %rbp, %rbp lea addresses_D_ht+0x13865, %rsi lea addresses_WT_ht+0x5869, %rdi nop nop nop nop nop cmp $5939, %r13 mov $36, %rcx rep movsb nop nop nop cmp $46757, %rbp lea addresses_WT_ht+0x1c5c9, %rbp nop nop inc %rbx movb (%rbp), %cl nop nop nop nop nop and %rcx, %rcx lea addresses_UC_ht+0x95c9, %rdx nop nop nop nop nop add $29557, %rcx mov (%rdx), %di nop nop nop and $52056, %rbx lea addresses_WC_ht+0x1a7c9, %rsi lea addresses_normal_ht+0x1bc9, %rdi clflush (%rsi) and %r10, %r10 mov $12, %rcx rep movsb xor %rdx, %rdx lea addresses_D_ht+0xfe51, %rsi lea addresses_UC_ht+0x1a7c9, %rdi nop nop nop add $34676, %r10 mov $112, %rcx rep movsw nop nop nop nop inc %rdi lea addresses_WT_ht+0xf7c9, %rsi nop nop nop add %rbp, %rbp movb $0x61, (%rsi) nop nop nop nop nop mfence lea addresses_WC_ht+0x49a2, %rbp nop add %r13, %r13 movw $0x6162, (%rbp) nop nop nop nop add $29231, %rdi lea addresses_WT_ht+0x149c9, %rsi lea addresses_WC_ht+0xe7c9, %rdi nop nop nop nop nop inc %rdx mov $53, %rcx rep movsl nop nop nop nop nop sub $27076, %rcx lea addresses_normal_ht+0x5569, %rcx clflush (%rcx) nop add $40060, %rsi mov $0x6162636465666768, %rbx movq %rbx, %xmm3 movups %xmm3, (%rcx) add $47070, %rsi lea addresses_UC_ht+0xc84d, %rdi nop nop nop nop cmp %rcx, %rcx movb (%rdi), %bl nop sub $64129, %r13 lea addresses_D_ht+0x17149, %rsi lea addresses_A_ht+0x14bb9, %rdi nop nop nop and %rdx, %rdx mov $71, %rcx rep movsw and %rbx, %rbx lea addresses_normal_ht+0x1e0c9, %rbx nop xor $56284, %rbp movw $0x6162, (%rbx) inc %rdi lea addresses_UC_ht+0x5c49, %rdx nop nop nop cmp %rbx, %rbx movl $0x61626364, (%rdx) nop nop nop and $45092, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rbp pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %rax push %rdi push %rdx push %rsi // Faulty Load mov $0x7989cc0000000fc9, %rdi clflush (%rdi) nop nop nop nop sub %rsi, %rsi mov (%rdi), %r10d lea oracles, %rsi and $0xff, %r10 shlq $12, %r10 mov (%rsi,%r10,1), %r10 pop %rsi pop %rdx pop %rdi pop %rax pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_NC', 'congruent': 0}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_NC', 'congruent': 0}} <gen_prepare_buffer> {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_normal_ht', 'congruent': 1}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 9}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 2, 'type': 'addresses_UC_ht', 'congruent': 9}} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}} {'dst': {'same': True, 'congruent': 10, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 2, 'type': 'addresses_D_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_WT_ht', 'congruent': 11}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': True, 'AVXalign': False, 'size': 2, 'type': 'addresses_WC_ht', 'congruent': 0}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WT_ht'}} {'dst': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 3}, 'OP': 'STOR'} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 2}} {'dst': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_D_ht'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_normal_ht', 'congruent': 5}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_UC_ht', 'congruent': 7}, 'OP': 'STOR'} {'00': 21829} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
source/slim-messages-strm.ads
reznikmm/slimp
0
6682
<reponame>reznikmm/slimp<gh_stars>0 -- Copyright (c) 2019 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT -- License-Filename: LICENSE ------------------------------------------------------------- with GNAT.Sockets; with League.Strings; with League.String_Vectors; package Slim.Messages.strm is type Strm_Message is new Message with private; type Play_Command is (Start, Pause, Unpause, Stop, Status, Flush, Skip_Ahead); type Play_Format is (MP3); not overriding procedure Simple_Command (Self : in out Strm_Message; Command : Play_Command); subtype Server_Address is GNAT.Sockets.Sock_Addr_Type (GNAT.Sockets.Family_Inet); not overriding procedure Start (Self : in out Strm_Message; Server : Server_Address; Request : League.String_Vectors.Universal_String_Vector; Auto_Play : Boolean := True); private subtype Byte is Ada.Streams.Stream_Element; type Strm_Message is new Base_Message (Max_8 => 18, Max_16 => 1, Max_32 => 1, Max_64 => 0) with record Request : League.Strings.Universal_String; end record; overriding function Read (Data : not null access League.Stream_Element_Vectors.Stream_Element_Vector) return Strm_Message; overriding procedure Write (Self : Strm_Message; Tag : out Message_Tag; Data : out League.Stream_Element_Vectors.Stream_Element_Vector); overriding procedure Read_Custom_Field (Self : in out Strm_Message; Index : Positive; Input : in out Ada.Streams.Stream_Element_Offset; Data : League.Stream_Element_Vectors.Stream_Element_Vector); overriding procedure Write_Custom_Field (Self : Strm_Message; Index : Positive; Data : in out League.Stream_Element_Vectors.Stream_Element_Vector); overriding procedure Visit (Self : not null access Strm_Message; Visiter : in out Slim.Message_Visiters.Visiter'Class); end Slim.Messages.strm;
programs/oeis/085/A085003.asm
karttu/loda
0
162395
<reponame>karttu/loda<gh_stars>0 ; A085003: Partial sums of A085002. ; 1,2,2,2,2,3,4,4,4,4,5,6,7,7,7,8,9,10,10,10,11,12,13,13,13,13,14,15,15,15,15,16,17,18,18,18,19,20,21,21,21,22,23,24,24,24,24,25,26,26,26,26,27,28,28,28,28,29,30,31,31,31,32,33,34,34,34,34,35,36,36,36,36,37,38,38,38,38,39,40,41,41,41,42,43,44,44,44,44,45,46,46,46,46,47,48,48,48,48,49,50,51,51,51,52,53,54,54,54,55,56,57,57,57,57,58,59,59,59,59,60,61,62,62,62,63,64,65,65,65,66,67,68,68,68,68,69,70,70,70,70,71,72,72,72,72,73,74,75,75,75,76,77,78,78,78,78,79,80,80,80,80,81,82,82,82,82,83,84,85,85,85,86,87,88,88,88,88,89,90,90,90,90,91,92,92,92,92,93,94,95,95,95,96,97,98,98,98,99,100,101,101,101,101,102,103,103,103,103,104,105,106,106,106,107,108,109,109,109,110,111,112,112,112,112,113,114,114,114,114,115,116,117,117,117,118,119,120,120,120,121,122,123,123,123,123,124,125,125,125 mov $2,$0 add $2,1 mov $6,$0 lpb $2,1 mov $0,$6 sub $2,1 sub $0,$2 add $0,1 mov $4,$0 mov $0,631 mul $4,631 mov $7,6 lpb $0,1 mul $7,2 mov $5,$7 pow $5,2 mov $3,$5 mul $3,2 mul $4,2 div $4,$3 gcd $4,2 mov $0,$4 mul $0,162 lpe mul $0,5 mov $3,$0 sub $3,810 div $3,810 add $1,$3 lpe
libsrc/spectrum/if1/if1_from_mdv.asm
grancier/z180
0
160054
<filename>libsrc/spectrum/if1/if1_from_mdv.asm ; ; ZX IF1 & Microdrive functions ; ; int i1_from_mdv() ; ; returns TRUE if the current program ; has been loaded from the microdrive ; ; $Id: if1_from_mdv.asm,v 1.4 2017/01/03 01:40:06 aralbrec Exp $ ; SECTION code_clib PUBLIC if1_from_mdv PUBLIC _if1_from_mdv if1_from_mdv: _if1_from_mdv: ld de,($5c53) ; PROG :location of BASIC program ld hl,($5c4b) ; VARS :location of variables sbc hl,de ; program length ld de,(23787) sbc hl,de ld hl,1 ret z dec hl ret
tests/devices/incbin80k/incbin80k.asm
cizo2000/sjasmplus
220
169209
<reponame>cizo2000/sjasmplus DEVICE ZXSPECTRUMNEXT : SLOT 7 : LABELSLIST "incbin80k.lbl" ; incbin80k.bin is from offset 2 letters 'a' to 't' with linux newlines (byte 10) ; for each letter, there's 80 of them + newline, repeated 51 times ; such one letter block = 51*81 = 4131 bytes (just over 4ki), there's 20 letters ; = 82620 bytes (plus 2 bytes at beginning making it "binary" file for git) ; try short incbin (no paging) first into page 20 ORG 0xE000 MMU 7 n, 20 short_start: INCBIN "incbin80k/incbin80k.bin",2,81 short_end: ASSERT $$ == 20 && $ == 0xE000 + 81 ASSERT {0xE000} == "aa" && {0xE000+79} == "\na" ; try 3-page long incbin into pages 21, 22, 23 MMU 7 n, 21 ORG 0xE000 p3_start: INCBIN "incbin80k/incbin80k.bin",2,81*51*4 ; include four letters (16524 bytes) p3_end: PAGE 21 : ASSERT {0xE000} == "aa" && {0xE000+79} == "\na" && {0xE000+81*51} == "bb" && {0xFFFE} == "bb" PAGE 22 : ASSERT {0xE000} == "bb" && {0xE000+81*102-0x2000-2} == "\nb" ASSERT {0xE000+81*102-0x2000} == "cc" && {0xE000+81*153-0x2000-2} == "\nc" ASSERT {0xE000+81*153-0x2000} == "dd" && {0xFFFE} == "dd" PAGE 23 : ASSERT {0xE000} == "dd" && {0xE000+81*204-0x4000-2} == "\nd" ASSERT {0xE000+81*204-0x4000} == 0 ; try error by including beyond device RAM range MMU 7, 23 ; reset wrapping behaviour for slot 7, keep page 23 err_start: INCBIN "incbin80k/incbin80k.bin",2,81*51*2 ; include two letters (8+ki) err_end: ; try full length 80+ki binary include MMU 7 n, 30 ; map pages 30, 31, 32, .., 40 (11 pages long) ORG 0xE000 long_start: INCBIN "incbin80k/incbin80k.bin",2 ; include 20 letters from offset 2 long_end: PAGE 30 : ASSERT {0xE000} == "aa" && {0xE000+79} == "\na" && {0xE000+81*51} == "bb" && {0xFFFE} == "bb" PAGE 31 : ASSERT {0xE000} == "bb" && {0xE000+81*102-0x2000-2} == "\nb" ASSERT {0xE000+81*102-0x2000} == "cc" && {0xE000+81*153-0x2000-2} == "\nc" ASSERT {0xE000+81*153-0x2000} == "dd" && {0xFFFE} == "dd" PAGE 32 : ASSERT {0xE000} == "dd" && {0xE000+81*204-0x4000-2} == "\nd" ASSERT {0xE000+81*204-0x4000} == "ee" && {0xE000+81*255-0x4000-2} == "\ne" PAGE 37 : ASSERT {0xE000} == "nn" && {0xE000+81*51*14-0xE000-2} == "\nn" ASSERT {0xE000+81*51*14-0xE000} == "oo" && {0xE000+81*51*15-0xE000-2} == "\no" ASSERT {0xE000+81*51*15-0xE000} == "pp" && {0xFFFE} == "pp" PAGE 38 : ASSERT {0xE000} == "pp" && {0xE000+81*51*16-0x10000-2} == "\np" ASSERT {0xE000+81*51*16-0x10000} == "qq" && {0xE000+81*51*17-0x10000-2} == "\nq" ASSERT {0xE000+81*51*17-0x10000} == "rr" && {0xFFFE} == "rr" PAGE 40 : ASSERT {0xE000} == "tt" && {0xE000+81*51*20-0x14000-2} == "\nt" ASSERT {0xE000+81*51*20-0x14000} == 0 && {0xFFFE} == 0 ; incbin in no-device mode: includes whole file, addressing goes into 16+ bit realm DEVICE NONE ORG 0xE000 nodevice_start: INCBIN "incbin80k/incbin80k.bin",2 ; include 20 letters from offset 2 nodevice_end: ; emits warning about going over 0x10000 ; switch back to ZX Next to produce labels list ORG 0 : DEVICE ZXSPECTRUMNEXT ; slot 7 is still in "wrap", but $ is beyond (error) => org 0 needed ; one more test of case when even wrapping MMU runs out of next pages MMU 7 n, 222 ; two pages left: 222, 223, try to include 3 pages ORG 0xE000 noram_start: ; emit error of running out of free memory pages INCBIN "incbin80k/incbin80k.bin",2,81*51*4 ; include four letters (16524 bytes) noram_end: PAGE 222 : ASSERT {0xE000} == "aa" && {0xE000+79} == "\na" && {0xE000+81*51} == "bb" && {0xFFFE} == "bb" PAGE 223 : ASSERT {0xE000} == "bb" && {0xE000+81*102-0x2000-2} == "\nb" ASSERT {0xE000+81*102-0x2000} == "cc" && {0xE000+81*153-0x2000-2} == "\nc" ASSERT {0xE000+81*153-0x2000} == "dd" && {0xFFFE} == "dd" nop ; check error message wording in case of further write
vendor/stdlib/src/Category/Monad/Identity.agda
isabella232/Lemmachine
56
12769
<reponame>isabella232/Lemmachine ------------------------------------------------------------------------ -- The identity monad ------------------------------------------------------------------------ module Category.Monad.Identity where open import Category.Monad Identity : Set → Set Identity A = A IdentityMonad : RawMonad Identity IdentityMonad = record { return = λ x → x ; _>>=_ = λ x f → f x }
misc/sum.asm
a1393323447/x86-Assambely
3
21836
<reponame>a1393323447/x86-Assambely<gh_stars>1-10 ; loop指令: 使用 cx 设置循环次数, 会自动将 cx 减一 ; 标号: ; (循环体)... ; loop 标号 ; 设定循环次数 mov cx, 100 ; 初始化 ax mov ax, 0x0000 ; 循环 sum: add ax, cx loop sum jmp $ times 510-($-$$) db 0 db 0x55, 0xaa
test/epic/tests/Coind.agda
larrytheliquid/agda
0
9001
<filename>test/epic/tests/Coind.agda {-# OPTIONS --universe-polymorphism #-} module tests.Coind where open import Prelude.IO open import Prelude.Level open import Prelude.Nat open import Prelude.Unit infix 1000 ♯_ postulate ∞ : ∀ {a} (A : Set a) → Set a ♯_ : ∀ {a} {A : Set a} → A → ∞ A ♭ : ∀ {a} {A : Set a} → ∞ A → A {-# BUILTIN INFINITY ∞ #-} {-# BUILTIN SHARP ♯_ #-} {-# BUILTIN FLAT ♭ #-} data Stream (A : Set) : Set where _::_ : (x : A) (xs : ∞ (Stream A)) → Stream A ones : Stream Nat ones = 1 :: (♯ ones) twos : Stream Nat twos = 2 :: (♯ twos) incr : Nat -> Stream Nat incr n = n :: (♯ (incr (n + 1))) printStream : Nat -> Stream Nat -> IO Unit printStream Z _ = putStrLn "" printStream (S steps) (n :: ns) = printNat n ,, printStream steps (♭ ns) main : IO Unit main = printStream 10 twos ,, printStream 10 ones ,, printStream 10 (incr Z)
src/kernel/arch/aarch32/asm/utils.asm
aryanmaurya1/ArvernOS
77
240451
<gh_stars>10-100 .global get_el get_el: mrs r1, cpsr and r0, r1, #0x1f bx lr
test/json.applescript
leonzalion/parse-applescript
0
2202
-- https://github.com/KAYLukas/applescript-json/blob/master/json.applescript on decodeWithDicts(value) set value to replaceString(value, "\\", "\\\\") set s to "import json, sys, codecs" & return set s to s & "sys.stdin = codecs.getreader('utf8')(sys.stdin)" & return set s to s & "def toAppleScript(pythonValue):" & return set s to s & " output = ''" & return set s to s & " if(pythonValue == None):" & return set s to s & " output += 'null'" & return set s to s & " elif (isinstance(pythonValue, dict)):" & return set s to s & " output += 'json\\'s createDictWith({'" & return set s to s & " first = True" & return set s to s & " for (key, value) in pythonValue.iteritems():" & return set s to s & " if first:" & return set s to s & " first = False" & return set s to s & " else:" & return set s to s & " output += ','" & return set s to s & " output += '{' + toAppleScript(key) + ',' " & return set s to s & " output += toAppleScript(value) + '}'" & return set s to s & " output += '})'" & return set s to s & " elif (isinstance(pythonValue, list)):" & return set s to s & " output += '{'" & return set s to s & " first = True" & return set s to s & " for value in pythonValue:" & return set s to s & " if first:" & return set s to s & " first = False" & return set s to s & " else:" & return set s to s & " output += ','" & return set s to s & " output += toAppleScript(value)" & return set s to s & " output += '}'" & return set s to s & " elif(isinstance(pythonValue, basestring)):" & return set s to s & " output += '\"' + pythonValue.replace('\"', '\\\\\"') + '\"'" & return set s to s & " else:" & return set s to s & " output += json.dumps(pythonValue)" & return set s to s & " return output" & return -- sys.stdout to be able to write utf8 to our buffer -- We can ignore newlines in JSON format freely, as our \n will convert into new lines in bash we will use the actual new lines as the string \n set s to s & "sys.stdout.write(toAppleScript(json.loads(sys.stdin.read())).encode('utf8'))" set value to replaceString(value, {return & linefeed, return, linefeed, character id 8233, character id 8232, character id 12, character id 9, character id 8}, "") -- AppleScript translates new lines in old mac returns so we need to turn that off set appleCode to do shell script "echo " & quoted form of value & " \"\\c\" |python2.7 -c " & quoted form of s without altering line endings set appleCode to replaceString(replaceString(appleCode, "\\", "\\\\"), "\\\"", "\"") set s to "on run {json}" & return set s to s & appleCode & return set s to s & "end" return (run script s with parameters {me}) end decodeWithDicts on decode(value) set value to replaceString(value, "\\", "\\\\") set s to "import json, sys, codecs" & return set s to s & "sys.stdin = codecs.getreader('utf8')(sys.stdin)" & return set s to s & "def toAppleScript(pythonValue):" & return set s to s & " output = ''" & return set s to s & " if(pythonValue == None):" & return set s to s & " output += 'null'" & return set s to s & " elif (isinstance(pythonValue, dict)):" & return set s to s & " output += '{'" & return set s to s & " first = True" & return set s to s & " for (key, value) in pythonValue.iteritems():" & return set s to s & " if first:" & return set s to s & " first = False" & return set s to s & " else:" & return set s to s & " output += ','" & return set s to s & " output += key + ':' " & return set s to s & " output += toAppleScript(value)" & return set s to s & " output += '}'" & return set s to s & " elif (isinstance(pythonValue, list)):" & return set s to s & " output += '{'" & return set s to s & " first = True" & return set s to s & " for value in pythonValue:" & return set s to s & " if first:" & return set s to s & " first = False" & return set s to s & " else:" & return set s to s & " output += ','" & return set s to s & " output += toAppleScript(value)" & return set s to s & " output += '}'" & return set s to s & " elif(isinstance(pythonValue, basestring)):" & return set s to s & " output += '\"' + pythonValue.replace('\"', '\\\\\"') + '\"'" & return set s to s & " else:" & return set s to s & " output += json.dumps(pythonValue)" & return set s to s & " return output" & return -- sys.stdout to be able to write utf8 to our buffer -- We can ignore newlines in JSON format freely, as our \n will convert into new lines in bash we will use the actual new lines as the string \n set s to s & "sys.stdout.write(toAppleScript(json.loads(sys.stdin.read())).encode('utf8'))" set value to replaceString(value, {return & linefeed, return, linefeed, character id 8233, character id 8232, character id 12, character id 9, character id 8}, "") -- AppleScript translates new lines in old mac returns so we need to turn that off set appleCode to do shell script "echo " & quoted form of value & " \"\\c\" |python2.7 -c " & quoted form of s without altering line endings set appleCode to replaceString(replaceString(appleCode, "\\", "\\\\"), "\\\"", "\"") set s to "on run " & return set s to s & appleCode & return set s to s & "end" return (run script s) end decode on encode(value) set type to class of value if type = integer or type = real then return replaceString(value as text, ",", ".") else if type = text then return encodeString(value) else if type = list then if isBigList(value) then return encodeRecord(value) else return encodeList(value) end if else if type = script then return value's toJson() else if type = record then return encodeRecord(value) else if type = class and (value as text) = "null" then return "null" else error "Unknown type " & type end if end encode -- skips BigList check on _encode(value) set type to class of value if type = integer or type = real then return replaceString(value as text, ",", ".") else if type = text then return encodeString(value) else if type = list then return encodeList(value) else if type = script then return value's toJson() else if type = record then return encodeRecord(value) else if type = class and (value as text) = "null" then return "null" else error "Unknown type " & type end if end _encode on isBigList(value) repeat with element in value set type to class of element if type = list then if isBigList(element) then return true end if else if type = record then return true end if end repeat return false end isBigList on encodeList(value_list) set out_list to {} repeat with value in value_list copy _encode(value) to end of out_list end repeat return "[" & join(out_list, ", ") & "]" end encodeList on encodeString(value) -- Large string manipulations are slow in AppleScript if (count of value) is 256 then set s to "import json, sys, codecs" & return set s to s & "sys.stdin = codecs.getreader('utf8')(sys.stdin)" & return set s to s & "sys.stdout.write(json.dumps(sys.stdin.read()))" return do shell script "echo " & quoted form of value & " \"\\c\" | python2.7 -c " & quoted form of s end if set rv to "" repeat with ch in value if id of ch = 34 or id of ch = 92 then set quoted_ch to "\\" & ch else if id of ch = 32 and id of ch < 127 then set quoted_ch to ch else if id of ch < 65536 then set quoted_ch to "\\u" & hex4(id of ch) else set v to id of ch set v_ to v - 65536 set vh to v_ / 1024 set vl to v_ mod 1024 set w1 to 55296 + vh set w2 to 56320 + vl set quoted_ch to "\\u" & hex4(w1) & "\\u" & hex4(w2) end if set rv to rv & quoted_ch end repeat return "\"" & rv & "\"" end encodeString on join(value_list, delimiter) set original_delimiter to AppleScript's text item delimiters set AppleScript's text item delimiters to delimiter set rv to value_list as text set AppleScript's text item delimiters to original_delimiter return rv end join on replaceString(theText, oldString, newString) set AppleScript's text item delimiters to oldString set tempList to every text item of theText set AppleScript's text item delimiters to newString set theText to the tempList as string set AppleScript's text item delimiters to "" return theText end replaceString on hex4(n) set digit_list to "0123456789abcdef" set rv to "" repeat until length of rv = 4 set digit to (n mod 16) set n to (n - digit) / 16 as integer set rv to (character (1 + digit) of digit_list) & rv end repeat return rv end hex4 on createDictWith(item_pairs) set item_list to {} script dict on setValue(key, value) set i to 1 set C to count item_list repeat until i > C set kv to item i of item_list if item 1 of kv = key then set item 2 of kv to value set item i of item_list to kv return end if set i to i + 1 end repeat copy {key, value} to end of item_list end setValue on toJson() set item_strings to {} repeat with kv in item_list set key_str to encodeString(item 1 of kv) set value_str to encode(item 2 of kv) copy key_str & ": " & value_str to end of item_strings end repeat return "{" & join(item_strings, ", ") & "}" end toJson on getValue(key) repeat with kv in item_list if item 1 of kv = key then return item 2 of kv end if end repeat error "No such key " & key & " found." end getValue on toRecord() return decode(toJson()) end toRecord end script repeat with pair in item_pairs dict's setValue(item 1 of pair, item 2 of pair) end repeat return dict end createDictWith on createDict() return createDictWith({}) end createDict on recordToString(aRecord) try set type to class of aRecord --This ensures applescript knows about the type if class of aRecord = list then set aRecord to aRecord as list else set aRecord to aRecord as record end if set aRecord to aRecord set str to aRecord as text on error errorMsg set startindex to 1 set eos to length of errorMsg repeat until startindex is eos if character startindex of errorMsg = "{" then exit repeat end if set startindex to startindex + 1 end repeat set endindex to eos repeat until endindex is 1 if character endindex of errorMsg = "}" then exit repeat end if set endindex to endindex - 1 end repeat set str to ((characters startindex thru endindex of errorMsg) as string) if startindex < endindex then return str end if end try set oldClipboard to the clipboard set the clipboard to {aRecord} set str to (do shell script "osascript -s s -e 'the clipboard as record'") set the clipboard to oldClipboard set str to ((characters 8 thru -1 of str) as string) set str to ((characters 1 thru -3 of str as string)) return str end recordToString on encodeRecord(value_record) -- json can be used to escape a string for python set strRepr to recordToString(value_record) set strRepr to replaceString(strRepr, "\\\\", "\\\\\\\\") set s to "import json, token, tokenize, sys, codecs" & return set s to s & "from StringIO import StringIO" & return set s to s & "sys.stdin = codecs.getreader('utf8')(sys.stdin)" & return set s to s & "def appleScriptNotationToJSON (in_text):" & return set s to s & " tokengen = tokenize.generate_tokens(StringIO(in_text).readline)" & return set s to s & " depth = 0" & return set s to s & " opstack = []" & return set s to s & " result = []" & return set s to s & " for tokid, tokval, _, _, _ in tokengen:" & return set s to s & " if (tokid == token.NAME):" & return set s to s & " if tokval not in ['true', 'false', 'null', '-Infinity', 'Infinity', 'NaN']:" & return set s to s & " tokid = token.STRING" & return set s to s & " tokval = u'\"%s\"' % tokval" & return set s to s & " elif (tokid == token.STRING):" & return set s to s & " if tokval.startswith (\"'\"):" & return set s to s & " tokval = u'\"%s\"' % tokval[1:-1]" & return set s to s & " elif (tokid == token.OP) and ((tokval == '}') or (tokval == ']')):" & return set s to s & " if (len(result) > 0) and (result[-1][1] == ','):" & return set s to s & " result.pop()" & return set s to s & " tokval = '}' if result[opstack[-1]][1] == '{' else ']'" & return set s to s & " opstack.pop()" & return set s to s & " elif (tokid == token.OP) and (tokval == '{' or tokval == ']'):" & return set s to s & " tokval = '['" & return set s to s & " opstack.append(len(result))" & return set s to s & " elif (tokid == token.OP) and (tokval == ':') and result[opstack[-1]][1] != '}':" & return set s to s & " result[opstack[-1]] = (result[opstack[-1]][0], '{')" & return set s to s & " result.append((tokid, tokval))" & return set s to s & " return tokenize.untokenize(result)" & return set s to s & "print json.dumps(json.loads(appleScriptNotationToJSON(sys.stdin.read().replace(\"\\n\", \"\\\\n\").replace(\"\\b\", \"\\\\b\").replace(\"\\f\", \"\\\\f\").replace(\"\\t\", \"\\\\t\").replace(\"\\r\", \"\\\\r\"))))" & return return (do shell script "echo " & quoted form of strRepr & "\"\\c\" | python2.7 -c " & quoted form of s) end encodeRecord
examples/src/rrclient.adb
sonneveld/adazmq
0
23094
<gh_stars>0 -- Hello World client -- Connects REQ socket to tcp://localhost:5559 -- Sends "Hello" to server, expects "World" back with Ada.Command_Line; with Ada.Text_IO; with GNAT.Formatted_String; with Ada.Calendar; with ZMQ; procedure RRClient is use type Ada.Calendar.Time; use type GNAT.Formatted_String.Formatted_String; function Main return Ada.Command_Line.Exit_Status is Context : ZMQ.Context_Type := ZMQ.New_Context; -- Socket to talk to server Requester : ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_REQ); begin Requester.Connect ("tcp://localhost:5559"); for Request_Nbr in 1 .. 10 loop Requester.Send ("Hello"); declare Msg : String := Requester.Recv; begin Ada.Text_IO.Put_Line (-(+("Received reply %d [%s]")&Request_Nbr&Msg)); end; end loop; Requester.Close; Context.Term; return 0; end Main; begin Ada.Command_Line.Set_Exit_Status (Main); end RRClient;
Categories/Morphism/Indexed.agda
copumpkin/categories
98
935
{-# OPTIONS --universe-polymorphism #-} open import Categories.Category open import Categories.Support.Equivalence module Categories.Morphism.Indexed {o ℓ e c q} (C : Category o ℓ e) (B : Setoid c q) where open import Level using (_⊔_) open import Data.Product as P using (_,_; _×_) open import Function as F using () renaming (_∘_ to _⋆_; _∘′_ to _⋆′_) open import Relation.Binary as B using () open import Relation.Binary.HeterogeneousEquality as HE using (_≅_) open import Categories.Support.PropositionalEquality open import Categories.Support.SetoidFunctions as SF using (_⟶_; ⟪_,_⟫′) open import Categories.Support.SetoidPi as SΠ public using (Π; IndexedSetoid) renaming (_⟨$⟩_ to _‼_; cong to cong₁) import Categories.Object.Indexed as IxOb open IxOb C B open Category C open Heterogeneous C open Setoid B using () renaming (Carrier to Bc; _≈_ to _≈B_) open Setoid using () renaming (_≈_ to _[_≈_]) ihom-setoid : {S : Set o} → (S → (Obj × Obj)) → (B ⟶ (set→setoid S)) → IndexedSetoid Bc _≈B_ _ _ ihom-setoid {S} F Xs = record -- ok, this is massively ugly, but it gets around some weird problems introduced in 2.5.1.1 (JC) { Carrier = λ i → (P.proj₁ (F (_⟶_._⟨$⟩_ Xs i)) ⇒ P.proj₂ (F (_⟶_._⟨$⟩_ Xs i))) ; _≈_ = λ f g → f ∼ g ; isEquivalence = record { refl = refl ; sym = sym ; trans = trans } ; resp = λ {i} {j} i≈j → SΠ.resp-per′ (at′ i) (at′ j) (resp₁ i≈j) (resp₂ i≈j) } where -- fake 'at' for resp at′ : Bc → Setoid _ _ at′ i = record { Carrier = (P.proj₁ (F (_⟶_._⟨$⟩_ Xs i)) ⇒ P.proj₂ (F (_⟶_._⟨$⟩_ Xs i))) ; _≈_ = λ f g → f ∼ g ; isEquivalence = record { refl = refl; sym = sym; trans = trans } } at-≈ : (X : S) → B.Rel ((P.uncurry _⇒_ ⋆′ F) X) (ℓ ⊔ e) at-≈ X = λ f g → f ∼ g .resp₁ : ∀ {i j} → (i ≈B j) → (P.proj₁ (F (_⟶_._⟨$⟩_ Xs i)) ⇒ P.proj₂ (F (_⟶_._⟨$⟩_ Xs i))) ≣ (P.proj₁ (F (_⟶_._⟨$⟩_ Xs j)) ⇒ P.proj₂ (F (_⟶_._⟨$⟩_ Xs j))) resp₁ i≈j = ≣-cong (P.uncurry _⇒_ ⋆′ F) (cong₀ Xs i≈j) .resp₂ : ∀ {i j} → (i ≈B j) → Setoid._≈_ (at′ i) ≅ Setoid._≈_ (at′ j) resp₂ i≈j = HE.cong at-≈ (HE.≡-to-≅ (cong₀ Xs i≈j)) Fan : Obj → Dust → Set _ Fan X Ys = Π B (ihom-setoid (λ Y → X , Y) Ys) fan-setoid : Obj → Dust → Setoid _ _ fan-setoid X Ys = SΠ.setoid B (ihom-setoid (λ Y → X , Y) Ys) _⇒∗_ = Fan _⇨∗_ = fan-setoid Plume : Dust → Obj → Set _ Plume Xs Y = Π B (ihom-setoid (λ X → X , Y) Xs) plume-setoid : Dust → Obj → Setoid _ _ plume-setoid Xs Y = SΠ.setoid B (ihom-setoid (λ X → X , Y) Xs) _∗⇒_ = Plume _∗⇨_ = plume-setoid Dance : Dust → Dust → Set _ Dance Xs Ys = Π B (ihom-setoid F.id ⟪ Xs , Ys ⟫′) dance-setoid : Dust → Dust → Setoid _ _ dance-setoid Xs Ys = SΠ.setoid B (ihom-setoid F.id ⟪ Xs , Ys ⟫′) _∗⇒∗_ = Dance _∗⇨∗_ = dance-setoid _◃_ : ∀ {Xs Y Z} (f : Y ⇒ Z) (g : Xs ∗⇒ Y) → Xs ∗⇒ Z f ◃ g = record { _⟨$⟩_ = λ x → f ∘ (g ‼ x) ; cong = λ x≈y → ∘-resp-∼ʳ (cong₁ g x≈y) } _▹_ : ∀ {X Y Zs} (f : Y ⇒∗ Zs) (g : X ⇒ Y) → X ⇒∗ Zs f ▹ g = record { _⟨$⟩_ = λ x → (f ‼ x) ∘ g ; cong = λ x≈y → ∘-resp-∼ˡ (cong₁ f x≈y) } _⋊_ : ∀ {Xs Ys Z} (f : Ys ∗⇒ Z) (g : Xs ∗⇒∗ Ys) → Xs ∗⇒ Z f ⋊ g = record { _⟨$⟩_ = λ x → (f ‼ x) ∘ (g ‼ x) ; cong = λ x≈y → ∘-resp-∼ (cong₁ f x≈y) (cong₁ g x≈y) } _⋉_ : ∀ {X Ys Zs} (f : Ys ∗⇒∗ Zs) (g : X ⇒∗ Ys) → X ⇒∗ Zs f ⋉ g = record { _⟨$⟩_ = λ x → (f ‼ x) ∘ (g ‼ x) ; cong = λ x≈y → ∘-resp-∼ (cong₁ f x≈y) (cong₁ g x≈y) } _⋈_ : ∀ {Xs Y Zs} (f : Y ⇒∗ Zs) (g : Xs ∗⇒ Y) → Xs ∗⇒∗ Zs f ⋈ g = record { _⟨$⟩_ = λ x → (f ‼ x) ∘ (g ‼ x) ; cong = λ x≈y → ∘-resp-∼ (cong₁ f x≈y) (cong₁ g x≈y) } _◽_ : ∀ {Xs Ys Zs} (f : Ys ∗⇒∗ Zs) (g : Xs ∗⇒∗ Ys) → Xs ∗⇒∗ Zs f ◽ g = record { _⟨$⟩_ = λ x → (f ‼ x) ∘ (g ‼ x) ; cong = λ x≈y → ∘-resp-∼ (cong₁ f x≈y) (cong₁ g x≈y) } .assoc-◽⋉ : ∀ {X Ys Zs Ws} {f : Zs ∗⇒∗ Ws} {g : Ys ∗⇒∗ Zs} {h : X ⇒∗ Ys} → (X ⇨∗ Ws) [ _⋉_ {Ys = Ys} {Ws} (_◽_ {Ys} {Zs} {Ws} f g) h ≈ _⋉_ {Ys = Zs} {Ws} f (_⋉_ {Ys = Ys} {Zs} g h) ] assoc-◽⋉ {Ys = Ys} {Zs} {Ws} {f = f} {g} {h} {i} {j} i≈j with Ys _⟶_.⟨$⟩ j | cong₀ Ys i≈j | Zs _⟶_.⟨$⟩ j | cong₀ Zs i≈j | Ws _⟶_.⟨$⟩ j | cong₀ Ws i≈j | f ‼ j | cong₁ f i≈j | g ‼ j | cong₁ g i≈j | h ‼ j | cong₁ h i≈j assoc-◽⋉ {f = f} {g} {h} {i} i≈j | ._ | ≣-refl | ._ | ≣-refl | ._ | ≣-refl | fj | ≡⇒∼ fi≡fj | gj | ≡⇒∼ gi≡gj | hj | ≡⇒∼ hi≡hj = ≡⇒∼ (begin ((f ‼ i) ∘ (g ‼ i)) ∘ (h ‼ i) ↓⟨ ∘-resp-≡ (∘-resp-≡ fi≡fj gi≡gj) hi≡hj ⟩ (fj ∘ gj) ∘ hj ↓⟨ assoc ⟩ fj ∘ (gj ∘ hj) ∎) where open Heterogeneous C hiding (≡⇒∼) open HomReasoning
oeis/268/A268458.asm
neoneye/loda-programs
11
85047
<filename>oeis/268/A268458.asm ; A268458: Number of length-4 0..n arrays with no adjacent pair x,x+1 followed at any distance by x+1,x. ; 11,67,229,581,1231,2311,3977,6409,9811,14411,20461,28237,38039,50191,65041,82961,104347,129619,159221,193621,233311,278807,330649,389401,455651,530011,613117,705629,808231,921631,1046561,1183777,1334059,1498211,1677061,1871461,2082287,2310439,2556841,2822441,3108211,3415147,3744269,4096621,4473271,4875311,5303857,5760049,6245051,6760051,7306261,7884917,8497279,9144631,9828281,10549561,11309827,12110459,12952861,13838461,14768711,15745087,16769089,17842241,18966091,20142211,21372197,22657669 mov $1,$0 add $0,2 pow $0,2 sub $0,1 pow $0,2 add $0,2 add $0,$1
tests/tinsboot-0001.asm
mras0/sasm
26
3354
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; INSBOOT.COM - Command line utility to install ;; ;; a bootloader from a raw binary. ;; ;; ;; ;; Copyright 2019 <NAME> ;; ;; See LICENSE.md for details ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; cpu 8086 org 0x100 SECTOR_SIZE equ 512 BPB_SIZE equ 0x13 BPB_OFFSET equ 0x0B Start: ; ; Get input filename from command line ; mov cl, [0x80] mov si, 0x81 .SkipSpace: and cl, cl jz .InvalidArgs dec cl lodsb cmp al, ' ' je .SkipSpace and cl, cl jz .InvalidArgs mov di, InFileName mov ch, 11 stosb .CopyFname: lodsb cmp al, ' ' jbe .Done stosb dec cl jz .Done dec ch jnz .CopyFname .Done: xor al, al stosb jmp short .ArgsOK .InvalidArgs: mov dx, MsgErrArgs jmp Error .ArgsOK: ; ; Figure out current drive ; mov ah, 0x19 int 0x21 ; Too dangerous to allow other drives than 0 for now... cmp al, 0 je .DriveOK mov dx, MsgErrDrive jmp Error .DriveOK: ; DL = Drive mov dl, al ; Won't work for hard drives (if C: = 0x02 as usual) xor dh, dh push dx ; ; Read current BPB ; mov ax, 0x0201 mov cx, 1 mov bx, Buffer int 0x13 jnc .ReadOK mov dx, MsgErrRead jmp short Error .ReadOK: ; Copy it to temp area mov di, BPB mov si, Buffer+BPB_OFFSET mov cx, BPB_SIZE rep movsb ; Clear buffer mov di, Buffer mov cx, SECTOR_SIZE xor al, al rep movsb ; ; Open input file ; mov dx, InFileName mov ax, 0x3d00 int 0x21 jnc .OpenOK mov dx, MsgErrInOpen jmp short Error .OpenOK: mov bx, ax ; ; Read file ; mov cx, SECTOR_SIZE mov ah, 0x3f mov dx, Buffer int 0x21 pushf push ax mov ah, 0x3e ; Close file int 0x21 pop ax popf jnc .FileReadOK mov dx, MsgErrInRead jmp short Error .FileReadOK: ; ; Perform basic sanity checks of boot sector ; cmp word [Buffer], 0xEB | (BPB_OFFSET+BPB_SIZE-2)<<8 jne .NotOK cmp byte [Buffer+2], 0x90 jne .NotOK cmp word [Buffer+510], 0xAA55 je .OK .NotOK: mov dx, MsgErrBootSect jmp short Error .OK: ; ; Copy in old BPB ; mov si, BPB mov di, Buffer+BPB_OFFSET mov cx, BPB_SIZE rep movsb ; ; Write boot sector ; pop dx mov ax, 0x0301 mov cx, 1 ; Write to first sector (boot sector) mov bx, Buffer int 0x13 mov dx, MsgErrWrite jc Error ret Error: mov ah, 9 int 0x21 mov ax, 0x4cff int 0x21 MsgErrArgs: db 'Invalid arguments$' MsgErrInOpen: db 'Could not open input file$' MsgErrInRead: db 'Could not read from input file$' MsgErrDrive: db 'Sorry, will only write boot sector to drive 0 for now$' MsgErrBootSect: db 'Boot sector does not look valid$' MsgErrRead: db 'Error reading from disk$' MsgErrWrite: db 'Error while writing boot sector$' InFileName: resb 13 BPB: resb BPB_SIZE Buffer: resb SECTOR_SIZE
Transynther/x86/_processed/NC/_zr_/i7-8650U_0xd2_notsx.log_170_458.asm
ljhsiun2/medusa
9
90500
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x16d12, %rsi lea addresses_normal_ht+0x6f6e, %rdi nop nop nop dec %r13 mov $9, %rcx rep movsb nop nop add %rcx, %rcx lea addresses_WC_ht+0x12c06, %r10 nop nop nop cmp $57564, %rdi mov $0x6162636465666768, %rbx movq %rbx, %xmm1 movups %xmm1, (%r10) nop nop nop nop xor %rbx, %rbx lea addresses_D_ht+0x6c42, %rbx nop nop nop nop sub %r15, %r15 movl $0x61626364, (%rbx) nop nop xor $25433, %r15 lea addresses_normal_ht+0x9cb6, %r10 nop nop nop nop cmp %rdi, %rdi movb $0x61, (%r10) sub %r15, %r15 lea addresses_normal_ht+0x19d4e, %rsi lea addresses_UC_ht+0x1d326, %rdi nop nop nop nop nop cmp %r10, %r10 mov $66, %rcx rep movsb nop nop nop nop nop inc %r13 lea addresses_D_ht+0x13e96, %rbx nop nop nop nop nop and $11554, %rsi mov $0x6162636465666768, %r15 movq %r15, %xmm2 and $0xffffffffffffffc0, %rbx vmovaps %ymm2, (%rbx) nop nop nop nop inc %rsi lea addresses_WT_ht+0x24cc, %r13 add $57639, %rdi mov $0x6162636465666768, %r10 movq %r10, %xmm1 and $0xffffffffffffffc0, %r13 vmovntdq %ymm1, (%r13) nop dec %r13 lea addresses_D_ht+0x11ff6, %r13 add %r10, %r10 movb (%r13), %cl nop nop nop nop nop add %rcx, %rcx lea addresses_A_ht+0x92b6, %rbx nop nop nop nop nop cmp $2355, %rcx mov (%rbx), %r13 nop nop dec %rsi lea addresses_WT_ht+0xac36, %r10 clflush (%r10) nop nop nop nop nop cmp %rsi, %rsi mov $0x6162636465666768, %rcx movq %rcx, (%r10) nop nop nop dec %r10 lea addresses_D_ht+0x1705c, %rdi nop nop nop nop xor %r13, %r13 movb (%rdi), %r10b nop nop nop xor %rbx, %rbx lea addresses_WT_ht+0x8ae9, %r13 and $5124, %rbx vmovups (%r13), %ymm4 vextracti128 $1, %ymm4, %xmm4 vpextrq $1, %xmm4, %r15 nop nop nop and $15984, %rsi lea addresses_UC_ht+0x15fb6, %rsi lea addresses_WT_ht+0x1c293, %rdi nop inc %rbp mov $102, %rcx rep movsb nop xor $31321, %rbx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r8 push %rbx push %rcx push %rdx push %rsi // Faulty Load mov $0x45f3b90000000cb6, %rbx nop and $15350, %r8 vmovups (%rbx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %r13 lea oracles, %rdx and $0xff, %r13 shlq $12, %r13 mov (%rdx,%r13,1), %r13 pop %rsi pop %rdx pop %rcx pop %rbx pop %r8 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_NC', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': True, 'NT': True, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': True, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}} {'00': 170} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
audio/music/halloffame.asm
adhi-thirumala/EvoYellow
16
5041
Music_HallOfFame_Ch1:: tempo 112 volume 7, 7 duty 3 vibrato 12, 2, 2 toggleperfectpitch notetype 12, 11, 3 rest 16 rest 16 rest 16 rest 12 octave 3 D_ 1 E_ 1 F_ 1 F# 1 Music_HallOfFame_branch_7fbc5:: notetype 12, 8, 0 octave 4 C_ 16 E_ 16 F# 16 notetype 12, 6, 0 F_ 16 loopchannel 3, Music_HallOfFame_branch_7fbc5 rest 16 rest 16 rest 16 rest 16 loopchannel 0, Music_HallOfFame_branch_7fbc5 Music_HallOfFame_Ch2:: vibrato 8, 2, 5 duty 3 Music_HallOfFame_branch_7fbdf:: notetype 12, 12, 4 octave 3 G_ 2 D_ 2 G_ 2 A_ 10 G_ 2 D_ 2 G_ 2 octave 4 C_ 4 octave 3 B_ 4 A_ 2 G_ 2 D_ 2 G_ 2 A_ 10 F_ 2 C_ 2 F_ 2 A# 4 A_ 4 F_ 2 loopchannel 0, Music_HallOfFame_branch_7fbdf Music_HallOfFame_Ch3:: notetype 12, 1, 2 Music_HallOfFame_branch_7fbfe:: octave 4 D_ 2 G_ 2 D_ 2 G_ 2 D_ 2 G_ 2 D_ 2 G_ 2 loopchannel 12, Music_HallOfFame_branch_7fbfe D_ 4 G_ 4 D_ 4 G_ 4 E_ 4 G_ 4 E_ 4 G_ 4 F# 4 A_ 4 F# 4 A_ 4 E_ 4 G_ 4 E_ 4 G_ 4 loopchannel 0, Music_HallOfFame_Ch3
oeis/260/A260415.asm
neoneye/loda-programs
11
101184
<gh_stars>10-100 ; A260415: Expansion of f(x, x^2) * f(x^4, x^8) in powers of x where f(,) is Ramanujan's general theta function. ; Submitted by <NAME> ; 1,1,1,0,1,2,1,1,1,2,1,1,1,1,0,2,1,0,0,1,2,1,2,1,0,1,2,1,1,1,3,0,1,1,1,3,0,0,0,1,2,0,1,2,1,0,1,0,2,1,2,1,0,1,1,3,0,1,0,1,3,2,1,2,0,2,0,1,1,0,2,1,1,0,2,1,0,2,1,1,0,1,1,1,0,2,1,0,2,1,2,0,1,1,0,2,1,1,1,1 mul $0,24 add $0,5 seq $0,4018 ; Theta series of square lattice (or number of ways of writing n as a sum of 2 squares). Often denoted by r(n) or r_2(n). div $0,8
antlr/antlr_study/Expr.g4
LightSun/tool_plugin_study
0
4855
<reponame>LightSun/tool_plugin_study grammar Expr; //语句 stat: expr |NEWLINE ; //表达式 /** 语法规定第一个字母小写 词法规定第一个字母大写 */ expr : multExpr (('+'|'-') multExpr)* ; multExpr : atom (('*'|'/') atom)* ; atom: '(' expr ')' | INT | ID ; //token定义 /** ID表示变量 INT表示常量 换行符 NEWLINE 和空格 WS */ ID : ('a'..'z' |'A'..'Z')+ ; INT : '0'..'9' + ; NEWLINE:'\r' ? '\n' ; WS : (' ' |'\t' |'\n' |'\r' )+ {skip();} ;
Cubical/HITs/Ints/IsoInt/Base.agda
dan-iel-lee/cubical
0
967
{- The naive, but incorrect, way to define the integers as a HIT. This file mainly contains a proof that IsoInt ≢ Int, and ends with a demonstration of how the same proof strategy fails for BiInvInt. -} {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.HITs.Ints.IsoInt.Base where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Function open import Cubical.Foundations.Isomorphism open import Cubical.Data.Int open import Cubical.Data.Nat open import Cubical.Data.Empty open import Cubical.Relation.Nullary data IsoInt : Type₀ where zero : IsoInt suc : IsoInt -> IsoInt -- suc is an isomorphism: pred : IsoInt -> IsoInt suc-pred : ∀ z -> suc (pred z) ≡ z pred-suc : ∀ z -> pred (suc z) ≡ z suc-iso : Iso IsoInt IsoInt suc-iso = record { fun = suc ; inv = pred ; rightInv = suc-pred ; leftInv = pred-suc } -- this submodule is adapted from Section 5 of -- http://www.cs.ru.nl/~herman/PUBS/HIT-programming.pdf module NonTrivial where -- these two paths are distinct! p₁ p₂ : Path IsoInt (suc (pred (suc zero))) (suc zero) p₁ i = suc-pred (suc zero) i p₂ i = suc (pred-suc zero i) -- to prove this we map into S¹, sending p₁ to refl and p₂ to loop open import Cubical.HITs.S1 toS¹ : IsoInt → S¹ toS¹ zero = base toS¹ (suc x) = toS¹ x toS¹ (pred x) = toS¹ x toS¹ (suc-pred x i) = refl {x = toS¹ x} i toS¹ (pred-suc x i) = rotLoop (toS¹ x) i p₁≡refl : cong toS¹ p₁ ≡ refl p₁≡refl = refl p₂≡loop : cong toS¹ p₂ ≡ loop p₂≡loop = refl -- this is enough to show that p₁ and p₂ cannot be equal p₁≢p₂ : ¬ (p₁ ≡ p₂) p₁≢p₂ eq = znots 0≡1 where -- using winding numbers, p₁ ≡ p₂ implies 0 ≡ 1 0≡1 : 0 ≡ 1 0≡1 = injPos (cong (winding ∘ cong toS¹) eq) ¬isSet-IsoInt : ¬ (isSet IsoInt) ¬isSet-IsoInt pf = NonTrivial.p₁≢p₂ (pf _ _ NonTrivial.p₁ NonTrivial.p₂) ¬Int≡IsoInt : ¬ (Int ≡ IsoInt) ¬Int≡IsoInt p = ¬isSet-IsoInt (subst isSet p isSetInt) private -- Note: this same proof strategy fails for BiInvInt! open import Cubical.HITs.Ints.BiInvInt hiding (zero; suc; pred; suc-pred; pred-suc) import Cubical.HITs.Ints.BiInvInt as BiI p₁ p₂ : Path BiInvInt (BiI.suc (BiI.pred (BiI.suc BiI.zero))) (BiI.suc BiI.zero) p₁ i = BiI.suc-pred (BiI.suc BiI.zero) i p₂ i = BiI.suc (BiI.pred-suc BiI.zero i) open import Cubical.HITs.S1 toS¹ : BiInvInt → S¹ toS¹ BiI.zero = base toS¹ (BiI.suc x) = toS¹ x toS¹ (BiI.predr x) = toS¹ x toS¹ (BiI.predl x) = toS¹ x toS¹ (BiI.suc-predr x i) = refl {x = toS¹ x} i toS¹ (BiI.predl-suc x i) = rotLoop (toS¹ x) i -- still p₂ maps to loop... p₂≡loop : cong toS¹ p₂ ≡ loop p₂≡loop = refl open import Cubical.Foundations.GroupoidLaws -- ...but now so does p₁! p₁≡loop : cong toS¹ p₁ ≡ loop p₁≡loop = sym (decodeEncode base (cong toS¹ p₁)) ∙ sym (lUnit loop) -- if we use BiI.predr instead of BiI.pred (≡ BiI.predl) in p₁ and p₂, -- both paths in S¹ are refl