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 |
|---|---|---|---|---|
Micrium-Probe-TargetCode-410/Micrium/Software/uC-CPU/ARM-Cortex-M0/RealView/cpu_a.asm | cos12a/GPUTFT | 0 | 19376 | ;********************************************************************************************************
; uC/CPU
; CPU CONFIGURATION & PORT LAYER
;
; (c) Copyright 2004-2015; Micrium, Inc.; Weston, FL
;
; All rights reserved. Protected by international copyright laws.
;
; uC/CPU is provided in source form to registered licensees ONLY. It is
; illegal to distribute this source code to any third party unless you receive
; written permission by an authorized Micrium representative. Knowledge of
; the source code may NOT be used to develop a similar product.
;
; Please help us continue to provide the Embedded community with the finest
; software available. Your honesty is greatly appreciated.
;
; You can find our product's user manual, API reference, release notes and
; more information at https://doc.micrium.com.
; You can contact us at www.micrium.com.
;********************************************************************************************************
;********************************************************************************************************
;
; CPU PORT FILE
;
; ARM-Cortex-M0
; RealView Development Suite
; RealView Microcontroller Development Kit (MDK)
; ARM Developer Suite (ADS)
; Keil uVision
;
; Filename : cpu_a.asm
; Version : V1.30.02.00
; Programmer(s) : BAN
; MD
;********************************************************************************************************
;********************************************************************************************************
; PUBLIC FUNCTIONS
;********************************************************************************************************
EXPORT CPU_IntDis
EXPORT CPU_IntEn
EXPORT CPU_SR_Save
EXPORT CPU_SR_Restore
EXPORT CPU_WaitForInt
EXPORT CPU_WaitForExcept
;********************************************************************************************************
; CODE GENERATION DIRECTIVES
;********************************************************************************************************
AREA |.text|, CODE, READONLY, ALIGN=2
THUMB
REQUIRE8
PRESERVE8
;********************************************************************************************************
; DISABLE and ENABLE INTERRUPTS
;
; Description : Disable/Enable interrupts.
;
; Prototypes : void CPU_IntDis(void);
; void CPU_IntEn (void);
;********************************************************************************************************
CPU_IntDis
CPSID I
BX LR
CPU_IntEn
CPSIE I
BX LR
;********************************************************************************************************
; CRITICAL SECTION FUNCTIONS
;
; Description : Disable/Enable interrupts by preserving the state of interrupts. Generally speaking, the
; state of the interrupt disable flag is stored in the local variable 'cpu_sr' & interrupts
; are then disabled ('cpu_sr' is allocated in all functions that need to disable interrupts).
; The previous interrupt state is restored by copying 'cpu_sr' into the CPU's status register.
;
; Prototypes : CPU_SR CPU_SR_Save (void);
; void CPU_SR_Restore(CPU_SR cpu_sr);
;
; Note(s) : (1) These functions are used in general like this :
;
; void Task (void *p_arg)
; {
; CPU_SR_ALLOC(); /* Allocate storage for CPU status register */
; :
; :
; CPU_CRITICAL_ENTER(); /* cpu_sr = CPU_SR_Save(); */
; :
; :
; CPU_CRITICAL_EXIT(); /* CPU_SR_Restore(cpu_sr); */
; :
; }
;********************************************************************************************************
CPU_SR_Save
MRS R0, PRIMASK ; Set prio int mask to mask all (except faults)
CPSID I
BX LR
CPU_SR_Restore ; See Note #2.
MSR PRIMASK, R0
BX LR
;********************************************************************************************************
; WAIT FOR INTERRUPT
;
; Description : Enters sleep state, which will be exited when an interrupt is received.
;
; Prototypes : void CPU_WaitForInt (void)
;
; Argument(s) : none.
;********************************************************************************************************
CPU_WaitForInt
WFI ; Wait for interrupt
BX LR
;********************************************************************************************************
; WAIT FOR EXCEPTION
;
; Description : Enters sleep state, which will be exited when an exception is received.
;
; Prototypes : void CPU_WaitForExcept (void)
;
; Argument(s) : none.
;********************************************************************************************************
CPU_WaitForExcept
WFE ; Wait for exception
BX LR
;********************************************************************************************************
; CPU ASSEMBLY PORT FILE END
;********************************************************************************************************
END
|
scroll.asm | NotExactlySiev/psychofloat | 1 | 101527 | <gh_stars>1-10
UpdateScroll: subroutine
; scrolls if the character passes a threshhold distance from the bottom or top of the screen
lda #SCREEN_HEIGHT-SCROLL_THOLD
cmp py0
bcc .scrolldown
lda py0
cmp #SCROLL_THOLD
bcc .scrollup
jmp .scrollover
.scrolldown
lda scroll
cmp #240
beq .scrollover
lda py0
sec
sbc #SCREEN_HEIGHT-SCROLL_THOLD
sta func0
clc
adc scroll
cmp #241
bcc .noverflow
lda #240
sec
sbc scroll
sta func0
.noverflow
jmp Scroll
.scrollup
lda scroll
beq .scrollover
lda py0
sec
sbc #SCROLL_THOLD
sta func0
clc
adc scroll
bpl .nunderflow
bcs .nunderflow ; sometimes scroll > $80 in which case a second check is needed
lda #0
sec
sbc scroll
sta func0
.nunderflow
Scroll:
lda func0
beq .scrolldone ; don't do calculation if disposition is 0
clc
adc scroll
sta scroll
lda py0+BACKUP_OFFSET
sec
sbc func0
sta py0+BACKUP_OFFSET
lda hookpy
sec
sbc func0
sta hookpy
lda py0
sec
sbc func0
sta py0
.scrolldone
jsr UpdateSprites
.scrollover
rts |
src/99-devRoom/enterprise-baron-to-corneria.asm | chaoshades/snes-ffci | 0 | 27466 | org $00CD4D ; Routine to hack
LDX #$A698 ; Corneria's landing zone
STX $1721 ; Place the airship at the landing zone
skip 2 ; Skip to $00CD55
STA $1720 ; Make the airship visible |
src/main.asm | gb-archive/waveform-gb | 0 | 245003 | INCLUDE "constants.asm"
KNOB_BASE_TILE EQU 0
KNOB_TRACK_TILE EQU 1
KNOB_LEFT_TILE EQU 2
KNOB_RIGHT_TILE EQU 3
KNOB_BOTH_TILE EQU 4
KNOB_START_X EQU 2
KNOB_START_Y EQU 1
NUM_COLUMNS EQU WAVE_SIZE
NUM_ROWS EQU 1 << BITS_PER_WAVE_SAMPLE
KNOB_HEIGHT EQU 1
KNOB_WIDTH EQU 5
NUMBER_X EQU (KNOB_START_X) - 1
NUMBER_Y EQU KNOB_START_Y
FONT_BASE_TILE EQU $20
FONT_HEIGHT EQU 6
FONT_WIDTH EQU 16
HEX_BASE_TILE EQU $10
HEX_X EQU KNOB_START_X
HEX_Y EQU KNOB_START_Y + NUM_ROWS
HEX_HEIGHT EQU 1
HEX_WIDTH EQU 16
ARROW_TILE EQU 0
ARROW_X EQU 8 * KNOB_START_X + 6
ARROW_Y EQU 8 * (KNOB_START_Y + 1)
ARROW_HEIGHT EQU 1
ARROW_WIDTH EQU 4
MIN_ARROW_POS EQU 0
MAX_ARROW_POS EQU (NUM_WAVE_SAMPLES) - 1
SECTION "Main WRAM", WRAM0
wWave:: ds WAVE_SIZE
wWaveSlot:: ds 1
wCursorPos: ds 1
wKnobColumn: ds NUM_ROWS
wHexTiles: ds BYTES_PER_TILE * HEX_WIDTH
wNewHexTile: ds BYTES_PER_TILE
SECTION "Main", ROM0
Main::
call Setup
.loop
call WaitVBlank
call Update
jr .loop
Update:
call Joypad
ld c, 0
ld a, [wCursorPos]
jbz 0, .even
ld c, 1
.even
srl a
ldr de, a
ld hl, wWave
add hl, de
ld a, [wJoyPressed]
je D_UP, .pressedUp
je D_DOWN, .pressedDown
je D_LEFT, .pressedLeft
je D_RIGHT, .pressedRight
je START, .pressedStart
ret
.pressedUp
ld a, [hl]
jb 0, c, .skipOdd1
swap a ; skip for odd knobs
.skipOdd1
and $0F
je $F, .isMax
inc a
jb 0, c, .skipOdd2
swap a ; skip for odd knobs
.skipOdd2
ld b, a
ld a, [hl]
jb 0, c, .skipOdd3
and $0F ; for even knobs
jr .skipEven1
.skipOdd3
and $F0 ; for odd knobs
.skipEven1
or b
ld [hl], a
jr .afterWaveChange
.isMax
ret
.pressedDown
ld a, [hl]
jb 0, c, .skipOdd4
swap a ; skip for odd knobs
.skipOdd4
and $0F
jz .isMin
dec a
jb 0, c, .skipOdd5
swap a ; skip for odd knobs
.skipOdd5
ld b, a
ld a, [hl]
jb 0, c, .skipOdd6
and $0F ; for even knobs
jr .skipEven2
.skipOdd6
and $F0 ; for odd knobs
.skipEven2
or b
ld [hl], a
jr .afterWaveChange
.isMin
ret
.afterWaveChange
call UpdateKnobTilemap_Defer
call UpdateHexTile_Defer
call UpdateWave
call PlayNote
ret
.pressedLeft
ld a, [wCursorPos]
dec a
jne (MIN_ARROW_POS) - 1, .noUnderflow
ld a, MAX_ARROW_POS
.noUnderflow
ld [wCursorPos], a
ld d, a
ld e, 4
call Multiply
ld bc, ARROW_X
add hl, bc
put [wOAM + 1], l
ret
.pressedRight
ld a, [wCursorPos]
inc a
jne MAX_ARROW_POS + 1, .noOverflow
ld a, MIN_ARROW_POS
.noOverflow
ld [wCursorPos], a
ld d, a
ld e, 4
call Multiply
ld bc, ARROW_X
add hl, bc
put [wOAM + 1], l
ret
.pressedStart
ld a, [wCursorPos]
jle 8, .noHide
; push arrow oam data
ld a, [wOAM + 0]
push af
ld a, [wOAM + 1]
push af
put [wOAM + 0], 0
put [wOAM + 1], 0
.noHide
put [wOAM + 2], 2
ld hl, StartMenuOptions
xor a
call OpenMenu
ld a, [wCursorPos]
jle 8, .noShow
; pop arrow oam data
pop af
ld [wOAM + 1], a
pop af
ld [wOAM + 0], a
.noShow
put [wOAM + 2], 0
ret
StartMenuOptions:
dw SaveLabel, SaveAction
dw LoadLabel, LoadAction
dw DefaultsLabel, DefaultsAction
dw CancelLabel, CancelAction
dw 0
SaveLabel:
db "Save...", 0
SaveAction:
ld hl, SaveMenuOptions
ld a, [wWaveSlot]
scf
call OpenMenu
je -1, .cancelled
ld [wWaveSlot], a
.cancelled
ret
LoadLabel:
db "Load...", 0
LoadAction:
ld hl, LoadMenuOptions
ld a, [wWaveSlot]
scf
call OpenMenu
je -1, .cancelled
ld [wWaveSlot], a
.cancelled
ret
DefaultsLabel:
db "Defaults...", 0
DefaultsAction:
ld hl, DefaultsMenuOptions
xor a
call OpenMenu
je -1, .cancelled
call LoadDefaultAction
.cancelled
ret
RefreshWave:
call WaitForCallbacks
ld a, [wCursorPos]
push af
put [wCursorPos], 0
ld c, NUM_COLUMNS
.refreshLoop
push bc
call UpdateKnobTilemap_Defer
call UpdateHexTile_Defer
call WaitForCallbacks
ld a, [wCursorPos]
add 2
ld [wCursorPos], a
pop bc
dec c
jr nz, .refreshLoop
pop af
ld [wCursorPos], a
ret
CancelLabel:
db "Cancel", 0
CancelAction:
ret
SaveMenuOptions:
dw Wave1Label, SaveWaveAction
dw Wave2Label, SaveWaveAction
dw Wave3Label, SaveWaveAction
dw Wave4Label, SaveWaveAction
dw Wave5Label, SaveWaveAction
dw Wave6Label, SaveWaveAction
dw Wave7Label, SaveWaveAction
dw Wave8Label, SaveWaveAction
; dw CancelLabel, CancelAction
dw 0
Wave1Label:
db "Wave 1", 0
Wave2Label:
db "Wave 2", 0
Wave3Label:
db "Wave 3", 0
Wave4Label:
db "Wave 4", 0
Wave5Label:
db "Wave 5", 0
Wave6Label:
db "Wave 6", 0
Wave7Label:
db "Wave 7", 0
Wave8Label:
db "Wave 8", 0
SaveWaveAction:
call SaveSAV
ret
LoadMenuOptions:
dw Wave1Label, LoadWaveAction
dw Wave2Label, LoadWaveAction
dw Wave3Label, LoadWaveAction
dw Wave4Label, LoadWaveAction
dw Wave5Label, LoadWaveAction
dw Wave6Label, LoadWaveAction
dw Wave7Label, LoadWaveAction
dw Wave8Label, LoadWaveAction
; dw CancelLabel, CancelAction
dw 0
LoadWaveAction:
call LoadSAV
call UpdateWave
call RefreshWave
call PlayNote
ret
DefaultsMenuOptions:
dw Default1Label, LoadDefaultAction
dw Default2Label, LoadDefaultAction
dw Default3Label, LoadDefaultAction
dw Default4Label, LoadDefaultAction
dw Default5Label, LoadDefaultAction
dw Default6Label, LoadDefaultAction
dw Default7Label, LoadDefaultAction
dw Default8Label, LoadDefaultAction
; dw CancelLabel, CancelAction
dw 0
Default1Label:
db "Triangle", 0
Default2Label:
db "Sawtooth", 0
Default3Label:
db "50% Square", 0
Default4Label:
db "Sine", 0
Default5Label:
db "Sine Saw", 0
Default6Label:
db "Double Saw", 0
Default7Label:
db "Arrow 1", 0
Default8Label:
db "Arrow 2", 0
LoadDefaultAction:
call LoadDefaultWave
call RefreshWave
call PlayNote
ret
UpdateWave:
ld hl, wWave
call LoadWave
ret
Setup:
call InitSound
put [wWaveSlot], 0
call LoadSAV
call UpdateWave
call DisableLCD
ld bc, KnobGraphics
ld de, vChars2 + KNOB_BASE_TILE * BYTES_PER_TILE
ld a, KNOB_WIDTH * KNOB_HEIGHT
call LoadGfx
ld bc, HexGraphics
ld de, wHexTiles
ld a, HEX_WIDTH * HEX_HEIGHT
call LoadGfx
ld bc, FontGraphics
ld de, vChars2 + FONT_BASE_TILE * BYTES_PER_TILE
ld a, FONT_WIDTH * FONT_HEIGHT
call LoadGfx
ld bc, ArrowsGraphics
ld de, vChars0 + ARROW_TILE * BYTES_PER_TILE
ld a, ARROW_WIDTH * ARROW_HEIGHT
call LoadGfx
put [wCursorPos], 0
REPT NUM_COLUMNS
call UpdateKnobTilemap
call UpdateHexTile
ld a, [wCursorPos]
add 2
ld [wCursorPos], a
ENDR
put [wCursorPos], MIN_ARROW_POS
call DrawNumberTilemap
ld hl, vBGMap0 + BG_WIDTH * HEX_Y + HEX_X
ld a, HEX_BASE_TILE
REPT NUM_COLUMNS
ld [hli], a
inc a
ENDR
ld hl, wOAM
put [hli], ARROW_Y
put [hli], ARROW_X + MIN_ARROW_POS * 4
put [hli], ARROW_TILE
put [hli], $00
call SetPalette
call EnableLCD
call PlayNote
ret
; update knob tilemap and copy to vram immediately
UpdateKnobTilemap:
call UpdateKnobTilemap_
call CopyKnobTilemap
ret
; update knob tilemap and copy to vram on vblank
UpdateKnobTilemap_Defer:
call UpdateKnobTilemap_
callback CopyKnobTilemap
ret
; update knob tilemap by updating the current column
; clear the column, then place the left and right knob
; use KNOB_BOTH_TILE if both knobs have same value
UpdateKnobTilemap_:
ld hl, wKnobColumn
ld a, KNOB_TRACK_TILE
REPT NUM_ROWS
ld [hli], a
ENDR
ld a, [wCursorPos]
srl a
ldr bc, a
ld hl, wWave
add hl, bc
ld a, [hl]
ld b, a
and $0F
push af
ld a, b
swap a
and $0F
ld b, a
ld a, $0F
sub b
ld d, a ; backup
ldr bc, a
ld hl, wKnobColumn
add hl, bc
ld [hl], KNOB_LEFT_TILE
pop af
ld b, a
ld a, $0F
sub b
ldr bc, a
ld hl, wKnobColumn
add hl, bc
ld [hl], KNOB_RIGHT_TILE
jne d, .different
ld [hl], KNOB_BOTH_TILE
.different
ret
; copy the updated knob column to vram
CopyKnobTilemap:
ld a, [wCursorPos]
srl a
ldr bc, a
ld hl, vBGMap0 + BG_WIDTH * KNOB_START_Y + KNOB_START_X
add hl, bc
ld de, wKnobColumn
ld bc, BG_WIDTH
REPT NUM_ROWS
put [hl], [de]
add hl, bc
inc de
ENDR
ret
; update hex digit tile and copy to vram immediately
UpdateHexTile:
call UpdateHexTile_
call CopyHexTile
ret
; update hex digit tile and copy to vram on vblank
UpdateHexTile_Defer:
call UpdateHexTile_
callback CopyHexTile
ret
; update hex digit tile by using the values of the left
; and right knob of the current column
UpdateHexTile_:
ld a, [wCursorPos]
srl a
ldr bc, a
ld hl, wWave
add hl, bc
ld a, [hl]
push af
and $F0
ld b, a
pop af
and $0F
swap a
ld hl, wHexTiles
ldr de, a
add hl, de
push hl
pop de
ld a, b
ld hl, wHexTiles
ldr bc, a
add hl, bc
push hl
pop bc
; combine tiles at bc and de
; left half of tile at bc gets placed in left half of tile at hl
; left half of tile at de gets placed in right half of tile at hl
ld hl, wNewHexTile
ld a, BYTES_PER_TILE
.hexLoop
push af
ld a, [bc]
inc bc
push bc
and $F0
ld b, a
ld a, [de]
inc de
and $F0
swap a
or b
ld [hli], a
pop bc
pop af
dec a
jr nz, .hexLoop
ret
; copy the updated hex digit tile to vram
CopyHexTile:
ld a, [wCursorPos]
srl a
swap a
ldr bc, a
ld hl, vChars2 + HEX_BASE_TILE * BYTES_PER_TILE
add hl, bc
ld de, wNewHexTile
REPT BYTES_PER_TILE
put [hli], [de]
inc de
ENDR
ret
; draw the knob values to the left of the knob columns
DrawNumberTilemap:
ld de, .numberTilemap
ld hl, vBGMap0 + BG_WIDTH * NUMBER_Y + NUMBER_X
ld bc, BG_WIDTH
.numberLoop
ld a, [de]
inc de
jz .numbersDone
ld [hl], a
add hl, bc
jr .numberLoop
.numbersDone
ret
.numberTilemap:
db "FEDCBA9876543210", 0
SetPalette:
ld a, %11100100 ; quaternary: 3210
ld [rOBP0], a
ld [rOBP1], a
ld [rBGP], a
ret
KnobGraphics:
INCBIN "gfx/knob.2bpp"
HexGraphics:
INCBIN "gfx/hex.2bpp"
FontGraphics:
INCBIN "gfx/font.2bpp"
ArrowsGraphics:
INCBIN "gfx/arrows.2bpp"
|
src/Generic/Lib/Data/Sum.agda | turion/Generic | 0 | 5251 | module Generic.Lib.Data.Sum where
open import Data.Sum hiding (swap) renaming (map to smap) hiding (map₁; map₂) public
|
arch/ARM/NXP/svd/lpc55s6x/nxp_svd-wwdt.ads | morbos/Ada_Drivers_Library | 2 | 11691 | -- Copyright 2016-2019 NXP
-- All rights reserved.SPDX-License-Identifier: BSD-3-Clause
-- This spec has been automatically generated from LPC55S6x.svd
pragma Restrictions (No_Elaboration_Code);
pragma Ada_2012;
pragma Style_Checks (Off);
with HAL;
with System;
package NXP_SVD.WWDT is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Watchdog enable bit. Once this bit is set to one and a watchdog feed is
-- performed, the watchdog timer will run permanently.
type MOD_WDEN_Field is
(
-- Stop. The watchdog timer is stopped.
Stop,
-- Run. The watchdog timer is running.
Run)
with Size => 1;
for MOD_WDEN_Field use
(Stop => 0,
Run => 1);
-- Watchdog reset enable bit. Once this bit has been written with a 1 it
-- cannot be re-written with a 0.
type MOD_WDRESET_Field is
(
-- Interrupt. A watchdog time-out will not cause a chip reset.
Interrupt,
-- Reset. A watchdog time-out will cause a chip reset.
Reset)
with Size => 1;
for MOD_WDRESET_Field use
(Interrupt => 0,
Reset => 1);
-- Watchdog update mode. This bit can be set once by software and is only
-- cleared by a reset.
type MOD_WDPROTECT_Field is
(
-- Flexible. The watchdog time-out value (TC) can be changed at any
-- time.
Flexible,
-- Threshold. The watchdog time-out value (TC) can be changed only after
-- the counter is below the value of WDWARNINT and WDWINDOW.
Threshold)
with Size => 1;
for MOD_WDPROTECT_Field use
(Flexible => 0,
Threshold => 1);
-- Watchdog mode register. This register contains the basic mode and status
-- of the Watchdog Timer.
type MOD_Register is record
-- Watchdog enable bit. Once this bit is set to one and a watchdog feed
-- is performed, the watchdog timer will run permanently.
WDEN : MOD_WDEN_Field := NXP_SVD.WWDT.Stop;
-- Watchdog reset enable bit. Once this bit has been written with a 1 it
-- cannot be re-written with a 0.
WDRESET : MOD_WDRESET_Field := NXP_SVD.WWDT.Interrupt;
-- Watchdog time-out flag. Set when the watchdog timer times out, by a
-- feed error, or by events associated with WDPROTECT. Cleared by
-- software writing a 0 to this bit position. Causes a chip reset if
-- WDRESET = 1.
WDTOF : Boolean := False;
-- Warning interrupt flag. Set when the timer is at or below the value
-- in WDWARNINT. Cleared by software writing a 1 to this bit position.
-- Note that this bit cannot be cleared while the WARNINT value is equal
-- to the value of the TV register. This can occur if the value of
-- WARNINT is 0 and the WDRESET bit is 0 when TV decrements to 0.
WDINT : Boolean := False;
-- Watchdog update mode. This bit can be set once by software and is
-- only cleared by a reset.
WDPROTECT : MOD_WDPROTECT_Field := NXP_SVD.WWDT.Flexible;
-- unspecified
Reserved_5_31 : HAL.UInt27 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for MOD_Register use record
WDEN at 0 range 0 .. 0;
WDRESET at 0 range 1 .. 1;
WDTOF at 0 range 2 .. 2;
WDINT at 0 range 3 .. 3;
WDPROTECT at 0 range 4 .. 4;
Reserved_5_31 at 0 range 5 .. 31;
end record;
subtype TC_COUNT_Field is HAL.UInt24;
-- Watchdog timer constant register. This 24-bit register determines the
-- time-out value.
type TC_Register is record
-- Watchdog time-out value.
COUNT : TC_COUNT_Field := 16#FF#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TC_Register use record
COUNT at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype FEED_FEED_Field is HAL.UInt8;
-- Watchdog feed sequence register. Writing 0xAA followed by 0x55 to this
-- register reloads the Watchdog timer with the value contained in TC.
type FEED_Register is record
-- Write-only. Feed value should be 0xAA followed by 0x55.
FEED : FEED_FEED_Field := 16#0#;
-- unspecified
Reserved_8_31 : HAL.UInt24 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for FEED_Register use record
FEED at 0 range 0 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
subtype TV_COUNT_Field is HAL.UInt24;
-- Watchdog timer value register. This 24-bit register reads out the
-- current value of the Watchdog timer.
type TV_Register is record
-- Read-only. Counter timer value.
COUNT : TV_COUNT_Field;
-- unspecified
Reserved_24_31 : HAL.UInt8;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for TV_Register use record
COUNT at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
subtype WARNINT_WARNINT_Field is HAL.UInt10;
-- Watchdog Warning Interrupt compare value.
type WARNINT_Register is record
-- Watchdog warning interrupt compare value.
WARNINT : WARNINT_WARNINT_Field := 16#0#;
-- unspecified
Reserved_10_31 : HAL.UInt22 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for WARNINT_Register use record
WARNINT at 0 range 0 .. 9;
Reserved_10_31 at 0 range 10 .. 31;
end record;
subtype WINDOW_WINDOW_Field is HAL.UInt24;
-- Watchdog Window compare value.
type WINDOW_Register is record
-- Watchdog window value.
WINDOW : WINDOW_WINDOW_Field := 16#FFFFFF#;
-- unspecified
Reserved_24_31 : HAL.UInt8 := 16#0#;
end record
with Volatile_Full_Access, Size => 32,
Bit_Order => System.Low_Order_First;
for WINDOW_Register use record
WINDOW at 0 range 0 .. 23;
Reserved_24_31 at 0 range 24 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Windowed Watchdog Timer (WWDT)
type WWDT_Peripheral is record
-- Watchdog mode register. This register contains the basic mode and
-- status of the Watchdog Timer.
MOD_k : aliased MOD_Register;
-- Watchdog timer constant register. This 24-bit register determines the
-- time-out value.
TC : aliased TC_Register;
-- Watchdog feed sequence register. Writing 0xAA followed by 0x55 to
-- this register reloads the Watchdog timer with the value contained in
-- TC.
FEED : aliased FEED_Register;
-- Watchdog timer value register. This 24-bit register reads out the
-- current value of the Watchdog timer.
TV : aliased TV_Register;
-- Watchdog Warning Interrupt compare value.
WARNINT : aliased WARNINT_Register;
-- Watchdog Window compare value.
WINDOW : aliased WINDOW_Register;
end record
with Volatile;
for WWDT_Peripheral use record
MOD_k at 16#0# range 0 .. 31;
TC at 16#4# range 0 .. 31;
FEED at 16#8# range 0 .. 31;
TV at 16#C# range 0 .. 31;
WARNINT at 16#14# range 0 .. 31;
WINDOW at 16#18# range 0 .. 31;
end record;
-- Windowed Watchdog Timer (WWDT)
WWDT_Periph : aliased WWDT_Peripheral
with Import, Address => System'To_Address (16#4000C000#);
end NXP_SVD.WWDT;
|
java-lib/src/main/antlr4/DSLexer.g4 | kjetijor/wf-proxy | 0 | 1469 | lexer grammar DSLexer;
EQ
: '='
;
NEQ
: '!='
;
IpV4Address
: Octet '.' Octet '.' Octet '.' Octet
;
MinusSign
: '-'
;
PlusSign
: '+'
;
IpV6Address
: ('::')? ((Segment ':') | (Segment '::'))+ (Segment | (Segment '::'))
| '::'
| '::' Segment ('::')?
| ('::')? Segment '::'
| ('::')? ((Segment '::')
| Segment ':')+ IpV4Address
| '::' IpV4Address
;
// negative numbers are not accounted for here since we need to
// handle for instance 5 - 6 (and not consume the minus sign into the number making it just two numbers).
Number
: Digit+ ('.' Digit+)? (('e' | 'E') (MinusSign | PlusSign)? Digit+)?
| '.' Digit+ (('e' | 'E') (MinusSign | PlusSign)? Digit+)?
;
Letters
: Letter+ Digit*
;
Quoted
: '"' ( '\\"' | . )*? '"'
| '\'' ( '\\\'' | . )*? '\''
;
Literal
: '~'? Letter (Letter
| Digit
| '.'
| '-'
| '_'
| '|'
| '~'
| '{'
| '}'
| SLASH
| STAR)+
;
fragment
Letter
: 'a'..'z'
| 'A'..'Z'
;
fragment
Digit
: '0'..'9'
;
fragment
Hex
: 'a'..'f'
| 'A'..'F'
| Digit
;
fragment
Segment
: Hex Hex Hex Hex
| Hex Hex Hex
| Hex Hex
| Hex
;
fragment
Octet
: ('1'..'9') (('0'..'9') ('0'..'9')?)?
| '0'
;
STAR : '*' ;
SLASH : '/' ;
WS : [ \t\r\n]+ -> channel(HIDDEN) ; |
runtime/commands.asm | paulscottrobson/amoral | 3 | 84893 | <reponame>paulscottrobson/amoral
; *******************************************************************************************
; *******************************************************************************************
;
; File: commands.asm
; Date: 13th November 2020
; Purpose: Command handlers
; Author: <NAME> (<EMAIL>)
;
; *******************************************************************************************
; *******************************************************************************************
; *******************************************************************************************
;
; Handles load.
;
; *******************************************************************************************
LoadHandler: ;; LDR $80
jsr EvaluateValue ; temp0 = target value.
lda temp0 ; copy value into register
sta Reg16
lda temp0+1
sta Reg16+1
jmp ExecLoop
; *******************************************************************************************
;
; Handles store
;
; *******************************************************************************************
StoreHandler: ;; STR $8A
jsr EvaluateAddress ; temp0 = target address.
ldy #0 ; write register out
lda Reg16
sta (temp0),y
lda Reg16+1
iny
sta (temp0),y
jmp ExecLoop
; *******************************************************************************************
;
; Add and Subtract
;
; *******************************************************************************************
Addhandler: ;; ADD $84
jsr EvaluateValue
clc
lda Reg16
adc temp0
sta Reg16
lda Reg16+1
adc temp0+1
sta Reg16+1
jmp ExecLoop
Subhandler: ;; SUB $85
jsr EvaluateValue
sec
lda Reg16
sbc temp0
sta Reg16
lda Reg16+1
sbc temp0+1
sta Reg16+1
jmp ExecLoop
; *******************************************************************************************
;
; Binary Operations
;
; *******************************************************************************************
Andhandler: ;; AND $81
jsr EvaluateValue
lda Reg16
and temp0
sta Reg16
lda Reg16+1
and temp0+1
sta Reg16+1
jmp ExecLoop
Orhandler: ;; ORR $82
jsr EvaluateValue
lda Reg16
ora temp0
sta Reg16
lda Reg16+1
ora temp0+1
sta Reg16+1
jmp ExecLoop
Xorhandler: ;; XOR $83
jsr EvaluateValue
lda Reg16
eor temp0
sta Reg16
lda Reg16+1
eor temp0+1
sta Reg16+1
jmp ExecLoop
; *******************************************************************************************
;
; Handles decrement
;
; *******************************************************************************************
DecVarHandler: ;; DCV $89
jsr EvaluateAddress ; temp0 = target address.
ldy #0
sec
lda (temp0),y ; subtract one from the address
sbc #1
sta (temp0),y
iny
lda (temp0),y
sbc #0
sta (temp0),y
jmp ExecLoop
|
wasp_spotify_bindings/tests/sample_applescript.scpt | danthelion/wasp | 2 | 2367 | <filename>wasp_spotify_bindings/tests/sample_applescript.scpt
set one to 1
set two to 2
set answer to one + two
return answer |
programs/oeis/134/A134115.asm | neoneye/loda | 22 | 25318 | ; A134115: Powers of 9 written backwards and sorted.
; 1,9,18,927,1656,94095,144135,9692874,12764034,984024783,1044876843,90695018313,184635924282,9238285681452,16945429767822,946490231198502,1481588810203581,96566699618177661,121999692536490051
mul $0,2
mov $1,-3
pow $1,$0
seq $1,4086 ; Read n backwards (referred to as R(n) in many sequences).
mov $0,$1
|
alloy4fun_models/trashltl/models/15/9uXpeQWR6simrdW7f.als | Kaixi26/org.alloytools.alloy | 0 | 3922 | open main
pred id9uXpeQWR6simrdW7f_prop16 {
always Protected = Protected'
}
pred __repair { id9uXpeQWR6simrdW7f_prop16 }
check __repair { id9uXpeQWR6simrdW7f_prop16 <=> prop16o } |
PL0.g4 | ashleypackard/compiler-design-project | 0 | 3366 | <filename>PL0.g4
grammar PL0;
program
: block DOT
;
block
: consts? vars? procedure* statement
;
consts
: CONST Ident CASSIGN Number (COMMA Ident CASSIGN Number)* SEMIC
;
vars
: VAR Ident (COMMA Ident)* SEMIC
;
procedure
: PROCEDURE Ident SEMIC block SEMIC
;
statement
: Ident ASSIGN expression # assignStat
| CALL Ident # callStat
| BANG Ident # bangStat
| BEGIN statement (SEMIC statement)* END # beginStat
| IF condition THEN statement # ifStat
| WHILE condition DO statement # whileStat
;
condition
: ODD expression
| expression op=(EQ|LT|LTE|GT|GTE) expression
;
expression
: opt_sign=(PLUS|MINUS)? term (opt_term)*
;
opt_term
: op=(PLUS|MINUS) term
;
term
: factor (opt_factor)*
;
opt_factor
: op=(MULT|DIV) factor
;
factor
: Ident # identFactor
| Number # numberFactor
| OPAR expression CPAR # parExpr
;
ODD : 'odd' ;
CALL: 'call' ;
BANG : '!' ;
OR : '||' ;
AND : '&&' ;
EQ : '==' ;
NEQ : '!=' ;
GT : '>' ;
LT : '<' ;
GTE : '>=' ;
LTE : '<=' ;
PLUS : '+' ;
MINUS : '-' ;
MULT : '*' ;
DIV : '/' ;
CASSIGN : '=' ;
ASSIGN : ':=' ;
OPAR : '(' ;
CPAR : ')' ;
COMMA : ',' ;
SEMIC : ';' ;
DOT : '.' ;
TRUE : 'true' ;
FALSE : 'false' ;
IF : 'if' ;
ELSE : 'else' ;
WHILE : 'while' ;
DO: 'do' ;
THEN : 'then' ;
BEGIN : 'begin' ;
END : 'end' ;
PROCEDURE : 'procedure' ;
VAR : 'var' ;
CONST : 'const' ;
Ident : ALPHA (ALPHA | DIGIT)* ;
Number : DIGIT+ ;
ALPHA : 'a'..'z' | 'A'..'Z' ;
DIGIT : '0'..'9' ;
WS : [ \r\t\n]+ -> skip ; // skip spaces, tabs, newlines
Comment : '{' .*? '}' -> skip ; // skip comments
|
6502DotNet/Examples/vcs/backgroundcycle.asm | Yttrmin/CSharpTo2600 | 7 | 87788 | .cpu "6502"
.target "flat"
* = $F000
BackgroundColor = $80
VSYNC = $00
VBLANK = $01
WSYNC = $02
COLUBK = $09
TIM64T = $296
INTIM = $284
Start
SEI
CLD
LDX #$FF
TXS
LDA #0
ClearMem
STA 0,X
DEX
BNE ClearMem
MainLoop
LDA #%00000010
STA VSYNC
STA WSYNC
STA WSYNC
STA WSYNC
LDA #43
STA TIM64T
LDA #0
STA VSYNC
INC BackgroundColor
LDA BackgroundColor
STA COLUBK
WaitForVBlankEnd
LDA INTIM
BNE WaitForVBlankEnd
STA WSYNC
STA VBLANK
LDY #192
ScanLoop
STA WSYNC
DEY
BNE ScanLoop
LDA #2
STA WSYNC
STA VBLANK
LDY #30
OverScanWait
STA WSYNC
DEY
BNE OverScanWait
JMP MainLoop
// Special memory locations. Tells the 6502 where to go.
* = $FFFC
.word Start
.word Start |
asm/arrays/primeNumbers.asm | IronHeart7334/AssemblyPrograms | 0 | 92459 | <gh_stars>0
; general comments
; There are many ways to determine prime numbers. Below is a design for one way to find the first 100 primes.
; Write an Assembly Language program that stores the primes in an array of doublewords primeArray.
; <NAME>'s example:
; prime[0] := 2 {first prime number}
; prime[1] := 3 {second prime number}
; primeCount := 2
; candidate := 5 {first candidate for a new prime}
; while (primeCount < 100)
; index := 0
; while ((index < primeCount) and (prime[index] does not evenly divide candidate))
; add 1 to index
; end while
;
; if (index == primeCount) then
; {found a new prime number}
; prime[primeCount] := candidate
; add 1 to primeCount
; end if
; add 2 to candidate
; end while
;
; Register Dictionary:
; - EBP holds the address of the prime numbers found array
; - EAX holds the quotient of dividing prime candidates by prime numbers
; - AL temporarily holds the maximum number of primes to find
; - EBX holds candidate prime numbers
; - BL temporarily holds the number of primes numbers found
; - ECX holds doubleword offsets from the beginning of the prime number array (indeces)
; - EDX holds the remainder after dividing prime candidates by prime numbers
; preprocessor directives
.586
.MODEL FLAT
; external files to link with
; stack configuration
.STACK 4096
; named memory allocation and initialization
.DATA
primeArray DWORD 100d dup(0); not sure if I'm allowed to use dup: check
primeCapacity BYTE 100d ; max number of primes to find
primesFound BYTE 0d
; names of procedures defined in other *.asm files in the project
; procedure code
.CODE
main PROC ; Psuedocode over here
; need to leave EAX and EDX open for division ;
lea EBP, primeArray ;
mov ECX, 0d ; temp so I can inc primesFound ;
mov EBX, 5d ; candidate := 5
mov DWORD PTR [EBP + 4*ECX], 2d ; prime[0] := 2
inc ECX ;
mov DWORD PTR [EBP + 4*ECX], 3d ; prime[1] := 3
inc ECX ;
mov primesFound, CL ; primeCount := 2
checkIfFoundEnoughPrimes: ;
mov AH, primesFound ;
mov AL, primeCapacity ;
cmp AH, AL ; while (primeCount < 100)
jb checkIfPrime ;
jmp doneFindingPrimes ;
checkIfPrime: ; check if the current candidate is prime;
mov ECX, 0d ; index := 0
doesItFactor: ; while((index < primeCount) and prime[index] does not evenly divide candidate)
cmp CL, primesFound ;
jae doneCheckingIfItFactors ;
mov EAX, EBX ;
mov EDX, 0 ;
; unsigned, so zero-out EDX instead of cdq ;
div DWORD PTR [EBP + 4*ECX] ;
cmp EDX, 0 ;
; if remainder is 0, ;
; prime[index] evenly divides the candidate ;
je doneCheckingIfItFactors ;
inc ECX ; add 1 to index
jmp doesItFactor ; end while
doneCheckingIfItFactors: ;
cmp CL, primesFound ; if(index == primeCount) then
je foundNewPrime ;
jmp callTheNextCandidiate ;
foundNewPrime: ;
mov [EBP + 4*ECX], EBX ; prime[primeCount] := candidate
inc ECX ; add 1 to primeCount
mov primesFound, CL ; end if
callTheNextCandidiate: ;
add EBX, 2d ; add 2 to candidate
jmp checkIfFoundEnoughPrimes ;
doneFindingPrimes: ; end while
; done
mov EAX, 0
ret
main ENDP
END
|
Sources/Globe_3d/globe_3d-collision_detection.ads | ForYouEyesOnly/Space-Convoy | 1 | 24128 | pragma Warnings (Off);
pragma Style_Checks (Off);
-------------------------------------------------------------------------
-- GLOBE_3D.Collision_detection
--
-- Copyright (c) <NAME> 1999 .. 2008
-- SWITZERLAND
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
-- NB : this is the MIT License, as found 12 - Sep - 2007 on the site
-- http://www.opensource.org/licenses/mit - license.php
-------------------------------------------------------------------------
-- Change log
--
-- 21 - May - 2008 : GM : slide mode working, by adding dist_before > 0.0
-- 14 - May - 2008 : GM : package created (re - used most of old Engine_3D)
package GLOBE_3D.Collision_detection is
-- Reaction to an object - and the world connected to it
type Reaction_method is (elastic, slide);
type Ball_type is record
centre : Point_3D;
radius : Real;
end record;
-- Collision between a ball, intending to do a step (vector), against
-- an object o. If there is a collision, step is reduced in length and
-- may change direction.
-- Typically, the ball's centre is the camera position and step is the camera's
-- move between two images. But the ball can be the abstraction of any moving
-- object, actor, .. .
procedure Reaction (
o : Object_3D'Class;
ball : Ball_type;
method : Reaction_method;
step : in out Vector_3D; -- Whole step (in : desired, out : effective)
reacted : out Real -- reaction in proportion to step; in [0, 1]
);
--
Unsupported : exception; -- something not yet implemented
Zero_normal, Not_one_normal : exception;
-- only occur when body's check_normals = True,
-- and also when normals are wrong, of course .. .
end GLOBE_3D.Collision_detection;
|
externals/mpir-3.0.0/mpn/x86/rshift.asm | JaminChan/eos_win | 1 | 244292 | <reponame>JaminChan/eos_win
dnl x86 mpn_rshift -- mpn right shift.
dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
dnl Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public License as
dnl published by the Free Software Foundation; either version 2.1 of the
dnl License, or (at your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public
dnl License along with the GNU MP Library; see the file COPYING.LIB. If
dnl not, write to the Free Software Foundation, Inc., 51 Franklin Street,
dnl Fifth Floor, Boston, MA 02110-1301, USA.
include(`../config.m4')
C cycles/limb
C P54: 7.5
C P55: 7.0
C P6: 2.5
C K6: 4.5
C K7: 5.0
C P4: 16.5
C mp_limb_t mpn_rshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
C unsigned shift);
defframe(PARAM_SHIFT,16)
defframe(PARAM_SIZE, 12)
defframe(PARAM_SRC, 8)
defframe(PARAM_DST, 4)
TEXT
ALIGN(8)
PROLOGUE(mpn_rshift)
pushl %edi
pushl %esi
pushl %ebx
deflit(`FRAME',12)
movl PARAM_DST,%edi
movl PARAM_SRC,%esi
movl PARAM_SIZE,%edx
movl PARAM_SHIFT,%ecx
leal -4(%edi,%edx,4),%edi
leal (%esi,%edx,4),%esi
negl %edx
movl (%esi,%edx,4),%ebx C read least significant limb
xorl %eax,%eax
shrdl( %cl, %ebx, %eax) C compute carry limb
incl %edx
jz L(end)
pushl %eax C push carry limb onto stack
testb $1,%dl
jnz L(1) C enter loop in the middle
movl %ebx,%eax
ALIGN(8)
L(oop): movl (%esi,%edx,4),%ebx C load next higher limb
shrdl( %cl, %ebx, %eax) C compute result limb
movl %eax,(%edi,%edx,4) C store it
incl %edx
L(1): movl (%esi,%edx,4),%eax
shrdl( %cl, %eax, %ebx)
movl %ebx,(%edi,%edx,4)
incl %edx
jnz L(oop)
shrl %cl,%eax C compute most significant limb
movl %eax,(%edi) C store it
popl %eax C pop carry limb
popl %ebx
popl %esi
popl %edi
ret
L(end): shrl %cl,%ebx C compute most significant limb
movl %ebx,(%edi) C store it
popl %ebx
popl %esi
popl %edi
ret
EPILOGUE()
|
test/asset/agda-stdlib-1.0/Relation/Binary/Construct/Add/Extrema/Strict.agda | omega12345/agda-mode | 0 | 607 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- The lifting of a strict order to incorporate new extrema
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
-- This module is designed to be used with
-- Relation.Nullary.Construct.Add.Extrema
open import Relation.Binary
module Relation.Binary.Construct.Add.Extrema.Strict
{a ℓ} {A : Set a} (_<_ : Rel A ℓ) where
open import Level
open import Function
open import Relation.Nullary
import Relation.Nullary.Construct.Add.Infimum as I
open import Relation.Nullary.Construct.Add.Extrema
import Relation.Binary.Construct.Add.Infimum.Strict as AddInfimum
import Relation.Binary.Construct.Add.Supremum.Strict as AddSupremum
import Relation.Binary.Construct.Add.Extrema.Equality as Equality
import Relation.Binary.Construct.Add.Extrema.NonStrict as NonStrict
------------------------------------------------------------------------
-- Definition
private
module Inf = AddInfimum _<_
module Sup = AddSupremum Inf._<₋_
open Sup using () renaming (_<⁺_ to _<±_) public
------------------------------------------------------------------------
-- Useful pattern synonyms
pattern ⊥±<[_] l = Sup.[ Inf.⊥₋<[ l ] ]
pattern [_] p = Sup.[ Inf.[ p ] ]
pattern ⊥±<⊤± = Sup.[ I.⊥₋ ]<⊤⁺
pattern [_]<⊤± k = Sup.[ I.[ k ] ]<⊤⁺
------------------------------------------------------------------------
-- Relational properties
[<]-injective : ∀ {k l} → [ k ] <± [ l ] → k < l
[<]-injective = Inf.[<]-injective ∘′ Sup.[<]-injective
<±-asym : Asymmetric _<_ → Asymmetric _<±_
<±-asym = Sup.<⁺-asym ∘′ Inf.<₋-asym
<±-trans : Transitive _<_ → Transitive _<±_
<±-trans = Sup.<⁺-trans ∘′ Inf.<₋-trans
<±-dec : Decidable _<_ → Decidable _<±_
<±-dec = Sup.<⁺-dec ∘′ Inf.<₋-dec
<±-irrelevant : Irrelevant _<_ → Irrelevant _<±_
<±-irrelevant = Sup.<⁺-irrelevant ∘′ Inf.<₋-irrelevant
module _ {e} {_≈_ : Rel A e} where
open Equality _≈_
<±-cmp : Trichotomous _≈_ _<_ → Trichotomous _≈±_ _<±_
<±-cmp = Sup.<⁺-cmp ∘′ Inf.<₋-cmp
<±-irrefl : Irreflexive _≈_ _<_ → Irreflexive _≈±_ _<±_
<±-irrefl = Sup.<⁺-irrefl ∘′ Inf.<₋-irrefl
<±-respˡ-≈± : _<_ Respectsˡ _≈_ → _<±_ Respectsˡ _≈±_
<±-respˡ-≈± = Sup.<⁺-respˡ-≈⁺ ∘′ Inf.<₋-respˡ-≈₋
<±-respʳ-≈± : _<_ Respectsʳ _≈_ → _<±_ Respectsʳ _≈±_
<±-respʳ-≈± = Sup.<⁺-respʳ-≈⁺ ∘′ Inf.<₋-respʳ-≈₋
<±-resp-≈± : _<_ Respects₂ _≈_ → _<±_ Respects₂ _≈±_
<±-resp-≈± = Sup.<⁺-resp-≈⁺ ∘′ Inf.<₋-resp-≈₋
module _ {r} {_≤_ : Rel A r} where
open NonStrict _≤_
<±-transʳ : Trans _≤_ _<_ _<_ → Trans _≤±_ _<±_ _<±_
<±-transʳ = Sup.<⁺-transʳ ∘′ Inf.<₋-transʳ
<±-transˡ : Trans _<_ _≤_ _<_ → Trans _<±_ _≤±_ _<±_
<±-transˡ = Sup.<⁺-transˡ ∘′ Inf.<₋-transˡ
------------------------------------------------------------------------
-- Structures
module _ {e} {_≈_ : Rel A e} where
open Equality _≈_
<±-isStrictPartialOrder : IsStrictPartialOrder _≈_ _<_ →
IsStrictPartialOrder _≈±_ _<±_
<±-isStrictPartialOrder =
Sup.<⁺-isStrictPartialOrder ∘′ Inf.<₋-isStrictPartialOrder
<±-isDecStrictPartialOrder : IsDecStrictPartialOrder _≈_ _<_ →
IsDecStrictPartialOrder _≈±_ _<±_
<±-isDecStrictPartialOrder =
Sup.<⁺-isDecStrictPartialOrder ∘′ Inf.<₋-isDecStrictPartialOrder
<±-isStrictTotalOrder : IsStrictTotalOrder _≈_ _<_ →
IsStrictTotalOrder _≈±_ _<±_
<±-isStrictTotalOrder =
Sup.<⁺-isStrictTotalOrder ∘′ Inf.<₋-isStrictTotalOrder
|
programs/oeis/017/A017733.asm | neoneye/loda | 22 | 89554 | ; A017733: Binomial coefficients C(n,69).
; 1,70,2485,59640,1088430,16108764,201359550,2186189400,21042072975,182364632450,1440680596355,10477677064400,70724320184700,446107250395800,2644778698775100,14810760713140560,78682166288559225,398039194165652550,1923856105133987325,8910491434304783400,39651686882656286130,169935800925669797700,702916267465270526850,2811665069861082107400,10895202145711693166175,40965960067875966304818,149683315632623723036835,532207344471551015242080,1843718300490730302802920,6230496325796261023265040,20560637875127661376774632,66324638306863423796047200,209337139656037681356273975,647042068027752833283028650,1960156853142898289063292675,5824466077910326344645212520,16988026060571785171881869850,48668398984340789951877789300,137039965561170119075024301450,379495289246317252823144219400,1034124663196214513943067997865,2774480803697160891066767799150,7332556409771068069247886326325,19098751578938595901296820198800,49049066555001394019239560965100,124257635272670198182073554444920,310644088181675495455183886112300,766696047427113988783007038064400,1868821615603590347658579655281975,4500427564106605327014538761699450,10711017602573720678294602252844691,25202394358996989831281417065516920,58644033027666072492020220479375910,134991925082552091396725790537431340,307481607132479763736986522890815830,693231259716863467334296887972021144
add $0,69
bin $0,69
|
oeis/185/A185455.asm | neoneye/loda-programs | 0 | 95195 | <reponame>neoneye/loda-programs
; A185455: Trajectory of 7 under repeated application of the map in A185452.
; Submitted by <NAME>(w1)
; 7,18,9,23,58,29,73,183,458,229,573,1433,3583,8958,4479,11198,5599,13998,6999,17498,8749,21873,54683,136708,68354,34177,85443,213608,106804,53402,26701,66753,166883,417208,208604,104302,52151,130378,65189,162973,407433,1018583,2546458,1273229,3183073,7957683,19894208,9947104,4973552,2486776,1243388,621694,310847,777118,388559,971398,485699,1214248,607124,303562,151781,379453,948633,2371583,5928958,2964479,7411198,3705599,9263998,4631999,11579998,5789999,14474998,7237499,18093748,9046874,4523437
mov $1,7
lpb $0
sub $0,1
seq $1,185452 ; Image of n under the map n -> n/2 if n even, (5*n+1)/2 if n odd.
lpe
mov $0,$1
|
test/Succeed/Issue1983.agda | shlevy/agda | 1,989 | 12440 | <reponame>shlevy/agda
open import Agda.Builtin.Nat
record C (A : Set) : Set where
module M (X : Set) where
module Ci = C {{...}}
module CiNat = M.Ci Nat -- error: The module M.Ci is not parameterized...
|
audio/sfx/cry22_2.asm | opiter09/ASM-Machina | 1 | 178735 | <gh_stars>1-10
SFX_Cry22_2_Ch5:
duty_cycle_pattern 0, 1, 0, 1
square_note 2, 3, -5, 897
square_note 7, 15, 5, 1537
square_note 1, 12, 2, 1153
square_note 8, 9, 1, 897
sound_ret
SFX_Cry22_2_Ch6:
duty_cycle_pattern 3, 2, 3, 2
square_note 2, 3, -6, 1456
square_note 7, 13, 5, 1885
square_note 1, 11, 2, 1712
square_note 8, 6, 1, 1456
sound_ret
SFX_Cry22_2_Ch8:
noise_note 2, 9, 2, 73
noise_note 7, 11, 5, 41
noise_note 1, 10, 2, 57
noise_note 8, 9, 1, 73
sound_ret
|
programs/oeis/055/A055952.asm | neoneye/loda | 22 | 14123 | ; A055952: n + reversal of base 6 digits of n (written in base 10).
; 0,2,4,6,8,10,7,14,21,28,35,42,14,21,28,35,42,49,21,28,35,42,49,56,28,35,42,49,56,63,35,42,49,56,63,70,37,74,111,148,185,222,49,86,123,160,197,234,61,98,135,172,209,246,73,110,147,184,221,258,85,122,159,196,233,270,97,134,171,208,245,282,74,111,148,185,222,259,86,123,160,197,234,271,98,135,172,209,246,283,110,147,184,221,258,295,122,159,196,233
mov $1,$0
seq $1,30105 ; Base 6 reversal of n (written in base 10).
add $0,$1
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_4428_1267.asm | ljhsiun2/medusa | 9 | 174506 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_A_ht+0xf111, %rbp
inc %r12
mov (%rbp), %r15
nop
nop
nop
nop
add $13587, %rdx
lea addresses_WT_ht+0x1e767, %rsi
lea addresses_D_ht+0xb467, %rdi
xor %r12, %r12
mov $73, %rcx
rep movsq
nop
nop
dec %rbp
lea addresses_D_ht+0x54cf, %rcx
nop
cmp $18369, %rdi
mov (%rcx), %r15w
nop
nop
inc %rcx
lea addresses_normal_ht+0x1c907, %rcx
dec %rdx
movl $0x61626364, (%rcx)
nop
nop
sub $27003, %r12
lea addresses_UC_ht+0x33e7, %rdx
nop
nop
mfence
movw $0x6162, (%rdx)
xor $13127, %rdx
lea addresses_WC_ht+0x1627b, %rbp
add %r12, %r12
mov (%rbp), %ecx
and %r15, %r15
lea addresses_normal_ht+0x13167, %rcx
nop
nop
nop
and %r15, %r15
mov $0x6162636465666768, %rdx
movq %rdx, (%rcx)
and %r12, %r12
lea addresses_UC_ht+0xa367, %rdx
nop
nop
nop
nop
xor %rsi, %rsi
movb $0x61, (%rdx)
nop
nop
and %r15, %r15
lea addresses_normal_ht+0xabea, %rdx
clflush (%rdx)
add $17330, %r15
mov $0x6162636465666768, %rbp
movq %rbp, %xmm1
movups %xmm1, (%rdx)
nop
nop
dec %rsi
lea addresses_D_ht+0x4767, %rdx
nop
nop
nop
dec %rsi
movb (%rdx), %cl
nop
nop
nop
xor %rdi, %rdi
lea addresses_A_ht+0x7187, %rsi
lea addresses_UC_ht+0x11167, %rdi
nop
nop
nop
nop
add %rbp, %rbp
mov $112, %rcx
rep movsw
nop
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_WC_ht+0x15d67, %rdx
nop
nop
nop
sub $15469, %r15
mov $0x6162636465666768, %rcx
movq %rcx, %xmm6
and $0xffffffffffffffc0, %rdx
vmovntdq %ymm6, (%rdx)
nop
nop
nop
nop
sub %rsi, %rsi
lea addresses_WT_ht+0x19f87, %r15
nop
nop
nop
nop
xor %r12, %r12
mov (%r15), %bp
nop
nop
nop
nop
inc %r15
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r9
push %rbp
push %rcx
push %rsi
// Store
mov $0x672d660000000247, %rcx
nop
nop
nop
dec %rbp
movl $0x51525354, (%rcx)
nop
nop
nop
nop
nop
add %rcx, %rcx
// Faulty Load
lea addresses_normal+0xc967, %rbp
nop
nop
nop
nop
cmp %rsi, %rsi
mov (%rbp), %r10
lea oracles, %rsi
and $0xff, %r10
shlq $12, %r10
mov (%rsi,%r10,1), %r10
pop %rsi
pop %rcx
pop %rbp
pop %r9
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': False, 'type': 'addresses_NC'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 9, 'same': False, 'type': 'addresses_WT_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 2, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 7, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'}
{'src': {'congruent': 5, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'dst': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 4, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'34': 4428}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
Ada/exception/error.adb | egustafson/sandbox | 2 | 1209 | with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
procedure Error is
-- Note: If Constrained_Integer is constrained to 0
-- .. Integer'Last then Constraint_Error is raised when
-- Result1 is calculated. It appears to me that the
-- boundry check is occurring after the calculation
-- completed and doesn't check the signs of the terms
-- vs. the results. Similar results occur with addition.
subtype Constrained_Integer is Integer
range Integer'First .. Integer'Last;
subtype Small_Integer is Integer range 0 .. 1000;
Multiplicand1 : Integer;
Multiplicand2 : Integer;
Result1 : Constrained_Integer;
Result2 : Small_Integer;
begin
Multiplicand1 := 2;
Multiplicand2 := Constrained_Integer'Last;
-- Constraint_Error should get raised with this
-- statement.
Result1 := Multiplicand1 * Multiplicand2;
Put("The result of multiplying ");
Put(Multiplicand1);
Put(" and ");
Put(Multiplicand2);
Put(" is ");
Put(Result1);
Put_Line(".");
Flush;
Multiplicand2 := Small_Integer'Last;
-- Constraint_Error should get raised with this
-- statement.
Result2 := Multiplicand1 * Multiplicand2;
Put("The result of multiplying ");
Put(Multiplicand1);
Put(" and ");
Put(Multiplicand2);
Put(" is ");
Put(Result2);
Put_Line(".");
Flush;
end Error;
|
src/tests/shapedatabasetest.ads | sebsgit/textproc | 0 | 30481 | <filename>src/tests/shapedatabasetest.ads
with AUnit; use AUnit;
with AUnit.Test_Cases; use AUnit.Test_Cases;
--TODO: add tests for histogram data
--TODO: add importing the training_set data
package ShapeDatabaseTest is
type TestCase is new AUnit.Test_Cases.Test_Case with null record;
procedure Register_Tests(T: in out TestCase);
function Name(T: TestCase) return Message_String;
procedure testHistogramDescriptors(T : in out Test_Cases.Test_Case'Class);
procedure testLearningData(T : in out Test_Cases.Test_Case'Class);
end ShapeDatabaseTest;
|
src/main/antlr/Brucelang.g4 | rodya-mirov/Brucelang | 1 | 2096 | grammar Brucelang;
@header {
package io.rodyamirov.brucelang.lexparse;
}
program
: (stmt)* EOF
;
stmt
: blockStmt # blockStmtBranch
| fnDef # fnDefBranch
| varDef # varDefBranch
| returnStmt # returnStmtBranch
| doStmt # doStmtBranch
| ifStmt # ifStmtBranch
| typeDefnStmt # typeDefnStmtBranch
| nativeDeclStmt # nativeDeclStmtBranch
;
nativeDeclStmt
: DECLARE NATIVE ID COLON typeExpr SEMI
;
typeDefnStmt
: DECLARE NATIVE TYPE ID L_CURLY (fieldDecl)* R_CURLY (SEMI)?
;
fieldDecl
: ID COLON typeExpr SEMI
;
returnStmt
: RETURN expr SEMI
;
doStmt
: DO expr SEMI
;
blockStmt
: L_CURLY (stmt)* R_CURLY
;
ifStmt
: IF L_PAREN expr R_PAREN blockStmt ( ELSE IF L_PAREN expr R_PAREN blockStmt )* ( ELSE blockStmt )?
;
varDef
: LET varDecl SET_EQ expr SEMI # simpleVarDef
| LET varDecl LT idList GT SET_EQ expr SEMI # parametrizedVarDef
;
fnDef
: DEFINE ID L_PAREN varDeclList R_PAREN COLON typeExpr AS blockStmt (SEMI)?
;
varDecl
: ID COLON typeExpr # explicitVarDecl
| ID # inferredVarDecl
;
varDeclList
: # noVarDecls
| varDecl (COMMA varDecl)* # someVarDecls
;
typeExpr
: ID # simpleType
| ID LT typeExprList GT # complexType
| FN L_PAREN typeExprList R_PAREN SM_ARROW typeExpr # fnType
| TYPE_FN L_PAREN idList R_PAREN SM_ARROW typeExpr # typeFnType
// I suspect parens aren't necessary for ambiguity prevention,
// but it felt right to be able to use them if I wanted to
| L_PAREN typeExpr R_PAREN # parenType
;
typeExprList
: # noTypes
| typeExpr (COMMA typeExpr)* # someTypes
;
idList
: # noIds
| ID (COMMA ID)* # someIds
;
exprList
: # noExprs
| expr (COMMA expr)* # someExprs
;
expr // top-level expression class
: lambda # lambdaExpr
| typeLambda # typeLambdaExpr
| linkedBoolExpr # booleanExpression
;
typeLambda
// note there is no "no parens" option; the <T> syntax helps remind you it's a type function
: LT idList GT BIG_ARROW blockStmt # stmtTypeLambda
| LT idList GT BIG_ARROW expr # exprTypeLambda
;
lambda
: varDecl BIG_ARROW blockStmt # oneArgLambda
| L_PAREN varDeclList R_PAREN BIG_ARROW blockStmt # multiArgLambda
| varDecl BIG_ARROW expr # oneArgExprLambda
| L_PAREN varDeclList R_PAREN BIG_ARROW expr # multiArgExprLambda
;
linkedBoolExpr
: compExpr # fallThroughCompExpr
| compExpr boolOp compExpr # boolOpExpr
;
compExpr
: addExpr # fallThroughAddExpr
| addExpr compOp addExpr # compOpExpr
;
addExpr
: mulExpr (addOp mulExpr)*
;
mulExpr
: unaryExpr (mulOp unaryExpr)*
;
unaryExpr
: accessOrCall # fallThroughAccessOrCall
| unaryOp unaryExpr # nestedUnaryExpr
;
accessOrCall
: accessOrCall DOT ID # namedFieldAccess
| accessOrCall L_PAREN exprList R_PAREN # fnCall
| accessOrCall LT typeExprList GT # typeFnCall
| baseExpr # fallThroughBaseExpr
;
baseExpr
: L_PAREN expr R_PAREN # parenExpr
| ID # variableReference
| INT # numConst
| STRING_CONST # stringConst
| boolVal # boolConst
;
boolOp : AND | OR ;
compOp : GT | GTE | LT | LTE | EQ | NEQ ;
boolVal : TRUE | FALSE ;
addOp : PLUS | MINUS ;
mulOp : TIMES | DIVIDE ;
unaryOp : MINUS | NOT ;
TRUE : 'true' ;
FALSE : 'false' ;
DECLARE : 'declare' ;
NATIVE : 'native' ;
DEFINE : 'define' ;
DO : 'do' ;
RETURN : 'return' ;
AS : 'as' ;
IS : 'is' ;
IF : 'if' ;
ELSE : 'else' ;
LET : 'let' ;
TYPE : 'type' ;
FN : 'Fn' ;
TYPE_FN : 'TypeFn' ;
AND : '&&' ;
OR : '||' ;
PLUS : '+' ;
MINUS : '-' ;
TIMES : '*' ;
DIVIDE : '/' ;
LTE : '<=' ;
LT : '<' ;
GTE : '>=' ;
GT : '>' ;
EQ : '==' ;
NEQ : '!=' ;
NOT : '!' ;
SEMI : ';' ;
L_CURLY : '{' ;
R_CURLY : '}' ;
L_PAREN : '(' ;
R_PAREN : ')' ;
SM_ARROW : '->' ;
BIG_ARROW : '=>' ;
SET_EQ : '=' ;
COLON : ':' ;
COMMA : ',' ;
DOT : '.' ;
LINE_COMMENT : '//' ~('\n' | '\r')* '\r'? '\n' -> skip ;
BLOCK_COMMENT : '/*' (.)*? '*/' -> skip ; // note non-greedy regex
// note that keywords _cannot_ parse as IDs; they have priority in the lexer, by design
ID : [A-Za-z][A-Za-z0-9_]* ; // ids have to start with a letter, then letter/num/underscore all good
INT: [0-9]+ ; // int
STRING_CONST
: '"' ( ESC_SEQ | ~('\\'|'"') )* '"'
;
ESC_SEQ
: '\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')
| UNICODE_ESC
| OCTAL_ESC
;
OCTAL_ESC
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;
UNICODE_ESC
: '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
;
HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F') ;
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
|
tests/tk-image-photo-photo_options_test_data.adb | thindil/tashy2 | 2 | 28814 | -- This package is intended to set up and tear down the test environment.
-- Once created by GNATtest, this package will never be overwritten
-- automatically. Contents of this package can be modified in any way
-- except for sections surrounded by a 'read only' marker.
package body Tk.Image.Photo.Photo_Options_Test_Data is
-- Local_Photo_Options : aliased GNATtest_Generated.GNATtest_Standard.Tk.Image.Photo.Photo_Options;
procedure Set_Up(Gnattest_T: in out Test_Photo_Options) is
begin
GNATtest_Generated.GNATtest_Standard.Tk.Image.Image_Options_Test_Data
.Image_Options_Tests
.Set_Up
(GNATtest_Generated.GNATtest_Standard.Tk.Image.Image_Options_Test_Data
.Image_Options_Tests
.Test_Image_Options
(Gnattest_T));
null;
-- Gnattest_T.Fixture := Local_Photo_Options'Access;
end Set_Up;
procedure Tear_Down(Gnattest_T: in out Test_Photo_Options) is
begin
GNATtest_Generated.GNATtest_Standard.Tk.Image.Image_Options_Test_Data
.Image_Options_Tests
.Tear_Down
(GNATtest_Generated.GNATtest_Standard.Tk.Image.Image_Options_Test_Data
.Image_Options_Tests
.Test_Image_Options
(Gnattest_T));
end Tear_Down;
end Tk.Image.Photo.Photo_Options_Test_Data;
|
oeis/322/A322303.asm | neoneye/loda-programs | 11 | 165749 | ; A322303: a(n) = Fibonacci(semiprime(n)).
; Submitted by <NAME>
; 3,8,34,55,377,610,10946,17711,75025,121393,3524578,5702887,9227465,39088169,63245986,1836311903,7778742049,20365011074,139583862445,365435296162,591286729879,4052739537881,17167680177565,117669030460994,1304969544928657,5527939700884757
seq $0,1358 ; Semiprimes (or biprimes): products of two primes.
seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
|
test/movq.asm | killvxk/AssemblyLine | 147 | 12302 | SECTION .text
GLOBAL test
test:
movq xmm0, rax
movq xmm0, rcx
movq xmm0, rdx
movq xmm0, rbx
movq xmm0, rsp
movq xmm0, rbp
movq xmm0, rsi
movq xmm0, rdi
movq xmm0, r8
movq xmm0, r9
movq xmm0, r10
movq xmm0, r11
movq xmm0, r12
movq xmm0, r13
movq xmm0, r14
movq xmm0, r15
movq xmm1, rax
movq xmm1, rcx
movq xmm1, rdx
movq xmm1, rbx
movq xmm1, rsp
movq xmm1, rbp
movq xmm1, rsi
movq xmm1, rdi
movq xmm1, r8
movq xmm1, r9
movq xmm1, r10
movq xmm1, r11
movq xmm1, r12
movq xmm1, r13
movq xmm1, r14
movq xmm1, r15
movq xmm2, rax
movq xmm2, rcx
movq xmm2, rdx
movq xmm2, rbx
movq xmm2, rsp
movq xmm2, rbp
movq xmm2, rsi
movq xmm2, rdi
movq xmm2, r8
movq xmm2, r9
movq xmm2, r10
movq xmm2, r11
movq xmm2, r12
movq xmm2, r13
movq xmm2, r14
movq xmm2, r15
movq xmm2, [rax+0xee]
movq xmm2, [rcx+0xdd]
movq xmm2, [rdx+0x8efde]
movq xmm2, [rbx+0x4cd]
movq xmm2, [rsp+0xaa]
movq xmm2, [rbp+0xff]
movq xmm2, [rsi+0xfddd]
movq xmm2, [rdi+0xabcd]
movq xmm2, [r8+0x9a9a9]
movq xmm2, [r9+0x456]
movq xmm2, [r10+0x123]
movq xmm2, [r11+0x89dd]
movq xmm2, [r12+0x9a34]
movq xmm2, [r13+0xffff]
movq xmm2, [r14+0x4edf]
movq xmm2, [r15+0xfe]
movq xmm3, rax
movq xmm3, rcx
movq xmm3, rdx
movq xmm3, rbx
movq xmm3, rsp
movq xmm3, rbp
movq xmm3, rsi
movq xmm3, rdi
movq xmm3, r8
movq xmm3, r9
movq xmm3, r10
movq xmm3, r11
movq xmm3, r12
movq xmm3, r13
movq xmm3, r14
movq xmm3, r15
movq xmm4, rax
movq xmm4, rcx
movq xmm4, rdx
movq xmm4, rbx
movq xmm4, rsp
movq xmm4, rbp
movq xmm4, rsi
movq xmm4, rdi
movq xmm4, r8
movq xmm4, r9
movq xmm4, r10
movq xmm4, r11
movq xmm4, r12
movq xmm4, r13
movq xmm4, r14
movq xmm4, r15
movq xmm5, rax
movq xmm5, rcx
movq xmm5, rdx
movq xmm5, rbx
movq xmm5, rsp
movq xmm5, rbp
movq xmm5, rsi
movq xmm5, rdi
movq xmm5, r8
movq xmm5, r9
movq xmm5, r10
movq xmm5, r11
movq xmm5, r12
movq xmm5, r13
movq xmm5, r14
movq xmm5, r15
movq xmm6, rax
movq xmm6, rcx
movq xmm6, rdx
movq xmm6, rbx
movq xmm6, rsp
movq xmm6, rbp
movq xmm6, rsi
movq xmm6, rdi
movq xmm6, r8
movq xmm6, r9
movq xmm6, r10
movq xmm6, r11
movq xmm6, r12
movq xmm6, r13
movq xmm6, r14
movq xmm6, r15
movq xmm7, rax
movq xmm7, rcx
movq xmm7, rdx
movq xmm7, rbx
movq xmm7, rsp
movq xmm7, rbp
movq xmm7, rsi
movq xmm7, rdi
movq xmm7, r8
movq xmm7, r9
movq xmm7, r10
movq xmm7, r11
movq xmm7, r12
movq xmm7, r13
movq xmm7, r14
movq xmm7, r15
movq xmm8, rax
movq xmm8, rcx
movq xmm8, rdx
movq xmm8, rbx
movq xmm8, rsp
movq xmm8, rbp
movq xmm8, rsi
movq xmm8, rdi
movq xmm8, r8
movq xmm8, r9
movq xmm8, r10
movq xmm8, r11
movq xmm8, r12
movq xmm8, r13
movq xmm8, r14
movq xmm8, r15
movq xmm9, rax
movq xmm9, rcx
movq xmm9, rdx
movq xmm9, rbx
movq xmm9, rsp
movq xmm9, rbp
movq xmm9, rsi
movq xmm9, rdi
movq xmm9, r8
movq xmm9, r9
movq xmm9, r10
movq xmm9, r11
movq xmm9, r12
movq xmm9, r13
movq xmm9, r14
movq xmm9, r15
movq xmm10, rax
movq xmm10, rcx
movq xmm10, rdx
movq xmm10, rbx
movq xmm10, rsp
movq xmm10, rbp
movq xmm10, rsi
movq xmm10, rdi
movq xmm10, r8
movq xmm10, r9
movq xmm10, r10
movq xmm10, r11
movq xmm10, r12
movq xmm10, r13
movq xmm10, r14
movq xmm10, r15
movq xmm11, rax
movq xmm11, rcx
movq xmm11, rdx
movq xmm11, rbx
movq xmm11, rsp
movq xmm11, rbp
movq xmm11, rsi
movq xmm11, rdi
movq xmm11, r8
movq xmm11, r9
movq xmm11, r10
movq xmm11, r11
movq xmm11, r12
movq xmm11, r13
movq xmm11, r14
movq xmm11, r15
movq xmm11, [rax+0xee]
movq xmm11, [rcx+0xdd]
movq xmm11, [rdx+0x8efde]
movq xmm11, [rbx+0x4cd]
movq xmm11, [rsp+0xaa]
movq xmm11, [rbp+0xff]
movq xmm11, [rsi+0xfddd]
movq xmm11, [rdi+0xabcd]
movq xmm11, [r8+0x9a9a9]
movq xmm11, [r9+0x456]
movq xmm11, [r10+0x123]
movq xmm11, [r11+0x89dd]
movq xmm11, [r12+0x9a34]
movq xmm11, [r13+0xffff]
movq xmm11, [r14+0x4edf]
movq xmm11, [r15+0xfe]
movq xmm12, rax
movq xmm12, rcx
movq xmm12, rdx
movq xmm12, rbx
movq xmm12, rsp
movq xmm12, rbp
movq xmm12, rsi
movq xmm12, rdi
movq xmm12, r8
movq xmm12, r9
movq xmm12, r10
movq xmm12, r11
movq xmm12, r12
movq xmm12, r13
movq xmm12, r14
movq xmm12, r15
movq xmm13, rax
movq xmm13, rcx
movq xmm13, rdx
movq xmm13, rbx
movq xmm13, rsp
movq xmm13, rbp
movq xmm13, rsi
movq xmm13, rdi
movq xmm13, r8
movq xmm13, r9
movq xmm13, r10
movq xmm13, r11
movq xmm13, r12
movq xmm13, r13
movq xmm13, r14
movq xmm13, r15
movq xmm14, rax
movq xmm14, rcx
movq xmm14, rdx
movq xmm14, rbx
movq xmm14, rsp
movq xmm14, rbp
movq xmm14, rsi
movq xmm14, rdi
movq xmm14, r8
movq xmm14, r9
movq xmm14, r10
movq xmm14, r11
movq xmm14, r12
movq xmm14, r13
movq xmm14, r14
movq xmm14, r15
movq xmm15, rax
movq xmm15, rcx
movq xmm15, rdx
movq xmm15, rbx
movq xmm15, rsp
movq xmm15, rbp
movq xmm15, rsi
movq xmm15, rdi
movq xmm15, r8
movq xmm15, r9
movq xmm15, r10
movq xmm15, r11
movq xmm15, r12
movq xmm15, r13
movq xmm15, r14
movq xmm15, r15
movq xmm0, xmm0
movq xmm0, xmm1
movq xmm0, xmm2
movq xmm0, xmm3
movq xmm0, xmm4
movq xmm0, xmm5
movq xmm0, xmm6
movq xmm0, xmm7
movq xmm0, xmm8
movq xmm0, xmm9
movq xmm0, xmm10
movq xmm0, xmm11
movq xmm0, xmm12
movq xmm0, xmm13
movq xmm0, xmm14
movq xmm0, xmm15
movq xmm1, xmm0
movq xmm1, xmm1
movq xmm1, xmm2
movq xmm1, xmm3
movq xmm1, xmm4
movq xmm1, xmm5
movq xmm1, xmm6
movq xmm1, xmm7
movq xmm1, xmm8
movq xmm1, xmm9
movq xmm1, xmm10
movq xmm1, xmm11
movq xmm1, xmm12
movq xmm1, xmm13
movq xmm1, xmm14
movq xmm1, xmm15
movq xmm2, xmm0
movq xmm2, xmm1
movq xmm2, xmm2
movq xmm2, xmm3
movq xmm2, xmm4
movq xmm2, xmm5
movq xmm2, xmm6
movq xmm2, xmm7
movq xmm2, xmm8
movq xmm2, xmm9
movq xmm2, xmm10
movq xmm2, xmm11
movq xmm2, xmm12
movq xmm2, xmm13
movq xmm2, xmm14
movq xmm2, xmm15
movq xmm3, xmm0
movq xmm3, xmm1
movq xmm3, xmm2
movq xmm3, xmm3
movq xmm3, xmm4
movq xmm3, xmm5
movq xmm3, xmm6
movq xmm3, xmm7
movq xmm3, xmm8
movq xmm3, xmm9
movq xmm3, xmm10
movq xmm3, xmm11
movq xmm3, xmm12
movq xmm3, xmm13
movq xmm3, xmm14
movq xmm3, xmm15
movq xmm4, xmm0
movq xmm4, xmm1
movq xmm4, xmm2
movq xmm4, xmm3
movq xmm4, xmm4
movq xmm4, xmm5
movq xmm4, xmm6
movq xmm4, xmm7
movq xmm4, xmm8
movq xmm4, xmm9
movq xmm4, xmm10
movq xmm4, xmm11
movq xmm4, xmm12
movq xmm4, xmm13
movq xmm4, xmm14
movq xmm4, xmm15
movq xmm5, xmm0
movq xmm5, xmm1
movq xmm5, xmm2
movq xmm5, xmm3
movq xmm5, xmm4
movq xmm5, xmm5
movq xmm5, xmm6
movq xmm5, xmm7
movq xmm5, xmm8
movq xmm5, xmm9
movq xmm5, xmm10
movq xmm5, xmm11
movq xmm5, xmm12
movq xmm5, xmm13
movq xmm5, xmm14
movq xmm5, xmm15
movq xmm6, xmm0
movq xmm6, xmm1
movq xmm6, xmm2
movq xmm6, xmm3
movq xmm6, xmm4
movq xmm6, xmm5
movq xmm6, xmm6
movq xmm6, xmm7
movq xmm6, xmm8
movq xmm6, xmm9
movq xmm6, xmm10
movq xmm6, xmm11
movq xmm6, xmm12
movq xmm6, xmm13
movq xmm6, xmm14
movq xmm6, xmm15
movq xmm7, xmm0
movq xmm7, xmm1
movq xmm7, xmm2
movq xmm7, xmm3
movq xmm7, xmm4
movq xmm7, xmm5
movq xmm7, xmm6
movq xmm7, xmm7
movq xmm7, xmm8
movq xmm7, xmm9
movq xmm7, xmm10
movq xmm7, xmm11
movq xmm7, xmm12
movq xmm7, xmm13
movq xmm7, xmm14
movq xmm7, xmm15
movq xmm8, xmm0
movq xmm8, xmm1
movq xmm8, xmm2
movq xmm8, xmm3
movq xmm8, xmm4
movq xmm8, xmm5
movq xmm8, xmm6
movq xmm8, xmm7
movq xmm8, xmm8
movq xmm8, xmm9
movq xmm8, xmm10
movq xmm8, xmm11
movq xmm8, xmm12
movq xmm8, xmm13
movq xmm8, xmm14
movq xmm8, xmm15
movq xmm9, xmm0
movq xmm9, xmm1
movq xmm9, xmm2
movq xmm9, xmm3
movq xmm9, xmm4
movq xmm9, xmm5
movq xmm9, xmm6
movq xmm9, xmm7
movq xmm9, xmm8
movq xmm9, xmm9
movq xmm9, xmm10
movq xmm9, xmm11
movq xmm9, xmm12
movq xmm9, xmm13
movq xmm9, xmm14
movq xmm9, xmm15
movq xmm10, xmm0
movq xmm10, xmm1
movq xmm10, xmm2
movq xmm10, xmm3
movq xmm10, xmm4
movq xmm10, xmm5
movq xmm10, xmm6
movq xmm10, xmm7
movq xmm10, xmm8
movq xmm10, xmm9
movq xmm10, xmm10
movq xmm10, xmm11
movq xmm10, xmm12
movq xmm10, xmm13
movq xmm10, xmm14
movq xmm10, xmm15
movq xmm11, xmm0
movq xmm11, xmm1
movq xmm11, xmm2
movq xmm11, xmm3
movq xmm11, xmm4
movq xmm11, xmm5
movq xmm11, xmm6
movq xmm11, xmm7
movq xmm11, xmm8
movq xmm11, xmm9
movq xmm11, xmm10
movq xmm11, xmm11
movq xmm11, xmm12
movq xmm11, xmm13
movq xmm11, xmm14
movq xmm11, xmm15
movq xmm12, xmm0
movq xmm12, xmm1
movq xmm12, xmm2
movq xmm12, xmm3
movq xmm12, xmm4
movq xmm12, xmm5
movq xmm12, xmm6
movq xmm12, xmm7
movq xmm12, xmm8
movq xmm12, xmm9
movq xmm12, xmm10
movq xmm12, xmm11
movq xmm12, xmm12
movq xmm12, xmm13
movq xmm12, xmm14
movq xmm12, xmm15
movq xmm13, xmm0
movq xmm13, xmm1
movq xmm13, xmm2
movq xmm13, xmm3
movq xmm13, xmm4
movq xmm13, xmm5
movq xmm13, xmm6
movq xmm13, xmm7
movq xmm13, xmm8
movq xmm13, xmm9
movq xmm13, xmm10
movq xmm13, xmm11
movq xmm13, xmm12
movq xmm13, xmm13
movq xmm13, xmm14
movq xmm13, xmm15
movq xmm14, xmm0
movq xmm14, xmm1
movq xmm14, xmm2
movq xmm14, xmm3
movq xmm14, xmm4
movq xmm14, xmm5
movq xmm14, xmm6
movq xmm14, xmm7
movq xmm14, xmm8
movq xmm14, xmm9
movq xmm14, xmm10
movq xmm14, xmm11
movq xmm14, xmm12
movq xmm14, xmm13
movq xmm14, xmm14
movq xmm14, xmm15
movq xmm0, xmm0
movq xmm0, xmm1
movq xmm0, xmm2
movq xmm0, xmm3
movq xmm0, xmm4
movq xmm0, xmm5
movq xmm0, xmm6
movq xmm0, xmm7
movq xmm0, xmm8
movq xmm0, xmm9
movq xmm0, xmm10
movq xmm0, xmm11
movq xmm0, xmm12
movq xmm0, xmm13
movq xmm0, xmm14
movq xmm0, xmm15
|
moveerase.agda | hazelgrove/hazelnut-agda | 0 | 16135 | <gh_stars>0
open import Nat
open import Prelude
open import List
open import judgemental-erase
open import lemmas-matching
open import statics-core
open import synth-unicity
module moveerase where
-- type actions don't change the term other than moving the cursor
-- around
moveeraset : {t t' : ztyp} {δ : direction} →
(t + move δ +> t') →
(t ◆t) == (t' ◆t)
moveeraset TMArrChild1 = refl
moveeraset TMArrChild2 = refl
moveeraset TMArrParent1 = refl
moveeraset TMArrParent2 = refl
moveeraset (TMArrZip1 {t2 = t2} m) = ap1 (λ x → x ==> t2) (moveeraset m)
moveeraset (TMArrZip2 {t1 = t1} m) = ap1 (λ x → t1 ==> x) (moveeraset m)
moveeraset TMPlusChild1 = refl
moveeraset TMPlusChild2 = refl
moveeraset TMPlusParent1 = refl
moveeraset TMPlusParent2 = refl
moveeraset (TMPlusZip1 {t2 = t2} m) = ap1 (λ x → x ⊕ t2) (moveeraset m)
moveeraset (TMPlusZip2 {t1 = t1} m) = ap1 (λ x → t1 ⊕ x) (moveeraset m)
moveeraset TMProdChild1 = refl
moveeraset TMProdChild2 = refl
moveeraset TMProdParent1 = refl
moveeraset TMProdParent2 = refl
moveeraset (TMProdZip1 {t2 = t2} m) = ap1 (λ x → x ⊠ t2) (moveeraset m)
moveeraset (TMProdZip2 {t1 = t1} m) = ap1 (λ x → t1 ⊠ x) (moveeraset m)
-- the actual movements don't change the erasure
moveerase : {e e' : zexp} {δ : direction} →
(e + move δ +>e e') →
(e ◆e) == (e' ◆e)
moveerase EMAscChild1 = refl
moveerase EMAscChild2 = refl
moveerase EMAscParent1 = refl
moveerase EMAscParent2 = refl
moveerase EMLamChild1 = refl
moveerase EMLamParent = refl
moveerase EMHalfLamChild1 = refl
moveerase EMHalfLamChild2 = refl
moveerase EMHalfLamParent1 = refl
moveerase EMHalfLamParent2 = refl
moveerase EMPlusChild1 = refl
moveerase EMPlusChild2 = refl
moveerase EMPlusParent1 = refl
moveerase EMPlusParent2 = refl
moveerase EMApChild1 = refl
moveerase EMApChild2 = refl
moveerase EMApParent1 = refl
moveerase EMApParent2 = refl
moveerase EMNEHoleChild1 = refl
moveerase EMNEHoleParent = refl
moveerase EMInlChild1 = refl
moveerase EMInlParent = refl
moveerase EMInrChild1 = refl
moveerase EMInrParent = refl
moveerase EMCaseParent1 = refl
moveerase EMCaseParent2 = refl
moveerase EMCaseParent3 = refl
moveerase EMCaseChild1 = refl
moveerase EMCaseChild2 = refl
moveerase EMCaseChild3 = refl
moveerase EMPairChild1 = refl
moveerase EMPairChild2 = refl
moveerase EMPairParent1 = refl
moveerase EMPairParent2 = refl
moveerase EMFstChild1 = refl
moveerase EMFstParent = refl
moveerase EMSndChild1 = refl
moveerase EMSndParent = refl
-- this form is essentially the same as above, but for judgemental
-- erasure, which is sometimes more convenient.
moveerasee' : {e e' : zexp} {e◆ : hexp} {δ : direction} →
erase-e e e◆ →
e + move δ +>e e' →
erase-e e' e◆
moveerasee' er1 m with erase-e◆ er1
... | refl = ◆erase-e _ _ (! (moveerase m))
moveeraset' : ∀{t t◆ t'' δ} →
erase-t t t◆ →
t + move δ +> t'' →
erase-t t'' t◆
moveeraset' er m with erase-t◆ er
moveeraset' er m | refl = ◆erase-t _ _ (! (moveeraset m))
-- movements don't change either the type or expression under expression
-- actions
mutual
moveerase-synth : ∀{Γ e e' e◆ t t' δ } →
erase-e e e◆ →
Γ ⊢ e◆ => t →
Γ ⊢ e => t ~ move δ ~> e' => t' →
(e ◆e) == (e' ◆e) × t == t'
moveerase-synth er wt (SAMove x) = moveerase x , refl
moveerase-synth (EEPlusL er) (SPlus x x₁) (SAZipPlus1 x₂) =
ap1 (λ q → q ·+ _) (moveerase-ana er x x₂) , refl
moveerase-synth (EEPlusR er) (SPlus x x₁) (SAZipPlus2 x₂) =
ap1 (λ q → _ ·+ q) (moveerase-ana er x₁ x₂) , refl
moveerase-synth (EEAscL er) (SAsc x) (SAZipAsc1 x₁) =
ap1 (λ q → q ·: _) (moveerase-ana er x x₁) , refl
moveerase-synth er wt (SAZipAsc2 x x₁ x₂ x₃)
with moveeraset x
... | qq = ap1 (λ q → _ ·: q) qq , eq-ert-trans qq x₂ x₁
moveerase-synth (EEHalfLamL x) (SLam x₁ wt) (SAZipLam1 x₂ x₃ x₄ x₅ x₆ x₇)
with erase-t◆ x₃
... | refl with erase-t◆ x₄
... | refl with moveeraset x₅
... | qq rewrite qq with synthunicity x₇ x₆
... | refl = refl , refl
moveerase-synth (EEHalfLamR er) (SLam x wt) (SAZipLam2 x₁ x₂ x₃ x₄)
with moveerase-synth x₂ x₃ x₄
... | qq , refl rewrite qq = refl , refl
moveerase-synth (EEApL er) (SAp wt x x₁) (SAZipApArr x₂ x₃ x₄ d x₅)
with erasee-det x₃ er
... | refl with synthunicity wt x₄
... | refl with moveerase-synth er x₄ d
... | pp , refl with ▸arr-unicity x x₂
... | refl = (ap1 (λ q → q ∘ _) pp ) , refl
moveerase-synth (EEApR er) (SAp wt x x₁) (SAZipApAna x₂ x₃ x₄)
with synthunicity x₃ wt
... | refl with ▸arr-unicity x x₂
... | refl = ap1 (λ q → _ ∘ q) (moveerase-ana er x₁ x₄ ) , refl
moveerase-synth er wt (SAZipNEHole x x₁ d) =
ap1 ⦇⌜_⌟⦈[ _ ] (π1 (moveerase-synth x x₁ d)) , refl
moveerase-synth er wt (SAZipPair1 x x₁ x₂ x₃) with moveerase-synth x x₁ x₂
... | π1 , refl = (ap1 (λ q → ⟨ q , _ ⟩) π1) , refl
moveerase-synth er wt (SAZipPair2 x x₁ x₂ x₃) with moveerase-synth x₁ x₂ x₃
... | π1 , refl = (ap1 (λ q → ⟨ _ , q ⟩) π1) , refl
moveerase-synth er wt (SAZipFst x x₁ x₂ x₃ x₄)
with moveerase-synth x₂ x₃ x₄
... | π1 , refl with ▸prod-unicity x₁ x
... | refl = (ap1 fst π1) , refl
moveerase-synth er wt (SAZipSnd x x₁ x₂ x₃ x₄)
with moveerase-synth x₂ x₃ x₄
... | π1 , refl with ▸prod-unicity x₁ x
... | refl = (ap1 snd π1) , refl
moveerase-ana : ∀{Γ e e' e◆ t δ } →
erase-e e e◆ →
Γ ⊢ e◆ <= t →
Γ ⊢ e ~ move δ ~> e' ⇐ t →
(e ◆e) == (e' ◆e)
moveerase-ana er wt (AASubsume x x₁ x₂ x₃) = π1 (moveerase-synth x x₁ x₂)
moveerase-ana er wt (AAMove x) = moveerase x
moveerase-ana (EELam er) (ASubsume () x₂) _
moveerase-ana (EELam er) (ALam x₁ x₂ wt) (AAZipLam x₃ x₄ d) with ▸arr-unicity x₂ x₄
... | refl = ap1 (λ q → ·λ _ q) (moveerase-ana er wt d)
moveerase-ana (EEInl er) (ASubsume () x₁) (AAZipInl x₂ d)
moveerase-ana (EEInl er) (AInl x wt) (AAZipInl x₁ d) with ▸sum-unicity x x₁
... | refl = ap1 inl (moveerase-ana er wt d)
moveerase-ana (EEInr er) (ASubsume () x₁) (AAZipInr x₂ d)
moveerase-ana (EEInr er) (AInr x wt) (AAZipInr x₁ d) with ▸sum-unicity x x₁
... | refl = ap1 inr (moveerase-ana er wt d)
moveerase-ana er wt (AAZipCase1 x₁ x₂ x₃ x₄ x₅ x₆ x₇ x₈) =
ap1 (λ q → case q _ _ _ _) (π1(moveerase-synth x₃ x₄ x₅))
moveerase-ana (EECase2 er) (ASubsume () x₂) (AAZipCase2 x₃ x₄ x₅ x₆ d)
moveerase-ana (EECase2 er) (ACase x₁ x₂ x₃ x₄ wt wt₁) (AAZipCase2 x₅ x₆ x₇ x₈ d)
with synthunicity x₄ x₇
... | refl with ▸sum-unicity x₃ x₈
... | refl = ap1 (λ q → case _ _ q _ _) (moveerase-ana er wt d)
moveerase-ana (EECase3 er) (ASubsume () x₂) (AAZipCase3 x₃ x₄ x₅ x₆ d)
moveerase-ana (EECase3 er) (ACase x₁ x₂ x₃ x₄ wt wt₁) (AAZipCase3 x₅ x₆ x₇ x₈ d)
with synthunicity x₄ x₇
... | refl with ▸sum-unicity x₃ x₈
... | refl = ap1 (λ q → case _ _ _ _ q) (moveerase-ana er wt₁ d)
|
oeis/079/A079504.asm | neoneye/loda-programs | 11 | 164274 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A079504: a(n) = 8*n^3*((2*n-1)^2 - 4*n + 4).
; 0,8,320,3672,18944,65000,174528,397880,806912,1498824,2600000,4269848,6704640,10141352,14861504,21195000,29523968,40286600,53980992,71168984,92480000,118614888,150349760,188539832,234123264,288125000,351660608,425940120,512271872,612066344,726840000,858219128,1007943680,1177871112,1369980224,1586375000,1829288448,2101086440,2404271552,2741486904,3115520000,3529306568,3985934400,4488647192,5040848384,5646105000,6308151488,7030893560,7818412032,8674966664,9605000000,10613141208,11704209920
mul $0,2
seq $0,79503 ; a(n) = (n-1)^3*((n-2)^2 - 2*(n-3)).
|
stone/testcases/cmp.asm | yutopp/sekki | 6 | 2043 | <reponame>yutopp/sekki<filename>stone/testcases/cmp.asm
bits 64
cmp cl, 0x0
cmp rcx, [rbp-32]
cmp dl, al
cmp rax, 0xff
cmp rax, 8
cmp rax, 0xffffffff
cmp rcx, rsi
cmp rax, -1
cmp rax,0x80
cmp al, byte [rbp-0x20]
|
src/tp1.adb | zdimension/tdinfo302 | 0 | 8542 | with Ada.Text_IO; use Ada.Text_IO;
procedure tp1 is
-- conversion en majuscule
function Maju (c : Character) return Character is
begin
if c in 'a'..'z' then -- si minuscule
return Character'Val(Character'Pos(c) - 32); -- on décale de 32
else
return c; -- on change rien
end if;
end Maju;
-- caractère actuel
ch : Character;
-- compteurs
nb_i, nb_le, nb_mots_4 : Integer := 0;
-- drapeau / indique si le dernier caractère était un L
dernier_est_l : Boolean := False;
-- drapeau / indique si le mot actuel contient au moins un I
mot_contient_i : Boolean := False;
-- longueur du mot en cours
longueur_act : Integer := 0;
begin
loop
-- lecture du caractère
Get(ch);
ch := Maju(ch);
-- fin de mot ou de phrase
if ch = ' ' or ch = '.' then
-- compteur de mots de 4 lettres
if longueur_act = 4 then
nb_mots_4 := nb_mots_4 + 1;
end if;
-- le mot est fini, on repasse la longueur à 0 et le drapeau à Faux
longueur_act := 0;
mot_contient_i := False;
else
-- le mot n'est pas fini, on incrémente la longueur
longueur_act := longueur_act + 1;
end if;
-- on sort de la boucle si on trouve un point car la phrase est finie
exit when ch = '.';
-- compteur de I
if ch = 'I' and not mot_contient_i then -- si c'est le premier I dans le mot actuel
nb_i := nb_i + 1;
mot_contient_i := True;
end if;
-- compteur de LE
if dernier_est_l and ch = 'E' then
nb_le := nb_le + 1;
end if;
-- on vérifie si c'est un L, pour pouvoir compter les LE
dernier_est_l := ch = 'L';
-- on affiche le caractère en majuscule
Put(Maju(ch));
end loop;
-- on ajoute une ligne à la fin de la phrase affichée
New_Line;
-- affichage des compteurs
Put_Line("Nombre de 'le' : " & Integer'Image(nb_le));
Put_Line("Nombre de mots contenant un i : " & Integer'Image(nb_i));
Put_Line("Nombre de mots de 4 lettres : " & Integer'Image(nb_mots_4));
end tp1;
|
PrimarSql/Antlr/PrimarSqlLexer.g4 | ScriptBox99/chequer-PrimarSql | 5 | 3965 | lexer grammar PrimarSqlLexer;
channels { PRIMARSQLCOMMENT, ERRORCHANNEL }
// SKIP
SPACE: [ \t\r\n]+ -> channel(HIDDEN);
SPEC_MYSQL_COMMENT: '/*!' .+? '*/' -> channel(PRIMARSQLCOMMENT);
COMMENT_INPUT: '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: (
('-- ' | '#') ~[\r\n]* ('\r'? '\n' | EOF)
| '--' ('\r'? '\n' | EOF)
) -> channel(HIDDEN);
SELECT: 'SELECT';
STRONGLY: 'STRONGLY';
EVENTUALLY: 'EVENTUALLY';
AS: 'AS';
FROM: 'FROM';
WHERE: 'WHERE';
GROUP: 'GROUP';
BY: 'BY';
WITH: 'WITH';
LIMIT: 'LIMIT';
LIMITS: 'LIMITS';
OFFSET: 'OFFSET';
TRUE: 'TRUE';
FALSE: 'FALSE';
VARCHAR: 'VARCHAR';
TEXT: 'TEXT';
MEDIUMTEXT: 'MEDIUMTEXT';
LONGTEXT: 'LONGTEXT';
STRING: 'STRING';
INT: 'INT';
INTEGER: 'INTEGER';
BIGINT: 'BIGINT';
BOOL: 'BOOL';
BOOLEAN: 'BOOLEAN';
LIST: 'LIST';
BINARY: 'BINARY';
NUMBER_LIST: 'NUMBER_LIST';
STRING_LIST: 'STRING_LIST';
BINARY_LIST: 'BINARY_LIST';
ORDER: 'ORDER';
CREATE: 'CREATE';
INDEX: 'INDEX';
INDEXES: 'INDEXES';
ON: 'ON';
LOCAL: 'LOCAL';
GLOBAL: 'GLOBAL';
ALL: 'ALL';
KEYS: 'KEYS';
ONLY: 'ONLY';
INCLUDE: 'INCLUDE';
TABLE: 'TABLE';
TABLES: 'TABLES';
HASH: 'HASH';
KEY: 'KEY';
RANGE: 'RANGE';
THROUGHPUT: 'THROUGHPUT';
BILLINGMODE: 'BILLINGMODE';
PROVISIONED: 'PROVISIONED';
PAY_PER_REQUEST: 'PAY_PER_REQUEST';
ON_DEMAND: 'ON_DEMAND';
ALTER: 'ALTER';
ADD: 'ADD';
DROP: 'DROP';
INSERT: 'INSERT';
IGNORE: 'IGNORE';
INTO: 'INTO';
VALUES: 'VALUES';
VALUE: 'VALUE';
ASC: 'ASC';
DESC: 'DESC';
DESCRIBE: 'DESCRIBE';
NOT: 'NOT';
IF_NOT_EXISTS: 'IF_NOT_EXISTS';
ATTRIBUTE_EXISTS: 'ATTRIBUTE_EXISTS';
ATTRIBUTE_NOT_EXISTS: 'ATTRIBUTE_NOT_EXISTS';
ATTRIBUTE_TYPE: 'ATTRIBUTE_TYPE';
BEGINS_WITH: 'BEGINS_WITH';
CONTAINS: 'CONTAINS';
SIZE: 'SIZE';
IF: 'IF';
EXISTS: 'EXISTS';
DEFAULT: 'DEFAULT';
BETWEEN: 'BETWEEN';
AND: 'AND';
LIKE: 'LIKE';
REGEXP: 'REGEXP';
RLIKE: 'RLIKE';
IN: 'IN';
IS: 'IS';
SOME: 'SOME';
ESCAPE: 'ESCAPE';
ROW: 'ROW';
XOR: 'XOR';
OR: 'OR';
START: 'START';
ENDPOINTS: 'ENDPOINTS';
SHOW: 'SHOW';
UPDATE: 'UPDATE';
SET: 'SET';
DELETE: 'DELETE';
PARTITION: 'PARTITION';
SORT: 'SORT';
CURRENT_DATE: 'CURRENT_DATE';
CURRENT_TIME: 'CURRENT_TIME';
CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP';
CAST: 'CAST';
SUBSTR: 'SUBSTR';
SUBSTRING: 'SUBSTRING';
TRIM: 'TRIM';
BOTH: 'BOTH';
LEADING: 'LEADING';
TRAILING: 'TRAILING';
FOR: 'FOR';
COLUMN: 'COLUMN';
OBJECT: 'OBJECT';
JSON: 'JSON';
COUNT: 'COUNT';
REMOVE: 'REMOVE';
NULL_LITERAL: 'NULL';
// Operators. Arithmetics
STAR: '*';
DIVIDE: '/';
MODULE: '%';
PLUS: '+';
MINUSMINUS: '--';
MINUS: '-';
DIV: 'DIV';
MOD: 'MOD';
// Operators. Comparation
EQUAL_SYMBOL: '=';
GREATER_SYMBOL: '>';
LESS_SYMBOL: '<';
EXCLAMATION_SYMBOL: '!';
// Operators. Bit
BIT_NOT_OP: '~';
BIT_OR_OP: '|';
BIT_AND_OP: '&';
BIT_XOR_OP: '^';
// Constructors symbols
DOT: '.';
LR_BRACKET: '(';
RR_BRACKET: ')';
L_BRACKET: '[';
R_BRACKET: ']';
JSON_L_BRACKET: '{';
JSON_R_BRACKET: '}';
ARRADD_L_BRACKET: '<<';
ARRADD_R_BRACKET: '>>';
COMMA: ',';
SEMI: ';';
AT_SIGN: '@';
ZERO_DECIMAL: '0';
ONE_DECIMAL: '1';
TWO_DECIMAL: '2';
SINGLE_QUOTE_SYMB: '\'';
DOUBLE_QUOTE_SYMB: '"';
REVERSE_QUOTE_SYMB: '`';
COLON_SYMB: ':';
// Literal Primitives
STRING_LITERAL: DQUOTA_STRING | SQUOTA_STRING; // | BQUOTA_STRING
DECIMAL_LITERAL: DEC_DIGIT+;
HEXADECIMAL_LITERAL: 'X' '\'' (HEX_DIGIT HEX_DIGIT)+ '\''
| '0X' HEX_DIGIT+;
REAL_LITERAL: (DEC_DIGIT+)? '.' DEC_DIGIT+
| DEC_DIGIT+ '.' EXPONENT_NUM_PART
| (DEC_DIGIT+)? '.' (DEC_DIGIT+ EXPONENT_NUM_PART)
| DEC_DIGIT+ EXPONENT_NUM_PART;
BIT_STRING: BIT_STRING_L;
// Identifiers
ID: ID_LITERAL;
DOUBLE_QUOTE_ID: '"' ~'"'+ '"';
REVERSE_QUOTE_ID: '`' ~'`'+ '`';
// Fragments for Literal primitives
fragment EXPONENT_NUM_PART: 'E' [-+]? DEC_DIGIT+;
fragment ID_LITERAL: [A-Z_$0-9]*?[A-Z_$]+?[A-Z_$0-9]*;
fragment DQUOTA_STRING: '"' ( '\\'. | '""' | ~('"'| '\\') )* '"';
fragment SQUOTA_STRING: '\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\'';
fragment BQUOTA_STRING: '`' ( '\\'. | '``' | ~('`'|'\\'))* '`';
fragment HEX_DIGIT: [0-9A-F];
fragment DEC_DIGIT: [0-9];
fragment BIT_STRING_L: 'B' '\'' [01]+ '\'';
// Last tokens must generate Errors
ERROR_RECONGNIGION: . -> channel(ERRORCHANNEL);
|
libsrc/_DEVELOPMENT/adt/b_array/c/sccz80/b_array_init.asm | teknoplop/z88dk | 8 | 101835 |
; b_array_t *b_array_init(void *p, void *data, size_t capacity)
SECTION code_clib
SECTION code_adt_b_array
PUBLIC b_array_init
EXTERN asm_b_array_init
b_array_init:
pop af
pop bc
pop de
pop hl
push hl
push de
push bc
push af
jp asm_b_array_init
|
oeis/077/A077597.asm | neoneye/loda-programs | 11 | 4411 | <reponame>neoneye/loda-programs<filename>oeis/077/A077597.asm
; A077597: Coefficient of x in the n-th Moebius polynomial (A074586), M(n,x), which satisfies M(n,-1)=mu(n) the Moebius function of n.
; Submitted by <NAME>(s4)
; 0,2,4,7,9,13,15,19,22,26,28,34,36,40,44,49,51,57,59,65,69,73,75,83,86,90,94,100,102,110,112,118,122,126,130,139,141,145,149,157,159,167,169,175,181,185,187,197,200,206,210,216,218,226,230,238,242,246,248,260
add $0,1
mov $2,$0
lpb $0
mov $0,$2
add $1,1
add $3,1
div $0,$3
sub $0,$3
add $1,$0
add $1,$0
lpe
mov $0,$1
sub $0,1
|
src/load.asm | furrtek/GB303 | 90 | 179885 | loadpattern:
ld a,(HWOK_EE)
or a
ret z ;No EE operation if EE boot check failed
ld a,(SAVECURPATTSLOT)
cp MAX_PATTERNS
ret nc ;Sanity check
ld b,a ;00000000 aAAAAAAA
rrca ;0aAAAAAA A0000000
and $80
ld (EEWRADDRL),a
ld a,b
srl a
and $3F
inc a ;Start at $0100
ld (EEWRADDRM),a
call readts
ld c,$00
call spicom
ld a,$08 ; CS high
ld ($2000),a
nop
ld a,d
cp e
jr z,+
;Bad checksum: whatever, go on, defaults will be restored if needed...
ret
ld a,(TEMPSECTOR)
or a
ret z ;Blank pattern, don't load
+:
ld b,8
ld hl,PATTNAME
ld de,TEMPSECTOR+1
-:
ld a,(de)
ldi (hl),a
inc de
dec b
jr nz,-
ld a,$FF ;Security
ld (PATTNAME+8),a
ld hl,pparams
ld de,TEMPSECTOR+$10
-:
ldi a,(hl)
or (hl)
jr z,+
ldd a,(hl) ;BC is pointer to variable
ld c,(hl)
ld b,a
ld a,(de) ;Get EE value
inc hl
inc hl
cp (hl)
jr c,++ ;<
jr z,++ ;=
inc hl
ld a,(hl) ;OOB: Restore default
jr +++
++:
inc hl
+++:
inc hl
ld (bc),a
inc de
jr -
+:
ld a,(EEWRADDRL)
or $40
ld (EEWRADDRL),a
call readts
ld c,$00
call spicom
ld a,$08 ; CS high
ld ($2000),a
nop
ld a,d
cp e
jr z,+
;Bad checksum:
ret
+:
ld b,16*4
ld hl,SEQ
ld de,TEMPSECTOR
-:
ld a,(de)
ldi (hl),a
inc de
dec b
jr nz,-
ld a,(SAVECURPATTSLOT)
ld (CURPATTERN),a
ld a,(CURSCREEN) ; Update pattern name in specific screens (not table, nor memory)
cp 1
jr z,+
cp 6
jr nz,++
ld a,(CURSCREEN)
cp 6
call z,setscreen
ret
++:
cp 2
call z,draw_seq
jp write_pattinfo ; Call+ret
+:
or a
ret nz
call liv_erasepotlinks ; To test !
jp liv_drawpotlinks ; Call+ret
|
addcarry1.asm | rvgarg/microprocessor_programs | 0 | 101930 | <filename>addcarry1.asm
mvi c,3eh
mvi a,0ffh
adc c
hlt |
lib/tgbl_keyboard.asm | trexxet/tgbl | 14 | 2472 | ; TGBL keyboard routines
; Keystroke handlers switcher, enabled by default
%define KBD_HANDLERS_ENABLED 1
%define KBD_HANDLERS_DISABLED 0
tgbl_kbd_handlers_enable db KBD_HANDLERS_ENABLED
; Keystroke handlers table pointer
tgbl_kbd_table equ 0x6b52 ; 0x7c00 - 4096 bytes stack - 2 * 0x87
; Enable/disable keystroke handlers
%macro tgblm_setKeyHandlers 1
mov byte [tgbl_kbd_handlers_enable], %1
%endmacro
; Clean keyboard handlers table
; Spoils: AX, BX
tgbl_clearKeyHandlersTable:
xor ax, ax
xor bx, bx
.clearLoop:
mov [tgbl_kbd_table + bx], ax
add bx, 2
cmp bx, 0x87 * 2
jb .clearLoop
ret
; Set keystroke handler
; Args: key, handler
%macro tgblm_initKey 2
mov word [tgbl_kbd_table + (%1) * 2], (%2)
%endmacro
; Clear keystroke handler
; Args: key
%macro tgblm_deinitKey 1
mov word [tgbl_kbd_table + (%1) * 2], 0
%endmacro
; Keyboard handler
; Spoils: AH, BX
tgbl_keyboardHandler:
; Check if handlers enabled
cmp byte [tgbl_kbd_handlers_enable], KBD_HANDLERS_DISABLED
je .noKey
; Get key
mov ah, 01h
int 16h
jz .noKey
; Get handler
movzx bx, ah
shl bx, 1
add bx, tgbl_kbd_table
mov bx, [bx]
; If handler exists, call it
test bx, bx
jz .end
call bx
.end:
; Clear key buffer
xor ah, ah
int 16h
.noKey:
ret
; Get ASCII character of the key pressed
; Returns: AL = ASCII character
; Spoils: AH
tgbl_getChar:
xor ah, ah
int 16h
ret
; Read input string until Enter is pressed
; Args: address of string, max length including zero terminator
; Spoils: AX, BX, CX, DI
%macro tgblm_getString 2
mov di, %1
mov bx, %2
call tgbl_getString
%endmacro
tgbl_getString:
mov cx, 1 ; CX - counter for read symbols
.readLoop:
cmp cx, bx
jae .end
xor ah, ah
int 16h
cmp al, 0x0D ; CR
je .end
mov byte [di], al
inc di
inc cx
jmp .readLoop
.end:
mov byte [di], 0
ret
; Keyboard scan codes
KEY_A equ 0x1E
KEY_B equ 0x30
KEY_C equ 0x2E
KEY_D equ 0x20
KEY_E equ 0x12
KEY_F equ 0x21
KEY_G equ 0x22
KEY_H equ 0x23
KEY_I equ 0x17
KEY_J equ 0x24
KEY_K equ 0x25
KEY_L equ 0x26
KEY_M equ 0x32
KEY_N equ 0x31
KEY_O equ 0x18
KEY_P equ 0x19
KEY_Q equ 0x10
KEY_R equ 0x13
KEY_S equ 0x1F
KEY_T equ 0x14
KEY_U equ 0x16
KEY_V equ 0x2F
KEY_W equ 0x11
KEY_X equ 0x2D
KEY_Y equ 0x15
KEY_Z equ 0x2C
KEY_1 equ 0x02
KEY_2 equ 0x03
KEY_3 equ 0x04
KEY_4 equ 0x05
KEY_5 equ 0x06
KEY_6 equ 0x07
KEY_7 equ 0x08
KEY_8 equ 0x09
KEY_9 equ 0x0A
KEY_0 equ 0x0B
KEY_MINUS equ 0x0C
KEY_EQUAL equ 0x0D
KEY_SQBRKT_OP equ 0x1A
KEY_SQBRKT_CL equ 0x1B
KEY_SEMICOLON equ 0x27
KEY_APOSTROPH equ 0x28
KEY_GRAVIS equ 0x29
KEY_BACKSLASH equ 0x2B
KEY_COMMA equ 0x33
KEY_DOT equ 0x34
KEY_SLASH equ 0x35
KEY_F1 equ 0x3B
KEY_F2 equ 0x3C
KEY_F3 equ 0x3D
KEY_F4 equ 0x3E
KEY_F5 equ 0x3F
KEY_F6 equ 0x40
KEY_F7 equ 0x41
KEY_F8 equ 0x42
KEY_F9 equ 0x43
KEY_F10 equ 0x44
KEY_F11 equ 0x85
KEY_F12 equ 0x86
KEY_BKSP equ 0x0E
KEY_DEL equ 0x53
KEY_DOWN_ARR equ 0x50
KEY_END equ 0x4F
KEY_ENTER equ 0x1C
KEY_ESC equ 0x01
KEY_HOME equ 0x47
KEY_INS equ 0x52
KEY_KPD_5 equ 0x4C
KEY_KPD_MUL equ 0x37
KEY_KPD_MINUS equ 0x4A
KEY_KPD_PLUS equ 0x4E
KEY_KPD_SLASH equ 0x35
KEY_LEFT_ARR equ 0x4B
KEY_PGDN equ 0x51
KEY_PGUP equ 0x49
KEY_RIGHT_ARR equ 0x4D
KEY_SPACE equ 0x39
KEY_TAB equ 0x0F
KEY_UP_ARR equ 0x48
|
ioctl/Cat05.asm | osfree-project/FamilyAPI | 1 | 94738 | ;/*!
; @file
;
; @ingroup fapi
;
; @brief DosDevIOCtl Category 5 Functions
;
; (c) osFree Project 2021, <http://www.osFree.org>
; for licence see licence.txt in root directory, or project website
;
; This is Family API implementation for DOS, used with BIND tools
; to link required API
;
; @author <NAME> (<EMAIL>)
;
; Documentation: http://osfree.org/doku/en:docs:fapi:dosdevioctl
;
;*/
_DATA SEGMENT BYTE PUBLIC 'DATA' USE16
PRNTABLE1:
DW IOPSETFRAME ; Function 41H Set Frame control
DW RESERVED ; Function 42H Reserved
DW RESERVED ; Function 43H Reserved
DW IOPSETRETRY ; Function 44H Set Infinite Retry
DW RESERVED ; Function 45H Reserved
DW IOPINIT ; Function 46H Initialize printer
PRNTABLE2:
DW IOPGETFRAME ; Function 62H Get Frame Control
DW RESERVED ; Function 63H Reserved
DW IOPGETRETRY ; Function 64H Get Infinite Retry
DW RESERVED ; Function 65H Reserved
DW IOPGETSTATUS ; Function 66H Get Printer Status
_DATA ENDS
_TEXT SEGMENT BYTE PUBLIC 'CODE' USE16
;--------------------------------------------------------
; Category 5 Handler
;--------------------------------------------------------
IOPRINTER PROC NEAR
MOV SI, [DS:BP].ARGS.FUNCTION
SUB SI, 41H ; 41H
JB EXIT
CMP SI, 05H ; 46H
JBE OK1
SUB SI, 20H ; 61H
JB EXIT
CMP SI, 05H ; 66H
JA EXIT
JMP OK2
OK1:
SHL SI, 1
; SHL SI, 1
CALL WORD PTR ES:PRNTABLE1[SI]
JMP EXIT
OK2:
SHL SI, 1
; SHL SI, 1
CALL WORD PTR ES:PRNTABLE2[SI]
EXIT:
RET
IOPRINTER ENDP
INCLUDE IopSetFrame.asm
INCLUDE IopSetRetry.asm
INCLUDE IopInit.asm
INCLUDE IopGetFrame.asm
INCLUDE IopGetRetry.asm
INCLUDE IopGetStatus.asm
_TEXT ENDS
|
oeis/028/A028065.asm | neoneye/loda-programs | 11 | 82629 | <filename>oeis/028/A028065.asm
; A028065: Expansion of 1/((1-3x)(1-5x)(1-8x)(1-10x)).
; Submitted by <NAME>
; 1,26,437,6058,75525,882258,9876613,107390426,1143865349,12003195490,124572616389,1282173260394,13113918930373,133479729281522,1353536864252165,13685361486439162,138053939020888197
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,18069 ; Expansion of 1/((1-3x)(1-8x)(1-10x)).
mul $1,5
add $1,$0
lpe
mov $0,$1
|
oeis/040/A040894.asm | neoneye/loda-programs | 11 | 168856 | ; A040894: Continued fraction for sqrt(925).
; Submitted by <NAME>(s3)
; 30,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2,60,2,2,2,2
mov $4,$0
add $0,5
gcd $0,$4
mov $2,$0
lpb $2
div $0,4
lpb $4
mov $0,2
mov $4,$3
lpe
mul $0,15
mov $2,1
lpe
mul $0,2
|
library/fmGUI_ManageDatabase/fmGUI_ManageDb_GoToTab.applescript | NYHTC/applescript-fm-helper | 1 | 4480 | -- fmGUI_ManageDb_GoToTab({tabName:null})
-- <NAME>, NYHTC
-- Go to the "Fields" tab of manage database
(*
HISTORY:
1.1 - 2018-05-02 ( eshagdar ): keep trying to click tab until it changes ( relationship graph can take a bit to load ).
1.0.1 - 2018-04-30 ( eshagdar ): updated error message
1.0 - 2016-06-30 ( eshagdar ): first created. Modeled from fmGUI_ManageDb_GoToTab_Fields version 1.3
REQUIRES:
fmGUI_AppFrontMost
fmGUI_ManageDb_Open
*)
on run
fmGUI_ManageDb_GoToTab({tabName:"Tables"})
end run
--------------------
-- START OF CODE
--------------------
on fmGUI_ManageDb_GoToTab(prefs)
-- version 1.1
set defaultPrefs to {tabName:"Tables"}
set prefs to prefs & defaultPrefs
set tabName to tabName of prefs
try
fmGUI_AppFrontMost()
fmGUI_ManageDb_Open({})
tell application "System Events"
tell application process "FileMaker Pro Advanced"
set tabObject to a reference to (first radio button of tab group 1 of window 1 whose title contains tabName)
repeat 100 times
click tabObject
if value of tabObject is 1 then exit repeat
delay 0.1
end repeat
if value of tabObject is 0 then error "time out trying to change tab" number -1024
end tell
end tell
return true
on error errMsg number errNum
error "unable to fmGUI_ManageDb_GoToTab ( couldn't go to the '" & tabName of prefs & "' tab ) - " & errMsg number errNum
end try
end fmGUI_ManageDb_GoToTab
--------------------
-- END OF CODE
--------------------
on fmGUI_AppFrontMost()
tell application "htcLib" to fmGUI_AppFrontMost()
end fmGUI_AppFrontMost
on fmGUI_ManageDb_Open(prefs)
tell application "htcLib" to fmGUI_ManageDb_Open(prefs)
end fmGUI_ManageDb_Open
|
source/asis/spec/ada-numerics-float_random.ads | faelys/gela-asis | 4 | 30374 | <reponame>faelys/gela-asis<filename>source/asis/spec/ada-numerics-float_random.ads<gh_stars>1-10
------------------------------------------------------------------------------
-- 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) $
package Ada.Numerics.Float_Random is
-- Basic facilities
type Generator is limited private;
subtype Uniformly_Distributed is Float range 0.0 .. 1.0;
function Random (Gen : Generator) return Uniformly_Distributed;
procedure Reset (Gen : in Generator;
Initiator : in Integer);
procedure Reset (Gen : in Generator);
-- Advanced facilities
type State is private;
procedure Save (Gen : in Generator;
To_State : out State);
procedure Reset (Gen : in Generator;
From_State : in State);
Max_Image_Width : constant := implementation-defined;
function Image (Of_State : State) return String;
function Value (Coded_State : String) return State;
private
pragma Import (Ada, State);
pragma Import (Ada, Generator);
end Ada.Numerics.Float_Random;
|
gfx/pokemon/wobbuffet/anim_idle.asm | Dev727/ancientplatinum | 28 | 240322 | <reponame>Dev727/ancientplatinum<gh_stars>10-100
frame 0, 30
endanim
|
src/grammar/tattoo.g4 | chris-koch-penn/tattoo-lang | 0 | 4976 | grammar tattoo;
prog: expression_list;
expression_list:
expression terminator
| expression_list expression terminator
| terminator;
expression:
function_definition
| function_inline_call
| require_block
| if_statement
| unless_statement
| rvalue
| return_statement
| while_statement
| for_statement
| pir_inline;
global_get:
var_name = lvalue op = ASSIGN global_name = id_global;
global_set:
global_name = id_global op = ASSIGN result = all_result;
global_result: id_global;
function_inline_call: function_call;
require_block: REQUIRE literal_t;
pir_inline: PIR crlf pir_expression_list END;
pir_expression_list: expression_list;
function_definition:
function_definition_header function_definition_body END;
function_definition_body: expression_list;
function_definition_header:
DEF function_name crlf
| DEF function_name function_definition_params crlf;
function_name: id_function | id;
function_definition_params:
LEFT_RBRACKET RIGHT_RBRACKET
| LEFT_RBRACKET function_definition_params_list RIGHT_RBRACKET
| function_definition_params_list;
function_definition_params_list:
function_definition_param_id
| function_definition_params_list COMMA function_definition_param_id;
function_definition_param_id: id;
return_statement: RETURN all_result;
function_call:
name = function_name LEFT_RBRACKET params = function_call_param_list RIGHT_RBRACKET
| name = function_name params = function_call_param_list
| name = function_name LEFT_RBRACKET RIGHT_RBRACKET;
function_call_param_list: function_call_params;
function_call_params:
function_param
| function_call_params COMMA function_param;
function_param: ( function_unnamed_param | function_named_param);
function_unnamed_param: (
int_result
| float_result
| string_result
| dynamic_result
);
function_named_param:
id op = ASSIGN (
int_result
| float_result
| string_result
| dynamic_result
);
function_call_assignment: function_call;
all_result: (
int_result
| float_result
| string_result
| dynamic_result
| global_result
);
elsif_statement: if_elsif_statement;
if_elsif_statement:
ELSIF cond_expression crlf statement_body
| ELSIF cond_expression crlf statement_body else_token crlf statement_body
| ELSIF cond_expression crlf statement_body if_elsif_statement;
if_statement:
IF cond_expression crlf statement_body END
| IF cond_expression crlf statement_body else_token crlf statement_body END
| IF cond_expression crlf statement_body elsif_statement END;
unless_statement:
UNLESS cond_expression crlf statement_body END
| UNLESS cond_expression crlf statement_body else_token crlf statement_body END
| UNLESS cond_expression crlf statement_body elsif_statement END;
while_statement: WHILE cond_expression crlf statement_body END;
for_statement:
FOR LEFT_RBRACKET init_expression SEMICOLON cond_expression SEMICOLON loop_expression
RIGHT_RBRACKET crlf statement_body END
| FOR init_expression SEMICOLON cond_expression SEMICOLON loop_expression crlf statement_body
END;
init_expression: for_init_list;
all_assignment: (
int_assignment
| float_assignment
| string_assignment
| dynamic_assignment
);
for_init_list:
for_init_list COMMA all_assignment
| all_assignment;
cond_expression: comparison_list;
loop_expression: for_loop_list;
for_loop_list:
for_loop_list COMMA all_assignment
| all_assignment;
statement_body: statement_expression_list;
statement_expression_list:
expression terminator
| RETRY terminator
| break_expression terminator
| statement_expression_list expression terminator
| statement_expression_list RETRY terminator
| statement_expression_list break_expression terminator;
assignment:
var_id = lvalue op = ASSIGN rvalue
| var_id = lvalue op = (
PLUS_ASSIGN
| MINUS_ASSIGN
| MUL_ASSIGN
| DIV_ASSIGN
| MOD_ASSIGN
| EXP_ASSIGN
) rvalue;
dynamic_assignment:
var_id = lvalue op = ASSIGN dynamic_result
| var_id = lvalue op = (
PLUS_ASSIGN
| MINUS_ASSIGN
| MUL_ASSIGN
| DIV_ASSIGN
| MOD_ASSIGN
| EXP_ASSIGN
) dynamic_result;
int_assignment:
var_id = lvalue op = ASSIGN int_result
| var_id = lvalue op = (
PLUS_ASSIGN
| MINUS_ASSIGN
| MUL_ASSIGN
| DIV_ASSIGN
| MOD_ASSIGN
| EXP_ASSIGN
) int_result;
float_assignment:
var_id = lvalue op = ASSIGN float_result
| var_id = lvalue op = (
PLUS_ASSIGN
| MINUS_ASSIGN
| MUL_ASSIGN
| DIV_ASSIGN
| MOD_ASSIGN
| EXP_ASSIGN
) float_result;
string_assignment:
var_id = lvalue op = ASSIGN string_result
| var_id = lvalue op = PLUS_ASSIGN string_result;
initial_array_assignment:
var_id = lvalue op = ASSIGN LEFT_SBRACKET RIGHT_SBRACKET;
array_assignment:
arr_def = array_selector op = ASSIGN arr_val = all_result;
array_definition:
LEFT_SBRACKET array_definition_elements RIGHT_SBRACKET;
array_definition_elements: (int_result | dynamic_result)
| array_definition_elements COMMA (
int_result
| dynamic_result
);
array_selector:
id LEFT_SBRACKET (int_result | dynamic_result) RIGHT_SBRACKET
| id_global LEFT_SBRACKET (int_result | dynamic_result) RIGHT_SBRACKET;
dynamic_result:
dynamic_result op = (MUL | DIV | MOD) int_result
| int_result op = ( MUL | DIV | MOD) dynamic_result
| dynamic_result op = ( MUL | DIV | MOD) float_result
| float_result op = ( MUL | DIV | MOD) dynamic_result
| dynamic_result op = (MUL | DIV | MOD) dynamic_result
| dynamic_result op = MUL string_result
| string_result op = MUL dynamic_result
| dynamic_result op = ( PLUS | MINUS) int_result
| int_result op = ( PLUS | MINUS) dynamic_result
| dynamic_result op = ( PLUS | MINUS) float_result
| float_result op = ( PLUS | MINUS) dynamic_result
| dynamic_result op = ( PLUS | MINUS) dynamic_result
| LEFT_RBRACKET dynamic_result RIGHT_RBRACKET
| dynamic;
dynamic: id | function_call_assignment | array_selector;
int_result:
int_result op = (MUL | DIV | MOD) int_result
| int_result op = ( PLUS | MINUS) int_result
| LEFT_RBRACKET int_result RIGHT_RBRACKET
| int_t;
float_result:
float_result op = (MUL | DIV | MOD) float_result
| int_result op = ( MUL | DIV | MOD) float_result
| float_result op = ( MUL | DIV | MOD) int_result
| float_result op = ( PLUS | MINUS) float_result
| int_result op = ( PLUS | MINUS) float_result
| float_result op = ( PLUS | MINUS) int_result
| LEFT_RBRACKET float_result RIGHT_RBRACKET
| float_t;
string_result:
string_result op = MUL int_result
| int_result op = MUL string_result
| string_result op = PLUS string_result
| literal_t;
comparison_list:
left = comparison op = BIT_AND right = comparison_list
| left = comparison op = AND right = comparison_list
| left = comparison op = BIT_OR right = comparison_list
| left = comparison op = OR right = comparison_list
| LEFT_RBRACKET comparison_list RIGHT_RBRACKET
| comparison;
comparison:
left = comp_var op = (
LESS
| GREATER
| LESS_EQUAL
| GREATER_EQUAL
) right = comp_var
| left = comp_var op = (EQUAL | NOT_EQUAL) right = comp_var;
comp_var: all_result | array_selector | id;
lvalue: id; //| id_global
rvalue:
lvalue
| initial_array_assignment
| array_assignment
| int_result
| float_result
| string_result
| global_set
| global_get
| dynamic_assignment
| string_assignment
| float_assignment
| int_assignment
| assignment
| function_call
| literal_t
| bool_t
| float_t
| int_t
| nil_t
| rvalue EXP rvalue
| ( NOT | BIT_NOT) rvalue
| rvalue ( MUL | DIV | MOD) rvalue
| rvalue ( PLUS | MINUS) rvalue
| rvalue ( BIT_SHL | BIT_SHR) rvalue
| rvalue BIT_AND rvalue
| rvalue ( BIT_OR | BIT_XOR) rvalue
| rvalue (LESS | GREATER | LESS_EQUAL | GREATER_EQUAL) rvalue
| rvalue ( EQUAL | NOT_EQUAL) rvalue
| rvalue ( OR | AND) rvalue
| LEFT_RBRACKET rvalue RIGHT_RBRACKET;
break_expression: BREAK;
literal_t: LITERAL;
float_t: FLOAT;
int_t: INT;
bool_t: TRUE | FALSE;
nil_t: NIL;
id: ID;
id_global: ID_GLOBAL;
id_function: ID_FUNCTION;
terminator:
terminator SEMICOLON
| terminator crlf
| SEMICOLON
| crlf;
else_token: ELSE;
crlf: CRLF;
fragment ESCAPED_QUOTE: '\\"';
LITERAL:
'"' (ESCAPED_QUOTE | ~('\n' | '\r'))*? '"'
| '\'' ( ESCAPED_QUOTE | ~('\n' | '\r'))*? '\'';
COMMA: ',';
SEMICOLON: ';';
CRLF: '\r'? '\n';
REQUIRE: 'import';
END: 'end';
DEF: 'def';
RETURN: 'return';
PIR: 'pir';
IF: 'if';
ELSE: 'else';
ELSIF: 'else if';
UNLESS: 'unless';
WHILE: 'while';
RETRY: 'retry';
BREAK: 'break';
FOR: 'for';
TRUE: 'true';
FALSE: 'false';
PLUS: '+';
MINUS: '-';
MUL: '*';
DIV: '/';
MOD: '%';
EXP: '**';
EQUAL: '==';
NOT_EQUAL: '!=';
GREATER: '>';
LESS: '<';
LESS_EQUAL: '<=';
GREATER_EQUAL: '>=';
ASSIGN: '=';
PLUS_ASSIGN: '+=';
MINUS_ASSIGN: '-=';
MUL_ASSIGN: '*=';
DIV_ASSIGN: '/=';
MOD_ASSIGN: '%=';
EXP_ASSIGN: '**=';
BIT_AND: '&';
BIT_OR: '|';
BIT_XOR: '^';
BIT_NOT: '~';
BIT_SHL: '<<';
BIT_SHR: '>>';
AND: 'and' | '&&';
OR: 'or' | '||';
NOT: 'not' | '!';
LEFT_RBRACKET: '(';
RIGHT_RBRACKET: ')';
LEFT_SBRACKET: '[';
RIGHT_SBRACKET: ']';
NIL: 'nil';
SL_COMMENT: ('#' ~('\r' | '\n')* '\r'? '\n') -> skip;
// ML_COMMENT: ('=begin' .*? '=end' '\r'? '\n') -> skip;
WS: (' ' | '\t')+ -> skip;
INT: [0-9]+;
FLOAT: [0-9]* '.' [0-9]+;
ID: [a-zA-Z_][a-zA-Z0-9_]*;
ID_GLOBAL: '$' ID;
ID_FUNCTION: ID [?]; |
unittests/ASM/Multiblock/ReachableInvalidCode.asm | cobalt2727/FEX | 628 | 95060 | %ifdef CONFIG
{
"Match": "All",
"RegData": {
"RAX": "0x20"
}
}
%endif
mov rax, 0
cmp rax, 0
jz finish
; multiblock should gracefully handle these invalid ops
db 0xf, 0x3B ; invalid opcode here
finish:
mov rax, 32
hlt |
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c3/c36205l.ada | best08618/asylo | 7 | 30614 | <reponame>best08618/asylo
-- C36205L.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- OBJECTIVE
-- FOR GENERIC PROCEDURES, CHECK THAT ATTRIBUTES GIVE THE
-- CORRECT VALUES FOR UNCONSTRAINED FORMAL PARAMETERS.
-- BASIC CHECKS OF ARRAY OBJECTS AND WHOLE ARRAYS PASSED AS
-- PARAMETERS TO GENERIC PROCEDURES
-- HISTORY
-- <NAME>, 9 AUGUST 1990
-- DAS 8 OCT 1990 ADDED OUT MODE PARAMETER TO GENERIC
-- PROCEDURE TEST_PROCEDURE AND FORMAL
-- GENERIC PARAMETER COMPONENT_VALUE.
WITH REPORT ;
PROCEDURE C36205L IS
SHORT_START : CONSTANT := -100 ;
SHORT_END : CONSTANT := 100 ;
TYPE SHORT_RANGE IS RANGE SHORT_START .. SHORT_END ;
SHORT_LENGTH : CONSTANT NATURAL := (SHORT_END - SHORT_START + 1) ;
MEDIUM_START : CONSTANT := 1 ;
MEDIUM_END : CONSTANT := 100 ;
TYPE MEDIUM_RANGE IS RANGE MEDIUM_START .. MEDIUM_END ;
MEDIUM_LENGTH : CONSTANT NATURAL := (MEDIUM_END - MEDIUM_START
+ 1) ;
TYPE MONTH_TYPE IS (JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG,
SEP, OCT, NOV, DEC) ;
TYPE DAY_TYPE IS RANGE 1 .. 31 ;
TYPE YEAR_TYPE IS RANGE 1904 .. 2050 ;
TYPE DATE IS RECORD
MONTH : MONTH_TYPE ;
DAY : DAY_TYPE ;
YEAR : YEAR_TYPE ;
END RECORD ;
TODAY : DATE := (MONTH => AUG,
DAY => 9,
YEAR => 1990) ;
SUBTYPE SHORT_STRING IS STRING (1 ..5) ;
DEFAULT_STRING : SHORT_STRING := "ABCDE" ;
TYPE FIRST_TEMPLATE IS ARRAY (SHORT_RANGE RANGE <>,
MEDIUM_RANGE RANGE <>) OF DATE ;
TYPE SECOND_TEMPLATE IS ARRAY (MONTH_TYPE RANGE <>,
DAY_TYPE RANGE <>) OF SHORT_STRING ;
TYPE THIRD_TEMPLATE IS ARRAY (CHARACTER RANGE <>,
BOOLEAN RANGE <>) OF DAY_TYPE ;
FIRST_ARRAY : FIRST_TEMPLATE (-10 .. 10, 27 .. 35)
:= (-10 .. 10 =>
(27 .. 35 => TODAY)) ;
SECOND_ARRAY : SECOND_TEMPLATE (JAN .. JUN, 1 .. 25)
:= (JAN .. JUN =>
(1 .. 25 => DEFAULT_STRING)) ;
THIRD_ARRAY : THIRD_TEMPLATE ('A' .. 'Z', FALSE .. TRUE)
:= ('A' .. 'Z' =>
(FALSE .. TRUE => DAY_TYPE (9))) ;
FOURTH_ARRAY : FIRST_TEMPLATE (0 .. 27, 75 .. 100)
:= (0 .. 27 =>
(75 .. 100 => TODAY)) ;
FIFTH_ARRAY : SECOND_TEMPLATE (JUL .. OCT, 6 .. 10)
:= (JUL .. OCT =>
(6 .. 10 => DEFAULT_STRING)) ;
SIXTH_ARRAY : THIRD_TEMPLATE ('X' .. 'Z', TRUE .. TRUE)
:= ('X' .. 'Z' =>
(TRUE .. TRUE => DAY_TYPE (31))) ;
GENERIC
TYPE FIRST_INDEX IS (<>) ;
TYPE SECOND_INDEX IS (<>) ;
TYPE COMPONENT_TYPE IS PRIVATE ;
TYPE UNCONSTRAINED_ARRAY IS ARRAY (FIRST_INDEX RANGE <>,
SECOND_INDEX RANGE <>) OF COMPONENT_TYPE ;
COMPONENT_VALUE: IN COMPONENT_TYPE;
PROCEDURE TEST_PROCEDURE (FIRST : IN UNCONSTRAINED_ARRAY ;
FFIFS : IN FIRST_INDEX ;
FFILS : IN FIRST_INDEX ;
FSIFS : IN SECOND_INDEX ;
FSILS : IN SECOND_INDEX ;
FFLEN : IN NATURAL ;
FSLEN : IN NATURAL ;
FFIRT : IN FIRST_INDEX ;
FSIRT : IN SECOND_INDEX ;
SECOND : OUT UNCONSTRAINED_ARRAY ;
SFIFS : IN FIRST_INDEX ;
SFILS : IN FIRST_INDEX ;
SSIFS : IN SECOND_INDEX ;
SSILS : IN SECOND_INDEX ;
SFLEN : IN NATURAL ;
SSLEN : IN NATURAL ;
SFIRT : IN FIRST_INDEX ;
SSIRT : IN SECOND_INDEX ;
REMARKS : IN STRING) ;
PROCEDURE TEST_PROCEDURE (FIRST : IN UNCONSTRAINED_ARRAY ;
FFIFS : IN FIRST_INDEX ;
FFILS : IN FIRST_INDEX ;
FSIFS : IN SECOND_INDEX ;
FSILS : IN SECOND_INDEX ;
FFLEN : IN NATURAL ;
FSLEN : IN NATURAL ;
FFIRT : IN FIRST_INDEX ;
FSIRT : IN SECOND_INDEX ;
SECOND : OUT UNCONSTRAINED_ARRAY ;
SFIFS : IN FIRST_INDEX ;
SFILS : IN FIRST_INDEX ;
SSIFS : IN SECOND_INDEX ;
SSILS : IN SECOND_INDEX ;
SFLEN : IN NATURAL ;
SSLEN : IN NATURAL ;
SFIRT : IN FIRST_INDEX ;
SSIRT : IN SECOND_INDEX ;
REMARKS : IN STRING) IS
BEGIN -- TEST_PROCEDURE
IF (FIRST'FIRST /= FFIFS) OR
(FIRST'FIRST (1) /= FFIFS) OR
(FIRST'FIRST (2) /= FSIFS) OR
(SECOND'FIRST /= SFIFS) OR
(SECOND'FIRST (1) /= SFIFS) OR
(SECOND'FIRST (2) /= SSIFS) THEN
REPORT.FAILED ("PROBLEMS WITH 'FIRST. " & REMARKS) ;
END IF ;
IF (FIRST'LAST /= FFILS) OR
(FIRST'LAST (1) /= FFILS) OR
(FIRST'LAST (2) /= FSILS) OR
(SECOND'LAST /= SFILS) OR
(SECOND'LAST (1) /= SFILS) OR
(SECOND'LAST (2) /= SSILS) THEN
REPORT.FAILED ("PROBLEMS WITH 'LAST. " & REMARKS) ;
END IF ;
IF (FIRST'LENGTH /= FFLEN) OR
(FIRST'LENGTH (1) /= FFLEN) OR
(FIRST'LENGTH (2) /= FSLEN) OR
(SECOND'LENGTH /= SFLEN) OR
(SECOND'LENGTH (1) /= SFLEN) OR
(SECOND'LENGTH (2) /= SSLEN) THEN
REPORT.FAILED ("PROBLEMS WITH 'LENGTH. " & REMARKS) ;
END IF ;
IF (FFIRT NOT IN FIRST'RANGE (1)) OR
(FFIRT NOT IN FIRST'RANGE) OR
(SFIRT NOT IN SECOND'RANGE (1)) OR
(SFIRT NOT IN SECOND'RANGE) OR
(FSIRT NOT IN FIRST'RANGE (2)) OR
(SSIRT NOT IN SECOND'RANGE (2)) THEN
REPORT.FAILED ("INCORRECT HANDLING OF 'RANGE " &
"ATTRIBUTE. " & REMARKS) ;
END IF ;
-- ASSIGN VALUES TO THE ARRAY PARAMETER OF MODE OUT
FOR I IN SECOND'RANGE(1) LOOP
FOR J IN SECOND'RANGE(2) LOOP
SECOND(I, J) := COMPONENT_VALUE;
END LOOP;
END LOOP;
END TEST_PROCEDURE ;
PROCEDURE FIRST_TEST_PROCEDURE IS NEW TEST_PROCEDURE (
FIRST_INDEX => SHORT_RANGE,
SECOND_INDEX => MEDIUM_RANGE,
COMPONENT_TYPE => DATE,
UNCONSTRAINED_ARRAY => FIRST_TEMPLATE,
COMPONENT_VALUE => TODAY) ;
PROCEDURE SECOND_TEST_PROCEDURE IS NEW TEST_PROCEDURE (
FIRST_INDEX => MONTH_TYPE,
SECOND_INDEX => DAY_TYPE,
COMPONENT_TYPE => SHORT_STRING,
UNCONSTRAINED_ARRAY => SECOND_TEMPLATE,
COMPONENT_VALUE => DEFAULT_STRING) ;
PROCEDURE THIRD_TEST_PROCEDURE IS NEW TEST_PROCEDURE (
FIRST_INDEX => CHARACTER,
SECOND_INDEX => BOOLEAN,
COMPONENT_TYPE => DAY_TYPE,
UNCONSTRAINED_ARRAY => THIRD_TEMPLATE,
COMPONENT_VALUE => DAY_TYPE'FIRST) ;
BEGIN -- C36205L
REPORT.TEST ( "C36205L","FOR GENERIC PROCEDURES, CHECK THAT " &
"ATTRIBUTES GIVE THE CORRECT VALUES FOR " &
"UNCONSTRAINED FORMAL PARAMETERS. BASIC " &
"CHECKS OF ARRAY OBJECTS AND WHOLE ARRAYS " &
"PASSED AS PARAMETERS TO GENERIC PROCEDURES");
FIRST_TEST_PROCEDURE (FIRST => FIRST_ARRAY,
FFIFS => -10,
FFILS => 10,
FSIFS => 27,
FSILS => 35,
FFLEN => 21,
FSLEN => 9,
FFIRT => 0,
FSIRT => 29,
SECOND => FOURTH_ARRAY,
SFIFS => 0,
SFILS => 27,
SSIFS => 75,
SSILS => 100,
SFLEN => 28,
SSLEN => 26,
SFIRT => 5,
SSIRT => 100,
REMARKS => "FIRST_TEST_PROCEDURE") ;
SECOND_TEST_PROCEDURE (FIRST => SECOND_ARRAY,
FFIFS => JAN,
FFILS => JUN,
FSIFS => 1,
FSILS => 25,
FFLEN => 6,
FSLEN => 25,
FFIRT => MAR,
FSIRT => 17,
SECOND => FIFTH_ARRAY,
SFIFS => JUL,
SFILS => OCT,
SSIFS => 6,
SSILS => 10,
SFLEN => 4,
SSLEN => 5,
SFIRT => JUL,
SSIRT => 6,
REMARKS => "SECOND_TEST_PROCEDURE") ;
THIRD_TEST_PROCEDURE (FIRST => THIRD_ARRAY,
FFIFS => 'A',
FFILS => 'Z',
FSIFS => FALSE,
FSILS => TRUE,
FFLEN => 26,
FSLEN => 2,
FFIRT => 'T',
FSIRT => TRUE,
SECOND => SIXTH_ARRAY,
SFIFS => 'X',
SFILS => 'Z',
SSIFS => TRUE,
SSILS => TRUE,
SFLEN => 3,
SSLEN => 1,
SFIRT => 'Z',
SSIRT => TRUE,
REMARKS => "THIRD_TEST_PROCEDURE") ;
REPORT.RESULT ;
END C36205L ;
|
PRG/levels/Ice/6-2.asm | narfman0/smb3_pp1 | 0 | 245650 | ; Original address was $B14C
; 6-2
.word W602_EndL ; Alternate level layout
.word W602_EndO ; Alternate object layout
.byte LEVEL1_SIZE_09 | LEVEL1_YSTART_140
.byte LEVEL2_BGPAL_00 | LEVEL2_OBJPAL_08 | LEVEL2_XSTART_18 | LEVEL2_UNUSEDFLAG
.byte LEVEL3_TILESET_12 | LEVEL3_VSCROLL_LOCKLOW | LEVEL3_PIPENOTEXIT
.byte LEVEL4_BGBANK_INDEX(12) | LEVEL4_INITACT_NOTHING
.byte LEVEL5_BGM_ATHLETIC | LEVEL5_TIME_300
.byte $36, $00, $43, $36, $07, $43, $72, $14, $13, $78, $1F, $13, $31, $15, $82, $57
.byte $1F, $E0, $37, $22, $01, $36, $28, $43, $77, $2D, $13, $30, $29, $10, $31, $29
.byte $10, $32, $29, $10, $33, $29, $10, $34, $29, $10, $35, $29, $10, $33, $2E, $82
.byte $76, $32, $13, $36, $37, $43, $36, $3E, $43, $30, $33, $82, $33, $3B, $82, $38
.byte $35, $82, $33, $34, $10, $34, $34, $10, $35, $34, $10, $33, $39, $10, $34, $39
.byte $10, $35, $39, $10, $38, $42, $43, $39, $49, $43, $2B, $4A, $40, $2C, $4A, $40
.byte $2D, $4A, $40, $2E, $4A, $40, $2F, $4A, $40, $30, $4A, $40, $31, $4A, $40, $32
.byte $4A, $40, $33, $4A, $40, $34, $4A, $40, $35, $4A, $40, $36, $4A, $40, $37, $4A
.byte $40, $38, $4A, $40, $6B, $51, $13, $28, $56, $43, $28, $5C, $43, $25, $58, $0A
.byte $46, $58, $E0, $47, $58, $E0, $6D, $68, $13, $34, $6F, $43, $30, $6E, $82, $38
.byte $78, $43, $2D, $74, $0B, $27, $72, $40, $28, $72, $40, $29, $72, $40, $2A, $72
.byte $40, $2B, $72, $40, $2C, $72, $40, $2D, $72, $40, $2E, $72, $40, $2F, $72, $40
.byte $30, $72, $43, $39, $80, $43, $37, $8A, $93, $E8, $42, $80, $FF
|
oeis/305/A305471.asm | neoneye/loda-programs | 11 | 160460 | ; A305471: a(0) = 1, a(1) = 3, a(n) = 3*n*a(n-1) - a(n-2).
; Submitted by <NAME>
; 1,3,17,150,1783,26595,476927,9988872,239256001,6449923155,193258438649,6371078552262,229165569442783,8931086129716275,374876451878640767,16860509248409118240,808929567471759034753,41238547431811301654163,2226072631750338530290049,126844901462337484924878630,7608468015108498756962427751,479206640050373084203708069683,31620029775309515058687770171327,2181302847856306165965252433751880,157022185015878734434439487459964033,11774482573343048776416996307063550595
lpb $0
sub $0,1
add $1,1
mov $3,$1
mul $3,$0
mul $3,3
add $3,$1
add $2,$3
add $1,$2
lpe
mov $0,$1
add $0,1
|
programs/oeis/321/A321999.asm | jmorken/loda | 1 | 171647 | <gh_stars>1-10
; A321999: Sum of digits of n minus the number of digits of n.
; 0,0,1,2,3,4,5,6,7,8,-1,0,1,2,3,4,5,6,7,8,0,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,10,2,3,4,5,6,7,8,9,10,11,3,4,5,6,7,8,9,10,11,12,4,5,6,7,8,9,10,11,12,13,5,6,7,8,9,10,11,12,13,14,6,7,8,9,10,11,12,13,14,15,7
lpb $0
mov $2,$0
div $0,10
mod $2,10
sub $2,1
add $1,$2
lpe
|
Driver/Mouse/AbsGen/absgen.asm | steakknife/pcgeos | 504 | 96285 | <gh_stars>100-1000
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Mouse Driver -- Absolute Generic Mouse Device-dependent routines
FILE: absgen.asm
AUTHOR: <NAME>, Jul 16, 1991
ROUTINES:
Name Description
---- -----------
MouseDevInit Intialize the device, registering a handler
with the DOS Mouse driver
MouseDevExit Deinitialize the device, nuking our handler.
MouseDevHandler Handler for DOS driver to call.
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 7/20/89 Initial revision
DESCRIPTION:
Generic mouse driver that sits on top of the standard DOS one,
using the absolute coordinates provided by the driver, rather than
being relative as the other generic mouse driver is.
$Id: absgen.asm,v 1.1 97/04/18 11:47:59 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
_Mouse = 1
;
; The following constants are used in mouseCommon.asm -- see that
; file for documentation.
;
MOUSE_NUM_BUTTONS = 3 ; Assume 3 for now -- we'll set it in MouseDevInit
MOUSE_CANT_SET_RATE =1 ; Microsoft driver doesn't specify a function
; to change the report rate.
MOUSE_SEPARATE_INIT = 1 ; We use a separate Init resource
MOUSE_DONT_ACCELERATE = 1 ; We'll handle acceleration in our monitor
MOUSE_USES_ABSOLUTE_DELTAS = 1 ; We pass absolute coordinates
include ../mouseCommon.asm ; Include common definitions/code.
include win.def
include Internal/grWinInt.def
include Internal/videoDr.def ; for gross video-exclusive hack
;------------------------------------------------------------------------------
; DEVICE STRINGS
;------------------------------------------------------------------------------
MouseExtendedInfoSeg segment lmem LMEM_TYPE_GENERAL
mouseExtendedInfo DriverExtendedInfoTable <
{}, ; lmem header added by Esp
length mouseNameTable, ; Number of supported devices
offset mouseNameTable,
offset mouseInfoTable
>
mouseNameTable lptr.char genLightPen,
genTouchScreen,
genTablet,
genDigitizer,
unmouse,
elodev,
summa,
wacomArtPad
lptr.char 0 ; null-terminator
genLightPen chunk.char 'Generic Light Pen', 0
genTouchScreen chunk.char 'Generic Touch Screen', 0
genTablet chunk.char 'Generic Tablet', 0
genDigitizer chunk.char 'Generic Digitizer', 0
unmouse chunk.char 'UnMouse Touch Tablet', 0
elodev chunk.char 'Elographics Touch Screen', 0
summa chunk.char 'SummaGraphics SummaSketch', 0
wacomArtPad chunk.char 'Wacom ArtPad', 0
mouseInfoTable MouseExtendedInfo \
mask MEI_GENERIC, ; genLightPen
mask MEI_GENERIC, ; genTouchScreen
mask MEI_GENERIC, ; genTablet
mask MEI_GENERIC, ; genDigitizer
mask MEI_GENERIC, ; unmouse
mask MEI_GENERIC, ; elodev
mask MEI_GENERIC, ; summa
mask MEI_GENERIC ; Wacom ArtPad
MouseExtendedInfoSeg ends
;------------------------------------------------------------------------------
; Variables
;------------------------------------------------------------------------------
idata segment
mouseSet byte 0 ; non-zero if device-type set
mouseRates label byte ; to avoid assembly errors
MOUSE_NUM_RATES equ 0
idata ends
MouseFuncs etype byte
MF_RESET enum MouseFuncs
MF_SHOW_CURSOR enum MouseFuncs
MF_HIDE_CURSOR enum MouseFuncs
MF_GET_POS_AND_BUTTONS enum MouseFuncs
MF_SET_POS enum MouseFuncs
MF_GET_BUTTON_PRESS_INFO enum MouseFuncs
MF_GET_BUTTON_RELEASE_INFO enum MouseFuncs
MF_SET_X_LIMITS enum MouseFuncs
MF_SET_Y_LIMITS enum MouseFuncs
MF_DEFINE_GRAPHICS_CURSOR enum MouseFuncs
MF_DEFINE_TEXT_CURSOR enum MouseFuncs
MF_READ_MOTION enum MouseFuncs
MF_DEFINE_EVENT_HANDLER enum MouseFuncs
MF_ENABLE_LIGHT_PEN enum MouseFuncs
MF_DISABLE_LIGHT_PEN enum MouseFuncs
MF_SET_ACCELERATOR enum MouseFuncs
MF_CONDITIONAL_HIDE_CURSOR enum MouseFuncs
MF_SET_ACCEL_THRESHOLD enum MouseFuncs
MouseEvents record
ME_MIDDLE_RELEASE:1
ME_MIDDLE_PRESS:1
ME_RIGHT_RELEASE:1
ME_RIGHT_PRESS:1
ME_LEFT_RELEASE:1
ME_LEFT_PRESS:1
ME_MOTION:1
MouseEvents end
Resident segment resource
Init segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseReset
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reset the mouse while dealing with non-standard drivers that
like to modify video state. Ensures that geos isn't
trying to draw by grabbing the video-exclusive for the
default video driver.
CALLED BY: MouseDevInit, MouseDevExit, MouseTestDevice
PASS: nothing
RETURN: ax = non-zero if driver present
bx = # buttons on mouse.
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 10/29/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FAKE_GSTATE equ 1 ; bogus GState "handle" passed to
; the video driver as the exclusive
; gstate. The driver doesn't care if
; the handle's legal or not. Since we
; can't get a legal one w/o a great
; deal of work, we don't bother.
bogusStrategy fptr.far farRet
Resident segment resource
farRet: retf
Resident ends
MouseReset proc far uses cx, dx, di, ds, si, bp
.enter
;
; Assume no video driver around -- makes life easier
;
segmov ds, cs
mov si, offset bogusStrategy - offset DIS_strategy
push bx
mov ax, GDDT_VIDEO
call GeodeGetDefaultDriver
tst ax
jz haveDriver
mov_tr bx, ax
call GeodeInfoDriver
haveDriver:
mov bx, FAKE_GSTATE
mov di, DR_VID_START_EXCLUSIVE
clr ax ; no override
call ds:[si].DIS_strategy
;
; Reset the DOS-level driver; now the system is protected from its
; potential for modifying video card registers.
;
pop bx ; recover default # buttons (in
; some cases)
mov ax, MF_RESET
int 51
;
; Release the video driver now the mouse driver reset is accomplished
;
push ax, bx
mov bx, FAKE_GSTATE
mov di, DR_VID_END_EXCLUSIVE
call ds:[si].DIS_strategy
tst ax ; any operation interrupted?
jz invalDone ; no
mov ax, si ; ax <- left
push di ; save top
call ImGetPtrWin ; bx <- driver, di <- root win
pop bx ; bx <- top
tst di
jz invalDone
clr bp, si ; rectangular region, thanks
call WinInvalTree
invalDone:
pop ax, bx
.leave
ret
MouseReset endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseDevInit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize the device
CALLED BY: MouseInit
PASS: es=ds=dgroup
RETURN: carry - set on error
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
Install our interrupt vector and initialize our state.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
adam 6/8/88 Initial Revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseDevInit proc far uses dx, ax, cx, si, bx
.enter
dec ds:[mouseSet]
mov bx, 3 ; Early LogiTech drivers screw up and
; restore all registers, so default
; number of buttons to 3.
call MouseReset
;
; The mouse driver initialization returns bx == # of buttons
; on the mouse. Some two-button drivers get upset if we request
; events from the third (non-existent) button, so we check the
; number of buttons available, and set the mask accordingly.
;
mov ds:[DriverTable].MDIS_numButtons, bx
mov cx, 1fh ;cx <- all events (2 buttons)
cmp bx, 2
je twoButtons
mov cx, 7fh ;cx <- all events (3 buttons)
twoButtons:
segmov es, Resident, dx ; Set up Event handler
mov dx, offset Resident:MouseDevHandler
mov ax, MF_DEFINE_EVENT_HANDLER
int 51
;
; Set the bounds over which the mouse is allowed to roam to match
; the dimensions of the default video screen, if we can...
;
mov ax, GDDT_VIDEO
call GeodeGetDefaultDriver ;ax <- default video
tst ax
jz done
mov_tr bx, ax
push ds
call GeodeInfoDriver
mov cx, ds:[si].VDI_pageW
mov dx, ds:[si].VDI_pageH
pop ds
push cx
clr cx ; min Y is 0, max Y in dx
mov ax, MF_SET_Y_LIMITS
int 51
pop dx ; dx <- max X
clr cx ; min X is 0
mov ax, MF_SET_X_LIMITS
int 51
done:
clc ; no error
.leave
ret
MouseDevInit endp
Init ends
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseDevExit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Clean up after ourselves
CALLED BY: MouseExit
PASS: Nothing
RETURN: carry - set on error
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
Contact the driver to remove our handler
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
adam 6/8/88 Initial Revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseDevExit proc near
tst ds:[mouseSet]
jz done
call MouseReset
clc ; No errors
done:
ret
MouseDevExit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseSetDevice
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Turn on the device.
CALLED BY: DRE_SET_DEVICE
PASS: dx:si = pointer to null-terminated device name string
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
Just call the device-initialization routine in Init
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 9/27/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseSetDevice proc near
.enter
call MouseDevInit
.leave
ret
MouseSetDevice endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseTestDevice
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See if the device specified is present.
CALLED BY: DRE_TEST_DEVICE
PASS: dx:si = null-terminated name of device (ignored, here)
RETURN: ax = DevicePresent enum
carry set if string invalid, clear otherwise
DESTROYED: di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 9/27/90 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseTestDevice proc near uses bx
.enter
; XXX: SOME DRIVERS DON'T DO THIS RIGHT!
call MouseReset
tst ax
mov ax, DP_PRESENT
jnz done
mov ax, DP_NOT_PRESENT
done:
.leave
ret
MouseTestDevice endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MouseDevHandler
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Mouse handler routine to take the event and pass it to
MouseSendEvents
CALLED BY: EXTERNAL
PASS: ax - mask of events that occurred:
b0 pointer motion
b1 left down
b2 left up
b3 right down
b4 right up
b5 middle down
b6 middle up
bx - button state
b0 left
b1 right
b2 middle
1 => pressed
cx - X position
dx - Y position
RETURN: Nothing
DESTROYED: Anything (Logitech driver saves all)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
adam 7/19/89 Initial revision
adam 7/16/91 Changed to use absolute deltas
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
MouseDevHandler proc far
;
; Load dgroup into ds. We pay no attention to the event
; mask we're passed, since MouseSendEvents just works from the
; data we give it. So we trash AX here.
;
mov ax, dgroup
mov ds, ax
;
; Now have to transform the button state. We're given
; <M,R,L> with 1 => pressed, which is just about as bad as
; we can get, since MouseSendEvents wants <L,M,R> with
; 0 => pressed. The contortions required to perform the
; rearrangement are truly gruesome.
;
andnf bx, 7 ; Make sure high bits are clear (see
; below)
shr bl, 1 ; L => CF
rcl bh, 1 ; L => BH<0>
shl bh, 1 ; L => BH<1>
shl bh, 1 ; L => BH<2>
or bh, bl ; Merge in M and R
not bh ; Invert the sense (want 0 => pressed)
; and make sure uncommitted bits all
; appear as UP.
;
; Ship the events off.
;
call MouseSendEvents
ret
MouseDevHandler endp
Resident ends
end
|
src/random.ads | JeremyGrosser/the_grid | 0 | 24416 | <filename>src/random.ads<gh_stars>0
with HAL; use HAL;
package Random is
function Next
return UInt16;
function In_Range
(First, Last : Natural)
return Natural;
end Random;
|
programming-languages/ada/aa.adb | robertwenquan/nyu-course-assignment | 1 | 16491 | with Ada.Numerics.Elementary_Functions;
use Ada.Numerics.Elementary_Functions;
procedure Quadratic_Equation
(A, B, C : Float; -- By default it is "in".
R1, R2 : out Float;
Valid : out Boolean)
is
Z : Float;
begin
Z := B**2 - 4.0 * A * C;
if Z < 0.0 or A = 0.0 then
Valid := False; -- Being out parameter, it should be modified at least once.
R1 := 0.0;
R2 := 0.0;
else
Valid := True;
R1 := (-B + Sqrt (Z)) / (2.0 * A);
R2 := (-B - Sqrt (Z)) / (2.0 * A);
end if;
end Quadratic_Equation;
|
prototyping/Luau/Var.agda | TheGreatSageEqualToHeaven/luau | 1 | 16001 | <filename>prototyping/Luau/Var.agda
module Luau.Var where
open import Agda.Builtin.Bool using (true; false)
open import Agda.Builtin.Equality using (_≡_)
open import Agda.Builtin.String using (String; primStringEquality)
open import Agda.Builtin.TrustMe using (primTrustMe)
open import Properties.Dec using (Dec; yes; no)
open import Properties.Equality using (_≢_)
Var : Set
Var = String
_≡ⱽ_ : (a b : Var) → Dec (a ≡ b)
a ≡ⱽ b with primStringEquality a b
a ≡ⱽ b | false = no p where postulate p : (a ≢ b)
a ≡ⱽ b | true = yes primTrustMe
|
Agda/ideals.agda | UlrikBuchholtz/HoTT-Intro | 333 | 8884 | {-# OPTIONS --without-K --exact-split #-}
module ideals where
import abelian-subgroups
import rings
open abelian-subgroups public
open rings public
{- Subsets of rings -}
subset-Ring :
(l : Level) {l1 : Level} (R : Ring l1) → UU ((lsuc l) ⊔ l1)
subset-Ring l R = type-Ring R → UU-Prop l
is-set-subset-Ring :
(l : Level) {l1 : Level} (R : Ring l1) → is-set (subset-Ring l R)
is-set-subset-Ring l R =
is-set-function-type (is-set-UU-Prop l)
{- Closure properties of subsets of rings -}
is-additive-subgroup-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) → UU (l1 ⊔ l2)
is-additive-subgroup-subset-Ring R = is-subgroup-Ab (ab-Ring R)
is-closed-under-mul-left-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) → UU (l1 ⊔ l2)
is-closed-under-mul-left-subset-Ring R P =
(x : type-Ring R) (y : type-Ring R) →
type-Prop (P y) → type-Prop (P (mul-Ring R x y))
is-closed-under-mul-right-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) → UU (l1 ⊔ l2)
is-closed-under-mul-right-subset-Ring R P =
(x : type-Ring R) (y : type-Ring R) →
type-Prop (P x) → type-Prop (P (mul-Ring R x y))
{- The definition of left and right ideals -}
is-left-ideal-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) → UU (l1 ⊔ l2)
is-left-ideal-subset-Ring R P =
is-additive-subgroup-subset-Ring R P ×
is-closed-under-mul-left-subset-Ring R P
Left-Ideal-Ring :
(l : Level) {l1 : Level} (R : Ring l1) → UU ((lsuc l) ⊔ l1)
Left-Ideal-Ring l R = Σ (subset-Ring l R) (is-left-ideal-subset-Ring R)
is-right-ideal-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) → UU (l1 ⊔ l2)
is-right-ideal-subset-Ring R P =
is-additive-subgroup-subset-Ring R P ×
is-closed-under-mul-right-subset-Ring R P
Right-Ideal-Ring :
(l : Level) {l1 : Level} (R : Ring l1) → UU ((lsuc l) ⊔ l1)
Right-Ideal-Ring l R = Σ (subset-Ring l R) (is-right-ideal-subset-Ring R)
is-two-sided-ideal-subset-Ring :
{l1 l2 : Level} (R : Ring l1) (P : subset-Ring l2 R) → UU (l1 ⊔ l2)
is-two-sided-ideal-subset-Ring R P =
is-additive-subgroup-subset-Ring R P ×
( is-closed-under-mul-left-subset-Ring R P ×
is-closed-under-mul-right-subset-Ring R P)
Two-Sided-Ideal-Ring :
(l : Level) {l1 : Level} (R : Ring l1) → UU ((lsuc l) ⊔ l1)
Two-Sided-Ideal-Ring l R =
Σ (subset-Ring l R) (is-two-sided-ideal-subset-Ring R)
{- Special ideals -}
|
15-Shred-Lines.speed.size.asm | blueset/7bh-solutions | 0 | 166670 | -- 7 Billion Humans --
-- 15: <NAME> --
-- Size: 9/10 --
-- Speed: 24/25 --
a:
b:
step n
if n != datacube:
jump b
endif
pickup n
c:
step s
if s == shredder:
giveto s
jump a
endif
jump c
|
extra/msg_passing-whiteboard.adb | HeisenbugLtd/msg_passing | 0 | 7433 | ------------------------------------------------------------------------
-- Copyright (C) 2010-2020 by Heisenbug Ltd. (<EMAIL>)
--
-- This work is free. You can redistribute it and/or modify it under
-- the terms of the Do What The Fuck You Want To Public License,
-- Version 2, as published by Sam Hocevar. See the LICENSE file for
-- more details.
------------------------------------------------------------------------
pragma License (Unrestricted);
------------------------------------------------------------------------
-- Msg_Passing.Whiteboard
--
-- Implementation of message passing via whiteboards.
--
------------------------------------------------------------------------
package body Msg_Passing.Whiteboard is
---------------------------------------------------------------------
-- Object.Read
---------------------------------------------------------------------
procedure Read (Instance : in out Object;
Message : out Letter) is
begin
Instance.Locked.Get (Message);
end Read;
---------------------------------------------------------------------
-- Object.Write
---------------------------------------------------------------------
procedure Write (Instance : in out Object;
Message : in Letter) is
begin
Instance.Locked.Put (Message);
end Write;
---------------------------------------------------------------------
-- protected body Mutex
---------------------------------------------------------------------
protected body Mutex is
------------------------------------------------------------------
-- Whiteboard.Put
------------------------------------------------------------------
entry Put (Message : in Letter) when not Msg_Available is
begin
The_Message := Message;
Msg_Available := True;
end Put;
------------------------------------------------------------------
-- Whiteboard.Get
------------------------------------------------------------------
entry Get (Message : out Letter) when Msg_Available is
begin
Message := The_Message;
end Get;
------------------------------------------------------------------
-- Whiteboard.Erase
------------------------------------------------------------------
procedure Erase is
begin
Msg_Available := False;
end Erase;
end Mutex;
end Msg_Passing.Whiteboard;
|
src/boot/stagetwo.asm | yotam5/SmollOs | 0 | 92292 | ORG 0x7e00
[BITS 16]
mov [loader_drivenum], dl
;; Set up vbe info structure
xor ax, ax
mov es, ax
mov ah, 4Fh
mov di, vbe_info_block
int 10h
cmp ax, 4Fh
jne error
mov ax, word [vbe_info_block.video_mode_pointer]
mov [offset], ax
mov ax, word [vbe_info_block.video_mode_pointer+2]
mov [t_segment], ax
mov fs, ax
mov si, [offset]
;; Get next VBE video mode
.find_mode:
mov dx, [fs:si]
inc si
inc si
mov [offset], si
mov [mode], dx
cmp dx, word 0FFFFh ; at end of video mode list?
je end_of_modes
mov ax, 4F01h ; get vbe mode info
mov cx, [mode]
mov di, mode_info_block ; Mode info block mem address
int 10h
cmp ax, 4Fh
jne error
;; Print out mode values...
mov dx, [mode_info_block.x_resolution]
call print_hex ; Print width
mov ax, 0E20h ; Print a space
int 10h
mov dx, [mode_info_block.y_resolution]
call print_hex ; Print height
mov ax, 0E20h ; Print a space
int 10h
xor dh, dh
mov dl, [mode_info_block.bits_per_pixel]
call print_hex ; Print bpp
mov ax, 0E0Ah ; Print a newline
int 10h
mov al, 0Dh
int 10h
;; Compare values with desired values
mov ax, [width]
cmp ax, [mode_info_block.x_resolution]
jne .next_mode
mov ax, [height]
cmp ax, [mode_info_block.y_resolution]
jne .next_mode
mov ax, [bpp]
cmp al, [mode_info_block.bits_per_pixel]
jne .next_mode
;; Uncomment these to verify correct width/height/bpp values
;; cli
;; hlt
mov ax, 4F02h ; Set VBE mode
mov bx, [mode]
or bx, 4000h ; Enable linear frame buffer, bit 14
xor di, di
int 10h
cmp ax, 4Fh
jne error
jmp load_GDT ; Move on to set up GDT & 32bit protected mode
.next_mode:
mov ax, [t_segment]
mov fs, ax
mov si, [offset]
jmp .find_mode
error:
mov ax, 0E46h ; Print 'F'
int 10h
cli
hlt
end_of_modes:
mov ax, 0E4Eh ; Print 'N'
int 10h
cli
hlt
;; print_hex: Suboutine to print a hex string
print_hex:
mov cx, 4 ; offset in string, counter (4 hex characters)
.hex_loop:
mov ax, dx ; Hex word passed in DX
and al, 0Fh ; Use nibble in AL
mov bx, hex_to_ascii
xlatb ; AL = [DS:BX + AL]
mov bx, cx ; Need bx to index data
mov [hexString+bx+1], al ; Store hex char in string
ror dx, 4 ; Get next nibble
loop .hex_loop
mov si, hexString ; Print out hex string
mov ah, 0Eh
mov cx, 6 ; Length of string
.loop:
lodsb
int 10h
loop .loop
ret
;; Set up GDT
GDT_start:
;; Offset 0h
dq 0h ;; 1st descriptor required to be NULL descriptor
;; Offset 08h
.code:
dw 0FFFFh ; Segment limit 1 - 2 bytes
dw 0h ; Segment base 1 - 2 bytes
db 0h ; Segment base 2 - 1 byte
db 10011010b ; Access byte - bits: 7 - Present, 6-5 - privelege level (0 = kernel), 4 - descriptor type (code/data)
; 3 - executable y/n, 2 - direction/conforming (grow up from base to limit), 1 - read/write, 0 - accessed (CPU sets this)
db 11001111b ; bits: 7 - granularity (4KiB), 6 - size (32bit protected mode), 3-0 segment limit 2 - 4 bits
db 0h ; Segment base 3 - 1 byte
;; Offset 10h
.data:
dw 0FFFFh ; Segment limit 1 - 2 bytes
dw 0h ; Segment base 1 - 2 bytes
db 0h ; Segment base 2 - 1 byte
db 10010010b ; Access byte
db 11001111b ; bits: 7 - granularity (4KiB), 6 - size (32bit protected mode), 3-0 segment limit 2 - 4 bits
db 0h ; Segment base 3 - 1 byte
;; Load GDT
GDT_Desc:
dw ($ - GDT_start - 1)
dd GDT_start
load_GDT:
mov dl, [loader_drivenum]
cli ; Clear interrupts first
lgdt [GDT_Desc] ; Load the GDT to the cpu
mov eax, cr0
or eax, 1 ; Set protected mode bit
mov cr0, eax ; Turn on protected mode
mov esi, mode_info_block
mov edi, 5000h
mov ecx, 64 ; Mode info block is 256 bytes / 4 = # of dbl words
rep movsd
jmp 0:0x2000
;; DATA AREA
loader_drivenum: db 0
hexString: db '0x0000'
hex_to_ascii: db '0123456789ABCDEF'
;; VBE Variables
width: dw 1920
height: dw 1080
bpp: db 32
offset: dw 0
t_segment: dw 0 ; "segment" is keyword in fasm
mode: dw 0
;; End normal 2ndstage bootloader sector padding
times 512-($-$$) db 0
vbe_info_block: ; 'Sector' 2
.vbe_signature: db 'VBE2'
.vbe_version: dw 0 ; Should be 0300h? BCD value
.oem_string_pointer: dd 0
.capabilities: dd 0
.video_mode_pointer: dd 0
.total_memory: dw 0
.oem_software_rev: dw 0
.oem_vendor_name_pointer: dd 0
.oem_product_name_pointer: dd 0
.oem_product_revision_pointer: dd 0
.reserved: times 222 db 0
.oem_data: times 256 db 0
mode_info_block: ; 'Sector' 3
;; Mandatory info for all VBE revisions
.mode_attributes: dw 0
.window_a_attributes: db 0
.window_b_attributes: db 0
.window_granularity: dw 0
.window_size: dw 0
.window_a_segment: dw 0
.window_b_segment: dw 0
.window_function_pointer: dd 0
.bytes_per_scanline: dw 0
;; Mandatory info for VBE 1.2 and above
.x_resolution: dw 0
.y_resolution: dw 0
.x_charsize: db 0
.y_charsize: db 0
.number_of_planes: db 0
.bits_per_pixel: db 0
.number_of_banks: db 0
.memory_model: db 0
.bank_size: db 0
.number_of_image_pages: db 0
.reserved1: db 1
;; Direct color fields (required for direct/6 and YUV/7 memory models)
.red_mask_size: db 0
.red_field_position: db 0
.green_mask_size: db 0
.green_field_position: db 0
.blue_mask_size: db 0
.blue_field_position: db 0
.reserved_mask_size: db 0
.reserved_field_position: db 0
.direct_color_mode_info: db 0
;; Mandatory info for VBE 2.0 and above
.physical_base_pointer: dd 0 ; Physical address for flat memory frame buffer
.reserved2: dd 0
.reserved3: dw 0
;; Mandatory info for VBE 3.0 and above
.linear_bytes_per_scan_line: dw 0
.bank_number_of_image_pages: db 0
.linear_number_of_image_pages: db 0
.linear_red_mask_size: db 0
.linear_red_field_position: db 0
.linear_green_mask_size: db 0
.linear_green_field_position: db 0
.linear_blue_mask_size: db 0
.linear_blue_field_position: db 0
.linear_reserved_mask_size: db 0
.linear_reserved_field_position: db 0
.max_pixel_clock: dd 0
.reserved4: times 190 db 0 ; Remainder of mode info block
;; Sector padding
times 1536-($-$$) db 0
|
src/util/liste_generique.adb | SKNZ/BezierToSTL | 0 | 2536 | with Ada.Unchecked_Deallocation;
package body Liste_Generique is
procedure Liberer is new Ada.Unchecked_Deallocation(Cellule, Pointeur);
procedure Vider(L : in out Liste) is
Cour : Pointeur := L.Debut;
Next : Pointeur;
begin
while Cour /= null loop
Next := Cour.Suivant;
Liberer(Cour);
Cour := Next;
end loop;
-- La liste est réinitialisée
L.Taille := 0;
L.Debut := null;
L.Fin := null;
end;
procedure Insertion_Tete(L : in out Liste ; E : Element) is
begin
if L.Debut = null then
L.Debut := new Cellule'(Contenu => E, Suivant => null);
L.Fin := L.Debut;
else
L.Debut := new Cellule'(Contenu => E, Suivant => L.Debut);
end if;
L.Taille := L.Taille + 1;
end;
procedure Insertion_Queue(L : in out Liste ; E : Element) is
Ptr_Cellule : Pointeur;
begin
if L.Debut = null then
L.Debut := new Cellule'(Contenu => E, Suivant => null);
L.Fin := L.Debut;
else
Ptr_Cellule := new Cellule'(Contenu => E, Suivant => null);
L.Fin.Suivant := Ptr_Cellule;
L.Fin := Ptr_Cellule;
end if;
L.Taille := L.Taille + 1;
end;
procedure Parcourir (L : Liste) is
Cour : Pointeur := L.Debut;
begin
while Cour /= null loop
Traiter(Cour.Contenu);
Cour := Cour.Suivant;
end loop;
end;
procedure Parcourir_Par_Couples(L : Liste) is
Cour : Pointeur := L.Debut;
begin
while Cour /= null loop
if Cour.Suivant /= null then
Traiter(Cour.Contenu, Cour.Suivant.Contenu);
end if;
Cour := Cour.Suivant;
end loop;
end;
procedure Fusion(L1 : in out Liste ; L2 : in out Liste) is
begin
if L1.Taille /= 0 then
L1.Fin.Suivant := L2.Debut;
else
L1.Debut := L2.Debut;
end if;
L1.Fin := L2.Fin;
L1.Taille := L1.Taille + L2.Taille;
L2.Debut := null;
L2.Fin := null;
L2.Taille := 0;
end;
function Taille(L : Liste) return Natural is
begin
return L.Taille;
end;
function Tete(L : Liste) return Element is
begin
return L.Debut.Contenu;
end;
function Queue(L : Liste) return Element is
begin
return L.Fin.Contenu;
end;
end;
|
programs/oeis/144/A144606.asm | jmorken/loda | 1 | 175403 | <gh_stars>1-10
; A144606: Christoffel word of slope 8/11.
; 0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1
mov $3,2
mov $6,$0
lpb $3
mov $0,$6
sub $3,1
add $0,$3
sub $0,1
mul $0,2
mov $4,4
mov $7,$0
mul $7,2
add $4,$7
lpb $0
sub $0,$0
mul $4,2
mov $5,$4
lpe
mov $2,$3
div $5,19
lpb $2
mov $1,$5
sub $2,1
lpe
lpe
lpb $6
sub $1,$5
mov $6,0
lpe
|
source/hash/a-szbzha.adb | ytomino/drake | 33 | 29329 | with Ada.Strings.Wide_Wide_Hash;
function Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash (
Key : Bounded.Bounded_Wide_Wide_String)
return Containers.Hash_Type is
begin
return Strings.Wide_Wide_Hash (Key.Element (1 .. Key.Length));
end Ada.Strings.Wide_Wide_Bounded.Wide_Wide_Hash;
|
programs/oeis/332/A332023.asm | neoneye/loda | 22 | 102299 | <gh_stars>10-100
; A332023: T(n, k) = binomial(n+2, 3) + binomial(k+1, 2) + binomial(k, 1). Triangle read by rows, T(n, k) for 0 <= k <= n.
; 0,1,3,4,6,9,10,12,15,19,20,22,25,29,34,35,37,40,44,49,55,56,58,61,65,70,76,83,84,86,89,93,98,104,111,119,120,122,125,129,134,140,147,155,164,165,167,170,174,179,185,192,200,209,219
mov $1,$0
lpb $1
mov $2,$1
sub $1,1
seq $2,2262 ; Triangle read by rows: T(n,k), 0 <= k <= n, in which row n lists the first n+1 nonnegative integers.
add $0,$2
lpe
|
include/defines.asm | untoxa/RGBDK | 1 | 18806 |
; First, let's include libraries
INCLUDE "hardware.inc/hardware.inc"
rev_Check_hardware_inc 3.0
INCLUDE "rgbds-structs/structs.asm"
; A couple more hardware defines
NB_SPRITES equ 40
; I generally discourage the use of pseudo-instructions for a variety of reasons,
; but this one includes a label, and manually giving them different names is tedious.
wait_vram: MACRO
.waitVRAM\@
ldh a, [rSTAT]
and STATF_BUSY
jr nz, .waitVRAM\@
ENDM
; `ld b, X` followed by `ld c, Y` is wasteful (same with other reg pairs).
; This writes to both halves of the pair at once, without sacrificing readability
; Example usage: `lb bc, X, Y`
lb: MACRO
assert -128 <= (\2) && (\2) <= 255, "Second argument to `lb` must be 8-bit!"
assert -128 <= (\3) && (\3) <= 255, "Third argument to `lb` must be 8-bit!"
ld \1, (LOW(\2) << 8) | LOW(\3)
ENDM
; switches bank with updating of a tracking variable
switch_bank: MACRO
ld a, BANK(\1)
ldh [hCurROMBank], a
ld [rROMB0], a
ENDM
; switches bank with updating of a tracking variable
ehl_call_far: MACRO
ld e, BANK(\1)
ld hl, \1
call ___sdcc_bcall_ehl
ENDM
; SGB packet types
RSRESET
PAL01 rb 1
PAL23 rb 1
PAL12 rb 1
PAL03 rb 1
ATTR_BLK rb 1
ATTR_LIN rb 1
ATTR_DIV rb 1
ATTR_CHR rb 1
SOUND rb 1 ; $08
SOU_TRN rb 1
PAL_SET rb 1
PAL_TRN rb 1
ATRC_EN rb 1
TEST_EN rb 1
ICON_EN rb 1
DATA_SND rb 1
DATA_TRN rb 1 ; $10
MLT_REQ rb 1
JUMP rb 1
CHR_TRN rb 1
PCT_TRN rb 1
ATTR_TRN rb 1
ATTR_SET rb 1
MASK_EN rb 1
OBJ_TRN rb 1 ; $18
PAL_PRI rb 1
SGB_PACKET_SIZE equ 16
; sgb_packet packet_type, nb_packets, data...
sgb_packet: MACRO
PACKET_SIZE equ _NARG - 1 ; Size of what's below
db (\1 << 3) | (\2)
REPT _NARG - 2
SHIFT
db \2
ENDR
ds SGB_PACKET_SIZE - PACKET_SIZE, 0
ENDM
; 64 bytes, should be sufficient for most purposes. If you're really starved on
; check your stack usage and consider setting this to 32 instead. 16 is probably not enough.
STACK_SIZE equ $40
; Use this to cause a crash.
; I don't recommend using this unless you want a condition:
; `call cc, Crash` is 3 bytes (`cc` being a condition); `error cc` is only 2 bytes
; This should help minimize the impact of error checking
error: MACRO
IF _NARG == 0
rst Crash
ELSE
assert Crash == $0038
; This assembles to XX FF (with XX being the `jr` instruction)
; If the condition is fulfilled, this jumps to the operand: $FF
; $FF encodes the instruction `rst $38`!
jr \1, @+1
ENDC
ENDM
|
tools/scitools/conf/understand/ada/ada05/g-flocon.ads | brucegua/moocos | 1 | 13747 | ------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . F L O A T _ C O N T R O L --
-- --
-- S p e c --
-- --
-- Copyright (C) 2000-2005 AdaCore --
-- --
-- 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 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
--
--
--
--
--
--
--
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- Control functions for floating-point unit
package GNAT.Float_Control is
procedure Reset;
-- Reset the floating-point processor to the default state needed to get
-- correct Ada semantics for the target. Some third party tools change
-- the settings for the floating-point processor. Reset can be called
-- to reset the floating-point processor into the mode required by GNAT
-- for correct operation. Use this call after a call to foreign code if
-- you suspect incorrect floating-point operation after the call.
--
-- For example under Windows NT some system DLL calls change the default
-- FPU arithmetic to 64 bit precision mode. However, since in Ada 95 it
-- is required to provide full access to the floating-point types of the
-- architecture, GNAT requires full 80-bit precision mode, and Reset makes
-- sure this mode is established.
--
-- Similarly on the PPC processor, it is important that overflow and
-- underflow exceptions be disabled.
--
-- The call to Reset simply has no effect if the target environment
-- does not give rise to such concerns.
private
pragma Import (C, Reset, "__gnat_init_float");
end GNAT.Float_Control;
|
software/hal/boards/pixhawk/hil/hil-uart.adb | TUM-EI-RCS/StratoX | 12 | 20560 | -- Institution: Technische Universität München
-- Department: Realtime Computer Systems (RCS)
-- Project: StratoX
--
-- Authors: <NAME> (<EMAIL>)
pragma SPARK_Mode (Off);
with STM32.USARTs;
with STM32.Device;
with HIL.Config;
with Ada.Interrupts; use Ada.Interrupts;
with Ada.Interrupts.Names; use Ada.Interrupts.Names;
with Generic_Queue;
with HIL.Devices;
-- @summary
-- Target-specific mapping for HIL of UART
package body HIL.UART with
SPARK_Mode => Off
is
procedure configure with SPARK_Mode => Off is
begin
-- UART 1
-- STM32.USARTs.Enable( STM32.Device.USART_1 );
STM32.USARTs.Set_Stop_Bits( STM32.Device.USART_1, STM32.USARTs.Stopbits_1 );
STM32.USARTs.Set_Word_Length( STM32.Device.USART_1, STM32.USARTs.Word_Length_8 );
STM32.USARTs.Set_Parity( STM32.Device.USART_1, STM32.USARTs.No_Parity );
STM32.USARTs.Set_Baud_Rate( STM32.Device.USART_1, 9_600 );
STM32.USARTs.Set_Oversampling_Mode( STM32.Device.USART_1, STM32.USARTs.Oversampling_By_16 );
STM32.USARTs.Set_Mode( STM32.Device.USART_1, STM32.USARTs.Tx_Rx_Mode );
STM32.USARTs.Set_Flow_Control( STM32.Device.USART_1, STM32.USARTs.No_Flow_Control );
-- UART 6 (PX4IO)
STM32.USARTs.Enable( STM32.Device.USART_6 );
STM32.USARTs.Set_Stop_Bits( STM32.Device.USART_6, STM32.USARTs.Stopbits_1 );
STM32.USARTs.Set_Word_Length( STM32.Device.USART_6, STM32.USARTs.Word_Length_8 );
STM32.USARTs.Set_Parity( STM32.Device.USART_6, STM32.USARTs.No_Parity );
STM32.USARTs.Set_Baud_Rate( STM32.Device.USART_6, HIL.Config.PX4IO_BAUD_RATE_HZ );
STM32.USARTs.Set_Oversampling_Mode( STM32.Device.USART_6, STM32.USARTs.Oversampling_By_16 );
STM32.USARTs.Set_Mode( STM32.Device.USART_6, STM32.USARTs.Tx_Rx_Mode );
STM32.USARTs.Set_Flow_Control( STM32.Device.USART_6, STM32.USARTs.No_Flow_Control );
-- UART 3 (Serial 2, Tele 2, Console)
STM32.USARTs.Enable( STM32.Device.USART_3 );
STM32.USARTs.Set_Stop_Bits( STM32.Device.USART_3, STM32.USARTs.Stopbits_1 );
STM32.USARTs.Set_Word_Length( STM32.Device.USART_3, STM32.USARTs.Word_Length_8 );
STM32.USARTs.Set_Parity( STM32.Device.USART_3, STM32.USARTs.No_Parity );
STM32.USARTs.Set_Baud_Rate( STM32.Device.USART_3, 57_600 );
STM32.USARTs.Set_Oversampling_Mode( STM32.Device.USART_3, STM32.USARTs.Oversampling_By_16 );
STM32.USARTs.Set_Mode( STM32.Device.USART_3, STM32.USARTs.Tx_Rx_Mode );
STM32.USARTs.Set_Flow_Control( STM32.Device.USART_3, STM32.USARTs.No_Flow_Control );
-- UART 4 (Serial 3, GPS)
STM32.USARTs.Enable( STM32.Device.UART_4 );
STM32.USARTs.Set_Stop_Bits( STM32.Device.UART_4, STM32.USARTs.Stopbits_1 );
STM32.USARTs.Set_Word_Length( STM32.Device.UART_4, STM32.USARTs.Word_Length_8 );
STM32.USARTs.Set_Parity( STM32.Device.UART_4, STM32.USARTs.No_Parity );
STM32.USARTs.Set_Baud_Rate( STM32.Device.UART_4, HIL.Config.UBLOX_BAUD_RATE_HZ );
STM32.USARTs.Set_Oversampling_Mode( STM32.Device.UART_4, STM32.USARTs.Oversampling_By_16 );
STM32.USARTs.Set_Mode( STM32.Device.UART_4, STM32.USARTs.Tx_Rx_Mode );
STM32.USARTs.Set_Flow_Control( STM32.Device.UART_4, STM32.USARTs.No_Flow_Control );
-- UART 7 (SER 5)
STM32.USARTs.Enable( STM32.Device.USART_7 );
STM32.USARTs.Set_Stop_Bits( STM32.Device.USART_7, STM32.USARTs.Stopbits_1 );
STM32.USARTs.Set_Word_Length( STM32.Device.USART_7, STM32.USARTs.Word_Length_8 );
STM32.USARTs.Set_Parity( STM32.Device.USART_7, STM32.USARTs.No_Parity );
STM32.USARTs.Set_Baud_Rate( STM32.Device.USART_7, 9_600 );
STM32.USARTs.Set_Oversampling_Mode( STM32.Device.USART_7, STM32.USARTs.Oversampling_By_8 );
STM32.USARTs.Set_Mode( STM32.Device.USART_7, STM32.USARTs.Tx_Rx_Mode );
STM32.USARTs.Set_Flow_Control( STM32.Device.USART_7, STM32.USARTs.No_Flow_Control );
-- Interrupts
-- Enable GPS Interrupt
STM32.USARTs.Enable_Interrupts( STM32.Device.UART_4, STM32.USARTs.Received_Data_Not_Empty );
-- Logger Interrupt
end configure;
type Buffer_Index_Type is mod BUFFER_MAX;
type Buffer_Type is array(Buffer_Index_Type) of Byte;
package Byte_Buffer_Pack is new Generic_Queue(Index_Type => Buffer_Index_Type, Element_Type => Byte);
protected UART_Interrupt_Handler is
pragma Interrupt_Priority (HIL.Devices.IRQ_PRIO_UART4);
procedure get_Buffer(data : out Data_Type; len : out Natural);
private
buffer_pointer : Buffer_Index_Type := 0;
Queue : Byte_Buffer_Pack.Buffer_Tag;
Buffer : Buffer_Type := (others => Byte(0));
procedure Handle_Interrupt
with Attach_Handler => Ada.Interrupts.Names.UART4_Interrupt,
Unreferenced;
end UART_Interrupt_Handler;
protected Logger_UART_Interrupt_Handler is
pragma Interrupt_Priority (HIL.Devices.IRQ_PRIO_UART_LOG);
procedure push_Buffer(data : Data_Type);
private
buffer_pointer : Buffer_Index_Type := 0;
Queue : Byte_Buffer_Pack.Buffer_Tag;
Buffer : Buffer_Type := (others => Byte(0));
procedure Handle_Interrupt
with Attach_Handler => Ada.Interrupts.Names.USART3_Interrupt,
Unreferenced;
end Logger_UART_Interrupt_Handler;
procedure write (Device : in Device_ID_Type; Data : in Data_Type) is
begin
case (Device) is
when HIL.Devices.GPS =>
for i in Data'Range loop
STM32.USARTs.Transmit( STM32.Device.UART_4, HAL.UInt9( Data(i) ) );
end loop;
when HIL.Devices.Console =>
Logger_UART_Interrupt_Handler.push_Buffer(data);
STM32.USARTs.Enable_Interrupts( STM32.Device.USART_3, STM32.USARTs.Transmit_Data_Register_Empty );
-- for i in Data'Range loop
-- STM32.USARTs.Transmit( STM32.Device.USART_3, HAL.UInt9( Data(i) ) );
-- end loop;
when HIL.Devices.PX4IO =>
for i in Data'Range loop
STM32.USARTs.Transmit( STM32.Device.USART_6, HAL.UInt9( Data(i) ) );
end loop;
end case;
end write;
procedure read (Device : in Device_ID_Type; Data : out Data_Type; n_read : out Natural)
with SPARK_Mode => Off is
begin
case (Device) is
when HIL.Devices.GPS =>
UART_Interrupt_Handler.get_Buffer (Data, n_read);
when HIL.Devices.Console =>
for i in Data'Range loop
STM32.USARTs.Receive (STM32.Device.USART_3, HAL.UInt9( Data(i)));
end loop;
n_read := Data'Length;
when HIL.Devices.PX4IO =>
for i in Data'Range loop
STM32.USARTs.Receive (STM32.Device.USART_6, HAL.UInt9( Data(i)));
end loop;
n_read := Data'Length;
end case;
end read;
function toData_Type( Message : String ) return Data_Type is
Bytes : Data_Type( Message'Range ) := (others => 0);
begin
for pos in Message'Range loop
Bytes(pos) := Character'Pos( Message(pos) );
end loop;
return Bytes;
end toData_Type;
protected body UART_Interrupt_Handler is
procedure get_Buffer(data : out Data_Type; len : out Natural) is
buf_data : Byte_Buffer_Pack.Element_Array(1 .. data'Length);
qlen : constant Byte_Buffer_Pack.Length_Type := Queue.Length;
begin
data := (others => Byte( 0 ) );
if not Queue.Empty then
if data'Length <= qlen then
-- more data than caller can take
Queue.get_front (buf_data);
data := Data_Type (buf_data); -- FIXME: slow cast of entire array
len := data'Length;
else
-- not enough data to fill caller
len := qlen;
Queue.get_front (buf_data (1 .. qlen));
data (data'First .. data'First + qlen - 1) := Data_Type (buf_data (1 .. qlen));
end if;
else
len := 0;
end if;
end get_Buffer;
procedure Handle_Interrupt with SPARK_Mode => Off is
data : HAL.UInt9;
begin
-- check for data arrival
if STM32.USARTs.Status (STM32.Device.UART_4, STM32.USARTs.Read_Data_Register_Not_Empty) and
STM32.USARTs.Interrupt_Enabled (STM32.Device.UART_4, STM32.USARTs.Received_Data_Not_Empty)
then
STM32.USARTs.Receive( STM32.Device.UART_4, data);
-- STM32.USARTs.Transmit( STM32.Device.USART_3, HAL.UInt9(65) );
Queue.push_back( Byte( data ) );
STM32.USARTs.Clear_Status (STM32.Device.UART_4, STM32.USARTs.Read_Data_Register_Not_Empty);
end if;
end Handle_Interrupt;
end UART_Interrupt_Handler;
protected body Logger_UART_Interrupt_Handler is
procedure push_Buffer(data : Data_Type) is
begin
for index in data'Range loop
Queue.push_back( Byte( data(index) ) );
end loop;
end push_Buffer;
procedure Handle_Interrupt is
data : Byte;
begin
-- check for data arrival
if STM32.USARTs.Status (STM32.Device.USART_3, STM32.USARTs.Transmit_Data_Register_Empty) and
STM32.USARTs.Interrupt_Enabled (STM32.Device.USART_3, STM32.USARTs.Transmit_Data_Register_Empty)
then
if not Queue.Empty then
Queue.pop_front( data );
STM32.USARTs.Transmit( STM32.Device.USART_3, HAL.UInt9( data ));
else
STM32.USARTs.Disable_Interrupts( STM32.Device.USART_3, STM32.USARTs.Transmit_Data_Register_Empty );
end if;
STM32.USARTs.Clear_Status (STM32.Device.USART_3, STM32.USARTs.Transmit_Data_Register_Empty);
end if;
end Handle_Interrupt;
end Logger_UART_Interrupt_Handler;
end HIL.UART;
|
audio/music/unused/Eterna Forest.asm | AtmaBuster/pokeplat-gen2-old | 2 | 101042 | <filename>audio/music/unused/Eterna Forest.asm
Music_TitleScreen:
dbw $C0, Music_TitleScreen_Ch1
dbw $01, Music_TitleScreen_Ch2
dbw $02, Music_TitleScreen_Ch3
dbw $03, Music_TitleScreen_Ch4
Music_TitleScreen_Ch1:
tempo $88
volume $77
notetype $C, $82
dutycycle 0
octave 5
note __, 1
note B_, 5
intensity $72
note B_, 6
intensity $62
note B_, 6
intensity $52
note B_, 6
intensity $42
note B_, 8
Music_TitleScreen_Ch1_loop:
note __, 1
intensity $82
note B_, 5
intensity $72
note B_, 6
intensity $62
note B_, 6
intensity $52
note B_, 6
intensity $42
note B_, 7
intensity $82
octave 4
note B_, 5
intensity $72
note B_, 6
intensity $62
note B_, 6
intensity $52
note B_, 6
intensity $42
note B_, 9
intensity $82
octave 5
note F#, 5
intensity $72
note F#, 6
intensity $62
note F#, 6
intensity $52
note F#, 6
intensity $42
note F#, 9
intensity $82
octave 4
note F#, 5
intensity $72
note F#, 6
intensity $62
note F#, 6
intensity $82
note D_, 6
intensity $72
note D_, 4
intensity $82
note C_, 16
dutycycle 1
note __, 16
note __, 12
octave 6
note C_, 2
octave 5
note F#, 2
octave 6
note C_, 12
octave 5
note F#, 2
note C_, 2
note F#, 14
octave 4
note B_, 2
octave 5
note D_, 10
octave 3
note B_, 4
note A_, 2
note B_, 2
octave 4
note F#, 8
octave 3
note B_, 4
note F#, 2
octave 4
note D_, 6
octave 3
note G_, 2
octave 4
note D_, 6
octave 3
note A_, 2
octave 4
note D_, 16
note __, 16
note __, 2
octave 6
note D_, 2
octave 5
note G_, 2
notetype $F, $82
note B_, 16
notetype $C, $82
octave 6
note D_, 2
octave 5
note F#, 2
notetype $F, $82
note A_, 16
notetype $C, $82
octave 6
note D_, 2
octave 5
note G_, 2
note D_, 4
octave 3
note B_, 2
octave 4
note B_, 2
octave 3
note A_, 2
note B_, 2
octave 4
note F#, 8
octave 3
note B_, 2
octave 4
note B_, 2
octave 3
note F#, 2
octave 4
note F#, 2
octave 5
note F#, 4
octave 3
note G_, 2
octave 4
note G_, 2
octave 5
note G_, 4
octave 4
note D_, 2
octave 5
note D_, 2
octave 6
note D_, 8
octave 4
note G_, 2
octave 5
note C_, 2
note G_, 2
octave 4
note G_, 2
octave 6
note C_, 2
note G_, 2
note F#, 2
note G_, 2
note D_, 2
octave 4
note G_, 4
octave 5
note D_, 2
note G_, 8
octave 4
note G_, 2
note B_, 2
octave 5
note G_, 2
octave 4
note G_, 2
octave 5
note B_, 2
octave 6
note G_, 2
note F#, 2
note G_, 2
note D_, 2
octave 4
note G_, 4
octave 5
note D_, 2
note G_, 6
note B_, 4
note G_, 4
note A_, 2
note D_, 6
octave 4
note B_, 4
note G_, 4
note A_, 2
octave 5
note D_, 2
note E_, 16
note __, 6
note F#, 4
note G_, 2
note F#, 4
note D_, 16
note __, 6
note A_, 4
note B_, 2
note A_, 4
note E_, 16
note __, 16
note __, 2
octave 6
note D_, 2
note C_, 2
octave 5
note G_, 2
note E_, 2
note C_, 2
octave 4
note B_, 2
note G_, 2
note C_, 2
octave 6
note D#, 2
note C_, 2
octave 5
note A_, 2
note F#, 2
note D#, 2
note C_, 2
octave 4
note A_, 2
note D#, 3
dutycycle 0
octave 5
note B_, 5
intensity $72
note B_, 6
intensity $62
note B_, 6
intensity $52
note B_, 6
intensity $42
note B_, 9
intensity $82
note B_, 5
intensity $72
note B_, 6
intensity $62
note B_, 6
intensity $52
note B_, 6
intensity $42
note B_, 9
intensity $82
note B_, 5
intensity $72
note B_, 6
intensity $62
note B_, 6
intensity $52
note B_, 6
intensity $42
note B_, 9
intensity $82
note B_, 5
intensity $72
note B_, 6
intensity $62
note B_, 6
intensity $52
note B_, 6
intensity $42
note B_, 8
loopchannel 0, Music_TitleScreen_Ch1_loop
Music_TitleScreen_Ch2:
notetype $C, $92
dutycycle 0
octave 5
note D_, 6
intensity $82
note D_, 6
intensity $72
note D_, 6
intensity $62
note D_, 6
intensity $52
note D_, 8
Music_TitleScreen_Ch2_loop:
intensity $92
note E_, 6
intensity $82
note E_, 6
intensity $72
note E_, 6
intensity $62
note E_, 6
intensity $52
note E_, 6
intensity $92
octave 4
note E_, 6
intensity $82
note E_, 6
intensity $72
note E_, 6
intensity $62
note E_, 6
intensity $52
note E_, 8
intensity $92
note B_, 6
intensity $82
note B_, 6
intensity $72
note B_, 6
intensity $62
note B_, 6
intensity $52
note B_, 8
intensity $92
octave 3
note B_, 6
intensity $82
note B_, 6
intensity $72
note B_, 6
intensity $62
note G_, 6
intensity $52
note G_, 4
intensity $92
note F#, 6
intensity $B6
dutycycle 2
octave 2
note C_, 2
note __, 4
octave 1
note C_, 2
note __, 16
note __, 8
octave 2
note C_, 2
note __, 4
octave 1
note C_, 2
note __, 16
note __, 8
note G_, 2
note __, 4
octave 1
note G_, 2
note __, 16
note __, 16
note __, 8
octave 1
note E_, 2
note __, 6
note D_, 2
note __, 6
octave 2
note C_, 2
note __, 4
octave 1
note C_, 2
note __, 16
note __, 8
octave 2
note C_, 2
note __, 4
octave 1
note C_, 2
note __, 16
note __, 8
note G_, 2
note __, 4
octave 1
note G_, 2
note __, 16
note __, 16
note __, 8
octave 1
note E_, 2
note __, 6
note D_, 2
note __, 6
octave 1
note A_, 2
note __, 4
note A_, 2
note __, 2
note A_, 2
note __, 1
note A_, 2
note __, 1
note B_, 2
note __, 4
note B_, 2
note __, 2
note B_, 2
note __, 1
note B_, 2
note __, 1
octave 1
note E_, 2
note __, 4
note E_, 2
note __, 2
note E_, 2
note __, 1
note E_, 2
note __, 1
note D_, 2
note __, 4
note D_, 2
note __, 2
note D_, 2
note __, 1
note D_, 2
note __, 1
octave 1
note A_, 2
note __, 6
note B_, 2
note __, 6
note A_, 2
note __, 2
note B_, 2
note __, 2
octave 1
note C_, 2
note D_, 2
note __, 2
note C_, 16
note __, 16
note __, 2
octave 1
note B_, 16
note __, 16
note __, 4
octave 1
note A_, 4
octave 2
note C_, 4
octave 1
note A_, 4
note B_, 4
octave 2
note D_, 4
note F#, 4
note A_, 4
octave 3
note C_, 6
octave 2
note C_, 6
octave 3
note C_, 4
octave 4
note C_, 6
octave 3
note C_, 10
intensity $92
dutycycle 0
octave 5
note C_, 6
intensity $82
note C_, 6
intensity $72
note C_, 6
intensity $62
note C_, 6
intensity $52
note C_, 8
intensity $92
octave 4
note G_, 6
intensity $82
note G_, 6
intensity $72
note G_, 6
intensity $62
note G_, 6
intensity $52
note G_, 8
intensity $92
octave 5
note C_, 6
intensity $82
note C_, 6
intensity $72
note C_, 6
intensity $62
note C_, 6
intensity $52
note C_, 8
intensity $92
octave 4
note G_, 6
intensity $82
note G_, 6
intensity $72
note G_, 6
intensity $62
note G_, 6
intensity $52
note G_, 8
loopchannel 0, Music_TitleScreen_Ch2_loop
Music_TitleScreen_Ch3:
notetype $C, $12
vibrato $10, $14
note __, 16
note __, 16
Music_TitleScreen_Ch3_loop:
octave 5
note __, 16
note B_, 2
octave 6
note C_, 2
note __, 2
octave 5
note B_, 2
note A_, 2
note B_, 2
note __, 2
octave 6
note C_, 2
octave 5
note B_, 2
note __, 2
note F#, 2
note G_, 2
note __, 2
note A_, 2
note __, 2
note G_, 2
note F#, 2
note G_, 2
note __, 2
note A_, 2
note G_, 2
note __, 2
note E_, 2
note G_, 2
note F#, 2
note G_, 2
note __, 2
note F#, 2
note D_, 2
note __, 2
octave 4
note B_, 2
note __, 16
note __, 16
note __, 16
note __, 16
note __, 2
octave 5
note B_, 2
octave 6
note C_, 2
note __, 2
octave 5
note B_, 2
note A_, 2
note B_, 2
note __, 2
octave 6
note C_, 2
octave 5
note B_, 2
note __, 2
note F#, 2
note G_, 2
note __, 2
note A_, 2
note __, 2
note G_, 2
note F#, 2
note G_, 2
note __, 2
note A_, 2
note G_, 2
note __, 2
note E_, 2
note G_, 2
note F#, 2
note G_, 2
note __, 2
note F#, 2
note D_, 2
note __, 2
octave 4
note B_, 2
note __, 16
note __, 16
note __, 16
note __, 14
octave 5
note E_, 2
note F#, 2
note G_, 2
note B_, 2
note __, 2
note A_, 2
octave 6
note D_, 2
note C_, 2
note __, 2
octave 5
note B_, 2
note F#, 2
note __, 2
note G_, 2
note A_, 2
note __, 2
note B_, 2
note __, 2
octave 6
note C_, 2
octave 5
note B_, 2
octave 6
note C_, 2
note __, 2
note D_, 2
note __, 2
note A_, 2
note F#, 2
note G_, 2
note A_, 2
note G_, 2
note __, 2
note D_, 2
note __, 2
octave 5
note B_, 2
note __, 16
note __, 16
note __, 16
note __, 4
octave 4
note G_, 8
octave 5
note C_, 4
octave 4
note B_, 8
octave 5
note D_, 4
note A_, 4
note G_, 12
octave 4
note B_, 4
octave 5
note D_, 8
note G_, 4
note A_, 4
note G_, 8
note E_, 4
note F#, 4
note G_, 4
note A_, 4
note B_, 4
octave 6
note C_, 2
note D_, 4
note E_, 2
notetype $8, $12
note F#, 4
note G_, 4
note F#, 4
note D_, 4
octave 5
note B_, 4
octave 6
note E_, 4
notetype $C, $12
octave 5
note G_, 16
notetype $8, $12
note A_, 4
note B_, 4
note A_, 4
note G_, 4
note E_, 4
note A_, 4
notetype $C, $12
note D_, 12
note A_, 4
note G_, 8
note E_, 4
note A_, 8
note G_, 4
note B_, 4
note A_, 4
octave 6
note D_, 16
note C_, 16
note C_, 8
octave 5
note C_, 2
octave 6
note F#, 2
note F#, 2
octave 5
note C_, 2
octave 6
note A_, 2
note B_, 4
note __, 16
note __, 2
octave 4
note G_, 2
octave 6
note D_, 2
note D_, 2
octave 4
note G_, 2
octave 6
note A_, 2
note B_, 4
note __, 16
note __, 2
octave 5
note C_, 2
octave 6
note F#, 2
note F#, 2
octave 5
note C_, 2
octave 6
note A_, 2
note B_, 2
octave 7
note D_, 2
note __, 16
note __, 2
octave 4
note G_, 2
octave 6
note D_, 2
note D_, 2
octave 4
note G_, 2
octave 6
note A_, 2
note B_, 2
octave 7
note D_, 2
note __, 10
loopchannel 0, Music_TitleScreen_Ch3_loop
Music_TitleScreen_Ch4:
togglenoise 4
notetype $C
note __, 16
note __, 16
Music_TitleScreen_Ch4_loop:
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note F#, 2
note G#, 2
note G#, 2
note G#, 2
note D#, 2
note F#, 1
note D#, 1
note C_, 2
note D#, 2
note F#, 2
note D#, 2
note C_, 1
note D#, 1
note F#, 2
note D#, 2
note F#, 1
note D#, 1
note C_, 2
note D#, 2
note F#, 2
note D#, 2
note C_, 1
note D#, 1
note F#, 2
note D#, 2
note F#, 1
note D#, 1
note C_, 2
note D#, 2
note F#, 2
note D#, 2
note C_, 1
note D#, 1
note F#, 2
note D#, 2
note F#, 1
note D#, 1
note C_, 2
note D#, 2
note F#, 2
note D#, 2
note C_, 1
note D#, 1
note F#, 2
note D#, 2
note D#, 2
note C_, 1
note D#, 2
note C_, 1
note D#, 2
note D#, 2
note C_, 1
note D#, 2
note C_, 1
note D#, 2
note D#, 2
note C_, 1
note C_, 2
note C_, 1
note C_, 2
note C_, 2
note C_, 1
note D#, 2
note C_, 1
note F#, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
note __, 16
loopchannel 0, Music_TitleScreen_Ch4_loop
|
host/stm32gd-gpio-polled.ads | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 16687 | <filename>host/stm32gd-gpio-polled.ads<gh_stars>1-10
with STM32GD.GPIO.Pin;
generic
with package Pin is new STM32GD.GPIO.Pin (<>);
package STM32GD.GPIO.Polled is
pragma Preelaborate;
procedure Configure_Trigger (Event : Boolean := False; Rising : Boolean := False; Falling : Boolean := False);
procedure Wait_For_Trigger;
procedure Clear_Trigger;
function Triggered return Boolean;
procedure Cancel_Wait;
end STM32GD.GPIO.Polled;
|
PMOO/EXAMEN/1617O/Centro_Mensajeria.adb | usainzg/EHU | 0 | 14073 | package body Centro_Mensajeria is
LEnvios: Lista_Envios.Lista;
Nombre: String(1..4);
Ubicacion: String(1..4);
procedure Localizar_Envios_Cercanos(Geo: in GeoLoc.Geo; out LCer: Lista_Envios.Lista) is
LAux: Lista_Envios.Lista;
EnvAux: Envios.Envio;
GeoAux: GeoLoc.Geo;
begin
Listas_Envios.Crear_Vacia(LCer);
Listas_Envios.Copiar(LAux, LEnvios);
while not Listas_Envios.Es_Vacia(LAux) loop
Listas_Envios.Obtener_Primero(LAux, EnvAux);
Listas_Envios.Eliminar_Primero(LAux);
GeoAux := Envios.GeoActual(EnvAux);
if GeoLoc.Distancia(GeoAux, Geo) < 1.0 then
Listas_Envios.Anadir(LCer, EnvAux);
end if;
end loop;
end Localizar_Envios_Cercanos; |
openSafariTabInChrome/OpenSafariTabInChrome.lbaction/Contents/Scripts/default.scpt | chrisfsmith/launchbar | 3 | 4540 | <reponame>chrisfsmith/launchbar<filename>openSafariTabInChrome/OpenSafariTabInChrome.lbaction/Contents/Scripts/default.scpt
--
-- opens current Safari tab in Google Chrome
-- forked from https://gist.github.com/3153606
-- which was forked from https://gist.github.com/3151932
--
property theURL : ""
if is_running("Safari") then
tell application "Safari"
if exists URL of current tab of window 1 then
set theURL to URL of current tab of window 1
end if
end tell
end if
if is_running("Google Chrome") then
tell application "Google Chrome"
if (count of (every window where visible is true)) is greater than 0 then
-- running with a visible window, ready for new tab
else
-- running but no visible window, so create one
make new window
end if
end tell
else
-- chrome app not running, so start it
do shell script "open -a \"Google Chrome\""
end if
-- now that we have made sure chrome is running and has a visible
-- window create a new tab in that window and activate it to bring to the front
tell application "Google Chrome"
if the URL of the active tab of window 1 is "chrome://newtab/" then
-- Current tab is empty, open theURL in it
set the URL of the active tab of window 1 to theURL
else
-- Otherwise make a new tab and open theURL
tell window 1 to make new tab with properties {URL:theURL}
end if
activate
end tell
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
|
src/asis/asis-data_decomposition-debug.ads | My-Colaborations/dynamo | 15 | 9470 | <filename>src/asis/asis-data_decomposition-debug.ads
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A S I S . D A T A _ D E C O M P O S I T I O N . D E B U G --
-- --
-- S p e c --
-- --
-- Copyright (c) 1995-2006, Free Software Foundation, Inc. --
-- --
-- ASIS-for-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 --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
-- This package contains routines forming debug images for bstractions
-- declared in Asis.Data_Decomposition.
package Asis.Data_Decomposition.Debug is
function Debug_Image (RC : Record_Component) return Wide_String;
function Debug_Image (AC : Array_Component) return Wide_String;
-- Returns a string value containing implementation-defined debug
-- information associated with the element.
--
-- The return value uses Asis.Text.Delimiter_Image to separate the lines
-- of multi-line results. The return value does not end with
-- Asis.Text.Delimiter_Image.
function Is_Derived_From_Record (TD : Element) return Boolean;
function Is_Derived_From_Array (TD : Element) return Boolean;
-- The public renaming of
-- Asis.Data_Decomposition.Aux.Is_Derived_From_Record/
-- Asis.Data_Decomposition.Aux.Is_Derived_From_Array
-- May be, we should have it in Asis.Extensions
function Dimension (Comp : Array_Component) return ASIS_Natural;
-- The public renaming of
-- Asis.Data_Decomposition.Set_Get.Dimension
-- May be, we should have it in Asis.Extensions
-- function Linear_Index
-- (Inds : Dimension_Indexes;
-- D : ASIS_Natural;
-- Ind_Lengths : Dimention_Length;
-- Conv : Convention_Id := Convention_Ada)
-- return Asis.ASIS_Natural;
-- function De_Linear_Index
-- (Index : Asis.ASIS_Natural;
-- D : ASIS_Natural;
-- Ind_Lengths : Dimention_Length;
-- Conv : Convention_Id := Convention_Ada)
-- return Dimension_Indexes;
-- The public renaming of
-- Asis.Data_Decomposition.Aux.Linear_Index and
-- Asis.Data_Decomposition.Aux.De_Linear_Index
end Asis.Data_Decomposition.Debug;
|
old/Mathematical/Numeral/Real.agda | Lolirofle/stuff-in-agda | 6 | 7522 | module Numeral.Real where
open import Data.Tuple
open import Logic
import Lvl
open import Numeral.Natural
open import Numeral.Natural.Oper
open import Numeral.Rational
open import Numeral.Rational.Oper
open import Relator.Equals
open import Type
open import Type.Quotient
-- TODO: This will not work, but it is the standard concept at least. Maybe there is a better way
record CauchySequence (a : ℕ → ℚ) : Stmt where
field
N : ℚ₊ → ℕ
∀{ε : ℚ₊}{m n : ℕ} → (m > N(ε)) → (n > N(ε)) → (‖ a(m) − a(n) ‖ < ε)
_converges-to-same_ : Σ(CauchySequence) → Σ(CauchySequence) → Stmt{Lvl.𝟎}
a converges-to-same b = lim(n ↦ Σ.left(a) − Σ.left(b)) ≡ 𝟎
ℝ : Type{Lvl.𝟎}
ℝ = Σ(CauchySequence) / (_converges-to-same_)
-- TODO: Here is another idea: https://github.com/dylanede/cubical-experiments/blob/master/scratch.agda
-- TODO: Also these: https://en.wikipedia.org/wiki/Construction_of_the_real_numbers#Construction_from_Cauchy_sequences
|
theorems/homotopy/DisjointlyPointedSet.agda | mikeshulman/HoTT-Agda | 0 | 795 | <filename>theorems/homotopy/DisjointlyPointedSet.agda
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
{-
Various lemmas that will be used in cohomology.DisjointlyPointedSet.
Many of them, for example the choice lemma about coproducts, should be
put into core/.
-}
module homotopy.DisjointlyPointedSet where
module _ {i} where
is-separable : (X : Ptd i) → Type i
is-separable X = has-dec-onesided-eq (pt X)
abstract
is-separable-is-prop : {X : Ptd i}
→ is-prop (is-separable X)
is-separable-is-prop = has-dec-onesided-eq-is-prop
MinusPoint : (X : Ptd i) → Type i
MinusPoint X = Σ (de⊙ X) (pt X ≠_)
unite-pt : (X : Ptd i) → (⊤ ⊔ MinusPoint X → de⊙ X)
unite-pt X (inl _) = pt X
unite-pt X (inr (x , _)) = x
has-disjoint-pt : (X : Ptd i) → Type i
has-disjoint-pt X = is-equiv (unite-pt X)
abstract
separable-has-disjoint-pt : {X : Ptd i}
→ is-separable X → has-disjoint-pt X
separable-has-disjoint-pt {X} dec =
is-eq _ sep unite-sep sep-unite where
sep : de⊙ X → ⊤ ⊔ (Σ (de⊙ X) (pt X ≠_))
sep x with dec x
sep x | inl _ = inl unit
sep x | inr ¬p = inr (x , ¬p)
abstract
sep-unite : ∀ x → sep (unite-pt X x) == x
sep-unite (inl _) with dec (pt X)
sep-unite (inl _) | inl _ = idp
sep-unite (inl _) | inr ¬p = ⊥-rec (¬p idp)
sep-unite (inr (x , ¬p)) with dec x
sep-unite (inr (x , ¬p)) | inl p = ⊥-rec (¬p p)
sep-unite (inr (x , ¬p)) | inr ¬p' = ap inr $ pair= idp (prop-has-all-paths ¬-is-prop ¬p' ¬p)
unite-sep : ∀ x → unite-pt X (sep x) == x
unite-sep x with dec x
unite-sep x | inl p = p
unite-sep x | inr ¬p = idp
disjoint-pt-is-separable : {X : Ptd i}
→ has-disjoint-pt X → is-separable X
disjoint-pt-is-separable unite-ise x with unite.g x | unite.f-g x
where module unite = is-equiv unite-ise
disjoint-pt-is-separable unite-ise x | inl unit | p = inl p
disjoint-pt-is-separable unite-ise x | inr (y , pt≠y) | y=x = inr λ pt=x → pt≠y (pt=x ∙ ! y=x)
separable-unite-equiv : ∀ {X}
→ is-separable X
→ (⊤ ⊔ MinusPoint X ≃ de⊙ X)
separable-unite-equiv dX = _ , separable-has-disjoint-pt dX
module _ {i j k} n (A : Type i) (B : Type j) where
abstract
⊔-has-choice-implies-inr-has-choice : has-choice n (A ⊔ B) k → has-choice n B k
⊔-has-choice-implies-inr-has-choice ⊔-ac W =
transport is-equiv (λ= lemma₃)
(snd lemma₂ ∘ise ⊔-ac W' ∘ise is-equiv-inverse (snd (Trunc-emap n lemma₁))) where
W' : A ⊔ B → Type k
W' (inl _) = Lift {j = k} ⊤
W' (inr b) = W b
lemma₁ : Π (A ⊔ B) W' ≃ Π B W
lemma₁ = equiv to from to-from from-to where
to : Π (A ⊔ B) W' → Π B W
to f b = f (inr b)
from : Π B W → Π (A ⊔ B) W'
from f (inl a) = lift tt
from f (inr b) = f b
abstract
to-from : ∀ f → to (from f) == f
to-from f = λ= λ b → idp
from-to : ∀ f → from (to f) == f
from-to f = λ= λ{(inl a) → idp; (inr b) → idp}
lemma₂ : Π (A ⊔ B) (Trunc n ∘ W') ≃ Π B (Trunc n ∘ W)
lemma₂ = equiv to from to-from from-to where
to : Π (A ⊔ B) (Trunc n ∘ W') → Π B (Trunc n ∘ W)
to f b = f (inr b)
from : Π B (Trunc n ∘ W) → Π (A ⊔ B) (Trunc n ∘ W')
from f (inl a) = [ lift tt ]
from f (inr b) = f b
abstract
to-from : ∀ f → to (from f) == f
to-from f = λ= λ b → idp
from-to : ∀ f → from (to f) == f
from-to f = λ= λ{
(inl a) → Trunc-elim
{P = λ t → [ lift tt ] == t}
(λ _ → =-preserves-level Trunc-level)
(λ _ → idp) (f (inl a));
(inr b) → idp}
lemma₃ : ∀ f → –> lemma₂ (unchoose (<– (Trunc-emap n lemma₁) f)) == unchoose f
lemma₃ = Trunc-elim
{P = λ f → –> lemma₂ (unchoose (<– (Trunc-emap n lemma₁) f)) == unchoose f}
(λ _ → =-preserves-level (Π-level λ _ → Trunc-level))
(λ f → λ= λ b → idp)
module _ {i j} n {X : Ptd i} (X-sep : has-disjoint-pt X) where
abstract
MinusPoint-has-choice : has-choice n (de⊙ X) j → has-choice n (MinusPoint X) j
MinusPoint-has-choice X-ac =
⊔-has-choice-implies-inr-has-choice n ⊤ (MinusPoint X) $
transport! (λ A → has-choice n A j) (ua (_ , X-sep)) X-ac
|
src/spopera.asm | samuelhorwitz/spaceopera | 0 | 27022 | ;---------------------------------------------------------------------------------------------------
;SPACE OPERA
;A game by <NAME> (N19081895) - 2008
;With thanks to <NAME> for some code.
;---------------------------------------------------------------------------------------------------
jmp start ;Jump to code
;---------------------------------------------------------------------------------------------------
;CONSTANTS
;Constant values to be used at assemble time.
;---------------------------------------------------------------------------------------------------
;Video information
VIDEO_MODE equ 0Dh ;EGA 16 Color mode
TEXT_MODE equ 3 ;CGA Color text mode
VIDEO_SEGMENT equ 0A000h ;The location of VGA video memory
BIOS_SEGMENT equ 40h ;The location of the ROM-BIOS variables
PAGE_OFFSET_ADR equ 4Eh ;The offset in BIOS_SEGMENT for page data
VIDEO_MAX_PIX equ 8000 ;The max number of bytes on an EGA plane
VIDEO_HEIGHT equ 25 ;The number of bytes high the video is
VIDEO_HEIGHT_PIX equ VIDEO_HEIGHT*8 ;The number of pixels high the video is
VIDEO_WIDTH equ 40 ;The number of bytes wide the video is
VIDEO_WIDTH_PIX equ VIDEO_WIDTH*8 ;The number of pixels wide the video is
;Bitplane masks
NO_COLORS equ 00000000b ;Mask off all planes
BLACK_MASK equ 00000000b ;Mask off all planes
BLUE_MASK equ 00000001b ;Mask off all planes except blue
GREEN_MASK equ 00000010b ;Mask off all planes except green
CYAN_MASK equ 00000011b ;Mask off all planes except blue and green
RED_MASK equ 00000100b ;Mask off all planes except red
PURPLE_MASK equ 00000101b ;Mask off all planes except red and blue
BROWN_MASK equ 00000110b ;Mask off all planes except red and green
LIGHT_GRAY_MASK equ 00000111b ;Mask off intensity plane only
DARK_GRAY_MASK equ 00001000b ;Mask off all planes except intensity
LIGHT_BLUE_MASK equ 00001001b ;Mask off all planes except i and blue
LIGHT_GREEN_MASK equ 00001010b ;Mask off all planes except i and green
LIGHT_CYAN_MASK equ 00001011b ;Mask off all planes except i green and blue
LIGHT_RED_MASK equ 00001100b ;Mask off all planes except i and red
MAGENTA_MASK equ 00001101b ;Mask off all planes except i red and blue
YELLOW_MASK equ 00001110b ;Mask off all planes except i red and green
WHITE_MASK equ 00001111b ;Mask off no planes
ALL_COLORS equ 00001111b ;Mask off no planes
XOR_MODE equ 18h ;XOR graphics mode
;Ports
SC_PORT equ 3C4h ;SC Index port
GC_PORT equ 3CEh ;GC Index port
TIMER_GATE_PORT equ 61h ;Timer gate control port
TIMER_CTRL_PORT equ 43h ;Timer control port
TIMER_CNTR_PORT equ 42h ;Timer counter port
;Port registers
SC_MAP_MASK_REG equ 2 ;Register for map masking
GC_DATA_ROT_REG equ 3 ;Register for data rotation
GC_MODE_REG equ 5 ;Register for graphics modes
;Object sizes and data
PLAYER_HT equ 3 ;Number of bytes tall player is
PLAYER_HT_PIX equ PLAYER_HT*8 ;Number of pixels tall player is
PLAYER_WD equ 3 ;Number of bytes wide player is
PLAYER_WD_PIX equ PLAYER_WD*8 ;Number of pixels wide player is
ENEMY1_HT equ 3 ;Number of bytes tall enemy 1 is
ENEMY1_HT_PIX equ ENEMY1_HT*8 ;Number of pixels tall enemey 1 is
ENEMY1_WD equ 3 ;Number of bytes wide enemy 1 is
ENEMY1_WD_PIX equ ENEMY1_WD*8 ;Number of pixels wide enemy 1 is
ENEMY1_PT_VAL equ 10 ;Point value of enemy 1
EXP_WD equ 3 ;Number of bytes wide explosions are
EXP_WD_PIX equ EXP_WD*8 ;Number of pixels wide explosions are
EXP_HT equ 3 ;Number of bytes tall explosions are
EXP_HT_PIX equ EXP_HT*8 ;Number of pixels tall explosions are
LETTER_HT equ 1 ;The height of each letter/number
LETTER_HT_PIX equ LETTER_HT*8 ;The height of each letter/number in pixels
LETTER_WD equ 1 ;The width of each letter/number
LETTER_WD_PIX equ LETTER_WD*8 ;The width of each letter/number in pixels
LASER_WD equ 1 ;Number of bytes wide laser is
LASER_WD_PIX equ LASER_WD*8 ;Number of pixels wide laser is
LASER_DUR equ 1 ;Duration of laser sound
LASER_FREQ equ 500 ;Frequency of laser sound
EXP_DUR equ 2 ;Duration of explosion sound
EXP_FREQ equ 200 ;Frequency of explosion sound
CHAR_ALIVE equ 1 ;Character is alive
CHAR_EXP equ 0 ;Character exploded
ENEMY_LIMIT equ 12 ;The maximum number of possible enemies
NO_ENEMY equ 10000 ;Used to specify blank array object enemy
NO_PLAYER equ 10000 ;Used to specify blank array object player
NO_BULLET equ 10000 ;Same as NO_ENEMY but named for bullets
PLAYER_COL equ 1 ;Signifies player on collision table
ENEMY1_COL equ 2 ;Signifies enemy 1 on collision table
PLASER_COL equ 3 ;Signifies good laser on collision table
ELASER_COL equ 4 ;Signifies bad laser on collision table
MENU_NEW equ 0 ;New game in menu
MENU_HELP equ 1 ;Help in menu
MENU_QUIT equ 2 ;Quit in menu
MENU2_EASY equ 0 ;Easy in difficulty menu
MENU2_MEDIUM equ 1 ;Medium in difficulty menu
MENU2_HARD equ 2 ;Hard in difficulty menu
MENU2_NIGHTMARE equ 3 ;Nightmare in difficulty menu
KBD_UP equ 48h ;Scancode for up arrow
KBD_DOWN equ 50h ;Scancode for down arrow
KBD_ESC equ 1 ;Scancode for escape
KBD_ENTER equ 1Ch ;Scancode for enter
TRUE equ 1 ;True
FALSE equ 0 ;False
;Peripheral data
MOUSE_LBOUND equ 0 ;The left bound of the mouse's movement
MOUSE_RBOUND equ VIDEO_WIDTH_PIX-PLAYER_WD_PIX;The right bound of the mouse's movement
MOUSE_UBOUND equ 48 ;The upper bound of the mouse's movement
MOUSE_BBOUND equ VIDEO_HEIGHT_PIX-PLAYER_HT_PIX;The bottom bound of the mouse's movement
SCREEN_DELAY equ 3 ;The amount of time for the delay function
MOUSE_HORDEF equ 160 ;Default horizontal position for mouse
MOUSE_VERDEF equ MOUSE_BBOUND ;Default vertical position for mouse
;---------------------------------------------------------------------------------------------------
;DATA
;Named locations of memory within the program itself.
;---------------------------------------------------------------------------------------------------
PlayerX dw MOUSE_HORDEF ;The X location of the player in pixels
PlayerY dw MOUSE_VERDEF ;The Y location of the player in pixels
PlayerShotX dw NO_BULLET ;Player's laser location x,y
PlayerShotY dw NO_BULLET
PlayerStat db CHAR_ALIVE ;Player's health status
PlayerDead db 0 ;Is player dead?
EnemiesX dw ENEMY_LIMIT dup(NO_ENEMY) ;Array of enemy X locations
EnemiesY dw ENEMY_LIMIT dup(NO_ENEMY) ;Array of enemy Y locations
EnemiesStat dw ENEMY_LIMIT dup(NO_ENEMY) ;The health status of all the enemies
EnemyShotX dw ENEMY_LIMIT dup(NO_BULLET) ;Enemies' laser locations x,y
EnemyShotY dw ENEMY_LIMIT dup(NO_BULLET)
MaxEnemies db 3 ;The maximum number of enemies onscreen
NumEnemies db 0 ;The current number of enemies in any state
EnemyChance db 20 ;There is a 1/this number chance of enemy
PLaserSpeed db 8 ;Speed of player's laser
ELaserSpeed db 4 ;Speed of enemy's laser
ELaserChn db 50 ;There is a 1/num chance of enemy shooting
EnemySpdChn db 25 ;There is a 1/num chance enemy moves/direc
EnemySpeed db 1 ;How many bytes traversed per movement
MouseX dw MOUSE_HORDEF ;The X location of the cursor
MouseY dw MOUSE_VERDEF ;The Y location of the cursor
LeftButton db 0 ;Boolean on whether left button is pressed
Score dw 0 ;The score
NumKills dw 0 ;The number of kills
NumKillsCnt db 0 ;Counts every 10 kill
Lives db 3 ;The number of lives the player has left
GameOver db 0 ;1 if game is over (lives are lost)
MenuSelect db 0 ;Menu selection
MenuSelect2 db 0 ;Difficulty menu selection
NumberPtrs dw offset zero ;This array contains the offsets to the
dw offset one ;number graphics. NumberPtrs[0] points to
dw offset two ;the zero graphic for example, making it
dw offset three ;useful for drawing numbers from data.
dw offset four
dw offset five
dw offset six
dw offset seven
dw offset eight
dw offset nine
;---------------------------------------------------------------------------------------------------
;Strings
;ASCII Strings for menu
;---------------------------------------------------------------------------------------------------
newgamestr db 'New Game', 0
helpstr db 'Help', 0
quitstr db 'Quit', 0
copystr db '(c) <NAME> 2008', 0
diffstr db 'Choose your difficulty', 0
gameoverstr db 'Game Over. Press any key '
db 'to continue.', 0
diff1 db 'Easy', 0
diff2 db 'Medium', 0
diff3 db 'Hard', 0
diff4 db 'Nightmare', 0
thanksstr db 'Thanks to <NAME> and', 0Dh, 8, 8, 8
db '<NAME> for portions of code', 0
help db 'SPACE OPERA is a very simple game. '
db 'The goal is to destroy as many '
db 'enemies as you can before '
db 'dying.', 0Dh, 0Dh
db 'You control a small, blue '
db 'spaceship that can move around '
db 'the screen and fire ', 0Dh
db 'lasers. '
db 'Your enemies are magenta spaceships, '
db 'and they, too, can fire '
db 'lasers.', 0Dh, 0Dh
db 'Move around the screen with your '
db 'mouse, and fire your lasers with '
db 'the left mouse button.', 0Dh, 0Dh
db 'Watch out though, you only '
db 'have 3 lives.', 0Dh, 0Dh
db 'Have fun! (To leave this '
db 'screen, press ESC)', 0Dh, 0Dh
db 'Also, you can pause your game '
db 'with the "p" button. '
db 'Make sure you do not have ', 0Dh
db 'caps lock on!', 0
;Thanks to http://www.network-science.de/ascii/ for ASCII art generator
spoperastr db ' _______________ __'
db '_ ______ _______ ', 0Dh
db ' / _ \ / '
db ' \ / || ____| ', 0Dh
db ' | (-----| |_) | / ^'
db ' \ | ,---- | |__ ', 0Dh
db ' \ \ | ___/ / /_'
db '\ \ | | | __| ', 0Dh
db '.----) | | | / ___'
db '__ \ | `----.| |____ ', 0Dh
db '|_______/ | _| /__/ '
db ' \__\ \______||_______| ', 0Dh
db ' ______ .______ ______'
db '_ .______ ___ ', 0Dh
db ' / __ \ | _ \ | ___'
db '_|| _ \ / \ ', 0Dh
db '| | | | | |_) | | |__ '
db ' | |_) | / ^ \ ', 0Dh
db '| | | | | ___/ | __|'
db ' | / / /_\ \ ', 0Dh
db '| `-- | | | | |___'
db '_ | |\ \----./ _____ \ ', 0Dh
db ' \______/ | _| |______'
db '_|| _| `.________/ \__\ ', 0
;---------------------------------------------------------------------------------------------------
;SPRITES
;The bitmap data used to construct the characters and objects that appear on the screen.
;---------------------------------------------------------------------------------------------------
;The player custom bitmap.
player db 00000000b, 00000000b, 00000000b
db 00000000b, 00000000b, 00000000b
db 00000000b, 01000010b, 00000000b
db 00000000b, 01011010b, 00000000b
db 00000000b, 00111100b, 00000000b
db 00000000b, 00111100b, 00000000b
db 00000000b, 01111110b, 00000000b
db 00000100b, 01111110b, 00100000b
db 00000100b, 01111110b, 00100000b
db 00001110b, 01111110b, 01110000b
db 00001110b, 01111110b, 01110000b
db 00001110b, 01111110b, 01110000b
db 00001110b, 01111110b, 01110000b
db 00001110b, 01111110b, 01110000b
db 00001110b, 01111110b, 01110000b
db 00001110b, 01111110b, 01110000b
db 00001111b, 11111111b, 11110000b
db 00001111b, 11111111b, 11110000b
db 01111111b, 11111111b, 11111110b
db 11111111b, 11111111b, 11111111b
db 11111111b, 11111111b, 11111111b
db 11111111b, 11111111b, 11111111b
db 11110001b, 10000001b, 10001111b
db 01110001b, 10000001b, 10001110b
;The graphic used for number of lives
playerlife db 00000000b
db 00011000b
db 00011000b
db 01011010b
db 01011010b
db 01111110b
db 01111110b
db 10100101b
;The enemy number 1 custom characters.
enemy1 db 01100000b, 00000000b, 00000110b
db 01100000b, 00000000b, 00000110b
db 01110000b, 00011000b, 00001110b
db 01110000b, 00011000b, 00001110b
db 01111000b, 00011000b, 00011110b
db 01111000b, 00011000b, 00011110b
db 00111111b, 11111111b, 11111100b
db 00011111b, 11111111b, 11111000b
db 00011111b, 11111111b, 11111000b
db 00011111b, 11111111b, 11111000b
db 00011111b, 11111111b, 11111000b
db 00011101b, 11111111b, 10111000b
db 00001000b, 11111111b, 00010000b
db 00001000b, 01111110b, 00010000b
db 00001000b, 01111110b, 00010000b
db 00001000b, 01111110b, 00010000b
db 00001000b, 01111110b, 00010000b
db 00000000b, 01111110b, 00000000b
db 00000000b, 00111100b, 00000000b
db 00000000b, 00111100b, 00000000b
db 00000000b, 00111100b, 00000000b
db 00000000b, 00011000b, 00000000b
db 00000000b, 00000000b, 00000000b
db 00000000b, 00000000b, 00000000b
;Explosion
explosion db 00000000b, 00000000b, 00000000b
db 01000000b, 00000000b, 00000000b
db 00111100b, 01100000b, 00000000b
db 00111110b, 01110000b, 00111000b
db 00111111b, 01111000b, 11111000b
db 00111111b, 11111001b, 11111000b
db 00111111b, 11111111b, 11111000b
db 00011111b, 11111111b, 11110000b
db 00001111b, 11111111b, 11110000b
db 00011111b, 11111111b, 11000000b
db 00111111b, 11111111b, 11000000b
db 00011111b, 11111111b, 11100000b
db 00000111b, 11111111b, 11100000b
db 00111111b, 11111111b, 11110000b
db 00011111b, 11111111b, 11111100b
db 00011111b, 11111111b, 11111100b
db 00011111b, 11111111b, 11111100b
db 00011100b, 11111111b, 11111100b
db 00010000b, 11110001b, 11111100b
db 00000000b, 11110001b, 11111000b
db 00000000b, 11100000b, 11001000b
db 00000000b, 11000000b, 00001110b
db 00000000b, 10000000b, 00000010b
db 00000000b, 00000000b, 00000001b
;Laser
laser db 01000010b
;One
one db 00111100b
db 01001000b
db 00001000b
db 00001000b
db 00001000b
db 00001000b
db 00001000b
db 01111110b
;Two
two db 00111000b
db 01000100b
db 00000100b
db 00001000b
db 00010000b
db 00100000b
db 01000000b
db 01111100b
;Three
three db 00111000b
db 01000100b
db 01000010b
db 00011100b
db 00000010b
db 01000010b
db 00100100b
db 00011000b
;Four
four db 10000100b
db 10000100b
db 10000100b
db 11111110b
db 00000100b
db 00000100b
db 00000100b
db 00000100b
;Five
five db 01111110b
db 01000000b
db 10000000b
db 01111110b
db 00000010b
db 10000010b
db 01000010b
db 00111100b
;Six
six db 00011100b
db 00100010b
db 01000000b
db 11111100b
db 10000010b
db 10000010b
db 01000010b
db 00111100b
;Seven
seven db 01111110b
db 10000010b
db 00000010b
db 00000100b
db 00000100b
db 00001000b
db 00001000b
db 00001000b
;Eight
eight db 00111100b
db 01000010b
db 01100110b
db 00011000b
db 00100100b
db 01000010b
db 01000010b
db 00111100b
;Nine
nine db 00111100b
db 01000010b
db 01000010b
db 00111110b
db 00000010b
db 01000010b
db 01000010b
db 00111100b
;Zero
zero db 00111100b
db 01000010b
db 01000010b
db 01000010b
db 01000010b
db 01000010b
db 01000010b
db 00111100b
;---------------------------------------------------------------------------------------------------
;PROCEDURES
;Callable segments of code that make programming easier.
;---------------------------------------------------------------------------------------------------
;Add enemies
addenemies proc
push ax ;Save registers
push bx
push cx
push dx
push si
mov al, NumEnemies ;Copy number of enemies to register
cmp al, MaxEnemies ;Compare number of current enemies to max
je addendn ;Number of enemies is equal to max, done
mov ah, 0 ;Prepare ah for ax
mov al, EnemyChance ;Prepare for random interrupt
int 62h ;Get random number
cmp ax, 0 ;See if random number is 0
jne addendn ;Not 0 so done
mov si, 0 ;Otherwise, prepare array pointer
addenlp1: cmp EnemiesX[si], NO_ENEMY ;Check if this location in array is free
jne addenlp2 ;Location isn't free
mov EnemiesY[si], 0 ;Spawn on top row
addenlp3: mov ax, VIDEO_WIDTH-ENEMY1_WD-1 ;Upper bound for random number
int 62h ;Get random number
inc ax ;Between 1 and 39
mov cl, 3 ;Prepare for shift
shl ax, cl ;Multiply random number by 8
mov bx, 0 ;Prepare registers for collision check proc
mov ch, ENEMY1_WD_PIX
mov cl, ENEMY1_HT_PIX
call chkcolenemy ;Check for collisions with other enemies
cmp dx, NO_ENEMY ;Check if no enemy constant is returned
jne addendn ;If not, forget about new enemy for now
mov EnemiesX[si], ax ;Otherwise, move random number into X location
mov EnemiesStat[si], CHAR_ALIVE ;Enemy is alive
inc NumEnemies ;Increment the number of enemies
jmp addendn ;Finished
addenlp2: add si, 2 ;Increment array pointer
cmp si, ENEMY_LIMIT*2 ;Check if out of bounds
jne addenlp1 ;Not out of array bounds so loop
addendn: pop si ;Restore registers
pop dx
pop cx
pop bx
pop ax
ret ;Return
addenemies endp
;Calculates the byte offset
;REGISTERS AX X Offset
; BX Y Offset
;RETURNS AX Byte Offset
; BX Bit Offset
byteoffset proc
push di ;Save registers
push dx
push si
mov di, ax ;Backup X offset
mov si, bx ;Backup Y offset
mov ax, VIDEO_WIDTH ;Get the video width in bytes for multiplication
mul bx ;Multiply width by Y offset
mov si, ax ;Backup product
mov ax, di ;Get X offset for division use
mov bx, 8 ;The number of bits in byte, for division use
div bx ;Divide the X offset by 8
add ax, si ;Add the quotient and product
mov bx, dx ;Copy the remainder to bx
pop si ;Restore registers
pop dx
pop di
ret ;Return
byteoffset endp
;This procedure directly accesses EGA video memory and clears the screen by writing 0s in a loop.
clearscn proc
push ax ;Save registers
push cx
push di
push dx
mov dx, SC_PORT ;Copy SC port location to dx for out use
mov al, SC_MAP_MASK_REG ;Use map masking capability of SC port
mov ah, ALL_COLORS ;Mask off no planes
out dx, ax ;Write to all bitplanes
mov di, 0 ;Reset video memory pointer
mov cx, VIDEO_MAX_PIX/2 ;Set repeat loop register to max number of pixels/2
mov ax, 0 ;AX is 0 which will clear video memory by word
rep stosw ;Write 0 to video memory until end of video memory
pop dx ;Restore registers
pop di
pop cx
pop ax
ret ;Return
clearscn endp
;Checks for an enemy collision given an X and Y coordinates
;REGISTERS AX X Offset
; BX Y Offset
; CH Width in pixels
; CL Height in pixels
;RETURNS DX NO_ENEMY if no collision or the array pointer to the enemy collided with
chkcolenemy proc
push ax ;Save registers
push bp
push bx
push cx
push di
push si
mov si, 0 ;Prepare array pointer
mov bp, NO_ENEMY ;Default return value to be put in dx at end of proc
chkcolelp1: cmp EnemiesX[si], NO_ENEMY ;Check if enemy is present in this offset
je chkcolelp2 ;No enemy present so next in array
mov di, bx ;Copy Y offset to new register
mov dh, 0 ;Prepare dx
mov dl, cl
add di, dx ;Add the height to the temp Y offset
cmp di, EnemiesY[si] ;Compare enemy top to inputted bottom
jb chkcolelp2 ;Inputted object above enemy, so next in array
mov di, EnemiesY[si] ;Copy enemy's Y offset to new register
add di, ENEMY1_HT_PIX ;Add height of enemy to temp enemy Y offset
cmp bx, di ;Compare inputted top to enemy bottom
ja chkcolelp2 ;Inputted object below enemy, so next
mov di, ax ;Copy X offset to new register
mov dh, 0 ;Prepare dx
mov dl, ch
add di, dx ;Add the width to the new temp X offset
cmp di, EnemiesX[si] ;Compare enemy left to inputted right
jb chkcolelp2 ;Inputted object is left of enemy, so next
mov di, EnemiesX[si] ;Copy enemy's X offset to new register
add di, ENEMY1_WD_PIX ;Add width of enemy to temp enemy X offset
cmp ax, di ;Compare inputted left to enemy right
ja chkcolelp2 ;Inputted object is right of enemy, so next
mov bp, si ;Collision has occured, indicate with whom
jmp chkcoledn ;Finished
chkcolelp2: add si, 2 ;Increment array pointer
cmp si, ENEMY_LIMIT*2 ;Check if array is out of bounds
jne chkcolelp1 ;Not out of bounds so loop
chkcoledn: mov dx, bp ;Set return register to "no enemy" or collided enemy
pop si ;Restore registers
pop di
pop cx
pop bx
pop bp
pop ax
ret ;Return
chkcolenemy endp
;Checks for an enemy collision given an X and Y coordinates
;REGISTERS AX X Offset
; BX Y Offset
; CH Width in pixels
; CL Height in pixels
;RETURNS DX NO_PLAYER if no collision or the array pointer to the enemy collided with
chkcolplay proc
push ax ;Save registers
push bp
push bx
push cx
push di
push si
mov bp, NO_PLAYER ;Default return value to be put in dx at end of proc
mov di, bx ;Copy Y offset to new register
mov dh, 0 ;Prepare dx
mov dl, cl
add di, dx ;Add the height to the temp Y offset
cmp di, PlayerY ;Compare player top to inputted bottom
jb chkcolpdn ;Inputted object above player, so next in array
mov di, PlayerY ;Copy player's Y offset to new register
add di, PLAYER_HT_PIX ;Add height of player to temp player Y offset
cmp bx, di ;Compare inputted top to player bottom
ja chkcolpdn ;Inputted object below enemy, so next
mov di, ax ;Copy X offset to new register
mov dh, 0 ;Prepare dx
mov dl, ch
add di, dx ;Add the width to the new temp X offset
cmp di, PlayerX ;Compare player left to inputted right
jb chkcolpdn ;Inputted object is left of player, so next
mov di, PlayerX ;Copy player's X offset to new register
add di, PLAYER_WD_PIX ;Add width of player to temp player X offset
cmp ax, di ;Compare inputted left to player right
ja chkcolpdn ;Inputted object is right of player, so next
mov bp, 1 ;Collision has occured
jmp chkcolpdn ;Finished
chkcolpdn: mov dx, bp ;Set return register
pop si ;Restore registers
pop di
pop cx
pop bx
pop bp
pop ax
ret ;Return
chkcolplay endp
;Decrement lives
declives proc
sub Lives, 1 ;Decrement lives
jnz declivesdn ;Check if 0
mov GameOver, 1 ;Yes so game over
declivesdn: ret ;Return
declives endp
;Decrement score by specified amount
;REGISTERS AX Amount to decrement
decscore proc
cmp ax, Score ;Compare amount to current score
ja decscore1 ;If amount to decrement is greater, make 0
sub Score, ax ;Otherwise, subtract score
jmp decscoredn ;And finish
decscore1: mov Score, 0 ;Score is 0
decscoredn: ret ;Return
decscore endp
;Delay routine. This code borrows heavily from the Dewar Game Program. Some wording and constant
;names have been changed.
delay proc
push ax ;Save registers
push dx
sub ax, ax ;Set ax to 0 for procedure call
mov dx, SCREEN_DELAY ;Delay length
call note ;Play blank note for specified time
pop dx ;Restore registers
pop ax
ret ;Return
delay endp
;Difficulty menu
diffmenu proc
push ax ;Save registers
push bx
push dx
mov MenuSelect2, 0 ;Start at top of menu
mov ah, 5 ;Change video page
mov al, 2
int 10h
diffmenulp: mov ax, offset diffstr
mov bh, 2
mov bl, LIGHT_CYAN_MASK
mov dh, 8
mov dl, 30
call writeasciiz
mov ax, offset diff1
mov bh, 2
cmp MenuSelect2, MENU2_EASY ;Check if menu selection is 0
jne diffmen1_1 ;It's not so next
mov bl, YELLOW_MASK
jmp diffmen1_2 ;Next
diffmen1_1: mov bl, WHITE_MASK
diffmen1_2: mov dh, 9
mov dl, 30
call writeasciiz
mov ax, offset diff2
mov bh, 2
cmp MenuSelect2, MENU2_MEDIUM ;Check if menu selection is 1
jne diffmen2_1 ;It's not so next
mov bl, YELLOW_MASK
jmp diffmen2_2 ;Next
diffmen2_1: mov bl, WHITE_MASK
diffmen2_2: mov dh, 10
mov dl, 30
call writeasciiz
mov ax, offset diff3
mov bh, 2
cmp MenuSelect2, MENU2_HARD ;Check if menu selection is 2
jne diffmen3_1 ;It's not so next
mov bl, YELLOW_MASK
jmp diffmen3_2 ;Next
diffmen3_1: mov bl, WHITE_MASK
diffmen3_2: mov dh, 11
mov dl, 30
call writeasciiz
mov ax, offset diff4
mov bh, 2
cmp MenuSelect2, MENU2_NIGHTMARE;Check if menu selection is 3
jne diffmen4_1 ;It's not so next
mov bl, YELLOW_MASK
jmp diffmen4_2 ;Next
diffmen4_1: mov bl, WHITE_MASK
diffmen4_2: mov dh, 12
mov dl, 30
call writeasciiz
;The following gets keyboard input and acts accordingly
mov ax, 0
int 16h
cmp ah, KBD_DOWN
jne diffmenu1
cmp MenuSelect2, 3
jne diffmenu2
mov MenuSelect2, 0
jmp diffmenu1
diffmenu2: inc MenuSelect2
diffmenu1: cmp ah, KBD_UP
jne diffmenu3
cmp MenuSelect2, 0
jne diffmenu4
mov MenuSelect2, 3
jmp diffmenu3
diffmenu4: dec MenuSelect2
diffmenu3: cmp ah, KBD_ESC
jne diffmenu5
call menuinit
diffmenu5: cmp ah, KBD_ENTER
jne diffmenu9
cmp MenuSelect2, 0
jne diffmenu6
call start_easy
diffmenu6: cmp MenuSelect2, 1
jne diffmenu7
call start_med
diffmenu7: cmp MenuSelect2, 2
jne diffmenu8
call start_hard
diffmenu8: cmp MenuSelect2, 3
jne diffmenu9
call start_nm
diffmenu9: jmp diffmenulp
pop dx ;Restore registers
pop bx
pop ax
ret ;Return
diffmenu endp
;Display the help screen
disphelp proc
push ax ;Save registers
push bx
push dx
mov ah, 5
mov al, 1
int 10h
mov ax, offset help
mov bh, 1
mov bl, WHITE_MASK
mov dh, 0
mov dl, 0
call writeasciiz ;Write help data to screen
disphelp1: mov ax, 0
int 16h ;Get input
cmp ah, KBD_ESC ;Check if Escape key pressed
jne disphelp ;If not, get input
mov ah, 5
mov al, 0
int 10h ;Go back to menu video page
pop dx ;Restore registers
pop bx
pop ax
ret ;Return
disphelp endp
;Display the number of lives the player has
displives proc
push ax ;Save registers
push bx
push cx
push di
push dx
push si
mov ch, Lives ;Move number of lives to a register
cmp ch, 0 ;Check if lives are 0
je displidn ;Zero so done
mov dx, SC_PORT ;Prepare for out statement
mov al, SC_MAP_MASK_REG ;Prepare for out statement to set color
mov ah, LIGHT_CYAN_MASK ;Lives color is light cyan
out dx, ax ;Set lives color by masking off correct planes
mov dx, VIDEO_WIDTH_PIX ;Prepare registers for proc
displilp1: sub dx, 10
mov ax, dx
mov bx, 8
call byteoffset ;Get byte offset
mov di, ax ;Set video offset
mov si, 0 ;Reset array pointer
mov cl, 8 ;Reset counter
displilp2: mov al, playerlife[si] ;The bmp data for the graphic
stosb ;Send bmp data to video memory
add di, VIDEO_WIDTH-1 ;Point to next row
inc si ;Next row in bmp data
sub cl, 1 ;Decrement count
jnz displilp2 ;Next row
sub ch, 1 ;Decrement life count
jnz displilp1 ;Not zero so loop
displidn: pop si ;Restore registers
pop dx
pop di
pop cx
pop bx
pop ax
ret ;Return
displives endp
;Display a number
;REGISTERS AX Number to display (between 0-9 inclusive)
; BX X Offset
; CX Y Offset
dispnumber proc
push ax ;Save registers
push bp
push bx
push cx
push di
push si
cmp ax, 9
ja dispnmdn
cmp ax, 0
jb dispnmdn
mov si, ax ;Backup number
mov ax, bx ;Prepare registers for proc
mov bx, cx
call byteoffset ;Get byte offset
mov di, ax ;Set video offset
shl si, 1 ;Multiply pointer by 2 because word array
mov bp, NumberPtrs[si] ;Get number offset
mov cl, 8 ;Number of times to repeat
dispnmlp1: mov al, [bp] ;Draw number by looping through bmp data
stosb
inc bp
add di, VIDEO_WIDTH-1
sub cl, 1
jnz dispnmlp1
dispnmdn: pop si ;Restore registers
pop di
pop cx
pop bx
pop bp
pop ax
ret ;Return
dispnumber endp
;Displays the score
dispscore proc
push ax ;Save registers
push bp
push bx
push cx
push di
push dx
push si
mov dx, SC_PORT ;Prepare for out statement
mov al, SC_MAP_MASK_REG ;Prepare for out statement to set color
mov ah, WHITE_MASK ;Score color is white
out dx, ax ;Set score color by masking off correct planes
mov ax, Score ;Prepare for divison
mov dx, 0
mov bx, 10000
div bx ;Divide
mov bx, 10 ;Prepare registers for proc
mov cx, 8
call dispnumber ;Display number
mov ax, dx ;Prepare
mov dx, 0
mov bx, 1000
div bx ;Divide
mov bx, 18 ;Prepare registers for proc
mov cx, 8
call dispnumber ;Display number
mov ax, dx ;Prepare
mov dx, 0
mov bx, 100
div bx ;Divide
mov bx, 26 ;Prepare registers for proc
mov cx, 8
call dispnumber ;Display number
mov ax, dx ;Prepare
mov dx, 0
mov bx, 10
div bx ;Divide
mov bx, 34 ;Prepare registers for proc
mov cx, 8
call dispnumber ;Display number
mov ax, dx
mov bx, 42 ;Prepare registers for proc
mov cx, 8
call dispnumber ;Display number
pop si ;Restore registers
pop dx
pop di
pop cx
pop bx
pop bp
pop ax
ret ;Return
dispscore endp
;Draw the enemies
drawenemies proc
push ax ;Save registers
push bp
push bx
push di
push dx
push si
mov bp, 0 ;Array pointer
jmp drawenlp1 ;Go to first loop
drawenlp1: cmp EnemiesX[bp], NO_ENEMY ;Compare current enemy to "no enemy" constant
je drawenlp2 ;No enemy here so draw nothing
mov ax, EnemiesX[bp] ;Prepare registers for procedure
mov bx, EnemiesY[bp]
call byteoffset ;Get byte offset
mov di, ax ;Copy byte offset to di
cmp EnemiesStat[bp], CHAR_EXP ;Check if enemy had been shot
je drawenlp4 ;Enemy will be not drawn as explosion
mov si, 0 ;Bitmap pointer
mov dx, SC_PORT ;Prepare for out statement
mov al, SC_MAP_MASK_REG ;Prepare for out statement to set color
mov ah, MAGENTA_MASK ;Enemy color is magenta
out dx, ax ;Set enemy color by masking off correct planes
mov bh, ENEMY1_WD ;Store enemy width
mov bl, ENEMY1_HT_PIX ;Store enemy height
drawenlp3: mov al, enemy1[si] ;Move current bmp byte into al for drawing
stosb ;Write byte to video memory
inc si ;Increment bmp pointer
sub bh, 1 ;Decrement enemy width
jnz drawenlp3 ;Check if width is equal to 0. If not, next byte
mov bh, ENEMY1_WD ;Width has been decremented to 0, reset
sub bl, 1 ;Decrement the height of the enemy
jz drawenlp2 ;Height of enemy is 0, next enemy
add di, VIDEO_WIDTH - ENEMY1_WD ;Otherwise begin drawing next row
jmp drawenlp3 ;Loop
drawenlp4: mov ax, EnemiesX[bp] ;Prepare registers for proc
mov bx, EnemiesY[bp]
call drawexp ;Draw an explosion
drawenlp2: add bp, 2 ;Increment array pointer
cmp bp, ENEMY_LIMIT*2 ;Check if pointer is out of bounds
jne drawenlp1 ;Not out of bounds so loop
drawendn: pop si ;Restore registers
pop dx
pop di
pop bx
pop bp
pop ax
ret ;Return
drawenemies endp
;Draw an explosion
;REGISTERS AX X Offset
; BX Y Offset
drawexp proc
push ax ;Save registers
push bx
push di
push dx
push si
call byteoffset
mov di, ax
mov si, 0 ;Bitmap pointer
mov bh, EXP_WD ;Width in reg
mov bl, EXP_HT_PIX ;Height in reg
mov dx, SC_PORT ;Prepare for out statement
mov al, SC_MAP_MASK_REG ;Prepare for out statement to set color
mov ah, YELLOW_MASK ;Explosion color is yellow
out dx, ax ;Set explosion color by masking off correct planes
drawexplp1: mov al, explosion[si] ;Move current bmp byte into al for drawing
stosb ;Write byte to video memory
inc si ;Increment bmp pointer
sub bh, 1 ;Decrement enemy width
jnz drawexplp1 ;Check if width is equal to 0. If not, next byte
mov bh, EXP_WD ;Width has been decremented to 0, reset
sub bl, 1 ;Decrement the height of the explosion
jz drawexpen ;Height of enemy is 0, done
add di, VIDEO_WIDTH - EXP_WD ;Otherwise begin drawing next row
jmp drawexplp1 ;Loop
drawexpen: mov ax, EXP_FREQ ;Prepare registers for procedure
mov dx, EXP_DUR
call note
pop si ;Restore registers
pop dx
pop di
pop bx
pop ax
ret ;Return
drawexp endp
;Draw the player. This should not be called directly, instead the player should be moved around the
;screen by the appropriate functions that will call this function to redraw the player correctly.
drawplayer proc
push ax ;Save registers
push bx
push cx
push di
push dx
push si
cmp PlayerStat, CHAR_EXP ;Check if player is exploded
je drawplayex ;Draw the player exploded
mov ax, PlayerX ;Prepare registers for procedure
mov bx, PlayerY
call byteoffset ;Get byte offset from X and Y
mov di, ax ;The byte offset to begin drawing the player
mov si, 0 ;Player bitmap data array pointer
mov dx, SC_PORT ;Prepare for out statement
mov al, SC_MAP_MASK_REG ;Prepare for out statement to set color
mov ah, LIGHT_CYAN_MASK ;Player color is light cyan
out dx, ax ;Set player color by masking off correct planes
mov bh, PLAYER_WD ;Store player width in register for drawing
mov bl, PLAYER_HT_PIX ;Store player height in register for drawing
drawplaylp: mov al, player[si] ;Move the current player bmp byte into draw reg
stosb ;Move current bitmap byte to current vid offset
inc si ;Increment the bitmap array pointer
sub bh, 1 ;Decrement the width of the player
jnz drawplaylp ;Check if width is equal to 0. If not, next byte
mov bh, PLAYER_WD ;Width has decremented to 0, reset width
sub bl, 1 ;Decrement the height of the player
jz enddrwplay ;If the height of the player is 0, we are done
add di, VIDEO_WIDTH - PLAYER_WD ;Otherwise, beging drawing next row of bmp data
jmp drawplaylp ;Loop
drawplayex: mov ax, PlayerX ;Prepare registers for proc
mov bx, PlayerY
call drawexp ;Draw an explosion
enddrwplay: pop si ;Restore registers
pop dx
pop di
pop cx
pop bx
pop ax
ret ;Return
drawplayer endp
;Draw the enemies' bullets on the screen
draweshot proc
push ax ;Save registers
push bp
push bx
push cx
push di
push dx
push si
mov bp, 0 ;Reset array pointer
draweshlp1: cmp EnemyShotX[bp], NO_BULLET ;Check if laser has been shot
je draweshlp2 ;No laser shot so loop
mov ax, EnemyShotX[bp] ;Prepare registers for collision check proc
mov bx, EnemyShotY[bp]
mov ch, LASER_WD_PIX
mov cl, ELaserSpeed
call chkcolplay ;Check if collision with player
cmp dx, NO_PLAYER ;See if collision occured
je draweshot1 ;No collision, draw laser
mov PlayerStat, CHAR_EXP ;Player has exploded
call declives ;Decrement player's lives
mov ax, ENEMY1_PT_VAL
call decscore ;Decrement player's score
mov EnemyShotX[bp], NO_BULLET ;Reset enemy's laser
mov EnemyShotY[bp], NO_BULLET
jmp draweshlp2 ;Done drawing laser
draweshot1: mov dx, SC_PORT ;Prepare for out statement
mov al, SC_MAP_MASK_REG ;Prepare for out statement to set color
mov ah, LIGHT_RED_MASK ;Laser color
out dx, ax ;Set laser color by masking off correct planes
mov ax, EnemyShotX[bp]
mov bx, EnemyShotY[bp]
call byteoffset
mov di, ax
mov dl, 7 ;Temporary loop count register
mov al, laser ;Load bmp data for laser
draweshlp3: stosb ;Send to video memory
add di, VIDEO_WIDTH - LASER_WD ;Next row
sub dl, 1 ;Subtract 1 from count
jnz draweshlp3 ;Count not zero so loop
draweshlp2: add bp, 2 ;Increment array pointer
cmp bp, ENEMY_LIMIT*2 ;Check if out of bounds
jne draweshlp1 ;Not out of bounds so loop
enddrwesht: pop si ;Restore registers
pop dx
pop cx
pop di
pop bx
pop bp
pop ax
ret ;Return
draweshot endp
;Draw the player's bullets on the screen
drawpshot proc
push ax ;Save registers
push bx
push cx
push di
push dx
push si
cmp PlayerShotX, NO_BULLET ;Check if laser has been shot
je enddrwpsht ;No laser shot so finish
mov ax, PlayerShotX ;Prepare registers for collision check proc
mov bx, PlayerShotY
mov ch, LASER_WD_PIX
mov cl, PLaserSpeed
call chkcolenemy ;Check if collision
cmp dx, NO_ENEMY ;See if collision occured from return value
je drawpshot1 ;No collision, draw laser
mov si, dx ;Copy enemy value to new register
mov EnemiesStat[si], CHAR_EXP ;Enemy is now in exploded state
dec NumEnemies ;Decrement enemy count
mov PlayerShotX, NO_BULLET ;Reset player's laser
mov PlayerShotY, NO_BULLET
mov ax, ENEMY1_PT_VAL ;Prepare register for proc
call incscore ;Increment the score
jmp enddrwpsht ;Done drawing laser
drawpshot1: mov dx, SC_PORT ;Prepare for out statement
mov al, SC_MAP_MASK_REG ;Prepare for out statement to set color
mov ah, LIGHT_BLUE_MASK ;Laser color
out dx, ax ;Set laser color by masking off correct planes
mov ax, PlayerShotX
mov bx, PlayerShotY
call byteoffset
mov di, ax
mov dl, 7 ;Temporary loop count register
mov al, laser ;Load bmp data for laser
drawpshtlp: stosb ;Send to video memory
add di, VIDEO_WIDTH - LASER_WD ;Next row
sub dl, 1 ;Subtract 1 from count
jnz drawpshtlp ;Count not zero so loop
enddrwpsht: pop si ;Restore registers
pop dx
pop cx
pop di
pop bx
pop ax
ret ;Return
drawpshot endp
;Enemy shoots weapon
enemyshoot proc
push ax ;Save registers
push bx
push dx
push si
mov si, 0 ;Reset array pointer
enshootlp1: cmp EnemiesX[si], NO_ENEMY ;Check if enemy exists in this pointer
je enshootlp2 ;Doesn't exist so next enemy
cmp EnemyShotX[si], NO_BULLET ;Check if enemy has shot anything yet
jne enshootlp2 ;Yes, enemy has already fired weapon
mov ah, 0 ;Prepare ax
mov al, ELaserChn ;Set random number upperbound
int 62h ;Get random number
cmp ax, 0 ;Check if random number is 0
jne enshootlp2 ;Not 0, so next enemy
mov ax, EnemiesX[si] ;Prepare registers for proc
mov bx, EnemiesY[si]
cmp bx, VIDEO_HEIGHT_PIX-8 ;Check if too close to bottom of screen
jae enshootlp2 ;Too close, next enemy
add ax, 8
add bx, 8
mov EnemyShotX[si], ax
mov EnemyShotY[si], bx
mov ax, LASER_FREQ ;Prepare registers for procedure
mov dx, LASER_DUR
call note ;Laser sound
enshootlp2: add si, 2 ;Increment array pointer
cmp si, ENEMY_LIMIT*2 ;Check if out of bounds
jne enshootlp1 ;Not out of bounds so loop
pop si ;Restore registers
pop dx
pop bx
pop ax
ret ;Return
enemyshoot endp
;Resets video modes and exits to DOS
exitgame proc
push ax ;Save registers
mov ah, 0 ;Prepare graphics mode registers
mov al, 3
int 10h
int 20h ;Exit game
pop ax ;Restore registers
ret ;Return
exitgame endp
;Gets the input from the mouse
getinput proc
push ax ;Save registers
push bx
push cx
push dx
mov ax, 3 ;Prepare mouse interrupt
int 33h ;Get mouse position and buttons
cmp cx, MOUSE_RBOUND ;Compare X offset to player max
jna movx ;Not greater so move X
mov cx, MOUSE_RBOUND ;Fix X
movx: mov MouseX, cx ;Copy X position to variable
cmp dx, MOUSE_BBOUND ;Compare Y offset to player max
jna movy ;Not greater so check upper bound
mov dx, MOUSE_BBOUND ;Fix Y
movy: cmp dx, MOUSE_UBOUND ;Compare Y offset to player max
jnb movy2 ;Not less so move Y
mov dx, MOUSE_UBOUND ;Fix Y
movy2: mov MouseY, dx ;Copy Y position to variable
mov ax, 0000000000000001b ;Create bitmask
and bx, ax ;Mask off button click register
cmp bx, 1 ;Compare button click register to 1
jne notpressed ;Not 1 so left not pressed
mov LeftButton, 1 ;Otherwise, left is pressed
jmp movdone ;Finished
notpressed: mov LeftButton, 0 ;Set left as not pressed
movdone: pop dx ;Restore registers
pop cx
pop bx
pop ax
ret ;Return
getinput endp
;Move enemies' laser downscreen
inceshot proc
push ax ;Save registers
push bx
push si
mov si, 0 ;Reset array pointer
inceshlp1: cmp EnemyShotX[si], NO_BULLET ;Check if laser in play
je inceshlp2 ;No laser, next enemy
mov ax, EnemyShotX[si] ;Set registers for proc
mov bx, EnemyShotY[si]
call byteoffset
cmp ax, 0 ;Check if laser is on screen
je inceshlp2 ;No laser, no incrementing
mov ah, 0
mov al, ELaserSpeed
cmp EnemyShotY[si], VIDEO_WIDTH_PIX;See if shot is at bottom of screen
jne inceshlp3 ;Not so next check
mov EnemyShotX[si], NO_BULLET ;Otherwise, remove laser from screen completely
mov EnemyShotY[si], NO_BULLET
jmp inceshlp2 ;Next enemy
inceshlp3: cmp EnemyShotY[si], ax ;Compare Y location and what will be subtracted
jnae inceshlp4 ;Not above or equal so make Y 0
add EnemyShotY[si], ax ;Otherwise move Y naturally
jmp inceshlp2 ;Next enemy
inceshlp4: mov EnemyShotY[si], 0
inceshlp2: add si, 2 ;Increment array pointer
cmp si, ENEMY_LIMIT*2 ;Check if in bounds
jne inceshlp1 ;In bounds, so loop
pop si ;Restore registers
pop bx
pop ax
ret ;Return
inceshot endp
;Move player's lasers upscreen
incpshot proc
push ax ;Save registers
push bx
cmp PlayerShotX, NO_BULLET ;Check if laser in play
je incpshotdn ;No laser, done
mov ax, PlayerShotX ;Set registers for procedure
mov bx, PlayerShotY
call byteoffset
cmp ax, 0 ;Check if laser is on screen
je incpshotdn ;No laser, no incrementing
mov ah, 0
mov al, PLaserSpeed
cmp PlayerShotY, 0 ;See if shot is at top of screen
jne incpshotd3 ;Not so next check
mov PlayerShotX, NO_BULLET ;Otherwise, remove laser from screen completely
mov PlayerShotY, NO_BULLET
jmp incpshotdn ;Finished
incpshotd3: cmp PlayerShotY, ax ;Compare Y location and what will be subtracted
jnae incpshotd2 ;Not above or equal so make Y 0
sub PlayerShotY, ax ;Otherwise move Y naturally
jmp incpshotdn ;Finished
incpshotd2: mov PlayerShotY, 0
incpshotdn: pop bx ;Restore registers
pop ax
ret ;Return
incpshot endp
;Increment the score by specified amount
;REGISTERS AX Amount to increase score by
incscore proc
push ax ;Save registers
push bx
push dx
add Score, ax ;Add specified amount to score
inc NumKills ;Increment the number of kills
cmp MaxEnemies, ENEMY_LIMIT ;Check if max enemies reached
je incscrdn ;Max enemies reached, done
inc NumKillsCnt ;Increment the 20 count of number of kills
cmp NumKillsCnt, 19 ;Compare number of kills 20 count to 19
jne incscrdn ;Not 19 so done
mov NumKillsCnt, 0 ;Reset number of kills 20 count
inc MaxEnemies ;Increment the maximum number of enemies
incscrdn: pop dx ;Restore registers
pop bx
pop ax
ret ;Return
incscore endp
;Initialize menu
menuinit proc
push ax ;Save registers
push bx
push cx
push dx
mov ah, 0 ;Initialize text mode
mov al, TEXT_MODE
int 10h
mov MenuSelect, 0
menuinlp1: mov ax, offset spoperastr
mov bh, 0
mov bl, LIGHT_CYAN_MASK
mov dh, 0
mov dl, 12
call writeasciiz ;Write SPACE OPERA string
mov ax, offset copystr
mov bh, 0
mov bl, CYAN_MASK
mov dh, 14
mov dl, 26
call writeasciiz ;Write copyright string
mov ax, offset thanksstr
mov bh, 0
mov bl, MAGENTA_MASK
mov dh, 16
mov dl, 26
call writeasciiz ;Write thank you string
mov ax, offset newgamestr
mov bh, 0
cmp MenuSelect, MENU_NEW ;Check if menu selection is 0
jne menuin1_1 ;It's not so next
mov bl, YELLOW_MASK
jmp menuin1_2 ;Next
menuin1_1: mov bl, WHITE_MASK
menuin1_2: mov dh, 19
mov dl, 34
call writeasciiz ;Write new game string
mov ax, offset helpstr
mov bh, 0
cmp MenuSelect, MENU_HELP ;Check if menu selection is 0
jne menuin2_1 ;It's not so next
mov bl, YELLOW_MASK
jmp menuin2_2 ;Next
menuin2_1: mov bl, WHITE_MASK
menuin2_2: mov dh, 20
mov dl, 36
call writeasciiz ;Write help string
mov ax, offset quitstr
mov bh, 0
cmp MenuSelect, MENU_QUIT ;Check if menu selection is 0
jne menuin3_1 ;It's not so next
mov bl, YELLOW_MASK
jmp menuin3_2 ;Next
menuin3_1: mov bl, WHITE_MASK
menuin3_2: mov dh, 21
mov dl, 36
call writeasciiz ;Write quit string
menugetin: mov ax, 0 ;Get input
int 16h
;The following controls menu selections and keyboard input
cmp ah, KBD_UP
jne menuin5
cmp MenuSelect, 0
jne menuin4
mov MenuSelect, 2
jmp menuin5
menuin4: sub MenuSelect, 1
menuin5: cmp ah, KBD_DOWN
jne menuin7
cmp MenuSelect, 2
jne menuin6
mov MenuSelect, 0
jmp menuin7
menuin6: add MenuSelect, 1
menuin7: cmp ah, KBD_ESC
jne menuin8
call exitgame
menuin8: cmp ah, KBD_ENTER
jne menuin11
cmp MenuSelect, MENU_NEW
jne menuin9
call diffmenu ;Start game
menuin9: cmp MenuSelect, MENU_HELP
jne menuin10
call disphelp ;Display help
menuin10: cmp MenuSelect, MENU_QUIT
jne menuin11
call exitgame
menuin11: jmp menuinlp1 ;Loop
pop dx ;Restore registers
pop cx
pop bx
pop ax
ret ;Return
menuinit endp
;Initialize the mouse
mouseinit proc
push ax ;Save registers
push cx
push dx
mov ax, 0 ;Initialize mouse
int 33h
mov ax, 4 ;Set mouse position
mov cx, MOUSE_HORDEF
mov dx, MOUSE_VERDEF
int 33h
pop dx ;Restore registers
pop cx
pop ax
ret ;Return
mouseinit endp
;Move the enemies
moveenemies proc
push ax ;Save registers
push cx
push si
mov si, 0 ;Prepare array pointer
mov ah, 0 ;Prepare al for ax
mov al, EnemySpeed ;Prepare register for addition
mov cl, 3 ;Prepare for shift
shl ax, cl ;Multiply register by 8
mov bp, ax ;Copy speed offset to dx
moveenlp1: cmp EnemiesX[si], NO_ENEMY ;Check if enemy exists
je moveenlp2 ;No enemy so next
cmp EnemiesStat[si], CHAR_EXP ;Check if it's exploded
jne moveenlp3 ;Not exploded so continue
mov EnemiesX[si], NO_ENEMY ;Reset enemy in array
mov EnemiesY[si], NO_ENEMY
mov EnemiesStat[si], NO_ENEMY
jmp moveenlp2 ;Next enemy
moveenlp3: mov ah, 0 ;Set random number upper bound
mov al, EnemySpdChn
int 62h ;Get random number
cmp ax, 0 ;Compare random number to 0
jne moveenlp2 ;Not 0 so finished
add EnemiesY[si], bp ;Otherwise move enemy forward
mov bx, PlayerX ;Send player X location to register
cmp EnemiesX[si], bx ;Compare player X to current enemy X
jna moveenrght ;The player is to the right so move right
sub EnemiesX[si], bp ;Otherwise, player is to the left so move left
jmp moveenlp4 ;Finished
moveenrght: add EnemiesX[si], bp ;Move player right
moveenlp4: cmp EnemiesY[si], VIDEO_HEIGHT_PIX;Check and see if player has gone offscreen
jna moveenlp2
mov EnemiesX[si], NO_ENEMY ;Enemy no longer exists; offscreen
mov EnemiesY[si], NO_ENEMY
mov EnemiesStat[si], NO_ENEMY
dec NumEnemies ;Decrement number of enemies
moveenlp2: add si, 2 ;Increment array pointer
cmp si, ENEMY_LIMIT*2 ;Check if array is out of bounds
jne moveenlp1 ;Not out of bounds so loop
moveendn: pop si ;Restore registers
pop cx
pop ax
ret ;Return
moveenemies endp
;Move player by mouse
moveplayer proc
push ax ;Save registers
push bx
push cx
push dx
mov ax, MouseX ;Copy mouse X to temp register
mov PlayerX, ax ;Copy temp register to player X
mov ax, MouseY ;Copy mouse Y to temp register
mov PlayerY, ax ;Copy temp register to player Y
mov ax, PlayerX ;Prepare registers for collision check proc
mov bx, PlayerY
mov ch, PLAYER_WD_PIX
mov cl, PLAYER_HT_PIX
call chkcolenemy ;Check if player has collided with enemy
cmp dx, NO_ENEMY ;Check if no enemy
je moveplaydn ;No enemy so done
mov bx, dx ;Copy enemy array pointer
mov PlayerStat, CHAR_EXP ;Player has exploded
mov EnemiesStat[bx], CHAR_EXP ;Enemy has exploded
dec NumEnemies ;Decrement the number of enemies
mov ax, ENEMY1_PT_VAL ;Prepare register for proc
call decscore ;Decrement score
call declives ;Decrement lives
moveplaydn: pop dx ;Restore registers
pop cx
pop bx
pop ax
ret ;Return
moveplayer endp
;Player shoots weapon
playershoot proc
push ax ;Save registers
push bx
cmp PlayerShotX, NO_BULLET ;Check if laser exists
jne endpshoot ;Is not 0, so done
mov ax, PlayerX ;Prepare registers for procedure
mov bx, PlayerY
cmp bx, 8
jbe endpshoot
add ax, 8
sub bx, 8
mov PlayerShotX, ax ;Store the byte offset in the laser table
mov PlayerShotY, bx
mov ax, LASER_FREQ ;Prepare registers for procedure
mov dx, LASER_DUR
call note ;Laser sound
endpshoot: pop bx ;Restore registers
pop ax
ret ;Return
playershoot endp
;Reset the game data
resetgame proc
push si ;Save registers
mov PlayerShotX, NO_BULLET
mov PlayerShotY, NO_BULLET
mov PlayerStat, CHAR_ALIVE
mov PlayerDead, FALSE
mov si, 0 ;Array pointer
resetlp1: mov EnemiesX[si], NO_ENEMY
mov EnemiesY[si], NO_ENEMY
mov EnemiesStat[si], NO_ENEMY
mov EnemyShotX[si], NO_BULLET
mov EnemyShotY[si], NO_BULLET
add si, 2
cmp si, ENEMY_LIMIT*2
jne resetlp1
mov MaxEnemies, 3
mov NumEnemies, 0
mov LeftButton, 0
mov Score, 0
mov NumKills, 0
mov NumKillsCnt, 0
mov Lives, 3
mov GameOver, FALSE
pop si ;Restore registers
ret ;Return
resetgame endp
;Reset player if dead
resetplayer proc
push ax ;Save registers
push cx
push dx
mov PlayerStat, CHAR_ALIVE ;Player is alive again
mov ax, 4
mov cx, 160
mov dx, MOUSE_BBOUND
int 33h
pop dx ;Restore registers
pop cx
pop ax
ret ;Return
resetplayer endp
;Start easy
start_easy proc
mov EnemyChance, 50
mov PLaserSpeed, 16
mov ELaserSpeed, 4
mov ELaserChn, 100
mov EnemySpdChn, 50
mov EnemySpeed, 1
jmp init
ret ;Return
start_easy endp
;Start medium
start_med proc
mov EnemyChance, 25
mov PLaserSpeed, 8
mov ELaserSpeed, 4
mov ELaserChn, 50
mov EnemySpdChn, 25
mov EnemySpeed, 1
jmp init
ret ;Return
start_med endp
;Start hard
start_hard proc
mov EnemyChance, 20
mov PLaserSpeed, 8
mov ELaserSpeed, 8
mov ELaserChn, 50
mov EnemySpdChn, 25
mov EnemySpeed, 2
jmp init
ret ;Return
start_hard endp
;Start nightmare
start_nm proc
mov EnemyChance, 10
mov PLaserSpeed, 4
mov ELaserSpeed, 8
mov ELaserChn, 100
mov EnemySpdChn, 10
mov EnemySpeed, 2
jmp init
ret ;Return
start_nm endp
;Writes an ASCIIZ string in text mode at specified location
;REGISTERS AX Offset to ASCIIZ string
; BH Video page
; BL Color
; DH Row
; DL Column
writeasciiz proc
push ax ;Save registers
push bx
push cx
push di
push dx
mov di, ax ;Backup offset
mov si, dx ;Backup location
wrasciilp1: mov ah, 2 ;Set cursor position
int 10h
mov ah, 9 ;Write character
mov al, [di] ;Copy character into new register
cmp al, 0 ;Check if null
je wrasciidn ;If null, finished
cmp al, 0Dh ;Check if carriage return
jne wrasciilp2 ;Not so skip
inc dh ;Increment row
mov cx, si
mov dl, cl ;Reset column
jmp wrasciilp3 ;Next character
wrasciilp2: cmp al, 8 ;Check if backspace
jne wrasciip4 ;Not so skip
dec dl ;Decrement column
jmp wrasciilp3 ;Next character
wrasciip4: mov cx, 1 ;Repeat once
int 10h ;Otherwise, write char
inc dl ;Increment column offset
wrasciilp3: inc di ;Increment character offset in string
jmp wrasciilp1 ;Loop
wrasciidn: mov ah, 1
mov ch, 32
int 10h ;Get rid of cursor
pop dx ;Restore registers
pop di
pop cx
pop bx
pop ax
ret ;Return
writeasciiz endp
;Initialize video
videoinit proc
push ax ;Save registers
mov ah, 0 ;Prepare registers for setting video mode int 10h
mov al, VIDEO_MODE ;Choose video mode for int 10h
int 10h ;Initialize video mode
mov ah, 5 ;Prepare registers for setting default page
mov al, 0 ;Default page is 0
int 10h ;Set default page
mov ax, VIDEO_SEGMENT ;Set video segment for copying into ES register
mov es, ax ;ES points to video segment
pop ax ;Restore registers
ret ;Return
videoinit endp
;---------------------------------------------------------------------------------------------------
;DEWAR CODE
;Code taken from Dewar game
;---------------------------------------------------------------------------------------------------
;
; Routine to play note on speaker
;
; (AX) Frequency in Hz (32 - 32000)
; (DX) Duration in units of 1/100 second
; CALL NOTE
;
; Note: a frequency of zero, means rest (silence) for the indicated
; time, allowing this routine to be used simply as a timing delay.
;
; Definitions for timer gate control
;
CTRL EQU 61H ; timer gate control port
TIMR EQU 00000001B ; bit to turn timer on
SPKR EQU 00000010B ; bit to turn speaker on
;
; Definitions of input/output ports to access timer chip
;
TCTL EQU 043H ; port for timer control
TCTR EQU 042H ; port for timer count values
;
; Definitions of timer control values (to send to control port)
;
TSQW EQU 10110110B ; timer 2, 2 bytes, sq wave, binary
LATCH EQU 10000000B ; latch timer 2
;
; Define 32 bit value used to set timer frequency
;
FRHI EQU 0012H ; timer frequency high (1193180 / 256)
FRLO EQU 34DCH ; timer low (1193180 mod 256)
;
NOTE PROC
PUSH AX ; save registers
PUSH BX
PUSH CX
PUSH DX
PUSH SI
MOV BX,AX ; save frequency in BX
MOV CX,DX ; save duration in CX
;
; We handle the rest (silence) case by using an arbitrary frequency to
; program the clock so that the normal approach for getting the right
; delay functions, but we will leave the speaker off in this case.
;
MOV SI,BX ; copy frequency to BX
OR BX,BX ; test zero frequency (rest)
JNZ NOT1 ; jump if not
MOV BX,256 ; else reset to arbitrary non-zero
;
; Initialize timer and set desired frequency
;
NOT1: MOV AL,TSQW ; set timer 2 in square wave mode
OUT TCTL,AL
MOV DX,FRHI ; set DX:AX = 1193180 decimal
MOV AX,FRLO ; = clock frequency
DIV BX ; divide by desired frequency
OUT TCTR,AL ; output low order of divisor
MOV AL,AH ; output high order of divisor
OUT TCTR,AL
;
; Turn the timer on, and also the speaker (unless frequency 0 = rest)
;
IN AL,CTRL ; read current contents of control port
OR AL,TIMR ; turn timer on
OR SI,SI ; test zero frequency
JZ NOT2 ; skip if so (leave speaker off)
OR AL,SPKR ; else turn speaker on as well
;
; Compute number of clock cycles required at this frequency
;
NOT2: OUT CTRL,AL ; rewrite control port
XCHG AX,BX ; frequency to AX
MUL CX ; frequency times secs/100 to DX:AX
MOV CX,100 ; divide by 100 to get number of beats
DIV CX
SHL AX,1 ; times 2 because two clocks/beat
XCHG AX,CX ; count of clock cycles to CX
;
; Loop through clock cycles
;
NOT3: CALL RCTR ; read initial count
;
; Loop to wait for clock count to get reset. The count goes from the
; value we set down to 0, and then is reset back to the set value
;
NOT4: MOV DX,AX ; save previous count in DX
CALL RCTR ; read count again
CMP AX,DX ; compare new count : old count
JB NOT4 ; loop if new count is lower
LOOP NOT3 ; else reset, count down cycles
;
; Wait is complete, so turn off clock and return
;
IN AL,CTRL ; read current contents of port
AND AL,0FFH-TIMR-SPKR ; reset timer/speaker control bits
OUT CTRL,AL ; rewrite control port
POP SI ; restore registers
POP DX
POP CX
POP BX
POP AX
RET ; return to caller
NOTE ENDP
;
; Routine to read count, returns current timer 2 count in AX
;
RCTR PROC
MOV AL,LATCH ; latch the counter
OUT TCTL,AL ; latch counter
IN AL,TCTR ; read lsb of count
MOV AH,AL
IN AL,TCTR ; read msb of count
XCHG AH,AL ; count is in AX
RET ; return to caller
RCTR ENDP
;---------------------------------------------------------------------------------------------------
;END OF DEWAR CODE
;End of code taken from Dewar game
;---------------------------------------------------------------------------------------------------
start:
;---------------------------------------------------------------------------------------------------
;Menu code
;Code for pre-game menu
;---------------------------------------------------------------------------------------------------
menu: call menuinit ;Initialize menu
;---------------------------------------------------------------------------------------------------
;INITIALIZE CODE
;Pre-game loop code.
;---------------------------------------------------------------------------------------------------
init: call videoinit ;Initialize video
call mouseinit ;Initialize mouse
call resetgame ;Reset game data
call clearscn ;Clear the screen
jmp game ;Skip first get input call/draw enemies call
;---------------------------------------------------------------------------------------------------
;GAME LOOP
;The main loop that is run through, throughout the game.
;---------------------------------------------------------------------------------------------------
;GAME LOOP CODE HERE
game: mov ah, 1 ;Check if key press
int 16h
jz game3 ;No key pressed so do loop
mov ah, 0 ;Otherwise, get pressed key
int 16h
cmp ah, KBD_ESC ;If key is escape go to menu
jne game5
call menuinit
game5: cmp al, 'p' ;If key is 'p', pause game
jne game3
mov cx, MouseX
mov dx, MouseY
game6: mov ah, 0 ;Get key while paused
int 16h
cmp al, 'p' ;If key is 'p', unpause
jne game6 ;Otherwise, getkey loop
mov ax, 4 ;Unpaused, reset mouse to wear start of pause loc
int 33h
game3: call clearscn ;Clear the screen
call addenemies ;Add enemies
call getinput ;Get input
call moveplayer ;Move the player
call moveenemies ;Move the enemies
call enemyshoot ;Enemies will try and shoot
cmp LeftButton, 1 ;See if left button is pressed
jne game2 ;It's not so do nothing
call playershoot ;Otherwise, shoot
game2: call draweshot ;Draw enemies' lasers
call drawpshot ;Draw player's lasers
call incpshot ;Increment player's lasers
call inceshot ;Increment enemies' lasers
call drawenemies ;Draw the enemies
call drawplayer ;Draw the player on the screen
call dispscore ;Display the score
call displives ;Display number of lives
call delay ;Delay
cmp GameOver, 0 ;Check if game is over
je game4 ;Not game over, continue
mov ax, offset gameoverstr
mov bh, 0
mov bl, WHITE_MASK
mov dh, 11
mov dl, 2
call writeasciiz ;Right game over string
mov ax, 0
int 16h ;Before returning to menu, have player press key
call menuinit ;Otherwise, exit game
game4: cmp PlayerStat, CHAR_EXP ;Check if player has exploded
jne game7 ;Not exploded, so loop
call resetplayer ;Reset the player
game7: jmp game ;Loop
end |
ls.asm | adrianna157/CS444-Lab5-Mutexes | 0 | 15605 |
_ls: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
close(fd);
}
int
main(int argc, char *argv[])
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 57 push %edi
4: 56 push %esi
5: 53 push %ebx
#ifdef LS_IS_MORE
printf(1, "%s\t\t%s\t%s\t%s\t%s\n",
"name", "type", "# lks", "ino #", "size"
);
#endif // LS_IS_MORE
if(argc < 2){
6: bb 01 00 00 00 mov $0x1,%ebx
{
b: 83 e4 f0 and $0xfffffff0,%esp
e: 83 ec 20 sub $0x20,%esp
11: 8b 75 08 mov 0x8(%ebp),%esi
printf(1, "%s\t\t%s\t%s\t%s\t%s\n",
14: c7 44 24 18 04 0e 00 movl $0xe04,0x18(%esp)
1b: 00
{
1c: 8b 7d 0c mov 0xc(%ebp),%edi
printf(1, "%s\t\t%s\t%s\t%s\t%s\n",
1f: c7 44 24 14 09 0e 00 movl $0xe09,0x14(%esp)
26: 00
27: c7 44 24 10 0f 0e 00 movl $0xe0f,0x10(%esp)
2e: 00
2f: c7 44 24 0c 15 0e 00 movl $0xe15,0xc(%esp)
36: 00
37: c7 44 24 08 1a 0e 00 movl $0xe1a,0x8(%esp)
3e: 00
3f: c7 44 24 04 1f 0e 00 movl $0xe1f,0x4(%esp)
46: 00
47: c7 04 24 01 00 00 00 movl $0x1,(%esp)
4e: e8 5d 07 00 00 call 7b0 <printf>
if(argc < 2){
53: 83 fe 01 cmp $0x1,%esi
56: 7e 17 jle 6f <main+0x6f>
ls(".");
exit();
}
for(i=1; i<argc; i++)
ls(argv[i]);
58: 8b 04 9f mov (%edi,%ebx,4),%eax
for(i=1; i<argc; i++)
5b: 83 c3 01 add $0x1,%ebx
ls(argv[i]);
5e: 89 04 24 mov %eax,(%esp)
61: e8 da 00 00 00 call 140 <ls>
for(i=1; i<argc; i++)
66: 39 f3 cmp %esi,%ebx
68: 75 ee jne 58 <main+0x58>
exit();
6a: e8 93 05 00 00 call 602 <exit>
ls(".");
6f: c7 04 24 30 0e 00 00 movl $0xe30,(%esp)
76: e8 c5 00 00 00 call 140 <ls>
exit();
7b: e8 82 05 00 00 call 602 <exit>
00000080 <filetype>:
{
80: 55 push %ebp
switch (sttype) {
81: b8 3f 00 00 00 mov $0x3f,%eax
{
86: 89 e5 mov %esp,%ebp
88: 8b 55 08 mov 0x8(%ebp),%edx
8b: 8d 4a ff lea -0x1(%edx),%ecx
8e: 83 f9 02 cmp $0x2,%ecx
91: 77 07 ja 9a <filetype+0x1a>
93: 0f b6 82 31 0e 00 00 movzbl 0xe31(%edx),%eax
}
9a: 5d pop %ebp
9b: c3 ret
9c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
000000a0 <fmtname>:
{
a0: 55 push %ebp
a1: 89 e5 mov %esp,%ebp
a3: 56 push %esi
a4: 53 push %ebx
a5: 83 ec 10 sub $0x10,%esp
a8: 8b 5d 08 mov 0x8(%ebp),%ebx
for(p=path+strlen(path); p >= path && *p != '/'; p--)
ab: 89 1c 24 mov %ebx,(%esp)
ae: e8 ad 03 00 00 call 460 <strlen>
b3: 01 d8 add %ebx,%eax
b5: 73 10 jae c7 <fmtname+0x27>
b7: eb 13 jmp cc <fmtname+0x2c>
b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
c0: 83 e8 01 sub $0x1,%eax
c3: 39 c3 cmp %eax,%ebx
c5: 77 05 ja cc <fmtname+0x2c>
c7: 80 38 2f cmpb $0x2f,(%eax)
ca: 75 f4 jne c0 <fmtname+0x20>
p++;
cc: 8d 58 01 lea 0x1(%eax),%ebx
if(strlen(p) >= DIRSIZ)
cf: 89 1c 24 mov %ebx,(%esp)
d2: e8 89 03 00 00 call 460 <strlen>
d7: 83 f8 0d cmp $0xd,%eax
da: 77 53 ja 12f <fmtname+0x8f>
memmove(buf, p, strlen(p));
dc: 89 1c 24 mov %ebx,(%esp)
df: e8 7c 03 00 00 call 460 <strlen>
e4: 89 5c 24 04 mov %ebx,0x4(%esp)
e8: c7 04 24 50 13 00 00 movl $0x1350,(%esp)
ef: 89 44 24 08 mov %eax,0x8(%esp)
f3: e8 d8 04 00 00 call 5d0 <memmove>
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
f8: 89 1c 24 mov %ebx,(%esp)
fb: e8 60 03 00 00 call 460 <strlen>
100: 89 1c 24 mov %ebx,(%esp)
return buf;
103: bb 50 13 00 00 mov $0x1350,%ebx
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
108: 89 c6 mov %eax,%esi
10a: e8 51 03 00 00 call 460 <strlen>
10f: ba 0e 00 00 00 mov $0xe,%edx
114: 29 f2 sub %esi,%edx
116: 89 54 24 08 mov %edx,0x8(%esp)
11a: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp)
121: 00
122: 05 50 13 00 00 add $0x1350,%eax
127: 89 04 24 mov %eax,(%esp)
12a: e8 61 03 00 00 call 490 <memset>
}
12f: 83 c4 10 add $0x10,%esp
132: 89 d8 mov %ebx,%eax
134: 5b pop %ebx
135: 5e pop %esi
136: 5d pop %ebp
137: c3 ret
138: 90 nop
139: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000140 <ls>:
{
140: 55 push %ebp
141: 89 e5 mov %esp,%ebp
143: 57 push %edi
144: 56 push %esi
145: 53 push %ebx
146: 81 ec 7c 02 00 00 sub $0x27c,%esp
14c: 8b 75 08 mov 0x8(%ebp),%esi
if((fd = open(path, 0)) < 0){
14f: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
156: 00
157: 89 34 24 mov %esi,(%esp)
15a: e8 e3 04 00 00 call 642 <open>
15f: 85 c0 test %eax,%eax
161: 89 c3 mov %eax,%ebx
163: 0f 88 e7 01 00 00 js 350 <ls+0x210>
if(fstat(fd, &st) < 0){
169: 8d bd d4 fd ff ff lea -0x22c(%ebp),%edi
16f: 89 7c 24 04 mov %edi,0x4(%esp)
173: 89 04 24 mov %eax,(%esp)
176: e8 df 04 00 00 call 65a <fstat>
17b: 85 c0 test %eax,%eax
17d: 0f 88 15 02 00 00 js 398 <ls+0x258>
switch(st.type){
183: 0f b7 85 d4 fd ff ff movzwl -0x22c(%ebp),%eax
18a: 66 83 f8 01 cmp $0x1,%ax
18e: 74 78 je 208 <ls+0xc8>
190: 66 83 f8 02 cmp $0x2,%ax
194: 75 5f jne 1f5 <ls+0xb5>
printf(1, "%s\t%c\t%d\t%d\t%d\n"
196: 8b 8d e4 fd ff ff mov -0x21c(%ebp),%ecx
19c: 8b 95 dc fd ff ff mov -0x224(%ebp),%edx
1a2: 89 34 24 mov %esi,(%esp)
1a5: 0f bf bd e0 fd ff ff movswl -0x220(%ebp),%edi
1ac: 89 8d b0 fd ff ff mov %ecx,-0x250(%ebp)
1b2: 89 95 b4 fd ff ff mov %edx,-0x24c(%ebp)
1b8: e8 e3 fe ff ff call a0 <fmtname>
1bd: 8b 8d b0 fd ff ff mov -0x250(%ebp),%ecx
1c3: 8b 95 b4 fd ff ff mov -0x24c(%ebp),%edx
1c9: 89 7c 24 10 mov %edi,0x10(%esp)
1cd: c7 44 24 0c 66 00 00 movl $0x66,0xc(%esp)
1d4: 00
1d5: 89 4c 24 18 mov %ecx,0x18(%esp)
1d9: 89 54 24 14 mov %edx,0x14(%esp)
1dd: 89 44 24 08 mov %eax,0x8(%esp)
1e1: c7 44 24 04 e1 0d 00 movl $0xde1,0x4(%esp)
1e8: 00
1e9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1f0: e8 bb 05 00 00 call 7b0 <printf>
close(fd);
1f5: 89 1c 24 mov %ebx,(%esp)
1f8: e8 2d 04 00 00 call 62a <close>
}
1fd: 81 c4 7c 02 00 00 add $0x27c,%esp
203: 5b pop %ebx
204: 5e pop %esi
205: 5f pop %edi
206: 5d pop %ebp
207: c3 ret
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
208: 89 34 24 mov %esi,(%esp)
20b: e8 50 02 00 00 call 460 <strlen>
210: 83 c0 10 add $0x10,%eax
213: 3d 00 02 00 00 cmp $0x200,%eax
218: 0f 87 5a 01 00 00 ja 378 <ls+0x238>
strcpy(buf, path);
21e: 89 74 24 04 mov %esi,0x4(%esp)
222: 8d b5 e8 fd ff ff lea -0x218(%ebp),%esi
228: 89 34 24 mov %esi,(%esp)
22b: e8 b0 01 00 00 call 3e0 <strcpy>
p = buf+strlen(buf);
230: 89 34 24 mov %esi,(%esp)
233: e8 28 02 00 00 call 460 <strlen>
238: 01 f0 add %esi,%eax
*p++ = '/';
23a: 8d 48 01 lea 0x1(%eax),%ecx
p = buf+strlen(buf);
23d: 89 85 a4 fd ff ff mov %eax,-0x25c(%ebp)
*p++ = '/';
243: 89 8d a0 fd ff ff mov %ecx,-0x260(%ebp)
249: c6 00 2f movb $0x2f,(%eax)
24c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
while(read(fd, &de, sizeof(de)) == sizeof(de)){
250: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax
256: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
25d: 00
25e: 89 44 24 04 mov %eax,0x4(%esp)
262: 89 1c 24 mov %ebx,(%esp)
265: e8 b0 03 00 00 call 61a <read>
26a: 83 f8 10 cmp $0x10,%eax
26d: 75 86 jne 1f5 <ls+0xb5>
if(de.inum == 0)
26f: 66 83 bd c4 fd ff ff cmpw $0x0,-0x23c(%ebp)
276: 00
277: 74 d7 je 250 <ls+0x110>
memmove(p, de.name, DIRSIZ);
279: 8d 85 c6 fd ff ff lea -0x23a(%ebp),%eax
27f: 89 44 24 04 mov %eax,0x4(%esp)
283: 8b 85 a0 fd ff ff mov -0x260(%ebp),%eax
289: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
290: 00
291: 89 04 24 mov %eax,(%esp)
294: e8 37 03 00 00 call 5d0 <memmove>
p[DIRSIZ] = 0;
299: 8b 85 a4 fd ff ff mov -0x25c(%ebp),%eax
29f: c6 40 0f 00 movb $0x0,0xf(%eax)
if(stat(buf, &st) < 0){
2a3: 89 7c 24 04 mov %edi,0x4(%esp)
2a7: 89 34 24 mov %esi,(%esp)
2aa: e8 a1 02 00 00 call 550 <stat>
2af: 85 c0 test %eax,%eax
2b1: 0f 88 09 01 00 00 js 3c0 <ls+0x280>
printf(1, "%s\t%c\t%d\t%d\t%d\n", fmtname(buf), filetype(st.type), st.nlink, st.ino, st.size);
2b7: 8b 85 dc fd ff ff mov -0x224(%ebp),%eax
switch (sttype) {
2bd: ba 3f 00 00 00 mov $0x3f,%edx
printf(1, "%s\t%c\t%d\t%d\t%d\n", fmtname(buf), filetype(st.type), st.nlink, st.ino, st.size);
2c2: 8b 8d e4 fd ff ff mov -0x21c(%ebp),%ecx
2c8: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp)
2ce: 0f bf 85 e0 fd ff ff movswl -0x220(%ebp),%eax
2d5: 89 85 b0 fd ff ff mov %eax,-0x250(%ebp)
switch (sttype) {
2db: 0f bf 85 d4 fd ff ff movswl -0x22c(%ebp),%eax
2e2: 83 e8 01 sub $0x1,%eax
2e5: 83 f8 02 cmp $0x2,%eax
2e8: 77 07 ja 2f1 <ls+0x1b1>
2ea: 0f be 90 32 0e 00 00 movsbl 0xe32(%eax),%edx
printf(1, "%s\t%c\t%d\t%d\t%d\n", fmtname(buf), filetype(st.type), st.nlink, st.ino, st.size);
2f1: 89 34 24 mov %esi,(%esp)
2f4: 89 8d a8 fd ff ff mov %ecx,-0x258(%ebp)
2fa: 89 95 ac fd ff ff mov %edx,-0x254(%ebp)
300: e8 9b fd ff ff call a0 <fmtname>
305: 8b 8d a8 fd ff ff mov -0x258(%ebp),%ecx
30b: 8b 95 b0 fd ff ff mov -0x250(%ebp),%edx
311: c7 44 24 04 e1 0d 00 movl $0xde1,0x4(%esp)
318: 00
319: c7 04 24 01 00 00 00 movl $0x1,(%esp)
320: 89 4c 24 18 mov %ecx,0x18(%esp)
324: 8b 8d b4 fd ff ff mov -0x24c(%ebp),%ecx
32a: 89 54 24 10 mov %edx,0x10(%esp)
32e: 8b 95 ac fd ff ff mov -0x254(%ebp),%edx
334: 89 44 24 08 mov %eax,0x8(%esp)
338: 89 4c 24 14 mov %ecx,0x14(%esp)
33c: 89 54 24 0c mov %edx,0xc(%esp)
340: e8 6b 04 00 00 call 7b0 <printf>
345: e9 06 ff ff ff jmp 250 <ls+0x110>
34a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(2, "ls: cannot open %s\n", path);
350: 89 74 24 08 mov %esi,0x8(%esp)
354: c7 44 24 04 b9 0d 00 movl $0xdb9,0x4(%esp)
35b: 00
35c: c7 04 24 02 00 00 00 movl $0x2,(%esp)
363: e8 48 04 00 00 call 7b0 <printf>
}
368: 81 c4 7c 02 00 00 add $0x27c,%esp
36e: 5b pop %ebx
36f: 5e pop %esi
370: 5f pop %edi
371: 5d pop %ebp
372: c3 ret
373: 90 nop
374: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(1, "ls: path too long\n");
378: c7 44 24 04 f1 0d 00 movl $0xdf1,0x4(%esp)
37f: 00
380: c7 04 24 01 00 00 00 movl $0x1,(%esp)
387: e8 24 04 00 00 call 7b0 <printf>
break;
38c: e9 64 fe ff ff jmp 1f5 <ls+0xb5>
391: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
printf(2, "ls: cannot stat %s\n", path);
398: 89 74 24 08 mov %esi,0x8(%esp)
39c: c7 44 24 04 cd 0d 00 movl $0xdcd,0x4(%esp)
3a3: 00
3a4: c7 04 24 02 00 00 00 movl $0x2,(%esp)
3ab: e8 00 04 00 00 call 7b0 <printf>
close(fd);
3b0: 89 1c 24 mov %ebx,(%esp)
3b3: e8 72 02 00 00 call 62a <close>
return;
3b8: e9 40 fe ff ff jmp 1fd <ls+0xbd>
3bd: 8d 76 00 lea 0x0(%esi),%esi
printf(1, "ls: cannot stat %s\n", buf);
3c0: 89 74 24 08 mov %esi,0x8(%esp)
3c4: c7 44 24 04 cd 0d 00 movl $0xdcd,0x4(%esp)
3cb: 00
3cc: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3d3: e8 d8 03 00 00 call 7b0 <printf>
continue;
3d8: e9 73 fe ff ff jmp 250 <ls+0x110>
3dd: 66 90 xchg %ax,%ax
3df: 90 nop
000003e0 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, const char *t)
{
3e0: 55 push %ebp
3e1: 89 e5 mov %esp,%ebp
3e3: 8b 45 08 mov 0x8(%ebp),%eax
3e6: 8b 4d 0c mov 0xc(%ebp),%ecx
3e9: 53 push %ebx
char *os;
os = s;
while((*s++ = *t++) != 0)
3ea: 89 c2 mov %eax,%edx
3ec: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3f0: 83 c1 01 add $0x1,%ecx
3f3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
3f7: 83 c2 01 add $0x1,%edx
3fa: 84 db test %bl,%bl
3fc: 88 5a ff mov %bl,-0x1(%edx)
3ff: 75 ef jne 3f0 <strcpy+0x10>
;
return os;
}
401: 5b pop %ebx
402: 5d pop %ebp
403: c3 ret
404: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
40a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000410 <strcmp>:
int
strcmp(const char *p, const char *q)
{
410: 55 push %ebp
411: 89 e5 mov %esp,%ebp
413: 8b 55 08 mov 0x8(%ebp),%edx
416: 53 push %ebx
417: 8b 4d 0c mov 0xc(%ebp),%ecx
while(*p && *p == *q)
41a: 0f b6 02 movzbl (%edx),%eax
41d: 84 c0 test %al,%al
41f: 74 2d je 44e <strcmp+0x3e>
421: 0f b6 19 movzbl (%ecx),%ebx
424: 38 d8 cmp %bl,%al
426: 74 0e je 436 <strcmp+0x26>
428: eb 2b jmp 455 <strcmp+0x45>
42a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
430: 38 c8 cmp %cl,%al
432: 75 15 jne 449 <strcmp+0x39>
p++, q++;
434: 89 d9 mov %ebx,%ecx
436: 83 c2 01 add $0x1,%edx
while(*p && *p == *q)
439: 0f b6 02 movzbl (%edx),%eax
p++, q++;
43c: 8d 59 01 lea 0x1(%ecx),%ebx
while(*p && *p == *q)
43f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx
443: 84 c0 test %al,%al
445: 75 e9 jne 430 <strcmp+0x20>
447: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
449: 29 c8 sub %ecx,%eax
}
44b: 5b pop %ebx
44c: 5d pop %ebp
44d: c3 ret
44e: 0f b6 09 movzbl (%ecx),%ecx
while(*p && *p == *q)
451: 31 c0 xor %eax,%eax
453: eb f4 jmp 449 <strcmp+0x39>
455: 0f b6 cb movzbl %bl,%ecx
458: eb ef jmp 449 <strcmp+0x39>
45a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000460 <strlen>:
uint
strlen(const char *s)
{
460: 55 push %ebp
461: 89 e5 mov %esp,%ebp
463: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
466: 80 39 00 cmpb $0x0,(%ecx)
469: 74 12 je 47d <strlen+0x1d>
46b: 31 d2 xor %edx,%edx
46d: 8d 76 00 lea 0x0(%esi),%esi
470: 83 c2 01 add $0x1,%edx
473: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
477: 89 d0 mov %edx,%eax
479: 75 f5 jne 470 <strlen+0x10>
;
return n;
}
47b: 5d pop %ebp
47c: c3 ret
for(n = 0; s[n]; n++)
47d: 31 c0 xor %eax,%eax
}
47f: 5d pop %ebp
480: c3 ret
481: eb 0d jmp 490 <memset>
483: 90 nop
484: 90 nop
485: 90 nop
486: 90 nop
487: 90 nop
488: 90 nop
489: 90 nop
48a: 90 nop
48b: 90 nop
48c: 90 nop
48d: 90 nop
48e: 90 nop
48f: 90 nop
00000490 <memset>:
void*
memset(void *dst, int c, uint n)
{
490: 55 push %ebp
491: 89 e5 mov %esp,%ebp
493: 8b 55 08 mov 0x8(%ebp),%edx
496: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
497: 8b 4d 10 mov 0x10(%ebp),%ecx
49a: 8b 45 0c mov 0xc(%ebp),%eax
49d: 89 d7 mov %edx,%edi
49f: fc cld
4a0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
4a2: 89 d0 mov %edx,%eax
4a4: 5f pop %edi
4a5: 5d pop %ebp
4a6: c3 ret
4a7: 89 f6 mov %esi,%esi
4a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000004b0 <strchr>:
char*
strchr(const char *s, char c)
{
4b0: 55 push %ebp
4b1: 89 e5 mov %esp,%ebp
4b3: 8b 45 08 mov 0x8(%ebp),%eax
4b6: 53 push %ebx
4b7: 8b 55 0c mov 0xc(%ebp),%edx
for(; *s; s++)
4ba: 0f b6 18 movzbl (%eax),%ebx
4bd: 84 db test %bl,%bl
4bf: 74 1d je 4de <strchr+0x2e>
if(*s == c)
4c1: 38 d3 cmp %dl,%bl
4c3: 89 d1 mov %edx,%ecx
4c5: 75 0d jne 4d4 <strchr+0x24>
4c7: eb 17 jmp 4e0 <strchr+0x30>
4c9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
4d0: 38 ca cmp %cl,%dl
4d2: 74 0c je 4e0 <strchr+0x30>
for(; *s; s++)
4d4: 83 c0 01 add $0x1,%eax
4d7: 0f b6 10 movzbl (%eax),%edx
4da: 84 d2 test %dl,%dl
4dc: 75 f2 jne 4d0 <strchr+0x20>
return (char*)s;
return 0;
4de: 31 c0 xor %eax,%eax
}
4e0: 5b pop %ebx
4e1: 5d pop %ebp
4e2: c3 ret
4e3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
4e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000004f0 <gets>:
char*
gets(char *buf, int max)
{
4f0: 55 push %ebp
4f1: 89 e5 mov %esp,%ebp
4f3: 57 push %edi
4f4: 56 push %esi
int i, cc;
char c;
for(i=0; i+1 < max; ){
4f5: 31 f6 xor %esi,%esi
{
4f7: 53 push %ebx
4f8: 83 ec 2c sub $0x2c,%esp
cc = read(0, &c, 1);
4fb: 8d 7d e7 lea -0x19(%ebp),%edi
for(i=0; i+1 < max; ){
4fe: eb 31 jmp 531 <gets+0x41>
cc = read(0, &c, 1);
500: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
507: 00
508: 89 7c 24 04 mov %edi,0x4(%esp)
50c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
513: e8 02 01 00 00 call 61a <read>
if(cc < 1)
518: 85 c0 test %eax,%eax
51a: 7e 1d jle 539 <gets+0x49>
break;
buf[i++] = c;
51c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
for(i=0; i+1 < max; ){
520: 89 de mov %ebx,%esi
buf[i++] = c;
522: 8b 55 08 mov 0x8(%ebp),%edx
if(c == '\n' || c == '\r')
525: 3c 0d cmp $0xd,%al
buf[i++] = c;
527: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
if(c == '\n' || c == '\r')
52b: 74 0c je 539 <gets+0x49>
52d: 3c 0a cmp $0xa,%al
52f: 74 08 je 539 <gets+0x49>
for(i=0; i+1 < max; ){
531: 8d 5e 01 lea 0x1(%esi),%ebx
534: 3b 5d 0c cmp 0xc(%ebp),%ebx
537: 7c c7 jl 500 <gets+0x10>
break;
}
buf[i] = '\0';
539: 8b 45 08 mov 0x8(%ebp),%eax
53c: c6 04 30 00 movb $0x0,(%eax,%esi,1)
return buf;
}
540: 83 c4 2c add $0x2c,%esp
543: 5b pop %ebx
544: 5e pop %esi
545: 5f pop %edi
546: 5d pop %ebp
547: c3 ret
548: 90 nop
549: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000550 <stat>:
int
stat(const char *n, struct stat *st)
{
550: 55 push %ebp
551: 89 e5 mov %esp,%ebp
553: 56 push %esi
554: 53 push %ebx
555: 83 ec 10 sub $0x10,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
558: 8b 45 08 mov 0x8(%ebp),%eax
55b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
562: 00
563: 89 04 24 mov %eax,(%esp)
566: e8 d7 00 00 00 call 642 <open>
if(fd < 0)
56b: 85 c0 test %eax,%eax
fd = open(n, O_RDONLY);
56d: 89 c3 mov %eax,%ebx
if(fd < 0)
56f: 78 27 js 598 <stat+0x48>
return -1;
r = fstat(fd, st);
571: 8b 45 0c mov 0xc(%ebp),%eax
574: 89 1c 24 mov %ebx,(%esp)
577: 89 44 24 04 mov %eax,0x4(%esp)
57b: e8 da 00 00 00 call 65a <fstat>
close(fd);
580: 89 1c 24 mov %ebx,(%esp)
r = fstat(fd, st);
583: 89 c6 mov %eax,%esi
close(fd);
585: e8 a0 00 00 00 call 62a <close>
return r;
58a: 89 f0 mov %esi,%eax
}
58c: 83 c4 10 add $0x10,%esp
58f: 5b pop %ebx
590: 5e pop %esi
591: 5d pop %ebp
592: c3 ret
593: 90 nop
594: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return -1;
598: b8 ff ff ff ff mov $0xffffffff,%eax
59d: eb ed jmp 58c <stat+0x3c>
59f: 90 nop
000005a0 <atoi>:
int
atoi(const char *s)
{
5a0: 55 push %ebp
5a1: 89 e5 mov %esp,%ebp
5a3: 8b 4d 08 mov 0x8(%ebp),%ecx
5a6: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
5a7: 0f be 11 movsbl (%ecx),%edx
5aa: 8d 42 d0 lea -0x30(%edx),%eax
5ad: 3c 09 cmp $0x9,%al
n = 0;
5af: b8 00 00 00 00 mov $0x0,%eax
while('0' <= *s && *s <= '9')
5b4: 77 17 ja 5cd <atoi+0x2d>
5b6: 66 90 xchg %ax,%ax
n = n*10 + *s++ - '0';
5b8: 83 c1 01 add $0x1,%ecx
5bb: 8d 04 80 lea (%eax,%eax,4),%eax
5be: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
while('0' <= *s && *s <= '9')
5c2: 0f be 11 movsbl (%ecx),%edx
5c5: 8d 5a d0 lea -0x30(%edx),%ebx
5c8: 80 fb 09 cmp $0x9,%bl
5cb: 76 eb jbe 5b8 <atoi+0x18>
return n;
}
5cd: 5b pop %ebx
5ce: 5d pop %ebp
5cf: c3 ret
000005d0 <memmove>:
void*
memmove(void *vdst, const void *vsrc, int n)
{
5d0: 55 push %ebp
char *dst;
const char *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
5d1: 31 d2 xor %edx,%edx
{
5d3: 89 e5 mov %esp,%ebp
5d5: 56 push %esi
5d6: 8b 45 08 mov 0x8(%ebp),%eax
5d9: 53 push %ebx
5da: 8b 5d 10 mov 0x10(%ebp),%ebx
5dd: 8b 75 0c mov 0xc(%ebp),%esi
while(n-- > 0)
5e0: 85 db test %ebx,%ebx
5e2: 7e 12 jle 5f6 <memmove+0x26>
5e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
*dst++ = *src++;
5e8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
5ec: 88 0c 10 mov %cl,(%eax,%edx,1)
5ef: 83 c2 01 add $0x1,%edx
while(n-- > 0)
5f2: 39 da cmp %ebx,%edx
5f4: 75 f2 jne 5e8 <memmove+0x18>
return vdst;
}
5f6: 5b pop %ebx
5f7: 5e pop %esi
5f8: 5d pop %ebp
5f9: c3 ret
000005fa <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
5fa: b8 01 00 00 00 mov $0x1,%eax
5ff: cd 40 int $0x40
601: c3 ret
00000602 <exit>:
SYSCALL(exit)
602: b8 02 00 00 00 mov $0x2,%eax
607: cd 40 int $0x40
609: c3 ret
0000060a <wait>:
SYSCALL(wait)
60a: b8 03 00 00 00 mov $0x3,%eax
60f: cd 40 int $0x40
611: c3 ret
00000612 <pipe>:
SYSCALL(pipe)
612: b8 04 00 00 00 mov $0x4,%eax
617: cd 40 int $0x40
619: c3 ret
0000061a <read>:
SYSCALL(read)
61a: b8 05 00 00 00 mov $0x5,%eax
61f: cd 40 int $0x40
621: c3 ret
00000622 <write>:
SYSCALL(write)
622: b8 10 00 00 00 mov $0x10,%eax
627: cd 40 int $0x40
629: c3 ret
0000062a <close>:
SYSCALL(close)
62a: b8 15 00 00 00 mov $0x15,%eax
62f: cd 40 int $0x40
631: c3 ret
00000632 <kill>:
SYSCALL(kill)
632: b8 06 00 00 00 mov $0x6,%eax
637: cd 40 int $0x40
639: c3 ret
0000063a <exec>:
SYSCALL(exec)
63a: b8 07 00 00 00 mov $0x7,%eax
63f: cd 40 int $0x40
641: c3 ret
00000642 <open>:
SYSCALL(open)
642: b8 0f 00 00 00 mov $0xf,%eax
647: cd 40 int $0x40
649: c3 ret
0000064a <mknod>:
SYSCALL(mknod)
64a: b8 11 00 00 00 mov $0x11,%eax
64f: cd 40 int $0x40
651: c3 ret
00000652 <unlink>:
SYSCALL(unlink)
652: b8 12 00 00 00 mov $0x12,%eax
657: cd 40 int $0x40
659: c3 ret
0000065a <fstat>:
SYSCALL(fstat)
65a: b8 08 00 00 00 mov $0x8,%eax
65f: cd 40 int $0x40
661: c3 ret
00000662 <link>:
SYSCALL(link)
662: b8 13 00 00 00 mov $0x13,%eax
667: cd 40 int $0x40
669: c3 ret
0000066a <mkdir>:
SYSCALL(mkdir)
66a: b8 14 00 00 00 mov $0x14,%eax
66f: cd 40 int $0x40
671: c3 ret
00000672 <chdir>:
SYSCALL(chdir)
672: b8 09 00 00 00 mov $0x9,%eax
677: cd 40 int $0x40
679: c3 ret
0000067a <dup>:
SYSCALL(dup)
67a: b8 0a 00 00 00 mov $0xa,%eax
67f: cd 40 int $0x40
681: c3 ret
00000682 <getpid>:
SYSCALL(getpid)
682: b8 0b 00 00 00 mov $0xb,%eax
687: cd 40 int $0x40
689: c3 ret
0000068a <sbrk>:
SYSCALL(sbrk)
68a: b8 0c 00 00 00 mov $0xc,%eax
68f: cd 40 int $0x40
691: c3 ret
00000692 <sleep>:
SYSCALL(sleep)
692: b8 0d 00 00 00 mov $0xd,%eax
697: cd 40 int $0x40
699: c3 ret
0000069a <uptime>:
SYSCALL(uptime)
69a: b8 0e 00 00 00 mov $0xe,%eax
69f: cd 40 int $0x40
6a1: c3 ret
000006a2 <getppid>:
#ifdef GETPPID
SYSCALL(getppid)
6a2: b8 16 00 00 00 mov $0x16,%eax
6a7: cd 40 int $0x40
6a9: c3 ret
000006aa <cps>:
#endif // GETPPID
#ifdef CPS
SYSCALL(cps)
6aa: b8 17 00 00 00 mov $0x17,%eax
6af: cd 40 int $0x40
6b1: c3 ret
000006b2 <halt>:
#endif // CPS
#ifdef HALT
SYSCALL(halt)
6b2: b8 18 00 00 00 mov $0x18,%eax
6b7: cd 40 int $0x40
6b9: c3 ret
000006ba <kdebug>:
#endif // HALT
#ifdef KDEBUG
SYSCALL(kdebug)
6ba: b8 19 00 00 00 mov $0x19,%eax
6bf: cd 40 int $0x40
6c1: c3 ret
000006c2 <va2pa>:
#endif // KDEBUG
#ifdef VA2PA
SYSCALL(va2pa)
6c2: b8 1a 00 00 00 mov $0x1a,%eax
6c7: cd 40 int $0x40
6c9: c3 ret
000006ca <kthread_create>:
#endif // VA2PA
#ifdef KTHREADS
SYSCALL(kthread_create)
6ca: b8 1b 00 00 00 mov $0x1b,%eax
6cf: cd 40 int $0x40
6d1: c3 ret
000006d2 <kthread_join>:
SYSCALL(kthread_join)
6d2: b8 1c 00 00 00 mov $0x1c,%eax
6d7: cd 40 int $0x40
6d9: c3 ret
000006da <kthread_exit>:
SYSCALL(kthread_exit)
6da: b8 1d 00 00 00 mov $0x1d,%eax
6df: cd 40 int $0x40
6e1: c3 ret
000006e2 <kthread_self>:
#endif // KTHREADS
#ifdef BENNY_MOOTEX
SYSCALL(kthread_self)
6e2: b8 1e 00 00 00 mov $0x1e,%eax
6e7: cd 40 int $0x40
6e9: c3 ret
000006ea <kthread_yield>:
SYSCALL(kthread_yield)
6ea: b8 1f 00 00 00 mov $0x1f,%eax
6ef: cd 40 int $0x40
6f1: c3 ret
000006f2 <kthread_cpu_count>:
SYSCALL(kthread_cpu_count)
6f2: b8 20 00 00 00 mov $0x20,%eax
6f7: cd 40 int $0x40
6f9: c3 ret
000006fa <kthread_thread_count>:
SYSCALL(kthread_thread_count)
6fa: b8 21 00 00 00 mov $0x21,%eax
6ff: cd 40 int $0x40
701: c3 ret
702: 66 90 xchg %ax,%ax
704: 66 90 xchg %ax,%ax
706: 66 90 xchg %ax,%ax
708: 66 90 xchg %ax,%ax
70a: 66 90 xchg %ax,%ax
70c: 66 90 xchg %ax,%ax
70e: 66 90 xchg %ax,%ax
00000710 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
710: 55 push %ebp
711: 89 e5 mov %esp,%ebp
713: 57 push %edi
714: 56 push %esi
715: 89 c6 mov %eax,%esi
717: 53 push %ebx
718: 83 ec 4c sub $0x4c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
71b: 8b 5d 08 mov 0x8(%ebp),%ebx
71e: 85 db test %ebx,%ebx
720: 74 09 je 72b <printint+0x1b>
722: 89 d0 mov %edx,%eax
724: c1 e8 1f shr $0x1f,%eax
727: 84 c0 test %al,%al
729: 75 75 jne 7a0 <printint+0x90>
neg = 1;
x = -xx;
} else {
x = xx;
72b: 89 d0 mov %edx,%eax
neg = 0;
72d: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
734: 89 75 c0 mov %esi,-0x40(%ebp)
}
i = 0;
737: 31 ff xor %edi,%edi
739: 89 ce mov %ecx,%esi
73b: 8d 5d d7 lea -0x29(%ebp),%ebx
73e: eb 02 jmp 742 <printint+0x32>
do{
buf[i++] = digits[x % base];
740: 89 cf mov %ecx,%edi
742: 31 d2 xor %edx,%edx
744: f7 f6 div %esi
746: 8d 4f 01 lea 0x1(%edi),%ecx
749: 0f b6 92 3c 0e 00 00 movzbl 0xe3c(%edx),%edx
}while((x /= base) != 0);
750: 85 c0 test %eax,%eax
buf[i++] = digits[x % base];
752: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
755: 75 e9 jne 740 <printint+0x30>
if(neg)
757: 8b 55 c4 mov -0x3c(%ebp),%edx
buf[i++] = digits[x % base];
75a: 89 c8 mov %ecx,%eax
75c: 8b 75 c0 mov -0x40(%ebp),%esi
if(neg)
75f: 85 d2 test %edx,%edx
761: 74 08 je 76b <printint+0x5b>
buf[i++] = '-';
763: 8d 4f 02 lea 0x2(%edi),%ecx
766: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1)
while(--i >= 0)
76b: 8d 79 ff lea -0x1(%ecx),%edi
76e: 66 90 xchg %ax,%ax
770: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax
775: 83 ef 01 sub $0x1,%edi
write(fd, &c, 1);
778: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
77f: 00
780: 89 5c 24 04 mov %ebx,0x4(%esp)
784: 89 34 24 mov %esi,(%esp)
787: 88 45 d7 mov %al,-0x29(%ebp)
78a: e8 93 fe ff ff call 622 <write>
while(--i >= 0)
78f: 83 ff ff cmp $0xffffffff,%edi
792: 75 dc jne 770 <printint+0x60>
putc(fd, buf[i]);
}
794: 83 c4 4c add $0x4c,%esp
797: 5b pop %ebx
798: 5e pop %esi
799: 5f pop %edi
79a: 5d pop %ebp
79b: c3 ret
79c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
x = -xx;
7a0: 89 d0 mov %edx,%eax
7a2: f7 d8 neg %eax
neg = 1;
7a4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
7ab: eb 87 jmp 734 <printint+0x24>
7ad: 8d 76 00 lea 0x0(%esi),%esi
000007b0 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, const char *fmt, ...)
{
7b0: 55 push %ebp
7b1: 89 e5 mov %esp,%ebp
7b3: 57 push %edi
char *s;
int c, i, state;
uint *ap;
state = 0;
7b4: 31 ff xor %edi,%edi
{
7b6: 56 push %esi
7b7: 53 push %ebx
7b8: 83 ec 3c sub $0x3c,%esp
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
7bb: 8b 5d 0c mov 0xc(%ebp),%ebx
ap = (uint*)(void*)&fmt + 1;
7be: 8d 45 10 lea 0x10(%ebp),%eax
{
7c1: 8b 75 08 mov 0x8(%ebp),%esi
ap = (uint*)(void*)&fmt + 1;
7c4: 89 45 d4 mov %eax,-0x2c(%ebp)
for(i = 0; fmt[i]; i++){
7c7: 0f b6 13 movzbl (%ebx),%edx
7ca: 83 c3 01 add $0x1,%ebx
7cd: 84 d2 test %dl,%dl
7cf: 75 39 jne 80a <printf+0x5a>
7d1: e9 ca 00 00 00 jmp 8a0 <printf+0xf0>
7d6: 66 90 xchg %ax,%ax
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
7d8: 83 fa 25 cmp $0x25,%edx
7db: 0f 84 c7 00 00 00 je 8a8 <printf+0xf8>
write(fd, &c, 1);
7e1: 8d 45 e0 lea -0x20(%ebp),%eax
7e4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
7eb: 00
7ec: 89 44 24 04 mov %eax,0x4(%esp)
7f0: 89 34 24 mov %esi,(%esp)
state = '%';
} else {
putc(fd, c);
7f3: 88 55 e0 mov %dl,-0x20(%ebp)
write(fd, &c, 1);
7f6: e8 27 fe ff ff call 622 <write>
7fb: 83 c3 01 add $0x1,%ebx
for(i = 0; fmt[i]; i++){
7fe: 0f b6 53 ff movzbl -0x1(%ebx),%edx
802: 84 d2 test %dl,%dl
804: 0f 84 96 00 00 00 je 8a0 <printf+0xf0>
if(state == 0){
80a: 85 ff test %edi,%edi
c = fmt[i] & 0xff;
80c: 0f be c2 movsbl %dl,%eax
if(state == 0){
80f: 74 c7 je 7d8 <printf+0x28>
}
} else if(state == '%'){
811: 83 ff 25 cmp $0x25,%edi
814: 75 e5 jne 7fb <printf+0x4b>
if(c == 'd' || c == 'u'){
816: 83 fa 75 cmp $0x75,%edx
819: 0f 84 99 00 00 00 je 8b8 <printf+0x108>
81f: 83 fa 64 cmp $0x64,%edx
822: 0f 84 90 00 00 00 je 8b8 <printf+0x108>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
828: 25 f7 00 00 00 and $0xf7,%eax
82d: 83 f8 70 cmp $0x70,%eax
830: 0f 84 aa 00 00 00 je 8e0 <printf+0x130>
putc(fd, '0');
putc(fd, 'x');
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
836: 83 fa 73 cmp $0x73,%edx
839: 0f 84 e9 00 00 00 je 928 <printf+0x178>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
83f: 83 fa 63 cmp $0x63,%edx
842: 0f 84 2b 01 00 00 je 973 <printf+0x1c3>
putc(fd, *ap);
ap++;
} else if(c == '%'){
848: 83 fa 25 cmp $0x25,%edx
84b: 0f 84 4f 01 00 00 je 9a0 <printf+0x1f0>
write(fd, &c, 1);
851: 8d 45 e6 lea -0x1a(%ebp),%eax
854: 83 c3 01 add $0x1,%ebx
857: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
85e: 00
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
85f: 31 ff xor %edi,%edi
write(fd, &c, 1);
861: 89 44 24 04 mov %eax,0x4(%esp)
865: 89 34 24 mov %esi,(%esp)
868: 89 55 d0 mov %edx,-0x30(%ebp)
86b: c6 45 e6 25 movb $0x25,-0x1a(%ebp)
86f: e8 ae fd ff ff call 622 <write>
putc(fd, c);
874: 8b 55 d0 mov -0x30(%ebp),%edx
write(fd, &c, 1);
877: 8d 45 e7 lea -0x19(%ebp),%eax
87a: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
881: 00
882: 89 44 24 04 mov %eax,0x4(%esp)
886: 89 34 24 mov %esi,(%esp)
putc(fd, c);
889: 88 55 e7 mov %dl,-0x19(%ebp)
write(fd, &c, 1);
88c: e8 91 fd ff ff call 622 <write>
for(i = 0; fmt[i]; i++){
891: 0f b6 53 ff movzbl -0x1(%ebx),%edx
895: 84 d2 test %dl,%dl
897: 0f 85 6d ff ff ff jne 80a <printf+0x5a>
89d: 8d 76 00 lea 0x0(%esi),%esi
}
}
}
8a0: 83 c4 3c add $0x3c,%esp
8a3: 5b pop %ebx
8a4: 5e pop %esi
8a5: 5f pop %edi
8a6: 5d pop %ebp
8a7: c3 ret
state = '%';
8a8: bf 25 00 00 00 mov $0x25,%edi
8ad: e9 49 ff ff ff jmp 7fb <printf+0x4b>
8b2: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printint(fd, *ap, 10, 1);
8b8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
8bf: b9 0a 00 00 00 mov $0xa,%ecx
printint(fd, *ap, 16, 0);
8c4: 8b 45 d4 mov -0x2c(%ebp),%eax
state = 0;
8c7: 31 ff xor %edi,%edi
printint(fd, *ap, 16, 0);
8c9: 8b 10 mov (%eax),%edx
8cb: 89 f0 mov %esi,%eax
8cd: e8 3e fe ff ff call 710 <printint>
ap++;
8d2: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
8d6: e9 20 ff ff ff jmp 7fb <printf+0x4b>
8db: 90 nop
8dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
write(fd, &c, 1);
8e0: 8d 45 e1 lea -0x1f(%ebp),%eax
8e3: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
8ea: 00
8eb: 89 44 24 04 mov %eax,0x4(%esp)
8ef: 89 34 24 mov %esi,(%esp)
8f2: c6 45 e1 30 movb $0x30,-0x1f(%ebp)
8f6: e8 27 fd ff ff call 622 <write>
8fb: 8d 45 e2 lea -0x1e(%ebp),%eax
8fe: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
905: 00
906: 89 44 24 04 mov %eax,0x4(%esp)
90a: 89 34 24 mov %esi,(%esp)
90d: c6 45 e2 78 movb $0x78,-0x1e(%ebp)
911: e8 0c fd ff ff call 622 <write>
printint(fd, *ap, 16, 0);
916: b9 10 00 00 00 mov $0x10,%ecx
91b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
922: eb a0 jmp 8c4 <printf+0x114>
924: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
s = (char*)*ap;
928: 8b 45 d4 mov -0x2c(%ebp),%eax
ap++;
92b: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
s = (char*)*ap;
92f: 8b 38 mov (%eax),%edi
s = "(null)";
931: b8 35 0e 00 00 mov $0xe35,%eax
936: 85 ff test %edi,%edi
938: 0f 44 f8 cmove %eax,%edi
while(*s != 0){
93b: 0f b6 07 movzbl (%edi),%eax
93e: 84 c0 test %al,%al
940: 74 2a je 96c <printf+0x1bc>
942: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
948: 88 45 e3 mov %al,-0x1d(%ebp)
write(fd, &c, 1);
94b: 8d 45 e3 lea -0x1d(%ebp),%eax
s++;
94e: 83 c7 01 add $0x1,%edi
write(fd, &c, 1);
951: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
958: 00
959: 89 44 24 04 mov %eax,0x4(%esp)
95d: 89 34 24 mov %esi,(%esp)
960: e8 bd fc ff ff call 622 <write>
while(*s != 0){
965: 0f b6 07 movzbl (%edi),%eax
968: 84 c0 test %al,%al
96a: 75 dc jne 948 <printf+0x198>
state = 0;
96c: 31 ff xor %edi,%edi
96e: e9 88 fe ff ff jmp 7fb <printf+0x4b>
putc(fd, *ap);
973: 8b 45 d4 mov -0x2c(%ebp),%eax
state = 0;
976: 31 ff xor %edi,%edi
putc(fd, *ap);
978: 8b 00 mov (%eax),%eax
write(fd, &c, 1);
97a: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
981: 00
982: 89 34 24 mov %esi,(%esp)
putc(fd, *ap);
985: 88 45 e4 mov %al,-0x1c(%ebp)
write(fd, &c, 1);
988: 8d 45 e4 lea -0x1c(%ebp),%eax
98b: 89 44 24 04 mov %eax,0x4(%esp)
98f: e8 8e fc ff ff call 622 <write>
ap++;
994: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
998: e9 5e fe ff ff jmp 7fb <printf+0x4b>
99d: 8d 76 00 lea 0x0(%esi),%esi
write(fd, &c, 1);
9a0: 8d 45 e5 lea -0x1b(%ebp),%eax
state = 0;
9a3: 31 ff xor %edi,%edi
write(fd, &c, 1);
9a5: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
9ac: 00
9ad: 89 44 24 04 mov %eax,0x4(%esp)
9b1: 89 34 24 mov %esi,(%esp)
9b4: c6 45 e5 25 movb $0x25,-0x1b(%ebp)
9b8: e8 65 fc ff ff call 622 <write>
9bd: e9 39 fe ff ff jmp 7fb <printf+0x4b>
9c2: 66 90 xchg %ax,%ax
9c4: 66 90 xchg %ax,%ax
9c6: 66 90 xchg %ax,%ax
9c8: 66 90 xchg %ax,%ax
9ca: 66 90 xchg %ax,%ax
9cc: 66 90 xchg %ax,%ax
9ce: 66 90 xchg %ax,%ax
000009d0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
9d0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
9d1: a1 60 13 00 00 mov 0x1360,%eax
{
9d6: 89 e5 mov %esp,%ebp
9d8: 57 push %edi
9d9: 56 push %esi
9da: 53 push %ebx
9db: 8b 5d 08 mov 0x8(%ebp),%ebx
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
9de: 8b 08 mov (%eax),%ecx
bp = (Header*)ap - 1;
9e0: 8d 53 f8 lea -0x8(%ebx),%edx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
9e3: 39 d0 cmp %edx,%eax
9e5: 72 11 jb 9f8 <free+0x28>
9e7: 90 nop
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
9e8: 39 c8 cmp %ecx,%eax
9ea: 72 04 jb 9f0 <free+0x20>
9ec: 39 ca cmp %ecx,%edx
9ee: 72 10 jb a00 <free+0x30>
9f0: 89 c8 mov %ecx,%eax
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
9f2: 39 d0 cmp %edx,%eax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
9f4: 8b 08 mov (%eax),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
9f6: 73 f0 jae 9e8 <free+0x18>
9f8: 39 ca cmp %ecx,%edx
9fa: 72 04 jb a00 <free+0x30>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
9fc: 39 c8 cmp %ecx,%eax
9fe: 72 f0 jb 9f0 <free+0x20>
break;
if(bp + bp->s.size == p->s.ptr){
a00: 8b 73 fc mov -0x4(%ebx),%esi
a03: 8d 3c f2 lea (%edx,%esi,8),%edi
a06: 39 cf cmp %ecx,%edi
a08: 74 1e je a28 <free+0x58>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
a0a: 89 4b f8 mov %ecx,-0x8(%ebx)
if(p + p->s.size == bp){
a0d: 8b 48 04 mov 0x4(%eax),%ecx
a10: 8d 34 c8 lea (%eax,%ecx,8),%esi
a13: 39 f2 cmp %esi,%edx
a15: 74 28 je a3f <free+0x6f>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
a17: 89 10 mov %edx,(%eax)
freep = p;
a19: a3 60 13 00 00 mov %eax,0x1360
}
a1e: 5b pop %ebx
a1f: 5e pop %esi
a20: 5f pop %edi
a21: 5d pop %ebp
a22: c3 ret
a23: 90 nop
a24: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
bp->s.size += p->s.ptr->s.size;
a28: 03 71 04 add 0x4(%ecx),%esi
a2b: 89 73 fc mov %esi,-0x4(%ebx)
bp->s.ptr = p->s.ptr->s.ptr;
a2e: 8b 08 mov (%eax),%ecx
a30: 8b 09 mov (%ecx),%ecx
a32: 89 4b f8 mov %ecx,-0x8(%ebx)
if(p + p->s.size == bp){
a35: 8b 48 04 mov 0x4(%eax),%ecx
a38: 8d 34 c8 lea (%eax,%ecx,8),%esi
a3b: 39 f2 cmp %esi,%edx
a3d: 75 d8 jne a17 <free+0x47>
p->s.size += bp->s.size;
a3f: 03 4b fc add -0x4(%ebx),%ecx
freep = p;
a42: a3 60 13 00 00 mov %eax,0x1360
p->s.size += bp->s.size;
a47: 89 48 04 mov %ecx,0x4(%eax)
p->s.ptr = bp->s.ptr;
a4a: 8b 53 f8 mov -0x8(%ebx),%edx
a4d: 89 10 mov %edx,(%eax)
}
a4f: 5b pop %ebx
a50: 5e pop %esi
a51: 5f pop %edi
a52: 5d pop %ebp
a53: c3 ret
a54: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
a5a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00000a60 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
a60: 55 push %ebp
a61: 89 e5 mov %esp,%ebp
a63: 57 push %edi
a64: 56 push %esi
a65: 53 push %ebx
a66: 83 ec 1c sub $0x1c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
a69: 8b 45 08 mov 0x8(%ebp),%eax
if((prevp = freep) == 0){
a6c: 8b 1d 60 13 00 00 mov 0x1360,%ebx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
a72: 8d 48 07 lea 0x7(%eax),%ecx
a75: c1 e9 03 shr $0x3,%ecx
if((prevp = freep) == 0){
a78: 85 db test %ebx,%ebx
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
a7a: 8d 71 01 lea 0x1(%ecx),%esi
if((prevp = freep) == 0){
a7d: 0f 84 9b 00 00 00 je b1e <malloc+0xbe>
a83: 8b 13 mov (%ebx),%edx
a85: 8b 7a 04 mov 0x4(%edx),%edi
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
if(p->s.size >= nunits){
a88: 39 fe cmp %edi,%esi
a8a: 76 64 jbe af0 <malloc+0x90>
a8c: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax
if(nu < 4096)
a93: bb 00 80 00 00 mov $0x8000,%ebx
a98: 89 45 e4 mov %eax,-0x1c(%ebp)
a9b: eb 0e jmp aab <malloc+0x4b>
a9d: 8d 76 00 lea 0x0(%esi),%esi
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
aa0: 8b 02 mov (%edx),%eax
if(p->s.size >= nunits){
aa2: 8b 78 04 mov 0x4(%eax),%edi
aa5: 39 fe cmp %edi,%esi
aa7: 76 4f jbe af8 <malloc+0x98>
aa9: 89 c2 mov %eax,%edx
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
aab: 3b 15 60 13 00 00 cmp 0x1360,%edx
ab1: 75 ed jne aa0 <malloc+0x40>
if(nu < 4096)
ab3: 8b 45 e4 mov -0x1c(%ebp),%eax
ab6: 81 fe 00 10 00 00 cmp $0x1000,%esi
abc: bf 00 10 00 00 mov $0x1000,%edi
ac1: 0f 43 fe cmovae %esi,%edi
ac4: 0f 42 c3 cmovb %ebx,%eax
p = sbrk(nu * sizeof(Header));
ac7: 89 04 24 mov %eax,(%esp)
aca: e8 bb fb ff ff call 68a <sbrk>
if(p == (char*)-1)
acf: 83 f8 ff cmp $0xffffffff,%eax
ad2: 74 18 je aec <malloc+0x8c>
hp->s.size = nu;
ad4: 89 78 04 mov %edi,0x4(%eax)
free((void*)(hp + 1));
ad7: 83 c0 08 add $0x8,%eax
ada: 89 04 24 mov %eax,(%esp)
add: e8 ee fe ff ff call 9d0 <free>
return freep;
ae2: 8b 15 60 13 00 00 mov 0x1360,%edx
if((p = morecore(nunits)) == 0)
ae8: 85 d2 test %edx,%edx
aea: 75 b4 jne aa0 <malloc+0x40>
return 0;
aec: 31 c0 xor %eax,%eax
aee: eb 20 jmp b10 <malloc+0xb0>
if(p->s.size >= nunits){
af0: 89 d0 mov %edx,%eax
af2: 89 da mov %ebx,%edx
af4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(p->s.size == nunits)
af8: 39 fe cmp %edi,%esi
afa: 74 1c je b18 <malloc+0xb8>
p->s.size -= nunits;
afc: 29 f7 sub %esi,%edi
afe: 89 78 04 mov %edi,0x4(%eax)
p += p->s.size;
b01: 8d 04 f8 lea (%eax,%edi,8),%eax
p->s.size = nunits;
b04: 89 70 04 mov %esi,0x4(%eax)
freep = prevp;
b07: 89 15 60 13 00 00 mov %edx,0x1360
return (void*)(p + 1);
b0d: 83 c0 08 add $0x8,%eax
}
}
b10: 83 c4 1c add $0x1c,%esp
b13: 5b pop %ebx
b14: 5e pop %esi
b15: 5f pop %edi
b16: 5d pop %ebp
b17: c3 ret
prevp->s.ptr = p->s.ptr;
b18: 8b 08 mov (%eax),%ecx
b1a: 89 0a mov %ecx,(%edx)
b1c: eb e9 jmp b07 <malloc+0xa7>
base.s.ptr = freep = prevp = &base;
b1e: c7 05 60 13 00 00 64 movl $0x1364,0x1360
b25: 13 00 00
base.s.size = 0;
b28: ba 64 13 00 00 mov $0x1364,%edx
base.s.ptr = freep = prevp = &base;
b2d: c7 05 64 13 00 00 64 movl $0x1364,0x1364
b34: 13 00 00
base.s.size = 0;
b37: c7 05 68 13 00 00 00 movl $0x0,0x1368
b3e: 00 00 00
b41: e9 46 ff ff ff jmp a8c <malloc+0x2c>
b46: 66 90 xchg %ax,%ax
b48: 66 90 xchg %ax,%ax
b4a: 66 90 xchg %ax,%ax
b4c: 66 90 xchg %ax,%ax
b4e: 66 90 xchg %ax,%ax
00000b50 <benny_thread_create>:
static struct benny_thread_s *bt_new(void);
int
benny_thread_create(benny_thread_t *abt, void (*func)(void*), void *arg_ptr)
{
b50: 55 push %ebp
b51: 89 e5 mov %esp,%ebp
b53: 56 push %esi
b54: 53 push %ebx
b55: 83 ec 10 sub $0x10,%esp
}
static struct benny_thread_s *
bt_new(void)
{
struct benny_thread_s *bt = malloc(sizeof(struct benny_thread_s));
b58: c7 04 24 0c 00 00 00 movl $0xc,(%esp)
b5f: e8 fc fe ff ff call a60 <malloc>
if (bt == NULL) {
b64: 85 c0 test %eax,%eax
struct benny_thread_s *bt = malloc(sizeof(struct benny_thread_s));
b66: 89 c6 mov %eax,%esi
if (bt == NULL) {
b68: 74 66 je bd0 <benny_thread_create+0x80>
// allocate 2 pages worth of memory and then make sure the
// beginning address used for the stack is page alligned.
// we want it page alligned so that we don't generate a
// page fault by accessing the stack for a thread.
bt->bt_stack = bt->mem_stack = malloc(PGSIZE * 2);
b6a: c7 04 24 00 20 00 00 movl $0x2000,(%esp)
b71: e8 ea fe ff ff call a60 <malloc>
if (bt->bt_stack == NULL) {
b76: 85 c0 test %eax,%eax
bt->bt_stack = bt->mem_stack = malloc(PGSIZE * 2);
b78: 89 c3 mov %eax,%ebx
b7a: 89 46 08 mov %eax,0x8(%esi)
b7d: 89 46 04 mov %eax,0x4(%esi)
if (bt->bt_stack == NULL) {
b80: 74 5d je bdf <benny_thread_create+0x8f>
free(bt);
return NULL;
}
if (((uint) bt->bt_stack) % PGSIZE != 0) {
b82: 25 ff 0f 00 00 and $0xfff,%eax
b87: 75 37 jne bc0 <benny_thread_create+0x70>
// allign the thread stack to a page boundary
bt->bt_stack += (PGSIZE - ((uint) bt->bt_stack) % PGSIZE);
}
bt->bid = -1;
b89: c7 06 ff ff ff ff movl $0xffffffff,(%esi)
bt->bid = kthread_create(func, arg_ptr, bt->bt_stack);
b8f: 8b 45 10 mov 0x10(%ebp),%eax
b92: 89 5c 24 08 mov %ebx,0x8(%esp)
b96: 89 44 24 04 mov %eax,0x4(%esp)
b9a: 8b 45 0c mov 0xc(%ebp),%eax
b9d: 89 04 24 mov %eax,(%esp)
ba0: e8 25 fb ff ff call 6ca <kthread_create>
if (bt->bid != 0) {
ba5: 85 c0 test %eax,%eax
bt->bid = kthread_create(func, arg_ptr, bt->bt_stack);
ba7: 89 06 mov %eax,(%esi)
if (bt->bid != 0) {
ba9: 74 2d je bd8 <benny_thread_create+0x88>
*abt = (benny_thread_t) bt;
bab: 8b 45 08 mov 0x8(%ebp),%eax
bae: 89 30 mov %esi,(%eax)
result = 0;
bb0: 31 c0 xor %eax,%eax
}
bb2: 83 c4 10 add $0x10,%esp
bb5: 5b pop %ebx
bb6: 5e pop %esi
bb7: 5d pop %ebp
bb8: c3 ret
bb9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
bt->bt_stack += (PGSIZE - ((uint) bt->bt_stack) % PGSIZE);
bc0: 29 c3 sub %eax,%ebx
bc2: 81 c3 00 10 00 00 add $0x1000,%ebx
bc8: 89 5e 04 mov %ebx,0x4(%esi)
bcb: eb bc jmp b89 <benny_thread_create+0x39>
bcd: 8d 76 00 lea 0x0(%esi),%esi
bd0: 8b 1d 04 00 00 00 mov 0x4,%ebx
bd6: eb b7 jmp b8f <benny_thread_create+0x3f>
int result = -1;
bd8: b8 ff ff ff ff mov $0xffffffff,%eax
bdd: eb d3 jmp bb2 <benny_thread_create+0x62>
free(bt);
bdf: 89 34 24 mov %esi,(%esp)
return NULL;
be2: 31 f6 xor %esi,%esi
free(bt);
be4: e8 e7 fd ff ff call 9d0 <free>
be9: 8b 5b 04 mov 0x4(%ebx),%ebx
bec: eb a1 jmp b8f <benny_thread_create+0x3f>
bee: 66 90 xchg %ax,%ax
00000bf0 <benny_thread_bid>:
{
bf0: 55 push %ebp
bf1: 89 e5 mov %esp,%ebp
return bt->bid;
bf3: 8b 45 08 mov 0x8(%ebp),%eax
}
bf6: 5d pop %ebp
return bt->bid;
bf7: 8b 00 mov (%eax),%eax
}
bf9: c3 ret
bfa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000c00 <benny_thread_join>:
{
c00: 55 push %ebp
c01: 89 e5 mov %esp,%ebp
c03: 53 push %ebx
c04: 83 ec 14 sub $0x14,%esp
c07: 8b 5d 08 mov 0x8(%ebp),%ebx
retVal = kthread_join(bt->bid);
c0a: 8b 03 mov (%ebx),%eax
c0c: 89 04 24 mov %eax,(%esp)
c0f: e8 be fa ff ff call 6d2 <kthread_join>
if (retVal == 0) {
c14: 85 c0 test %eax,%eax
c16: 75 27 jne c3f <benny_thread_join+0x3f>
free(bt->mem_stack);
c18: 8b 53 08 mov 0x8(%ebx),%edx
c1b: 89 45 f4 mov %eax,-0xc(%ebp)
c1e: 89 14 24 mov %edx,(%esp)
c21: e8 aa fd ff ff call 9d0 <free>
bt->bt_stack = bt->mem_stack = NULL;
c26: c7 43 08 00 00 00 00 movl $0x0,0x8(%ebx)
c2d: c7 43 04 00 00 00 00 movl $0x0,0x4(%ebx)
free(bt);
c34: 89 1c 24 mov %ebx,(%esp)
c37: e8 94 fd ff ff call 9d0 <free>
c3c: 8b 45 f4 mov -0xc(%ebp),%eax
}
c3f: 83 c4 14 add $0x14,%esp
c42: 5b pop %ebx
c43: 5d pop %ebp
c44: c3 ret
c45: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c49: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000c50 <benny_thread_exit>:
{
c50: 55 push %ebp
c51: 89 e5 mov %esp,%ebp
}
c53: 5d pop %ebp
return kthread_exit(exitValue);
c54: e9 81 fa ff ff jmp 6da <kthread_exit>
c59: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000c60 <benny_mootex_init>:
}
# ifdef BENNY_MOOTEX
int
benny_mootex_init(benny_mootex_t *benny_mootex)
{
c60: 55 push %ebp
c61: 89 e5 mov %esp,%ebp
c63: 8b 45 08 mov 0x8(%ebp),%eax
benny_mootex->locked = 0;
c66: c7 00 00 00 00 00 movl $0x0,(%eax)
benny_mootex->bid = -1;
c6c: c7 40 04 ff ff ff ff movl $0xffffffff,0x4(%eax)
return 0;
}
c73: 31 c0 xor %eax,%eax
c75: 5d pop %ebp
c76: c3 ret
c77: 89 f6 mov %esi,%esi
c79: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000c80 <benny_mootex_yieldlock>:
int
benny_mootex_yieldlock(benny_mootex_t *benny_mootex)
{
c80: 55 push %ebp
xchg(volatile uint *addr, uint newval)
{
uint result;
// The + in "+m" denotes a read-modify-write operand.
asm volatile("lock; xchgl %0, %1" :
c81: b8 01 00 00 00 mov $0x1,%eax
c86: 89 e5 mov %esp,%ebp
c88: 56 push %esi
c89: 53 push %ebx
c8a: 8b 5d 08 mov 0x8(%ebp),%ebx
c8d: f0 87 03 lock xchg %eax,(%ebx)
// #error this is the call to lock the mootex that will yield in a
// #error loop until the lock is acquired.
while(xchg(&benny_mootex->locked, 1) != 0){
c90: 85 c0 test %eax,%eax
c92: be 01 00 00 00 mov $0x1,%esi
c97: 74 15 je cae <benny_mootex_yieldlock+0x2e>
c99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
benny_yield(void)
{
// # error This just gives up the rest of this scheduled time slice to
// # error another process/thread.
return kthread_yield();
ca0: e8 45 fa ff ff call 6ea <kthread_yield>
ca5: 89 f0 mov %esi,%eax
ca7: f0 87 03 lock xchg %eax,(%ebx)
while(xchg(&benny_mootex->locked, 1) != 0){
caa: 85 c0 test %eax,%eax
cac: 75 f2 jne ca0 <benny_mootex_yieldlock+0x20>
return kthread_self();
cae: e8 2f fa ff ff call 6e2 <kthread_self>
benny_mootex->bid = benny_self();
cb3: 89 43 04 mov %eax,0x4(%ebx)
}
cb6: 31 c0 xor %eax,%eax
cb8: 5b pop %ebx
cb9: 5e pop %esi
cba: 5d pop %ebp
cbb: c3 ret
cbc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000cc0 <benny_mootex_spinlock>:
{
cc0: 55 push %ebp
cc1: ba 01 00 00 00 mov $0x1,%edx
cc6: 89 e5 mov %esp,%ebp
cc8: 53 push %ebx
cc9: 83 ec 04 sub $0x4,%esp
ccc: 8b 5d 08 mov 0x8(%ebp),%ebx
ccf: 90 nop
cd0: 89 d0 mov %edx,%eax
cd2: f0 87 03 lock xchg %eax,(%ebx)
while(xchg(&benny_mootex->locked, 1) != 0){
cd5: 85 c0 test %eax,%eax
cd7: 75 f7 jne cd0 <benny_mootex_spinlock+0x10>
return kthread_self();
cd9: e8 04 fa ff ff call 6e2 <kthread_self>
benny_mootex->bid = benny_self();
cde: 89 43 04 mov %eax,0x4(%ebx)
}
ce1: 83 c4 04 add $0x4,%esp
ce4: 31 c0 xor %eax,%eax
ce6: 5b pop %ebx
ce7: 5d pop %ebp
ce8: c3 ret
ce9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000cf0 <benny_mootex_unlock>:
{
cf0: 55 push %ebp
cf1: 89 e5 mov %esp,%ebp
cf3: 53 push %ebx
cf4: 83 ec 04 sub $0x4,%esp
cf7: 8b 5d 08 mov 0x8(%ebp),%ebx
return kthread_self();
cfa: e8 e3 f9 ff ff call 6e2 <kthread_self>
if(tid == benny_mootex->bid){
cff: 39 43 04 cmp %eax,0x4(%ebx)
d02: 75 1c jne d20 <benny_mootex_unlock+0x30>
__sync_synchronize();
d04: 0f ae f0 mfence
return 0;
d07: 31 c0 xor %eax,%eax
benny_mootex->bid = -1;
d09: c7 43 04 ff ff ff ff movl $0xffffffff,0x4(%ebx)
__sync_lock_release(&benny_mootex->locked);
d10: c7 03 00 00 00 00 movl $0x0,(%ebx)
}
d16: 83 c4 04 add $0x4,%esp
d19: 5b pop %ebx
d1a: 5d pop %ebp
d1b: c3 ret
d1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
d20: 83 c4 04 add $0x4,%esp
return -1;
d23: b8 ff ff ff ff mov $0xffffffff,%eax
}
d28: 5b pop %ebx
d29: 5d pop %ebp
d2a: c3 ret
d2b: 90 nop
d2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000d30 <benny_mootex_trylock>:
{
d30: 55 push %ebp
d31: b8 01 00 00 00 mov $0x1,%eax
d36: 89 e5 mov %esp,%ebp
d38: 53 push %ebx
d39: 83 ec 04 sub $0x4,%esp
d3c: 8b 5d 08 mov 0x8(%ebp),%ebx
d3f: f0 87 03 lock xchg %eax,(%ebx)
if(xchg(&benny_mootex->locked, 1) != 0){
d42: 85 c0 test %eax,%eax
d44: 75 08 jne d4e <benny_mootex_trylock+0x1e>
int tid = kthread_self();
d46: e8 97 f9 ff ff call 6e2 <kthread_self>
benny_mootex->bid = tid;
d4b: 89 43 04 mov %eax,0x4(%ebx)
}
d4e: 83 c4 04 add $0x4,%esp
d51: b8 ff ff ff ff mov $0xffffffff,%eax
d56: 5b pop %ebx
d57: 5d pop %ebp
d58: c3 ret
d59: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000d60 <benny_mootex_wholock>:
{
d60: 55 push %ebp
d61: 89 e5 mov %esp,%ebp
return benny_mootex->bid;
d63: 8b 45 08 mov 0x8(%ebp),%eax
}
d66: 5d pop %ebp
return benny_mootex->bid;
d67: 8b 40 04 mov 0x4(%eax),%eax
}
d6a: c3 ret
d6b: 90 nop
d6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000d70 <benny_mootex_islocked>:
{
d70: 55 push %ebp
d71: 89 e5 mov %esp,%ebp
return benny_mootex->locked;
d73: 8b 45 08 mov 0x8(%ebp),%eax
}
d76: 5d pop %ebp
return benny_mootex->locked;
d77: 8b 00 mov (%eax),%eax
}
d79: c3 ret
d7a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000d80 <benny_self>:
{
d80: 55 push %ebp
d81: 89 e5 mov %esp,%ebp
}
d83: 5d pop %ebp
return kthread_self();
d84: e9 59 f9 ff ff jmp 6e2 <kthread_self>
d89: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000d90 <benny_yield>:
{
d90: 55 push %ebp
d91: 89 e5 mov %esp,%ebp
}
d93: 5d pop %ebp
return kthread_yield();
d94: e9 51 f9 ff ff jmp 6ea <kthread_yield>
d99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000da0 <benny_cpu_count>:
int
benny_cpu_count(void)
{
da0: 55 push %ebp
da1: 89 e5 mov %esp,%ebp
// # error call the kthread_cpu_count() function.
// kthread_cpu_count();
return kthread_cpu_count();
}
da3: 5d pop %ebp
return kthread_cpu_count();
da4: e9 49 f9 ff ff jmp 6f2 <kthread_cpu_count>
da9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000db0 <benny_thread_count>:
int
benny_thread_count(void)
{
db0: 55 push %ebp
db1: 89 e5 mov %esp,%ebp
// # error call the kthread_thread_count() function.
// kthread_thread_count()
return kthread_thread_count();
}
db3: 5d pop %ebp
return kthread_thread_count();
db4: e9 41 f9 ff ff jmp 6fa <kthread_thread_count>
|
alloy4fun_models/trainstlt/models/2/yT4iE3jWrGtqwJb26.als | Kaixi26/org.alloytools.alloy | 0 | 4240 | open main
pred idyT4iE3jWrGtqwJb26_prop3 {
all t : Train | always t.pos in Entry or always t.pos in Exit
}
pred __repair { idyT4iE3jWrGtqwJb26_prop3 }
check __repair { idyT4iE3jWrGtqwJb26_prop3 <=> prop3o } |
pin-3.22-98547-g7a303a835-gcc-linux/source/tools/Mix/assy-support-intel64.asm | ArthasZhang007/15418FinalProject | 0 | 80740 | ;
; Copyright (C) 2008-2012 Intel Corporation.
; SPDX-License-Identifier: MIT
;
.CODE
ALIGN 4
mix_fp_save PROC
fxsave BYTE PTR [rcx]
emms
ret
mix_fp_save ENDP
.CODE
ALIGN 4
mix_fp_restore PROC
fxrstor BYTE PTR [rcx]
ret
mix_fp_restore ENDP
END
|
programs/oeis/154/A154295.asm | karttu/loda | 1 | 85116 | <reponame>karttu/loda
; A154295: a(n) = 81*n^2 - 90*n + 26.
; 26,17,170,485,962,1601,2402,3365,4490,5777,7226,8837,10610,12545,14642,16901,19322,21905,24650,27557,30626,33857,37250,40805,44522,48401,52442,56645,61010,65537,70226,75077,80090,85265,90602,96101,101762,107585,113570,119717,126026,132497,139130,145925,152882,160001,167282,174725,182330,190097,198026,206117,214370,222785,231362,240101,249002,258065,267290,276677,286226,295937,305810,315845,326042,336401,346922,357605,368450,379457,390626,401957,413450,425105,436922,448901,461042,473345,485810,498437,511226,524177,537290,550565,564002,577601,591362,605285,619370,633617,648026,662597,677330,692225,707282,722501,737882,753425,769130,784997,801026,817217,833570,850085,866762,883601,900602,917765,935090,952577,970226,988037,1006010,1024145,1042442,1060901,1079522,1098305,1117250,1136357,1155626,1175057,1194650,1214405,1234322,1254401,1274642,1295045,1315610,1336337,1357226,1378277,1399490,1420865,1442402,1464101,1485962,1507985,1530170,1552517,1575026,1597697,1620530,1643525,1666682,1690001,1713482,1737125,1760930,1784897,1809026,1833317,1857770,1882385,1907162,1932101,1957202,1982465,2007890,2033477,2059226,2085137,2111210,2137445,2163842,2190401,2217122,2244005,2271050,2298257,2325626,2353157,2380850,2408705,2436722,2464901,2493242,2521745,2550410,2579237,2608226,2637377,2666690,2696165,2725802,2755601,2785562,2815685,2845970,2876417,2907026,2937797,2968730,2999825,3031082,3062501,3094082,3125825,3157730,3189797,3222026,3254417,3286970,3319685,3352562,3385601,3418802,3452165,3485690,3519377,3553226,3587237,3621410,3655745,3690242,3724901,3759722,3794705,3829850,3865157,3900626,3936257,3972050,4008005,4044122,4080401,4116842,4153445,4190210,4227137,4264226,4301477,4338890,4376465,4414202,4452101,4490162,4528385,4566770,4605317,4644026,4682897,4721930,4761125,4800482,4840001,4879682,4919525,4959530,4999697
mul $0,9
sub $0,5
pow $0,2
mov $1,$0
add $1,1
|
Driver/Video/Dumb/VidMem/Clr4/clr4Tables.asm | steakknife/pcgeos | 504 | 177354 |
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1991 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Video driver
FILE: clr4Tables.asm
AUTHOR: <NAME>
REVISION HISTORY:
Name Date Description
---- ---- -----------
jad 12/91 initial version
DESCRIPTION:
$Id: clr4Tables.asm,v 1.1 97/04/18 11:42:45 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
; left mask table
leftMaskTable label word
byte 11111111b,11111111b
byte 00001111b,11111111b
byte 00000000b,11111111b
byte 00000000b,00001111b
rightMaskTable label word
byte 11110000b,00000000b
byte 11111111b,00000000b
byte 11111111b,11110000b
byte 11111111b,11111111b
;----------------------------------------------------------------------------
; Driver jump table (used by DriverStrategy)
;----------------------------------------------------------------------------
driverJumpTable label word
dw 0 ; intiialization
dw 0 ; last gasp
dw 0 ; suspend
dw 0 ; unsuspend
dw 0 ; test for device existance
dw 0 ; set device type
dw 0 ; get ptr to info block
dw 0 ; get exclusive
dw 0 ; start exclusive
dw 0 ; end exclusive
dw offset Clr4:VidGetPixel ; get a pixel color
dw offset Clr4:Clr4CallMod ; GetBits in another module
dw 0 ; set the ptr pic
dw 0 ; hide the cursor
dw 0 ; show the cursor
dw 0 ; move the cursor
dw 0 ; set save under area
dw 0 ; restore save under area
dw 0 ; nuke save under area
dw 0 ; request save under
dw 0 ; check save under
dw 0 ; get save under info
dw 0 ; check s.u. collision
dw 0 ; set xor region
dw 0 ; clear xor region
dw offset Clr4:VidDrawRect ; rectangle
dw offset Clr4:VidPutString ; char string
dw offset Clr4:Clr4CallMod ; BitBlt in another module
dw offset Clr4:Clr4CallMod ; PutBits in another module
dw offset Clr4:Clr4CallMod ; DrawLine in another module
dw offset Clr4:VidDrawRegion ; draws a region
dw offset Clr4:Clr4CallMod ; PutLine in another module
dw offset Clr4:Clr4CallMod ; Polygon in another module
dw 0 ; ScreenOn in another module
dw 0 ; ScreenOff in another module
dw offset Clr4:Clr4CallMod ; Polyline in another module
dw offset Clr4:Clr4CallMod ; Polyline in another module
dw offset Clr4:Clr4CallMod ; Polyline in another module
dw 0 ; SetPalette
dw 0 ; GetPalette
.assert ($-driverJumpTable) eq VidFunction
; this table holds offsets to the routines in different modules
moduleTable label fptr
fptr 0 ; intiialization
fptr 0 ; last gasp
fptr 0 ; suspend
fptr 0 ; unsuspend
fptr 0 ; test for device existance
fptr 0 ; set device type
fptr 0 ; get ptr to info block
fptr 0 ; get exclusive
fptr 0 ; start exclusive
fptr 0 ; end exclusive
fptr 0 ; get a pixel color
fptr Clr4Misc:VidGetBits ; GetBits in another module
fptr 0 ; set the ptr pic
fptr 0 ; hide the cursor
fptr 0 ; show the cursor
fptr 0 ; move the cursor
fptr 0 ; set save under area
fptr 0 ; restore save under area
fptr 0 ; nuke save under area
fptr 0 ; request save under
fptr 0 ; check save under
fptr 0 ; get save under info
fptr 0 ; check s.u. collision
fptr 0 ; set xor region
fptr 0 ; clear xor region
fptr 0 ; rectangle
fptr 0 ; char string
fptr Clr4Blt:VidBitBlt ; BitBlt in another module
fptr Clr4Bitmap:VidPutBits ; PutBits in another module
fptr Clr4Line:VidDrawLine ; DrawLine in another module
fptr 0 ; draws a region
fptr Clr4PutLine:VidPutLine ; PutLine in another module
fptr Clr4Line:VidPolygon ; Polygon in another module
fptr 0 ; ScreenOn in another module
fptr 0 ; ScreenOff in another module
fptr Clr4Line:VidPolyline ; Polyline in another module
fptr Clr4Line:VidDashLine ; DashLine in another module
fptr Clr4Line:VidDashFill ; DashFill in another module
fptr 0 ; SetPalette in another module
fptr 0 ; SetPalette in another module
.assert ($-moduleTable) eq (VidFunction*2)
;----------------------------------------------------------------------------
; Video Semaphores
;----------------------------------------------------------------------------
videoSem Semaphore <1,0>
;------------------------------------------------------------------------------
; Table of character drawing routines
;------------------------------------------------------------------------------
FCC_table label word
dw offset Clr4:Char1In ;load 1
dw offset Clr4:Char2In ;load 2
dw offset Clr4:Char3In ;load 3
dw offset Clr4:Char4In ;load 4
;------------------------------------------------------------------------------
; Table of draw mode routines
;------------------------------------------------------------------------------
drawModeTable label word
nptr ModeCLEAR
nptr ModeCOPY
nptr ModeNOP
nptr ModeAND
nptr ModeINVERT
nptr ModeXOR
nptr ModeSET
nptr ModeOR
VidSegment Bitmap
; this is a table of routines to put a single bitmap scan
; line. The B_type field passed in PutBitsArgs is used to
; index into the table (the lower 5 bits). The low three
; bits are the bitmap format, the next bit (BMT_COMPLEX) is
; used by the kernel bitmap code to signal that it is a
; monochrome bitmap that should be filled with the current
; area color. The fifth bit is set if there is a mask storeed
; with the bitmap.
putbitsTable label nptr ; FORMAT mask? fill?
nptr offset PutBWScan ; BMF_MONO no no
nptr offset PutColorScan ; BMF_CLR4 no no
nptr offset NullBMScan ; BMF_CLR8 no no
nptr offset NullBMScan ; BMF_CLR24 no no
nptr offset NullBMScan ; BMF_CMYK no no
nptr offset NullBMScan ; UNUSED no no
nptr offset NullBMScan ; UNUSED no no
nptr offset NullBMScan ; UNUSED no no
nptr offset FillBWScan ; BMF_MONO no yes
nptr offset NullBMScan ; BMF_CLR4 no yes
nptr offset NullBMScan ; BMF_CLR8 no yes
nptr offset NullBMScan ; BMF_CLR24 no yes
nptr offset NullBMScan ; BMF_CMYK no yes
nptr offset NullBMScan ; UNUSED no yes
nptr offset NullBMScan ; UNUSED no yes
nptr offset NullBMScan ; UNUSED no yes
nptr offset PutBWScanMask ; BMF_MONO yes no
nptr offset PutColorScanMask ; BMF_CLR4 yes no
nptr offset NullBMScan ; BMF_CLR8 yes no
nptr offset NullBMScan ; BMF_CLR24 yes no
nptr offset NullBMScan ; BMF_CMYK yes no
nptr offset NullBMScan ; UNUSED yes no
nptr offset NullBMScan ; UNUSED yes no
nptr offset NullBMScan ; UNUSED yes no
nptr offset FillBWScan ; BMF_MONO yes yes
nptr offset FillBWScan ; BMF_CLR4 yes yes
nptr offset FillBWScan ; BMF_CLR8 yes yes
nptr offset FillBWScan ; BMF_CLR24 yes yes
nptr offset FillBWScan ; BMF_CMYK yes yes
VidEnds Bitmap
VidSegment PutLine
; this is a table of routines to put a single bitmap scan
; line. The B_type field passed in PutBitsArgs is used to
; index into the table (the lower 5 bits). The low three
; bits are the bitmap format, the next bit (BMT_COMPLEX) is
; used by the kernel bitmap code to signal that it is a
; monochrome bitmap that should be filled with the current
; area color. The fifth bit is set if there is a mask storeed
; with the bitmap.
putlineTable label nptr ; FORMAT mask? fill?
nptr offset PutBWScan ; BMF_MONO no no
nptr offset PutColorScan ; BMF_CLR4 no no
nptr offset NullBMScan ; BMF_CLR8 no no
nptr offset NullBMScan ; BMF_CLR24 no no
nptr offset NullBMScan ; BMF_CMYK no no
nptr offset NullBMScan ; UNUSED no no
nptr offset NullBMScan ; UNUSED no no
nptr offset NullBMScan ; UNUSED no no
nptr offset FillBWScan ; BMF_MONO no yes
nptr offset NullBMScan ; BMF_CLR4 no yes
nptr offset NullBMScan ; BMF_CLR8 no yes
nptr offset NullBMScan ; BMF_CLR24 no yes
nptr offset NullBMScan ; BMF_CMYK no yes
nptr offset NullBMScan ; UNUSED no yes
nptr offset NullBMScan ; UNUSED no yes
nptr offset NullBMScan ; UNUSED no yes
nptr offset PutBWScanMask ; BMF_MONO yes no
nptr offset PutColorScanMask ; BMF_CLR4 yes no
nptr offset NullBMScan ; BMF_CLR8 yes no
nptr offset NullBMScan ; BMF_CLR24 yes no
nptr offset NullBMScan ; BMF_CMYK yes no
nptr offset NullBMScan ; UNUSED yes no
nptr offset NullBMScan ; UNUSED yes no
nptr offset NullBMScan ; UNUSED yes no
nptr offset FillBWScan ; BMF_MONO yes yes
nptr offset FillBWScan ; BMF_CLR4 yes yes
nptr offset FillBWScan ; BMF_CLR8 yes yes
nptr offset FillBWScan ; BMF_CLR24 yes yes
nptr offset FillBWScan ; BMF_CMYK yes yes
; these are offsets to the byte mode routines in the
; bitmap module
PLByteModeRout label nptr
nptr ByteCLEAR
nptr ByteCOPY
nptr ByteNOP
nptr ByteAND
nptr ByteINV
nptr ByteXOR
nptr ByteSET
nptr ByteOR
VidEnds PutLine
|
samples/xmlrd.adb | RREE/ada-util | 60 | 1562 | -----------------------------------------------------------------------
-- xrds -- XRDS parser example
-- Copyright (C) 2010, 2011 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
with Ada.Text_IO;
with Ada.Command_Line;
with Ada.Containers;
with Ada.Containers.Vectors;
with Util.Log.Loggers;
with Util.Beans;
with Util.Beans.Objects;
with Util.Streams.Texts;
with Util.Streams.Buffered;
with Util.Serialize.Mappers.Record_Mapper;
with Util.Serialize.Mappers.Vector_Mapper;
with Util.Serialize.IO.XML;
procedure Xmlrd is
use Ada.Containers;
use Util.Streams.Buffered;
use Ada.Strings.Unbounded;
Reader : Util.Serialize.IO.XML.Parser;
Count : constant Natural := Ada.Command_Line.Argument_Count;
type Service_Fields is (FIELD_PRIORITY, FIELD_TYPE, FIELD_URI, FIELD_LOCAL_ID, FIELD_DELEGATE);
type Service is record
Priority : Integer;
URI : Ada.Strings.Unbounded.Unbounded_String;
RDS_Type : Ada.Strings.Unbounded.Unbounded_String;
Delegate : Ada.Strings.Unbounded.Unbounded_String;
Local_Id : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Service_Access is access all Service;
package Service_Vector is
new Ada.Containers.Vectors (Element_Type => Service,
Index_Type => Natural);
procedure Print (P : in Service_Vector.Cursor);
procedure Print (P : in Service);
procedure Set_Member (P : in out Service;
Field : in Service_Fields;
Value : in Util.Beans.Objects.Object);
function Get_Member (P : in Service;
Field : in Service_Fields) return Util.Beans.Objects.Object;
procedure Set_Member (P : in out Service;
Field : in Service_Fields;
Value : in Util.Beans.Objects.Object) is
begin
Ada.Text_IO.Put_Line ("Set member " & Service_Fields'Image (Field)
& " to " & Util.Beans.Objects.To_String (Value));
case Field is
when FIELD_PRIORITY =>
P.Priority := Util.Beans.Objects.To_Integer (Value);
when FIELD_TYPE =>
P.RDS_Type := Util.Beans.Objects.To_Unbounded_String (Value);
when FIELD_URI =>
P.URI := Util.Beans.Objects.To_Unbounded_String (Value);
when FIELD_LOCAL_ID =>
P.Local_Id := Util.Beans.Objects.To_Unbounded_String (Value);
when FIELD_DELEGATE =>
P.Delegate := Util.Beans.Objects.To_Unbounded_String (Value);
end case;
end Set_Member;
function Get_Member (P : in Service;
Field : in Service_Fields) return Util.Beans.Objects.Object is
begin
case Field is
when FIELD_PRIORITY =>
return Util.Beans.Objects.To_Object (P.Priority);
when FIELD_TYPE =>
return Util.Beans.Objects.To_Object (P.RDS_Type);
when FIELD_URI =>
return Util.Beans.Objects.To_Object (P.URI);
when FIELD_LOCAL_ID =>
return Util.Beans.Objects.To_Object (P.Local_Id);
when FIELD_DELEGATE =>
return Util.Beans.Objects.To_Object (P.Delegate);
end case;
end Get_Member;
package Service_Mapper is
new Util.Serialize.Mappers.Record_Mapper (Element_Type => Service,
Element_Type_Access => Service_Access,
Fields => Service_Fields,
Set_Member => Set_Member);
package Service_Vector_Mapper is
new Util.Serialize.Mappers.Vector_Mapper (Vectors => Service_Vector,
Element_Mapper => Service_Mapper);
procedure Print (P : in Service) is
begin
Ada.Text_IO.Put_Line (" URI: " & To_String (P.URI));
Ada.Text_IO.Put_Line (" Priority: " & Integer'Image (P.Priority));
Ada.Text_IO.Put_Line ("Type (last): " & To_String (P.RDS_Type));
Ada.Text_IO.Put_Line (" Delegate: " & To_String (P.Delegate));
Ada.Text_IO.New_Line;
end Print;
procedure Print (P : in Service_Vector.Cursor) is
begin
Print (Service_Vector.Element (P));
end Print;
Service_Mapping : aliased Service_Mapper.Mapper;
Service_Vector_Mapping : aliased Service_Vector_Mapper.Mapper;
Mapper : Util.Serialize.Mappers.Processing;
begin
Util.Log.Loggers.Initialize ("samples/log4j.properties");
if Count = 0 then
Ada.Text_IO.Put_Line ("Usage: xmlrd file...");
return;
end if;
Service_Mapping.Add_Mapping ("Type", FIELD_TYPE);
Service_Mapping.Add_Mapping ("URI", FIELD_URI);
Service_Mapping.Add_Mapping ("Delegate", FIELD_DELEGATE);
Service_Mapping.Add_Mapping ("@priority", FIELD_PRIORITY);
Service_Mapping.Bind (Get_Member'Access);
Service_Vector_Mapping.Set_Mapping (Service_Mapping'Unchecked_Access);
Mapper.Add_Mapping ("XRDS/XRD/Service", Service_Vector_Mapping'Unchecked_Access);
for I in 1 .. Count loop
declare
S : constant String := Ada.Command_Line.Argument (I);
List : aliased Service_Vector_Mapper.Vector;
begin
Service_Vector_Mapper.Set_Context (Mapper, List'Unchecked_Access);
Reader.Parse (S, Mapper);
Ada.Text_IO.Put_Line ("Rule count: " & Count_Type'Image (List.Length));
-- The list now contains our elements.
List.Iterate (Process => Print'Access);
declare
Buffer : aliased Util.Streams.Texts.Print_Stream;
Output : Util.Serialize.IO.XML.Output_Stream;
begin
Buffer.Initialize (Size => 10000);
Output.Initialize (Output => Buffer'Unchecked_access);
Output.Start_Entity ("XRDS");
Service_Vector_Mapping.Write (Output, List);
Output.End_Entity ("XRDS");
Ada.Text_IO.Put_Line (Util.Streams.Texts.To_String (Buffer));
end;
end;
end loop;
end Xmlrd;
|
test/patest_toomanysines/src/patest_toomanysines.adb | ficorax/PortAudioAda | 2 | 1480 | with Ada.Float_Text_IO; use Ada.Float_Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Ada.Text_IO; use Ada.Text_IO;
with System;
with PortAudioAda; use PortAudioAda;
with PaTest_TooManySines_Types; use PaTest_TooManySines_Types;
with PaTest_TooManySines_Callbacks; use PaTest_TooManySines_Callbacks;
procedure PaTest_TooManySines
is
stream : aliased PA_Stream_Ptr;
err : PA_Error;
load : Long_Float;
numStress : Integer;
begin
Put ("PortAudio Test: output sine wave. SR = ");
Put (Sample_Rate, 0, 0, 0);
Put (", BufSize = ");
Put (Frames_Per_Buffer, 0);
Put (". MAX_LOAD = ");
Put (Max_Load, 0, 0, 0);
New_Line;
err := PA_Initialize;
if err /= paNoError then
goto Error;
end if;
outputParameters.device := PA_Get_Default_Output_Device;
if outputParameters.device = paNoDevice then
Put ("Error: No default output device.");
goto Error;
end if;
outputParameters.channelCount := 1;
outputParameters.sampleFormat := paFloat32;
outputParameters.suggestedLatency
:= PA_Get_Device_Info (outputParameters.device).defaultLowOutputLatency;
outputParameters.hostApiSpecificStreamInfo := System.Null_Address;
err := PA_Open_Stream
(stream'Access,
null,
outputParameters'Access,
Sample_Rate,
Frames_Per_Buffer,
paClipOff,
paTestCallback'Access,
data'Address);
if err /= paNoError then
goto Error;
end if;
err := PA_Start_Stream (stream);
if err /= paNoError then
goto Error;
end if;
-- Determine number of sines required to get to 50%
loop
data.numSines := data.numSines + 1;
delay 0.1;
load := PA_Get_Stream_Cpu_Load (stream);
Put ("numSines = ");
Put (data.numSines, 0);
Put (", CPU load = ");
Put (Float (load), 0, 6, 0);
New_Line;
exit when load >= 0.5;
end loop;
-- Calculate target stress value then ramp up to that level
numStress := Integer (2.0 * Float (data.numSines) * Max_Load);
while data.numSines < numStress loop
delay 0.2;
load := PA_Get_Stream_Cpu_Load (stream);
Put ("STRESSING: numSines = ");
Put (data.numSines, 0);
Put (", CPU load = ");
Put (Float (load), 0, 6, 0);
New_Line;
data.numSines := data.numSines + 1;
end loop;
Put_Line ("Suffer for 5 seconds.");
delay 5.0;
Put_Line ("Stop stream.");
err := PA_Stop_Stream (stream);
if err /= paNoError then
goto Error;
end if;
err := PA_Close_Stream (stream);
if err /= paNoError then
goto Error;
end if;
err := PA_Terminate;
Put_Line ("Test finished.");
-----------------------------------------------------------------------------
return;
<<Error>>
Put_Line ("Error occured while using the PortAudio stream");
Put ("Error code: ");
Put (PA_Error'Image (err));
New_Line;
Put ("Error message: ");
Put (PA_Get_Error_Text (err));
New_Line;
err := PA_Terminate;
pragma Unreferenced (err);
end PaTest_TooManySines;
|
bb-runtimes/examples/monitor/net/netproto.ads | JCGobbi/Nucleo-STM32G474RE | 0 | 6623 | <reponame>JCGobbi/Nucleo-STM32G474RE
------------------------------------------------------------------------------
-- --
-- GNAT EXAMPLE --
-- --
-- Copyright (C) 2013, AdaCore --
-- --
-- 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 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Interfaces; use Interfaces;
package Netproto is
type Rcv_Status is (Rcv_Err, Rcv_Ign, Rcv_Ip, Rcv_Arp, Rcv_Udp, Rcv_None);
-- Rcv_Err: error detected in the packet
-- Rcv_Ign: packet ignored
function Handle_Eth_Packet return Rcv_Status;
-- To be called when an ethernet packet is received. Filter and decode
-- the frame.
procedure Dump_Pkt (Off : Natural := 0);
procedure Route_To_Server;
-- Prepare the route to the server (check if this is possible, get
-- ARP address). The Srv_Eth_Addr is set to null_eth_Addr if there is no
-- route.
My_Udp_Port : Unsigned_16 := 0;
Srv_Udp_Port : Unsigned_16 := 0;
-- UDP ports for outgoing packets.
-- Only incoming packets whose dport is My_Udp_Port are accept, and sport
-- is filtered if srv_udp_port is not 0.
procedure Prepare_Udp (Ip_Off : out Natural);
-- Prepare an UDP packet: write the ethernet, IP and UDP headers (not
-- yet completed).
procedure Send_Udp (Ip_Off : Natural);
-- Complete the IP and UDP headers and send the packet
end Netproto;
|
test/Succeed/Issue739.agda | redfish64/autonomic-agda | 3 | 14945 | <filename>test/Succeed/Issue739.agda
module Issue739 where
record ⊤ : Set where
constructor tt
record Σ (A : Set) (B : A → Set) : Set where
constructor _,_
field
fst : A
snd : B fst
uncurry : {A : Set} {B : A → Set} →
((x : A) → B x → Set) →
Σ A B → Set
uncurry f (x , y) = f x y
data U : Set₁
El : U → Set
infixl 5 _▻_
data U where
ε : U
_▻_ : (u : U) → (El u → Set) → U
El ε = ⊤
El (u ▻ P) = Σ (El u) P
Id : ∀ u → (El u → Set) → El u → Set
Id u P = P
-- Type-checks:
works : U
works =
ε
▻ (λ _ → ⊤)
▻ (λ { (_ , _) → ⊤ })
-- Type-checks:
works′ : U
works′ =
ε
▻ (λ _ → ⊤)
▻ Id (_ ▻ _) (λ { (_ , _) → ⊤ })
-- Type-checks:
works″ : U
works″ =
ε
▻ (λ _ → ⊤)
▻ Id _ (uncurry λ _ _ → ⊤)
-- Type-checks:
works‴ : U
works‴ =
ε
▻ (λ _ → ⊤)
▻ Id _ const-⊤
where
const-⊤ : _ → _
const-⊤ (_ , _) = ⊤
-- Type-checks:
works⁗ : U
works⁗ =
ε
▻ (λ _ → ⊤)
▻ Id _ const-⊤
where
const-⊤ : _ → _
const-⊤ = λ { (_ , _) → ⊤ }
-- Type-checks:
works′́ : U
works′́ =
ε
▻ (λ _ → ⊤)
▻ Id _ (λ { _ → ⊤ })
-- Doesn't type-check (but I want to write something like this):
fails : U
fails =
ε
▻ (λ _ → ⊤)
▻ Id _ (λ { (_ , _) → ⊤ })
-- Given all the working examples I'm led to believe that there is
-- something wrong with pattern-matching lambdas. Please correct me if
-- I'm wrong.
-- Andreas, 2012-10-29 should work now.
|
src/JVM/Syntax/Bytecode/Printer.agda | ajrouvoet/jvm.agda | 6 | 14094 | <filename>src/JVM/Syntax/Bytecode/Printer.agda
{-# OPTIONS --no-qualified-instances #-}
open import Data.List
open import Relation.Unary
open import Relation.Ternary.Core
open import Relation.Ternary.Structures
open import Relation.Ternary.Structures.Syntax
import JVM.Printer.Printer as Printer
import JVM.Model as Model
module JVM.Syntax.Bytecode.Printer {ℓ T}
(⟨_⇒_⟩ : T → T → List T → Set ℓ)
(let open Model T)
(let open Printer T)
(print : ∀ {τ₁ τ₂} → ∀[ Down ⟨ τ₁ ⇒ τ₂ ⟩ ⇒ Printer Emp ] ) where
open import JVM.Syntax.Bytecode T ⟨_⇒_⟩
open import Relation.Binary.PropositionalEquality
open import Relation.Ternary.Data.ReflexiveTransitive
open import Relation.Ternary.Monad
{-# TERMINATING #-}
pretty : ∀ {ψ₁ ψ₂} → ∀[ ⟪ ψ₁ ↝ ψ₂ ⟫ ⇒ Printer Emp ]
pretty nil = do
return refl
pretty (instr i ▹⟨ σ ⟩ is) = do
is ← ✴-id⁻ʳ ⟨$⟩ (print i &⟨ ⟪ _ ↝ _ ⟫ # ∙-comm σ ⟩ is)
pretty is
pretty (labeled l∙i ▹⟨ σ₂ ⟩ is) = do
let l ∙⟨ σ ⟩ i∙is = ✴-assocᵣ (l∙i ∙⟨ σ₂ ⟩ is)
i ∙⟨ σ ⟩ is ← ✴-id⁻ʳ ⟨$⟩ (print-labels l &⟨ _ ✴ ⟪ _ ↝ _ ⟫ # ∙-comm σ ⟩ i∙is)
is ← ✴-id⁻ʳ ⟨$⟩ (print i &⟨ ∙-comm σ ⟩ is)
pretty is
|
Assignment 4/SwitchUpperLower.asm | wstern1234/COMSC-260 | 0 | 172001 | ; SwitchUpperLower.asm - exchanges the upper and lower words in a doubleword variable named three
INCLUDE Irvine32.inc
.386
.model flat, stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD
.data
three DWORD "w x",0
.code
main PROC
mov ecx, three
mov ax, WORD PTR three
mov bx, WORD PTR three + 2
mov WORD PTR three, bx
mov WORD PTR three + 2, ax
mov eax, three ; eax and ecx are flipped, so it worked
INVOKE ExitProcess, 0
main ENDP
END main |
alloy4fun_models/trashltl/models/1/EbGhTiJ3t34bu3D9a.als | Kaixi26/org.alloytools.alloy | 0 | 3936 | open main
pred idEbGhTiJ3t34bu3D9a_prop2 {
some File since ( historically no File )
}
pred __repair { idEbGhTiJ3t34bu3D9a_prop2 }
check __repair { idEbGhTiJ3t34bu3D9a_prop2 <=> prop2o } |
src/scripts/list.applescript | maaslalani/reminders | 2 | 848 | <reponame>maaslalani/reminders<filename>src/scripts/list.applescript
tell application "Reminders"
return name of reminders in lists "Reminders" whose completed is false
quit
end tell
|
oeis/078/A078313.asm | neoneye/loda-programs | 0 | 104925 | ; A078313: Number of distinct prime factors of n*rad(n)+1, where rad=A007947 (squarefree kernel).
; Submitted by <NAME>(w3)
; 1,1,2,1,2,1,2,1,2,1,2,1,3,1,2,2,3,1,2,2,3,2,3,2,3,1,2,2,2,2,3,2,3,2,2,2,3,2,2,1,2,2,3,3,2,2,4,1,2,2,2,3,3,2,3,2,3,2,2,1,2,2,2,2,2,1,3,2,2,2,2,1,4,1,2,2,3,2,2,2,2,2,4,1,2,2,3,2,3,2,3,3,3,1,2,1,3,1,3,3
seq $0,64549 ; a(n) = n * Product_{primes p|n} p.
seq $0,1221 ; Number of distinct primes dividing n (also called omega(n)).
|
Tools/unix/lzsa/asm/6502/decompress_faster_v1.asm | davidknoll/RomWBW | 194 | 20498 | ; ***************************************************************************
; ***************************************************************************
;
; lzsa1_6502.s
;
; NMOS 6502 decompressor for data stored in <NAME>'s LZSA1 format.
;
; This code is written for the ACME assembler.
;
; Optional code is presented for one minor 6502 optimization that breaks
; compatibility with the current LZSA1 format standard.
;
; The code is 168 bytes for the small version, and 205 bytes for the normal.
;
; Copyright <NAME> 2019.
;
; Distributed under the Boost Software License, Version 1.0.
; (See accompanying file LICENSE_1_0.txt or copy at
; http://www.boost.org/LICENSE_1_0.txt)
;
; ***************************************************************************
; ***************************************************************************
; ***************************************************************************
; ***************************************************************************
;
; Decompression Options & Macros
;
;
; Save 6 bytes of code and 21 cycles by swapping the order
; of bytes in the 16-bit length encoding?
;
; N.B. Setting this breaks compatibility with LZSA v1.2
;
LZSA_SWAP_LEN16 = 0
;
; Choose size over space (within sane limits)?
;
LZSA_SMALL_SIZE = 0
;
; Remove code inlining to save space?
;
; This saves 15 bytes of code at the cost of 7% speed.
;
!if LZSA_SMALL_SIZE {
LZSA_NO_INLINE = 1
} else {
LZSA_NO_INLINE = 0
}
;
; Use smaller code for copying literals?
;
; This saves 11 bytes of code at the cost of 15% speed.
;
!if LZSA_SMALL_SIZE {
LZSA_SHORT_CP = 1
} else {
LZSA_SHORT_CP = 0
}
;
; Use smaller code for copying literals?
;
; This saves 11 bytes of code at the cost of 30% speed.
;
!if LZSA_SMALL_SIZE {
LZSA_SHORT_LZ = 1
} else {
LZSA_SHORT_LZ = 0
}
;
; Assume that we're decompessing from a large multi-bank
; compressed data file, and that the next bank may need to
; paged in when a page-boundary is crossed.
;
LZSA_FROM_BANK = 0
;
; Macro to increment the source pointer to the next page.
;
; This should call a subroutine to determine if a bank
; has been crossed, and a new bank should be paged in.
;
!if LZSA_FROM_BANK {
!macro LZSA_INC_PAGE {
jsr lzsa1_next_page
}
} else {
!macro LZSA_INC_PAGE {
inc <lzsa_srcptr + 1
}
}
;
; Macro to read a byte from the compressed source data.
;
!if LZSA_NO_INLINE {
!macro LZSA_GET_SRC {
jsr lzsa1_get_byte
}
} else {
!macro LZSA_GET_SRC {
lda (lzsa_srcptr),y
inc <lzsa_srcptr + 0
bne .skip
+LZSA_INC_PAGE
.skip:
}
}
; ***************************************************************************
; ***************************************************************************
;
; Data usage is last 8 bytes of zero-page.
;
!if (LZSA_SHORT_CP | LZSA_SHORT_LZ) {
lzsa_length = $F8 ; 1 byte.
}
lzsa_cmdbuf = $F9 ; 1 byte.
lzsa_winptr = $FA ; 1 word.
lzsa_srcptr = $FC ; 1 word.
lzsa_dstptr = $FE ; 1 word.
LZSA_SRC_LO = $FC
LZSA_SRC_HI = $FD
LZSA_DST_LO = $FE
LZSA_DST_HI = $FF
; ***************************************************************************
; ***************************************************************************
;
; lzsa1_unpack - Decompress data stored in <NAME>'s LZSA1 format.
;
; Args: lzsa_srcptr = ptr to compessed data
; Args: lzsa_dstptr = ptr to output buffer
; Uses: lots!
;
; If compiled with LZSA_FROM_BANK, then lzsa_srcptr should be within the bank
; window range.
;
DECOMPRESS_LZSA1_FAST:
lzsa1_unpack: ldy #0 ; Initialize source index.
ldx #0 ; Initialize hi-byte of length.
;
; Copy bytes from compressed source data.
;
; N.B. X=0 is expected and guaranteed when we get here.
;
.cp_length: +LZSA_GET_SRC
sta <lzsa_cmdbuf ; Preserve this for later.
and #$70 ; Extract literal length.
beq .lz_offset ; Skip directly to match?
lsr ; Get 3-bit literal length.
lsr
lsr
lsr
cmp #$07 ; Extended length?
bne .got_cp_len
jsr .get_length ; CS from CMP, X=0.
!if LZSA_SHORT_CP {
.got_cp_len: cmp #0 ; Check the lo-byte of length.
beq .put_cp_len
inx ; Increment # of pages to copy.
.put_cp_len: stx <lzsa_length
tax
.cp_page: lda (lzsa_srcptr),y
sta (lzsa_dstptr),y
inc <lzsa_srcptr + 0
bne .skip1
inc <lzsa_srcptr + 1
.skip1: inc <lzsa_dstptr + 0
bne .skip2
inc <lzsa_dstptr + 1
.skip2: dex
bne .cp_page
dec <lzsa_length ; Any full pages left to copy?
bne .cp_page
} else {
.got_cp_len: tay ; Check the lo-byte of length.
beq .cp_page
inx ; Increment # of pages to copy.
.get_cp_src: clc ; Calc address of partial page.
adc <lzsa_srcptr + 0
sta <lzsa_srcptr + 0
bcs .get_cp_dst
dec <lzsa_srcptr + 1
.get_cp_dst: tya
clc ; Calc address of partial page.
adc <lzsa_dstptr + 0
sta <lzsa_dstptr + 0
bcs .get_cp_idx
dec <lzsa_dstptr + 1
.get_cp_idx: tya ; Negate the lo-byte of length.
eor #$FF
tay
iny
.cp_page: lda (lzsa_srcptr),y
sta (lzsa_dstptr),y
iny
bne .cp_page
inc <lzsa_srcptr + 1
inc <lzsa_dstptr + 1
dex ; Any full pages left to copy?
bne .cp_page
}
;
; Copy bytes from decompressed window.
;
; N.B. X=0 is expected and guaranteed when we get here.
;
.lz_offset: +LZSA_GET_SRC
clc
adc <lzsa_dstptr + 0
sta <lzsa_winptr + 0
lda #$FF
bit <lzsa_cmdbuf
bpl .hi_offset
+LZSA_GET_SRC
.hi_offset: adc <lzsa_dstptr + 1
sta <lzsa_winptr + 1
.lz_length: lda <lzsa_cmdbuf ; X=0 from previous loop.
and #$0F
adc #$03 - 1 ; CS from previous ADC.
cmp #$12 ; Extended length?
bne .got_lz_len
jsr .get_length ; CS from CMP, X=0.
!if LZSA_SHORT_LZ {
.got_lz_len: cmp #0 ; Check the lo-byte of length.
beq .put_lz_len
inx ; Increment # of pages to copy.
.put_lz_len: stx <lzsa_length
tax
.lz_page: lda (lzsa_winptr),y
sta (lzsa_dstptr),y
inc <lzsa_winptr + 0
bne .skip3
inc <lzsa_winptr + 1
.skip3: inc <lzsa_dstptr + 0
bne .skip4
inc <lzsa_dstptr + 1
.skip4: dex
bne .lz_page
dec <lzsa_length ; Any full pages left to copy?
bne .lz_page
jmp .cp_length ; Loop around to the beginning.
} else {
.got_lz_len: tay ; Check the lo-byte of length.
beq .lz_page
inx ; Increment # of pages to copy.
.get_lz_win: clc ; Calc address of partial page.
adc <lzsa_winptr + 0
sta <lzsa_winptr + 0
bcs .get_lz_dst
dec <lzsa_winptr + 1
.get_lz_dst: tya
clc ; Calc address of partial page.
adc <lzsa_dstptr + 0
sta <lzsa_dstptr + 0
bcs .get_lz_idx
dec <lzsa_dstptr + 1
.get_lz_idx: tya ; Negate the lo-byte of length.
eor #$FF
tay
iny
.lz_page: lda (lzsa_winptr),y
sta (lzsa_dstptr),y
iny
bne .lz_page
inc <lzsa_winptr + 1
inc <lzsa_dstptr + 1
dex ; Any full pages left to copy?
bne .lz_page
jmp .cp_length ; Loop around to the beginning.
}
;
; Get 16-bit length in X:A register pair.
;
; N.B. X=0 is expected and guaranteed when we get here.
;
.get_length: clc ; Add on the next byte to get
adc (lzsa_srcptr),y ; the length.
inc <lzsa_srcptr + 0
bne .skip_inc
+LZSA_INC_PAGE
.skip_inc: bcc .got_length ; No overflow means done.
cmp #$00 ; Overflow to 256 or 257?
beq .extra_word
.extra_byte: inx
jmp lzsa1_get_byte ; So rare, this can be slow!
!if LZSA_SWAP_LEN16 {
.extra_word: jsr lzsa1_get_byte ; So rare, this can be slow!
tax
beq .finished ; Length-hi == 0 at EOF.
} else {
.extra_word: jsr lzsa1_get_byte ; So rare, this can be slow!
pha
jsr lzsa1_get_byte ; So rare, this can be slow!
tax
beq .finished ; Length-hi == 0 at EOF.
pla ; Length-lo.
rts
}
lzsa1_get_byte:
lda (lzsa_srcptr),y ; Subroutine version for when
inc <lzsa_srcptr + 0 ; inlining isn't advantageous.
beq lzsa1_next_page
.got_length: rts
lzsa1_next_page:
inc <lzsa_srcptr + 1 ; Inc & test for bank overflow.
!if LZSA_FROM_BANK {
bmi lzsa1_next_bank ; Change for target hardware!
}
rts
.finished: pla ; Length-lo.
pla ; Decompression completed, pop
pla ; return address.
rts
|
impl/src/test/resources/patterns/CompCodes.asm | jeslie/hack-assembler | 1 | 161778 | // mnemonic // 111 A comp 000 000
0 // 0 101010
1 // 0 111111
-1 // 0 111010
D // 0 001100
A // 0 110000
!D // 0 001101
!A // 0 110001
-D // 0 001111
-A // 0 110011
D+1 // 0 011111
A+1 // 0 110111
D-1 // 0 001110
A-1 // 0 110010
D+A // 0 000010
D-A // 0 010011
A-D // 0 000111
D&A // 0 000000
D|A // 0 010101
M // 1 110000
!M // 1 110001
-M // 1 110011
M+1 // 1 110111
M-1 // 1 110010
D+M // 1 000010
D-M // 1 010011
M-D // 1 000111
D&M // 1 000000
D|M // 1 010101
M // 1 110000
!M // 1 110001
-M // 1 110011
M+1 // 1 110111
|
oeis/065/A065705.asm | neoneye/loda-programs | 11 | 3094 | ; A065705: a(n) = Lucas(10*n).
; 2,123,15127,1860498,228826127,28143753123,3461452808002,425730551631123,52361396397820127,6440026026380244498,792070839848372253127,97418273275323406890123,11981655542024930675232002,1473646213395791149646646123,181246502592140286475862241127,22291846172619859445381409012498,2741715832729650571495437446296127,337208755579574400434493424485411123,41473935220454921602871195774259272002,5100956823360375782752722586809405045123,627376215338105766356982006981782561278127
mul $0,10
mov $1,2
mov $2,1
lpb $0
sub $0,2
add $1,$2
add $2,$1
lpe
mov $0,$1
|
base/mvdm/dos/v86/redir/resident.asm | npocmaka/Windows-Server-2003 | 17 | 11522 | page ,132
if 0
/*++
Copyright (c) 1991 Microsoft Corporation
Module Name:
resident.asm
Abstract:
This module contains the resident code part of the stub redir TSR for NT
VDM net support. The routines contained herein are the 2f handler and the
API support routines:
MultHandler
ReturnMode
SetMode
GetAssignList
DefineMacro
BreakMacro
GetRedirVersion
NetGetUserName
DefaultServiceError
NetGetEnumInfo
NetSpoolStuff
Author:
<NAME> (rfirth) 05-Sep-1991
Environment:
Dos mode only
Revision History:
05-Sep-1991 rfirth
Created
--*/
endif
.xlist ; don't list these include files
.xcref ; turn off cross-reference listing
include dosmac.inc ; Break macro etc (for following include files only)
include dossym.inc ; User_<Reg> defines
include mult.inc ; MultNET
include error.inc ; DOS errors - ERROR_INVALID_FUNCTION
include syscall.inc ; DOS system call numbers
include rdrint2f.inc ; redirector Int 2f numbers
include segorder.inc ; segments
include enumapis.inc ; dispatch codes
include debugmac.inc ; DbgPrint macro
include localmac.inc ; DbgPrint macro
include asmmacro.inc ; language extensions
include rdrsvc.inc ; BOP and SVC macros/dispatch codes
include rdrmisc.inc ; miscellaneous definitions
include sf.inc ; SFT definitions/structure
include vrdefld.inc ; VDM_LOAD_INFO
.cref ; switch cross-reference back on
.list ; switch listing back on
subttl ; kill subtitling started in include file
.286 ; all code in this module 286 compatible
ResidentDataStart
public LanRootLength, LanRoot
LanRootLength dw ? ; can't be >81 bytes anyhow
LanRoot db (64+3+1+13) dup (?)
ResidentDataEnd
ResidentCodeStart
extrn DosQnmPipeInfo: near
extrn DosQNmpHandState: near
extrn DosSetNmpHandState: near
extrn DosPeekNmPipe: near
extrn DosTransactNmPipe: near
extrn DosCallNmPipe: near
extrn DosWaitNmPipe: near
extrn NetTransactAPI: near
extrn NetIRemoteAPI: near
extrn NetUseAdd: near
extrn NetUseDel: near
extrn NetUseEnum: near
extrn NetUseGetInfo: near
extrn NetServerEnum: near
extrn DosMakeMailslot: near
extrn DosDeleteMailslot: near
extrn DosMailslotInfo: near
extrn DosReadMailslot: near
extrn DosPeekMailslot: near
extrn DosWriteMailslot: near
extrn NetNullTransactAPI: near
extrn NetServerEnum2: near
extrn NetServiceControl: near
extrn NetWkstaGetInfo: near
extrn NetWkstaSetInfo: near
extrn NetMessageBufferSend: near
extrn NetHandleGetInfo: near
extrn NetHandleSetInfo: near
extrn DosReadAsyncNmPipe: near
extrn DosWriteAsyncNmPipe: near
extrn DosReadAsyncNmPipe2: near
extrn DosWriteAsyncNmPipe2: near
extrn MessengerDispatch: near
;
; IMPORTANT: This structure MUST be the first thing in the resident code segment
;
extrn dwPostRoutineAddress: dword
VdmWindowAddr VDM_LOAD_INFO <dwPostRoutineAddress, 0>
align 4
;
; Address of previous handler to chain if int 2f not for us
;
public OldMultHandler
OldMultHandler dd ?
;
; OldFunctionTable is a table of near pointers to handlers for the old 5f
; functions 5f00 through 5f05
;
OldFunctionTable label word
dw ReturnMode ; 5f00
dw SetMode ; 5f01
dw GetAssignList ; 5f02
dw DefineMacro ; 5f03
dw BreakMacro ; 5f04
dw GetAssignList2 ; 5f05
;
; May as well keep this jump table in the code segment - no point in loading
; ds just to get a jump offset
;
MultDispatchTable label word
dw GetRedirVersion ; 5f30
dw DefaultServiceError ; 5f31 - NetWkstaSetUID
dw DosQnmPipeInfo ; 5f32
dw DosQNmpHandState ; 5f33
dw DosSetNmpHandState ; 5f34
dw DosPeekNmPipe ; 5f35
dw DosTransactNmPipe ; 5f36
dw DosCallNmPipe ; 5f37
dw DosWaitNmPipe ; 5f38
dw DefaultServiceError ; 5f39 - DosRawReadNmPipe
dw DefaultServiceError ; 5f3a - DosRawWriteNmPipe
dw NetHandleSetInfo ; 5f3b
dw NetHandleGetInfo ; 5f3c
dw NetTransactAPI ; 5f3d
dw DefaultServiceError ; 5f3e - NetSpecialSMB
dw NetIRemoteAPI ; 5f3f
dw NetMessageBufferSend ; 5f40
dw DefaultServiceError ; 5f41 - NetServiceEnum
dw NetServiceControl ; 5f42
dw DefaultServiceError ; 5f43 - DosPrintJobGetID
dw NetWkstaGetInfo ; 5f44
dw NetWkstaSetInfo ; 5f45
dw NetUseEnum ; 5f46
dw NetUseAdd ; 5f47
dw NetUseDel ; 5f48
dw NetUseGetInfo ; 5f49
dw DefaultServiceError ; 5f4a - NetRemoteCopy
dw DefaultServiceError ; 5f4b - NetRemoteMove
dw NetServerEnum ; 5f4c
dw DosMakeMailslot ; 5f4d
dw DosDeleteMailslot ; 5f4e
dw DosMailslotInfo ; 5f4f
dw DosReadMailslot ; 5f50
dw DosPeekMailslot ; 5f51
dw DosWriteMailslot ; 5f52
dw NetServerEnum2 ; 5f53
dw NetNullTransactAPI ; 5f54 - NullTransaction entrypoint.
MAX_TABLE_ENTRIES = (($-MultDispatchTable)/type MultDispatchTable)-1
;
; this next table dispatches the functions that come in through a direct call
; to int 2f, ah=11, al=function code
;
ServiceDispatchTable label word
dw NetGetUserName ; 80h - NetGetUserName o
dw DefaultServiceError ; 81h - NetSetUserName x
dw DefaultServiceError ; 82h - NetServiceNotify x
dw DefaultServiceError ; 83h - NetPrintNameEnum x
dw NetGetEnumInfo ; 84h - NetGetEnumInfo o
dw DefaultServiceError ; 85h - TestDBCSLB x
dw DosReadAsyncNmPipe ; 86h - DosReadAsyncNmPipe x
dw DefaultServiceError ; 87h - DosUnusedFunction1 x
dw DefaultServiceError ; 88h - DosUnusedFunction2 x
dw DefaultServiceError ; 89h - NetCalloutNCB x
dw DefaultServiceError ; 8Ah - EncrPasswd x
dw DefaultServiceError ; 8Bh - NetGetLogonServer o
dw DefaultServiceError ; 8Ch - NetSetLogonServer o
dw DefaultServiceError ; 8Dh - NetGetDomain o
dw DefaultServiceError ; 8Eh - NetSetDomain o
dw DosWriteAsyncNmPipe ; 8FH - DosWriteAsyncNmPipe x
dw DosReadAsyncNmPipe2 ; 90H - DosReadAsyncNmPipe2 x
dw DosWriteAsyncNmPipe2 ; 91H - DosWriteAsyncNmPipe2 x
MAX_SERVICE_ENTRIES = (($-ServiceDispatchTable)/type ServiceDispatchTable)-1
page
; *** MultHandler
; *
; * Whenever an INT 2F call is made, sooner or later this function will
; * get control. If the call is actually for the redir, AH will be set
; * to 11h (MultNET). If it is any other value then we just chain it
; * along. Note that since there is no MINSES loaded in the NT DOS network
; * stack, then we need also to fake calls to MINSES. These are made through
; * INT 2F, with ah = 0xB8. We trap calls AX=B800 (network presence test)
; * and AX=B809 (network/redir installation test)
; *
; * ENTRY ax = (MultNET << 8) | net operation code
; * Net operation code can be:
; * Install check 0
; * Assign operation 30
; * Anything else is DOS/NET specific. We should raise a gorbachev
; * or rather an error if we receive something else
; *
; * Stack: IP \
; * CS > From Int 2f
; * Flags /
; * Caller's AX From call to Int 21/ah=5f
; *
; * We need the caller's AX to dispatch the NetAssOper calls, nothing
; * more
; *
; * All the rest of the registers are as per the caller
; *
; * EXIT CF = 0
; * success
; * CF = 1
; * AX = error
; *
; * USES all regs
; *
; * ASSUMES Earth is flat
; *
; ***
if DEBUG
OriginalAx dw ?
OriginalBx dw ?
endif
public MultHandler
MultHandler proc far
assume cs:ResidentCode
assume ds:nothing
assume es:nothing
assume ss:nothing
if DEBUG
mov OriginalAx,ax
mov OriginalBx,bx
endif
cmp ah,MultNET ; 11h
je @f
;
; test for AH=B8 and return network presence indicators if it is. Here we are
; faking calls to MINSES (minimum session layer) and intercept calls AX=B800
; and AX=B809. Any other AH=B8 call must be for a different TSR/driver
;
cmp ah,0b8h
jne check_messenger
or al,al
jnz try_9
;
; AX=B800. This is the MinSes installation check. Return the magic numbers
; AL=1 and BX=8 (see doslan\minses\int2f.inc in LANMAN project)
;
inc al
mov bx,8
do_iret:iret
try_9:
cmp al,9
jne chain_previous_handler ; AL not 0 or 9, AH=B8 for somebody else
;
; AX=B809 is a network installation test. Return the magic numbers AL=1, AH=2
; for PC Network version 1.2 (this is what minses does, don't complain to me
; about PC networks, etc, etc)
;
mov ax,0201h
jmp short do_iret
;
; MESSENGER TSR uses AH=42h
;
check_messenger:
cmp ah,42h ; multMESSAGE
jne chain_previous_handler
call MessengerDispatch
retf 2 ; return state in flags
chain_previous_handler:
jmp OldMultHandler ; not for us; pass it along
;
; the 2f call is for us. If it is the installation check, return al == -1 else
; dispatch the byte code at sp+6
;
@@: sti ; re-enable interrupts
or al,al
jnz @f
or al,-1 ; installation check just returns 0xff
ret 2 ; 'or' clears carry
@@: cld ; auto-increment string operations
;
; this call is something other than an installation check. I really hope that
; its the AssignOper request, because I don't know what to do if it isn't...
;
cmp al,_2F_NET_ASSOPER
jmpe is_net_request ; yes - we can do something
;
; if its the ResetEnvironment request then we have to kill any net state info
; like mailslot info. Return via iret
;
cmp al,_2F_NetResetEnvironment
jmpne check_service_call
;
; deferred loading: don't load VDMREDIR.DLL for VrTerminateDosProcess if no NET
; calls have been made
;
cmp VdmWindowAddr.VrInitialized,1
je @f
iret
if 0
DbgPrintString "NetResetEnvironment received. PDB="
push ax ; int 21/51 uses ax,bx
push bx
endif
@@: mov ah,51h
int 21h ; get current PDB
if 0
DbgPrintHexWord bx ; bx contains PSP of current process
pop bx
pop ax
DbgCrLf
endif
mov ax,bx
SVC SVC_RDRTERMINATE
iret
;
; if this is a net service call (ah=11h, al=function code 80h through 91h) then
; dispatch through the service table
;
check_service_call:
cmp al,_2F_NetSpoolOper ; 25h
jne @f
call NetSpoolStuff
jmp short return_to_dos
@@: cmp al,_2F_NetGetUserName ; 80h
jmpb trap_it
cmp al,_2F_DosWriteAsyncNmPipe2 ; 91h
jmpa trap_it
if 0
DbgPrintString "Received Service Request: "
DbgPrintHexWord ax
DbgCrLf
endif
sub ax,(MultNET shl 8) + _2F_NetGetUserName
xchg ax,bx
shl bx,1
mov bx,ServiceDispatchTable[bx]
xchg ax,bx
call ax
;
; all calls that come through here are expected to have originated in DOS
;
return_to_dos:
ret 2 ; with interrupts enabled
;
; if we get anything else, either from DOS, or some - as yet - unknown source,
; then just pass it along to the next handler. In the debug version, we alert
; someone to the fact that we've got an unrecognized call
;
trap_it:
DbgPrintString "Received unrecognized Service Request: "
DbgPrintHexWord ax
DbgCrLf
DbgBreakPoint
jmp OldMultHandler ; pass it down the chain
;
; get the original dispatch code back off the stack. We no longer require the
; current contents of ax
;
is_net_request:
push bp
mov bp,sp
mov ax,[bp + 8] ; ax <- original code (5fxx)
pop bp
if DEBUG
mov OriginalAx,ax
endif
;
; quick sanity check to make sure that we're processing the right call. If we
; were called with ax != 5fxx, assume that somebody else is also using the
; same 2F function call, and chain the next handler. Note: this wouldn't be
; a very smart thing to do
;
sub ah,AssignOper ; ah => 0 it is AssignOper
jz @f
DbgBreakPoint
mov ax,(MultNET shl 8) + _2F_NET_ASSOPER ; restore ax
jmps chain_previous_handler
@@: cmp al,5 ; is it 5f00 - 5f05?
jnbe @f
;
; if the function is in the range 0 - 5 then its an old function - dispatch
; through the old function table
;
shl al,1
xchg ax,bx
mov bx,OldFunctionTable[bx]
xchg ax,bx
call ax
ret 2
@@: sub al,Local_API_RedirGetVersion
jz @f ; function is GetRedirVersion
cmp al,MAX_TABLE_ENTRIES
jbe @f ; UNSIGNED comparison!!!
;
; get 32-bit support code to dump registers to debug terminal
;
if DEBUG
mov ax,OriginalAx
DbgUnsupported
endif
mov ax,ERROR_NOT_SUPPORTED
stc ; set error indication
jmp short set_ax_exit
;
; the function is within range. Dispatch it. Copy the offset from the dispatch
; table into ax then call through ax. ax was only required to get us this far
; and contains no useful information
;
@@: xchg ax,bx ; need base register, ax not good enough in 286
shl bx,1 ; bx is now offset in dispatch table
mov bx,MultDispatchTable[bx]; bx is offset of handler routine
xchg ax,bx ; restore caller's bx
call ax ; go handle it
ret 2 ; return without reinstating flags
;
; Return an error in the caller's ax register. To do this we have to ask DOS to
; please give us the address of its copy of the user's registers, which it will
; pass back in DS:SI. We then futz with the copy of the user's reg. Dos will
; restore this before returning control to the user code. Since we know we have
; an error situation set the carry flag
;
set_ax_exit:
pushf ; error indicator
push ax ; return code
DosCallBack GET_USER_STACK ; get pointer to caller's context
assume ds:nothing ; nuked - actually in DOS somewhere (stack)
pop [si].User_Ax ; copy saved return code into user's copy
popf ; restore error indicator
ret 2 ; clear caller's flags from int 2f call
MultHandler endp
page
; *** ReturnMode
; *
; * Returns the disk or print redirection flag. Flag is 0 if redirection
; * is paused, else 1
; *
; * ENTRY BL = 3
; * Return print redirection
; *
; * BL = 4
; * Return drive redirection
; *
; * EXIT CF = 0
; * BX = redirection flag: 0 or 1
; *
; * CF = 1
; * error
; *
; * USES bx
; *
; * ASSUMES nothing
; *
; ***
PrintRedirection db 0
DriveRedirection db 0
ReturnMode proc near
assume cs:ResidentCode
assume ds:nothing
DbgPrintString <"5f00 called",13,10>
DbgUnsupported
cmp bl,3
jne @f
mov bh,PrintRedirection
jmp short set_info
@@: cmp bl,4
stc
jnz @f
mov bh,DriveRedirection
set_info:
and bh,1
DosCallBack GET_USER_STACK
mov [si].User_Bx,bx
clc
@@: ret
ReturnMode endp
page
; *** SetMode
; *
; * Pauses or continues drive or printer redirection. Note that we don't
; * support drive/print pause/continuation from DOS
; *
; * ENTRY BL = printer (3) or drive (4) redirection
; * BH = pause (0) or continue (1)
; *
; * EXIT CF = 0
; * success
; * CF = 1
; * ax = ERROR_INVALID_PARAMETER
; *
; * USES ax, bx
; *
; * ASSUMES nothing
; *
; ***
SetMode proc near
assume cs:ResidentCode
assume ds:nothing
DbgPrintString <"5f01 called",13,10>
DbgUnsupported
cmp bh,1
jnbe bad_parm_exit
dec bh ; convert 0 => ff, 1 => 0
not bh ; convert ff => 0, 0 => ff
sub bl,3
jnz try_drive
mov PrintRedirection,bh
jmp short ok_exit
try_drive:
dec bl
jnz bad_parm_exit
mov DriveRedirection,bh
ok_exit:clc
ret
bad_parm_exit:
mov ax,ERROR_INVALID_PARAMETER
stc
ret
SetMode endp
page
; *** GetAssignList
; *
; * Returns information on enumerated redirections. Old version of
; * NetUseGetInfo
; *
; * ENTRY BX = which item to return (starts @ 0)
; * DS:SI points to local redirection name
; * ES:DI points to remote redirection name
; * AL != 0 means return LSN in BP (GetAssignList2)? ** UNSUPPORTED **
; *
; * EXIT CF = 0
; * BL = macro type (3 = printer, 4 = drive)
; * BH = 'interesting' bits: 00 = valid, 01 = invalid
; * CX = user word
; * DS:SI has device type
; * ES:DI has net path
; * CF = 1
; * AX = ERROR_NO_MORE_FILES
; *
; * USES
; *
; * ASSUMES nothing
; *
; ***
GetAssignList proc near
assume cs:ResidentCode
assume ds:nothing
xor al,al
jmp short @f
GetAssignList2:
or al,-1
@@: SVC SVC_RDRGET_ASG_LIST
jc @f
push bx
push cx
DosCallBack GET_USER_STACK
pop [si].User_Cx
pop [si].User_Bx
clc
@@: ret
GetAssignList endp
page
; *** DefineMacro
; *
; * Old version of NetUseAdd
; *
; * ENTRY BL = device type
; * 3 = printer
; * 4 = drive
; * bit 7 on means use the wksta password when connecting
; * CX = user word
; * DS:SI = local device
; * Can be NUL device name, indicating UNC use
; * ES:DI = remote name
; *
; * EXIT CF = 0
; * success
; *
; * CF = 1
; * AX = ERROR_INVALID_PARAMETER (87)
; * ERROR_INVALID_PASSWORD (86)
; * ERROR_INVALID_DRIVE (15)
; * ERROR_ALREADY_ASSIGNED (85)
; * ERROR_PATH_NOT_FOUND (3)
; * ERROR_ACCESS_DENIED (5)
; * ERROR_NOT_ENOUGH_MEMORY (8)
; * ERROR_NO_MORE_FILES (18)
; * ERROR_REDIR_PAUSED (72)
; *
; * USES
; *
; * ASSUMES nothing
; *
; ***
DefineMacro proc near
assume cs:ResidentCode
assume ds:nothing
SVC SVC_RDRDEFINE_MACRO
ret
DefineMacro endp
page
; *** BreakMacro
; *
; * Old version of NetUseDel
; *
; * ENTRY DS:SI = buffer containing device name of redirection to break
; *
; * EXIT
; *
; * USES
; *
; * ASSUMES nothing
; *
; ***
BreakMacro proc near
assume cs:ResidentCode
assume ds:nothing
SVC SVC_RDRBREAK_MACRO
ret
BreakMacro endp
page
; *** GetRedirVersion
; *
; * Returns the version number of this redir in ax
; *
; * ENTRY none
; *
; * EXIT ax = version #
; *
; * USES ax, flags
; *
; * ASSUMES nothing
; *
; ***
GetRedirVersion proc near
assume cs:ResidentCode
assume ds:nothing
mov ax,300
clc
ret
GetRedirVersion endp
page
; *** NetGetUserName
; *
; * Returns the current logged on user name (if any)
; *
; * ENTRY CX = buffer length
; * ES:DI = buffer
; *
; * EXIT CF = 1
; * AX = Error code
; * NERR_BufTooSmall
; * Buffer not large enough for user name
; *
; * CF = 0
; * CX:BX = UID (ignored)
; * ES:DI = user name
; *
; * USES ax, flags
; *
; * ASSUMES nothing
; *
; ***
NetGetUserName proc near
assume cs:ResidentCode
assume ds:nothing
mov bx,1 ; bx == 1: check name length against cx
call NetGetUserNameSvcCall
DbgBreakPoint
jc @f ; error
;
; no error: the user name was copied into ES:DI. Set the caller's cx and bx to
; return a UID. We could leave this as a random number since it is not used,
; but we set it to a known value
;
DosCallBack GET_USER_STACK
xor ax,ax ; clears carry again
mov [si].User_Cx,ax
inc ax
mov [si].User_Bx,ax ; UID = 0x00000001
@@: ret
NetGetUserName endp
page
; *** DefaultServiceError
; *
; * Default error routine - returns ERROR_INVALID_FUNCTION for any API
; * function which we don't support. Reached exclusively through dispatch
; * table
; *
; * ENTRY none
; *
; * EXIT CF = 1
; * AX = ERROR_INVALID_FUNCTION
; *
; * USES ax, flags
; *
; * ASSUMES nothing
; *
; ***
DefaultServiceError proc near
assume cs:ResidentCode
assume ds:nothing
; DbgPrintString <"DefaultServiceError Ax="
; DbgPrintHexWord OriginalAx
; DbgPrintString <" Bx=">,NOBANNER
; DbgPrintHexWord OriginalBx
; DbgCrLf
;
; cause debug output to go to debug port: making invalid BOP will dump registers
;
if DEBUG
mov ax,OriginalAx
mov bx,OriginalBx
DbgUnsupported
endif
mov ax,ERROR_INVALID_FUNCTION
stc
ret
DefaultServiceError endp
page
; *** NetGetEnumInfo
; *
; * Routine which returns various internal redir variables based on an
; * index
; *
; * ENTRY BL = index
; * 0 = CDNames
; * 1 = Comment (not supported)
; * 2 = LanRoot
; * 3 = ComputerName
; * 4 = UserName
; * 5 = Primary Domain
; * 6 = Logon Server
; * 7 = Mailslots Yes/No
; * 8 = RIPL Yes/No
; * 9 = Get RIPL UNC
; * 10 = Get RIPL drive
; * 11 = Start marking CON_RIPL
; * 12 = Stop marking CON_RIPL
; * 13 = exchange int17 handlers
; * 14 = primary WrkNet
; *
; * es:di = buffer for returned info
; *
; * EXIT CF = 0
; * success
; * CF = 1
; * AX = ERROR_INVALID_FUNCTION
; *
; * USES ax, flags
; *
; * ASSUMES nothing
; *
; ***
NetGetEnumInfo proc near
or bl,bl
jnz @f
;
; CDNames (Computer and Domain Names)
;
; DbgPrintString <"NetGetEnumInfo: return CDNames", 13, 10>
SVC SVC_RDRGETCDNAMES
ret
;
; Comment - nothing returned by this or the original redir (ax = invalid
; function, but carry clear?)
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: return Comment", 13, 10>
mov ax,ERROR_INVALID_FUNCTION
ret
;
; LanRoot
;
@@: dec bl
jnz check_computername
DbgPrintString <"NetGetEnumInfo: return LanRoot", 13, 10>
pusha ; save user gp regs
push es ; save user seg regs
push ds
mov si,ResidentData
mov ds,si
assume ds:ResidentData
mov si,offset LanRoot
mov cx,LanRootLength
shr cx,1 ; cx = number of words to copy, cf=lsb
cld
rep movsw ; copy words
jnc @f ; if not odd number of bytes skip
movsb ; copy single byte
@@: pop ds ; restore user seg regs
pop es
popa ; restore user gp regs
ret
;
; ComputerName
;
check_computername:
dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: return ComputerName", 13, 10>
SVC SVC_RDRGETCOMPUTERNAME
ret
;
; Username
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: return UserName", 13, 10>
;
; This is also the entry point for NetGetUserName, which return some info in
; cx:bx (the (ignored) UID). We could leave this random, but we set it to a
; known value, just in case
;
NetGetUserNameSvcCall:
SVC SVC_RDRGETUSERNAME ; either 0 if for NetGetEnumInfo or 1 if NetGetUserName
ret
;
; Primary domain name
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: return DomainName", 13, 10>
SVC SVC_RDRGETDOMAINNAME
ret
;
; Logon server name
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: return LogonServerName", 13, 10>
SVC SVC_RDRGETLOGONSERVER
ret
;
; Mailslots YN
;
; Mailslots are always enabled with this redir, so return yes (TRUE, 1)
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: Mailslot check", 13, 10>
mov ax,1
ret
;
; RIPL YN
;
; This redir doesn't know anything about RPL, so return no (FALSE, 0)
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: RIPL check", 13, 10>
xor ax,ax
ret
;
; RIPL UNC
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: return RIPL UNC", 13, 10>
jmps DefaultServiceError
;
; RIPL drive
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: return RIPL drive", 13, 10>
jmps DefaultServiceError
;
; Start marking CON_RIPL
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: Start marking CON_RIPL", 13, 10>
jmps DefaultServiceError
;
; Stop marking CON_RIPL
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: Stop marking CON_RIPL", 13, 10>
jmps DefaultServiceError
;
; exchange int 17 handlers
;
; We don't support this so return error
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: exchange int 17 handlers", 13, 10>
jmps DefaultServiceError
;
; primary WrkNet
;
; This is transport-specific so we don't return anything except error
;
@@: dec bl
jnz @f
DbgPrintString <"NetGetEnumInfo: return primary WrkNet", 13, 10>
jmps DefaultServiceError
;
; anything else - return an error
;
@@: DbgPrintString "NetGetEnumInfo: unknown request: "
DbgPrintHexWord bx
DbgCrLf
jmps DefaultServiceError
NetGetEnumInfo endp
page
; *** NetSpoolStuff
; *
; * Gets control from INT 2f/ax=1125h. This really has no use in NTVDM,
; * but we supply it because DOS has started making 1125 calls. Spooling
; * in NTVDM has nothing to do with the Redir TSR. Historically, printing
; * over the net was handled by the redir & this call was used (amongst
; * other things) to flush & close all spool files when an app terminated
; *
; * ENTRY AL = 7 Return truncate flag in DL (DH destroyed)
; * AL = 8 Set truncate flag from DL (must be 0 or 1)
; * AL = 9 Close all spool files
; *
; * EXIT CF = 1
; * AX = ERROR_INVALID_FUNCTION
; *
; * USES ax, dx, si, ds, flags
; *
; * ASSUMES nothing
; *
; ***
PrintTruncate db 0
NetSpoolStuff proc near
sub al,9 ; most common case first
jnz @f
net_spool_stuff_good_exit:
xor ax,ax ; nothing to do for CloseAllSpool!
ret
@@: inc al
jnz @f ; must be get, or invalid
mov ax,ERROR_INVALID_PARAMETER
cmp dl,1 ; must be 0 or 1
ja net_spool_stuff_error_exit
mov PrintTruncate,dl
jmp short net_spool_stuff_good_exit
@@: inc al
mov ax,ERROR_INVALID_FUNCTION
jnz net_spool_stuff_error_exit
;
; return PrintTruncate flag to caller (app)
;
DosCallBack GET_USER_STACK
mov dl,PrintTruncate
xor dh,dh
mov [si].User_Dx,dx
ret
net_spool_stuff_error_exit:
stc
ret
NetSpoolStuff endp
page
if DEBUG
even
public Old21Handler
Old21Handler dd ?
public CheckInt21Function5e
CheckInt21Function5e proc far
assume cs:ResidentCode
assume ds:nothing
assume es:nothing
assume ss:nothing
; cmp ah,5eh
; jnz @f
; DbgUnsupported
@@: jmp Old21Handler ; let DOS handle it. DOS returns to caller
CheckInt21Function5e endp
endif
ResidentCodeEnd
end
|
specs/ada/server/ees/tkmrpc-operation_handlers-ees-esa_acquire.adb | DrenfongWong/tkm-rpc | 0 | 15338 | <reponame>DrenfongWong/tkm-rpc
with Tkmrpc.Servers.Ees;
with Tkmrpc.Results;
with Tkmrpc.Request.Ees.Esa_Acquire.Convert;
with Tkmrpc.Response.Ees.Esa_Acquire.Convert;
package body Tkmrpc.Operation_Handlers.Ees.Esa_Acquire is
-------------------------------------------------------------------------
procedure Handle (Req : Request.Data_Type; Res : out Response.Data_Type) is
Specific_Req : Request.Ees.Esa_Acquire.Request_Type;
Specific_Res : Response.Ees.Esa_Acquire.Response_Type;
begin
Specific_Res := Response.Ees.Esa_Acquire.Null_Response;
Specific_Req := Request.Ees.Esa_Acquire.Convert.From_Request (S => Req);
if Specific_Req.Data.Sp_Id'Valid then
Servers.Ees.Esa_Acquire
(Result => Specific_Res.Header.Result,
Sp_Id => Specific_Req.Data.Sp_Id);
Res :=
Response.Ees.Esa_Acquire.Convert.To_Response (S => Specific_Res);
else
Res.Header.Result := Results.Invalid_Parameter;
end if;
end Handle;
end Tkmrpc.Operation_Handlers.Ees.Esa_Acquire;
|
programs/oeis/114/A114091.asm | jmorken/loda | 1 | 94099 | ; A114091: Number of partitions of n into parts that are distinct mod 3.
; 1,1,2,2,2,4,3,3,7,4,4,11,5,5,16,6,6,22,7,7,29,8,8,37,9,9,46,10,10,56,11,11,67,12,12,79,13,13,92,14,14,106,15,15,121,16,16,137,17,17,154,18,18,172,19,19,191,20,20,211,21,21,232,22,22,254,23,23,277,24,24,301,25,25,326,26,26,352,27,27,379,28,28,407,29,29,436,30,30,466,31,31,497,32,32,529,33,33,562,34,34,596,35,35,631,36,36,667,37,37,704,38,38,742,39,39,781,40,40,821,41,41,862,42,42,904,43,43,947,44,44,991,45,45,1036,46,46,1082,47,47,1129,48,48,1177,49,49,1226,50,50,1276,51,51,1327,52,52,1379,53,53,1432,54,54,1486,55,55,1541,56,56,1597,57,57,1654,58,58,1712,59,59,1771,60,60,1831,61,61,1892,62,62,1954,63,63,2017,64,64,2081,65,65,2146,66,66,2212,67,67,2279,68,68,2347,69,69,2416,70,70,2486,71,71,2557,72,72,2629,73,73,2702,74,74,2776,75,75,2851,76,76,2927,77,77,3004,78,78,3082,79,79,3161,80,80,3241,81,81,3322,82,82,3404,83,83,3487,84
mov $5,$0
mov $7,2
lpb $7
clr $0,5
mov $0,$5
sub $7,1
add $0,$7
sub $0,1
lpb $0
sub $0,2
mov $1,$0
cal $1,101882 ; Write three numbers, skip one, write three, skip two, write three, skip three... and so on.
sub $0,1
add $2,$1
lpe
mov $1,$2
mov $8,$7
lpb $8
mov $6,$1
sub $8,1
lpe
lpe
lpb $5
mov $5,0
sub $6,$1
lpe
mov $1,$6
add $1,1
|
AutoChessServer/Dependencies/concurrentqueue/benchmarks/tbb/intel64-masm/atomic_support.asm | 908760230/MyAutoChess | 0 | 93268 | ; Copyright 2005-2014 Intel Corporation. All Rights Reserved.
;
; This file is part of Threading Building Blocks. Threading Building Blocks is free software;
; you can redistribute it and/or modify it under the terms of the GNU General Public License
; version 2 as published by the Free Software Foundation. Threading Building Blocks 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 Threading Building Blocks; if not, write to the
; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
;
; As a special exception, you may use this file as part of a free software library without
; restriction. Specifically, if other files instantiate templates or use macros or inline
; functions from this file, or you compile this file and link it with other files to produce
; an executable, this file does not by itself cause the resulting executable to be covered
; by the GNU General Public License. This exception does not however invalidate any other
; reasons why the executable file might be covered by the GNU General Public License.
; DO NOT EDIT - AUTOMATICALLY GENERATED FROM .s FILE
.code
ALIGN 8
PUBLIC __TBB_machine_fetchadd1
__TBB_machine_fetchadd1:
mov rax,rdx
lock xadd [rcx],al
ret
.code
ALIGN 8
PUBLIC __TBB_machine_fetchstore1
__TBB_machine_fetchstore1:
mov rax,rdx
lock xchg [rcx],al
ret
.code
ALIGN 8
PUBLIC __TBB_machine_cmpswp1
__TBB_machine_cmpswp1:
mov rax,r8
lock cmpxchg [rcx],dl
ret
.code
ALIGN 8
PUBLIC __TBB_machine_fetchadd2
__TBB_machine_fetchadd2:
mov rax,rdx
lock xadd [rcx],ax
ret
.code
ALIGN 8
PUBLIC __TBB_machine_fetchstore2
__TBB_machine_fetchstore2:
mov rax,rdx
lock xchg [rcx],ax
ret
.code
ALIGN 8
PUBLIC __TBB_machine_cmpswp2
__TBB_machine_cmpswp2:
mov rax,r8
lock cmpxchg [rcx],dx
ret
.code
ALIGN 8
PUBLIC __TBB_machine_pause
__TBB_machine_pause:
L1:
dw 090f3H; pause
add ecx,-1
jne L1
ret
end
|
private/windows/shell/accesory/cardfile/indos2.asm | King0987654/windows2000 | 11 | 90434 | title indos2.asm
;************************************************************************/
;* */
;* Windows Cardfile - Written by <NAME> */
;* (c) Copyright Microsoft Corp. 1985, 1991 - All Rights Reserved */
;* */
;************************************************************************/
.xlist
include cmacros.inc
.list
createSeg _INPUT,REPMOV,byte,public,CODE
sBegin DATA
sEnd DATA
sBegin REPMOV
assumes CS,REPMOV
assumes DS,DATA
cProc RepMov,<PUBLIC,FAR>,<di,si>
parmD lpDest
parmD lpSrc
parmW cnt
cBegin
push ds
cld
les di,lpDest
lds si,lpSrc
mov cx,cnt
repne movsb
pop ds
cEnd
cProc RepMovDown,<PUBLIC,FAR>,<di,si>
parmD lpDest
parmD lpSrc
parmW cnt
cBegin
push ds
std
les di,lpDest
lds si,lpSrc
mov cx,cnt
add si,cx
add di,cx
dec si
dec di
repne movsb
cld
pop ds
cEnd
sEnd REPMOV
end
|
src/sfx.asm | santiontanon/talesofpopolon-ext | 4 | 19913 | SFX_fire_arrow:
db 4,#00,5,#04 ;; frequency
db 10,#10 ;; volume
db 11,#00,12,#10 ;; envelope frequency
db 13 + MUSIC_CMD_TIME_STEP_FLAG,#09 ;; shape of the envelope
; db 7,#b8 ;; sets channels to wave
db MUSIC_CMD_SKIP
db 4,#00,5 + MUSIC_CMD_TIME_STEP_FLAG,#08 ;; frequency
db MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP
db 10,#00 ;; silence
db SFX_CMD_END
SFX_fire_bullet_enemy:
db 4,#00,5,#02 ;; frequency
db 10,#10 ;; volume
db 11,#00,12,#10 ;; envelope frequency
db 13 + MUSIC_CMD_TIME_STEP_FLAG,#09 ;; shape of the envelope
; db 7,#b8 ;; sets channels to wave
db MUSIC_CMD_SKIP
db 4,#00,5,#04 ;; frequency
db MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP, MUSIC_CMD_SKIP
db 10,#00 ;; silence
db SFX_CMD_END
SFX_sword_swing:
db 7,#9c ;; noise in channel C, and tone in channels B and A
db 10,#0a ;; volume
db 6 + MUSIC_CMD_TIME_STEP_FLAG,#16 ;; noise frequency
db 10,#0c ;; volume
db 6 + MUSIC_CMD_TIME_STEP_FLAG,#14 ;; noise frequency
db 10,#0f ;; volume
db 6 + MUSIC_CMD_TIME_STEP_FLAG,#12 ;; noise frequency
db 6 + MUSIC_CMD_TIME_STEP_FLAG,#10 ;; noise frequency
db 10,#0c ;; volume
db 6 + MUSIC_CMD_TIME_STEP_FLAG,#08 ;; noise frequency
db 10,#0a ;; volume
db 6 + MUSIC_CMD_TIME_STEP_FLAG,#06 ;; noise frequency
db 10,#08 ;; volume
db 6 + MUSIC_CMD_TIME_STEP_FLAG,#04 ;; noise frequency
db 10,#06 ;; volume
db 6 + MUSIC_CMD_TIME_STEP_FLAG,#02 ;; noise frequency
db 10,#04 ;; volume
db 6 + MUSIC_CMD_TIME_STEP_FLAG,#01 ;; noise frequency
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#02 ;; volume
db 10,#00 ;; silence
db SFX_CMD_END
SFX_hit_enemy:
db 7,#b8 ;; SFX all channels to tone
db 10,#0f ;; volume
db 4,#0, 5 + MUSIC_CMD_TIME_STEP_FLAG,4 ;; frequency
db 5 + MUSIC_CMD_TIME_STEP_FLAG,5 ;; frequency
db 5 + MUSIC_CMD_TIME_STEP_FLAG,6 ;; frequency
db 5 + MUSIC_CMD_TIME_STEP_FLAG,7 ;; frequency
db 5 + MUSIC_CMD_TIME_STEP_FLAG,8 ;; frequency
db 10,#0d ;; volume
db 5 + MUSIC_CMD_TIME_STEP_FLAG,9 ;; frequency
db 10,#0a ;; volume
db 5 + MUSIC_CMD_TIME_STEP_FLAG,10 ;; frequency
db 10,#00 ;; volume
db SFX_CMD_END
SFX_hit_deflected:
db 7,#9c ;; noise in channel C, and tone in channels B and A
db 10,#0f ;; volume
db 6 + MUSIC_CMD_TIME_STEP_FLAG,#04 ;; noise frequency
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; volume
db MUSIC_CMD_SKIP
db 6,#01 ;; noise frequency
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#0c ;; volume
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; volume
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#0a ;; volume
db MUSIC_CMD_SKIP
db 7,#b8 ;; SFX all channels to tone
db 10,#0c ;; volume
db 4,#20, 5 + MUSIC_CMD_TIME_STEP_FLAG,0 ;; frequency
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; volume
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#0a ;; volume
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; volume
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#08 ;; volume
db MUSIC_CMD_SKIP
db 10,#00 ;; volume
db SFX_CMD_END
SFX_enemy_kill:
db 7,#b8 ;; SFX all channels to tone
db 10,#0f ;; volume
db 4,0, 5 + MUSIC_CMD_TIME_STEP_FLAG,8 ;; frequency
db MUSIC_CMD_SKIP
db 5 + MUSIC_CMD_TIME_STEP_FLAG,6 ;; frequency
db MUSIC_CMD_SKIP
db 10,#0b ;; volume
db 5 + MUSIC_CMD_TIME_STEP_FLAG,4 ;; frequency
db MUSIC_CMD_SKIP
db 10,#08 ;; volume
db 5 + MUSIC_CMD_TIME_STEP_FLAG,2 ;; frequency
db MUSIC_CMD_SKIP
db 10,#0d ;; volume
db 5 + MUSIC_CMD_TIME_STEP_FLAG,6 ;; frequency
db MUSIC_CMD_SKIP
db 5 + MUSIC_CMD_TIME_STEP_FLAG,4 ;; frequency
db MUSIC_CMD_SKIP
db 10,#08 ;; volume
db 5 + MUSIC_CMD_TIME_STEP_FLAG,3 ;; frequency
db MUSIC_CMD_SKIP
db 10,#06 ;; volume
db 5 + MUSIC_CMD_TIME_STEP_FLAG,2 ;; frequency
db MUSIC_CMD_SKIP
db 10,#0b ;; volume
db 5 + MUSIC_CMD_TIME_STEP_FLAG,4 ;; frequency
db MUSIC_CMD_SKIP
db 5 + MUSIC_CMD_TIME_STEP_FLAG,3 ;; frequency
db MUSIC_CMD_SKIP
db 10,#06 ;; volume
db 5 + MUSIC_CMD_TIME_STEP_FLAG,2 ;; frequency
db MUSIC_CMD_SKIP
db 10,#04 ;; volume
db 5 + MUSIC_CMD_TIME_STEP_FLAG,1 ;; frequency
db MUSIC_CMD_SKIP
db 10,#00 ;; silence
db SFX_CMD_END
SFX_weapon_switch:
db 7,#b8 ;; SFX all channels to tone
db 10,#0f ;; volume
db 4,0, 5 + MUSIC_CMD_TIME_STEP_FLAG,#01 ;; frequency
db MUSIC_CMD_SKIP
db MUSIC_CMD_SKIP
db 4,#40,5 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#0d ;; volume
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#0b ;; volume
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#09 ;; volume
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#07 ;; volume
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#05 ;; volume
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#03 ;; volume
db 10,#00 ;; silence
db SFX_CMD_END
SFX_item_pickup:
db 7,#b8 ;; SFX all channels to tone
db 10,#0f ;; volume
db 4,#80, 5 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db 10,#0d ;; volume
db MUSIC_CMD_SKIP
db 10,#0f ;; volume
db 4,#70, 5 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#0d ;; volume
db 10,#0f ;; volume
db 4,#60, 5 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#0d ;; volume
db 10,#0f ;; volume
db 4,#50, 5 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#0d ;; volume
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#0b ;; volume
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#08 ;; volume
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#06 ;; volume
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#04 ;; volume
db MUSIC_CMD_SKIP
db 10 + MUSIC_CMD_TIME_STEP_FLAG,#02 ;; volume
db MUSIC_CMD_SKIP
db 10,#00 ;; silence
db SFX_CMD_END
SFX_door_open:
db 7,#b8 ;; SFX all channels to tone
db 10,#0f ;; volume
db 4,#00, 5 + MUSIC_CMD_TIME_STEP_FLAG,#06 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#0e ;; volume
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#0d ;; volume
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#0c ;; volume
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#0b ;; volume
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#0a ;; volume
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#08 ;; volume
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#07 ;; volume
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#06 ;; volume
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#05 ;; volume
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#04 ;; volume
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#80 ;; frequency
db MUSIC_CMD_SKIP
db 10,#00 ;; silence
db SFX_CMD_END
SFX_hourglass:
db 7,#b8 ;; SFX all channels to tone
db 10,#0f ;; volume
db 4,#40, 5 + MUSIC_CMD_TIME_STEP_FLAG,#00 ;; frequency
db MUSIC_CMD_SKIP
db 10,#00 ;; silence
db SFX_CMD_END
SFX_playerhit:
db 7,#b8 ;; SFX all channels to tone
db 10,#0f ;; volume
db 4,#00, 5 + MUSIC_CMD_TIME_STEP_FLAG,#08 ;; frequency
db MUSIC_CMD_SKIP
db 5 + MUSIC_CMD_TIME_STEP_FLAG,#04 ;; frequency
db 5 + MUSIC_CMD_TIME_STEP_FLAG,#02 ;; frequency
db 5 + MUSIC_CMD_TIME_STEP_FLAG,#01 ;; frequency
db 4,#80, 5 + MUSIC_CMD_TIME_STEP_FLAG, #00 ;; frequency
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#40 ;; frequency
db 4 + MUSIC_CMD_TIME_STEP_FLAG,#20 ;; frequency
db MUSIC_CMD_SKIP
db 10,#00 ;; silence
db SFX_CMD_END
|
oeis/001/A001018.asm | neoneye/loda-programs | 11 | 101767 | ; A001018: Powers of 8: a(n) = 8^n.
; 1,8,64,512,4096,32768,262144,2097152,16777216,134217728,1073741824,8589934592,68719476736,549755813888,4398046511104,35184372088832,281474976710656,2251799813685248,18014398509481984,144115188075855872,1152921504606846976,9223372036854775808,73786976294838206464,590295810358705651712,4722366482869645213696,37778931862957161709568,302231454903657293676544,2417851639229258349412352,19342813113834066795298816,154742504910672534362390528,1237940039285380274899124224,9903520314283042199192993792
mov $1,8
pow $1,$0
mov $0,$1
|
libsrc/_DEVELOPMENT/adt/b_array/c/sdcc_iy/b_array_data_fastcall.asm | meesokim/z88dk | 0 | 965 |
; void *b_array_data_fastcall(b_array_t *a)
SECTION code_adt_b_array
PUBLIC _b_array_data_fastcall
defc _b_array_data_fastcall = asm_b_array_data
INCLUDE "adt/b_array/z80/asm_b_array_data.asm"
|
gfx/pokemon/gloom/anim_idle.asm | Dev727/ancientplatinum | 28 | 14820 | <gh_stars>10-100
setrepeat 2
frame 0, 10
frame 5, 10
dorepeat 1
endanim
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.