hexsha stringlengths 40 40 | size int64 6 1.05M | ext stringclasses 3 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 4 232 | max_stars_repo_name stringlengths 7 106 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 7 | max_stars_count int64 1 33.5k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 232 | max_issues_repo_name stringlengths 7 106 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 7 | max_issues_count int64 1 37.5k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 232 | max_forks_repo_name stringlengths 7 106 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 7 | max_forks_count int64 1 12.6k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 6 1.05M | avg_line_length float64 1.16 19.7k | max_line_length int64 2 938k | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
54e5ee84285eb19ec32224ea13f2b54a69216c0c | 3,566 | asm | Assembly | src/dict_a.asm | PeterCamilleri/zed8e | f4eda87cc9eea4e305d789ff282d04645260a7b5 | [
"MIT"
] | null | null | null | src/dict_a.asm | PeterCamilleri/zed8e | f4eda87cc9eea4e305d789ff282d04645260a7b5 | [
"MIT"
] | null | null | null | src/dict_a.asm | PeterCamilleri/zed8e | f4eda87cc9eea4e305d789ff282d04645260a7b5 | [
"MIT"
] | null | null | null | ; Zed8E FORTH - A direct threaded FORTH for the Z-80
;
; The FORTH ROM dictionary part A, stack manipulation.
;
__drop: ; a --
; Drop the top of data stack.
word 0 ; This is the last entry in the dictionary.
byte xix
byte 4
abyte 0 "drop"
cfa_drop:
pop hl
jp pnext
__dup: ; a -- a a
; Duplicate the top of data stack.
word __drop
byte xix
byte 3
abyte 0 "dup"
cfa_dup:
pop hl
push hl
push hl
jp pnext
__swap: ; a b -- b a
; Swap the top and next of the data stack.
word __dup
byte xix
byte 4
abyte 0 "swap"
cfa_swap:
pop hl
pop de
push hl
push de
jp pnext
__over: ; a b -- b a b
; Pull a copy of the next of stack over the top.
word __swap
byte xix
byte 4
abyte 0 "over"
cfa_over:
pop hl
pop de
push de
push hl
push de
jp pnext
__rot: ; a b c -- c a b
; Rotate the top three data stack elements.
word __over
byte xix
byte 3
abyte 0 "rot"
cfa_rot:
exx
pop hl
pop de
pop bc
push de
push hl
push bc
exx
jp pnext
__qdup: ; a -- a a if a <> 0
; a -- 0 if a == 0
; Duplicate the top of the data stack if it's not zero.
word __rot
byte xix
byte 4
abyte 0 "?dup"
cfa_qdup:
pop hl
push hl
ld a,l
or h
jr z,__qdup_z
push hl
__qdup_z:
jp pnext
__2drop: ; da --
; a b --
; Drop the double data top of data stack.
word __qdup
byte xix
byte 5
abyte 0 "2drop"
cfa_2drop:
pop hl
pop hl
jp pnext
__2dup: ; da -- da da
; a b -- a b a b
; Duplicate the double top of data stack.
word __2drop
byte xix
byte 4
abyte 0 "2dup"
cfa_2dup:
pop hl
pop de
push de
push hl
push de
push hl
jp pnext
__2swap: ; da db -- db da
; a b c d -- c d a b
; Swap the double top and next.
word __2dup
byte xix
byte 5
abyte 0 "2swap"
cfa_2swap:
pop hl
pop de
exx
pop hl
pop de
exx
push de
push hl
exx
push de
push hl
exx
jp pnext
__2over: ; 2a 2b -- 2b 2a 2b
; a b c d -- c d a b c d
; Pull a copy of the double next of stack over the top.
word __2swap
byte xix
byte 5
abyte 0 "2over"
cfa_2over:
pop hl
pop de
exx
pop hl
pop de
push de
push hl
exx
push de
push hl
exx
push de
push hl
exx
jp pnext
__2rot: ; da db dc -- dc da db
; a b c d e f -- e f a b c d
; Rotate the top three double data stack elements.
word __2over
byte xix
byte 4
abyte 0 "2rot"
cfa_2rot:
pop hl
pop de
exx
pop hl
pop de
pop bc
pop pnext
push de
push hl
exx
push de
push hl
exx
push pnext
push bc
exx
ld pnext,next ; pnext always points to next.
jp pnext
; Define the last entry in dictionary section 'a'.
define last_a __2rot
| 18.572917 | 67 | 0.464105 |
8868f492b85e93f1ad20b9bcf7c53354a93923b2 | 123 | asm | Assembly | asm/src/long_boot.asm | jrasky/kernel | cfe3bb8e73600afc6eb6b53c5ff7437160909ab4 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | asm/src/long_boot.asm | jrasky/kernel | cfe3bb8e73600afc6eb6b53c5ff7437160909ab4 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | asm/src/long_boot.asm | jrasky/kernel | cfe3bb8e73600afc6eb6b53c5ff7437160909ab4 | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | global _lboot
extern _lstart
section .boot_text
bits 64
_lboot:
;; jump to actual entry
jmp _lstart
| 12.3 | 27 | 0.650407 |
e3ccee25d20423ca274bb02d9daf87317da07e6f | 4,940 | asm | Assembly | asm/por_allow_mastering_spells.asm | Iemnur/DSVEdit | 1f52feb6de8a47c7d223a17d739e69bb40aedd3f | [
"MIT"
] | 70 | 2017-02-25T15:06:47.000Z | 2022-03-16T03:05:35.000Z | asm/por_allow_mastering_spells.asm | Iemnur/DSVEdit | 1f52feb6de8a47c7d223a17d739e69bb40aedd3f | [
"MIT"
] | 58 | 2017-03-12T21:34:50.000Z | 2022-01-31T17:22:36.000Z | asm/por_allow_mastering_spells.asm | Iemnur/DSVEdit | 1f52feb6de8a47c7d223a17d739e69bb40aedd3f | [
"MIT"
] | 26 | 2017-03-04T16:35:13.000Z | 2021-11-24T20:52:19.000Z | .nds
.relativeinclude on
.erroronwarning on
; This allows Charlotte's spells to gain SP like subweapons do.
; Once a spell is mastered, it will act like it is fully-charged even if half-charged.
; If you fully charge a spell that is also mastered, it acts super-charged, doing 3x damage and possibly having more projectiles than normal.
; Note that unlike subweapons, spells do not gradually scale in damage as you gain SP. They only suddenly increase once mastered.
.open "ftc/overlay9_0", 021CDF60h
.org 0x021D9E10
; When the enemy is hit, it checks the type of the attack to see if it's a subweapon (damage type bit 02000000).
; If it is, the enemy is marked so that it should give SP whenever it dies.
; We change the damage type bit mask it checks to 06000000, so it gives SP if it's hit by either a subweapon or a spell.
ands r0, r0, 06000000h
.org 0x021D9B10
; When SP is added to the player's current skill, it only checks Jonathan's equipped skill.
; So we need to change it to add to the controlled character's equipped skill's SP.
; We also change the Master Ring checks to check the controlled character instead of always Jonathan.
; Note: Because this adds SP to whatever player character is currently controlled, using your partner's skill with the skill cube does not give SP to your partner, but to you instead. Same with the Master Ring checks.
; r0 already has 020CA580 in it from the line before, so we add 47000 to it to get 02111580.
add r1, r0, 47000h
; Checks if the game mode is Jonathan mode
ldrb r0, [r1,09D1h] ; 02111F51, current game mode
cmp r0, 0h
bne 21D9C00h
; Checks if the enemy had ever been hit by a subweapon (or a spell now)
ldr r0,[r8,120h] ; Enemy+120
ands r0,r0,2000h
beq 21D9C00h
ldrb r0, [r1,09D7h] ; 02111F57, current player number
mov r2,6Ch ; Size of each player's info is 0x6C
mul r2,r0,r2
add r1,r1,r2
ldrb r0, [r1,0BFEh] ; Currently equipped skill (0211217E or 021121EA). (Note that this is technically a halfword, but we need to read it as a byte because the opcode to read halfwords has more limited immediate offsets.)
; Check that there is an equipped skill.
cmp r0, 0h
beq 21D9C00h
ldrb r3,[r6,0Dh] ; Read SP given by this enemy
ldrb r2, [r1,0C06h] ; Currently equipped accessory 1 (02112186 or 021121F2). (Note that this is technically a halfword, but we need to read it as a byte because the opcode to read halfwords has more limited immediate offsets.)
cmp r2, 0Eh ; Check if Master Ring is equipped
moveq r3,r3,lsl 1h ; Double given SP if so
ldrb r2, [r1,0C08h] ; Currently equipped accessory 2 (02112188 or 021121F4). (Note that this is technically a halfword, but we need to read it as a byte because the opcode to read halfwords has more limited immediate offsets.)
cmp r2, 0Eh ; Check if Master Ring is equipped
moveq r3,r3,lsl 1h ; Double given SP if so
; Fixes the multiplier on spells not increasing by 1 when the spell is mastered.
.org 0x02214DC8
ldrneb r2, [r0,11Eh] ; Where the spell's multiplier is stored
addne r2, r2, r4 ; r4 has the bonus multiplier for fully charging the spell (0 or 1)
strneb r2, [r0,11Eh]
; Fixes Charlotte not yelling out the name of the spell when it's charged to level 3.
.org 0x021F227C
cmp r0, 1h
beq 0x021F22AC
.close
.open "ftc/arm9.bin", 02000000h
.org 0x0203C894
; Fixes mastered spells not having yellow names in Charlotte's spell equip menu.
; Normally this line skipped making the name yellow if the skill index was >= 0x27 (the first spell index), so we change it to >= 0x51 (the first dual crush index).
cmp r0, 51h
.close
; Now make some fixes to specific spells at level 3.
.open "ftc/overlay9_0", 021CDF60h
; Spirit of Light
.org 0x021EFF8C
; Normally it would only create 2 projectiles if the multiplier is 2.
; Instead we change it to create 2 projectiles as long as the multiplier is not 1.
cmp r0, 1h
beq 0x021EFFC8
; Stone Circle
.org 0x021ECD90
; Normally level 3 Stone Circle would attempt to create 12 stones, but there's only enough entity slots for 9, so there would be a gap in the circle.
; So limit it to 9 stones.
cmp r8, 9h
movgt r8, 9h
; Ice Needle
.org 0x021EC700
; Similar to the above, we limit it to 9 projectiles instead of 12.
mov r5, 1h
mov r1, r2, lsl 2h
cmp r1, 9h
movgt r1, 9h
strh r1, [r4, 18h]
; But then we also need to adjust the delay in frames in between creating each projectile.
; Normally for level 1 it waits 0x10 frames between creating each one, and for level 2 it waits 8 frames. Either way it takes 0x40 frames in total.
; It calculates this as 10-((level-1)*8).
; Since that formula wouldn't work for level 3 (it would wait 0 frames between each projectile), we change it to calculate the number of frames as 0x40 divided by the number of projectiles.
mov r0, 40h
bl 0x020BD93C ; Divide
strh r0, [r4, 1Ch]
strb r5, [r4, 0Dh]
.close
| 44.107143 | 228 | 0.73664 |
79abb7f078ab4cf8d889ecd8a76f173eda196ccd | 2,003 | asm | Assembly | Labs/Lab5/lab05_ex2.asm | ptr2578/CS61 | 682dccd6b986f383120a4612eb7e7a2d1e3cfa3f | [
"BSD-3-Clause"
] | 1 | 2019-01-01T23:31:22.000Z | 2019-01-01T23:31:22.000Z | Labs/Lab5/lab05_ex2.asm | ptr2578/CS61 | 682dccd6b986f383120a4612eb7e7a2d1e3cfa3f | [
"BSD-3-Clause"
] | null | null | null | Labs/Lab5/lab05_ex2.asm | ptr2578/CS61 | 682dccd6b986f383120a4612eb7e7a2d1e3cfa3f | [
"BSD-3-Clause"
] | null | null | null | ;=================================================
; Name: Sungho Ahn
; Email: sahn025@ucr.edu
; GitHub username: ptr2578
;
; Lab: lab 5
; Lab section: B21
; TA: Jason Goulding
;
;=================================================
.ORIG x3000
;--------------
; Instructions
;--------------
LD R1, ARRAY_PTR ; Load address of Array into R1
ADD R0, R0, #0 ; Put number 0 in R0
ADD R3, R3, #10 ; R3 used for loop counter
ADD R4, R4, #7 ; R4 used for secondary counter to grab 7th
;-------------
; CODE BEGINS
;-------------
Loop ; BRANCH Loop/ Loop begins
ADD R3, R3, #-1 ; Decrement the loop counter
BRn LoopEnd ; If counter becomes 0, out the loop
ADD R4, R4, #-1 ; Check if current array is 7th slot
BRz GrabSeven ; If the secondary counter is 0, grab the value
BR GrabSevenEnd ; Skip the steps if it is not yet 7th
GrabSeven ; BRANCH GrabSeven
ADD R2, R0, #0 ; Grab the 7th array value into R2
GrabSevenEnd ; BRANCH GrabSevenEnd
STR R0, R1, #0 ; Stores the number in R0 into the array
ADD R1, R1, #1 ; Move to next data slot
ADD R0, R0, #1 ; Increase the value in R0
BR Loop ; Backt to top of the loop
LoopEnd ; BRANCH LoopEnd
LD R1, ARRAY_PTR ; Reload R1 with the array address
AND R3, R3, #0 ; Clear R0 for next use
ADD R3, R3, #10 ; Refill the loop counter with 10
LD R5, POS48 ; Load ASCII Hex value x30 into R5
OutputLoop ; Branch OutputLoop/ Loop begins
ADD R3, R3, #-1 ; Decrement loop counter
BRn OutputLoopEnd ; If zero, out the loop
LDR R0, R1, #0 ; Load direct the value of array into R0
ADD R0, R0, R5 ; Add x30 to change the value to character
OUT ; Print out the character
ADD R1, R1, #1 ; Move to the next data slot
BR OutputLoop ; Back to the top of the loop
OutputLoopEnd ; Branch OutputLoopEnd
HALT
;------
; Data
;------
ARRAY_PTR .FILL x4000
POS48 .FILL x30
;-------------
; Remote data
;-------------
.ORIG x4000
ARRAY .BLKW #10
;----------------
; END of Program
;----------------
.END | 25.679487 | 64 | 0.600599 |
a5607638d11ec07c5eab00ec1f841cf726177649 | 556 | asm | Assembly | libsrc/_DEVELOPMENT/arch/zx/bifrost2/c/sdcc/BIFROST2_showTilePosH_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/arch/zx/bifrost2/c/sdcc/BIFROST2_showTilePosH_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/arch/zx/bifrost2/c/sdcc/BIFROST2_showTilePosH_callee.asm | jpoikela/z88dk | 7108b2d7e3a98a77de99b30c9a7c9199da9c75cb | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z | ; ----------------------------------------------------------------
; Z88DK INTERFACE LIBRARY FOR THE BIFROST*2 ENGINE
;
; See "bifrost2.h" for further details
; ----------------------------------------------------------------
; void BIFROST2_showTilePosH(unsigned char lin,unsigned char col)
; callee
SECTION code_clib
SECTION code_bifrost2
PUBLIC _BIFROST2_showTilePosH_callee
EXTERN asm_BIFROST2_showTilePosH
_BIFROST2_showTilePosH_callee:
pop hl
ex (sp),hl
ld d,l ; D = lin
ld e,h ; E = col
jp asm_BIFROST2_showTilePosH
| 22.24 | 66 | 0.568345 |
b55b190561d85332ce84ada4a08adf050887111a | 8,271 | asm | Assembly | src/dns.asm | speccytools/spectranet-index-module | d23b03c3b11ce4fb07129392ff5a16b4651e69ca | [
"MIT"
] | null | null | null | src/dns.asm | speccytools/spectranet-index-module | d23b03c3b11ce4fb07129392ff5a16b4651e69ca | [
"MIT"
] | null | null | null | src/dns.asm | speccytools/spectranet-index-module | d23b03c3b11ce4fb07129392ff5a16b4651e69ca | [
"MIT"
] | null | null | null | include "../include/spectranet.inc"
include "../include/sysvars.inc"
include "vars.inc"
include "memory.inc"
;========================================================================
; F_dnsAquery
; Queries a DNS server for TXT records, using the servers enumerated
; in system variables v_nameserver1 and v_nameserver2.
; Stores results as a series of null-terminated strings, stored at address of 0x1000 (page a)
; Note that that address is noing to be valid forever - so long page a doesn't change
;
; Parameters: HL = pointer to null-terminated string containing address to query
; Returns : HL = NULL (error) or a pointer past last byte of series of null-terminated strings
;
global _resolve_txt_records
_resolve_txt_records:
ld a, (PAGE_DNS_REQUEST)
call SETPAGEA
ld ix, hl ; preserve query
ld c, SOCK_STREAM ; Open a TCP socket
call SOCKET
jp c, errorout ; bale out on error
ld (v_dnsfd), a ; save the file descriptor
ld de, (v_cur_resolver)
ld bc, dns_port
call CONNECT ; connect to the resolver over TCP
jp c, errorcleanup2
; set up the query string to resolve in the workspace area
ld de, buf_workspace+14 ; write it after the header
ld hl, ix ; restore query
call F_dnsstring ; string to convert in hl
xor a
ld b, dns_TXTrecord ; query type TXT
ld (hl), a ; MSB of query type (A)
inc hl
ld (hl), b ; LSB of query type (A)
inc hl
ld b, 1 ; IN
ld (hl), a ; MSB of class (IN)
inc hl
ld (hl), b ; LSB of class (IN)
ld de, buf_workspace-1 ; find out the length
sbc hl, de ; of the query block
ld (v_querylength), hl ; and save it in sysvars
ld hl, v_nameserver1 ; set up the first resolver
ld (v_cur_resolver), hl ; and save it in sysvars area
call RAND16 ; generate the DNS query ID
ld (buf_workspace + 2), hl ; store it at the start of the workspace
ld hl, query ; start address of standard query data
ld de, buf_workspace+4 ; destination
ld bc, queryend-query ; bytes to copy
ldir ; build the query header
ld a, (v_querylength + 1)
ld (buf_workspace), a
ld a, (v_querylength)
ld (buf_workspace + 1), a ; store query length in big endian
ld a, (v_dnsfd)
ld de, buf_workspace ; point de at the workspace
ld bc, (v_querylength) ; bc = length of query
inc bc ; bump it by two
inc bc
call SEND ; send the block of data
jr c, errorcleanup2 ; recover if there's an error
resolve_txt_records_recv:
ld a, (v_dnsfd)
ld de, buf_workspace
ld bc, 2
call RECV ; ask for response size
jr c, errorcleanup2 ; recover if there's an error
ld a, (buf_workspace+1) ; read how many data there is
ld e, a
ld a, (buf_workspace) ; in big endian
ld d, a
ld hl, PAGE_A_SIZE
sbc hl, de
jr c, errorcleanup2 ; we cannot handle more than PAGE_A_SIZE
ld a, (v_dnsfd)
ld bc, de ; spell how much to request
ld de, PAGE_A_ADDR ; set de to the message buffer
call RECV
jr c, errorcleanup2
ld a, (v_dnsfd)
call CLOSE
ld a, (PAGE_A_ADDR + dns_bitfield2)
and 0x0F ; Did we successfully resolve something?
jr z, result2 ; yes, so process the answer.
jp errorout
errorcleanup2:
push af
ld a, (v_dnsfd) ; free up the socket we've opened
call CLOSE
pop af
jp errorout
result2:
xor a
ld (v_ansprocessed), a ; set answers processed = 0
ld hl, PAGE_A_ADDR + dns_headerlen
questionloop4:
ld a, (hl) ; advance to the end of the question record
and a ; null terminator?
inc hl
jr nz, questionloop4 ; not null, check the next character
inc hl ; go past QTYPE
inc hl
inc hl ; go past QCLASS
inc hl
ld de, PAGE_A_ADDR ; retrieve pointer to result buffer
decodeanswer4:
ld a, (hl) ; Test for a pointer or a label
and 0xC0 ; First two bits are 1 for a pointer
jr z, skiplabel4 ; otherwise it's a label so skip it
inc hl
inc hl
recordtype4:
inc hl ; skip MSB
ld a, (hl) ; what kind of record?
cp dns_TXTrecord ; is it an A record?
jr nz, skiprecord4 ; if not, advance HL to next answer
ld bc, 9 ; TXT record length is the 9th byte
add hl, bc ; further on in an A record response
ld b, 0
ld c, (hl) ; get the record length
inc hl ; move over
ldir ; copy
ld (de), 0 ; zero-terminate
inc de
jp decodeanswer4 ; next answer
skiplabel4:
ld a, (hl)
and a ; is it null?
jr z, recordtype4 ; yes - process the record type
inc hl
jr skiplabel4
skiprecord4:
ld a, (buf_message+dns_ancount+1)
ld b, a ; number of RR answers in B
ld a, (v_ansprocessed) ; how many have we processed already?
inc a ; pre-increment processed counter
cp b ; compare answers processed with total
jr z, allrecordscomplete ; we've processed all records
ld (v_ansprocessed), a
ld bc, 7 ; skip forward
add hl, bc ; 7 bytes - now pointing at data length
ld b, (hl) ; big-endian length MSB
inc hl
ld c, (hl) ; LSB
inc hl
add hl, bc ; advance hl to the end of the data
jr decodeanswer4 ; decode the next answer
allrecordscomplete:
ld hl, de ; return pointer to past last data byte
ret
errorout:
ld hl, 0 ; return NULL
ret
;========================================================================
; F_dnsstring
; Convert a string (such as 'spectrum.alioth2.net2') into the format
; used in DNS queries and responses. The string is null terminated.
;
; The format adds an 8 bit byte count in front of every part of the
; complete host/domain, replacing the dots, so 'spectrum.alioth2.net2'
; would become [0x08]spectrum[0x06]alioth[0x03]net - the values in
; square brackets being a single byte (8 bit integer).
;
; Parameters: HL - pointer to string to convert
; DE - destination address of finished string
; On exit : HL - points at next byte after converted data
; DE is preserved.
F_dnsstring:
ld (v_fieldptr), de ; Set current field byte count pointer
inc e ; Intial destination address.
findsep3:
ld c, 0xFF ; byte counter, decremented by LDI
loop3:
ld a, (hl) ; What are we looking at?
cp '.' ; DNS string field separator?
jr z, dot3
and a ; Null terminator?
jr z, done3
ldi ; copy (hl) to (de), incrementing both
jr loop3
dot3:
push de ; save current destination address
ld a, c ; low order of byte counter (255 - bytes)
cpl ; turn it into the byte count
ld de, (v_fieldptr) ; retrieve field pointer
ld (de), a ; store byte counter
pop de ; get current destination address back
ld (v_fieldptr), de ; save it
inc e ; and update pointer to new address
inc hl ; address pointer at next character
jr findsep3 ; and get next bit
done3:
push de ; save current destination address
xor a ; put a NULL on the end of the result
ld (de), a
ld a, c ; low order of byte count (255 - bytes)
cpl ; turn it into a byte count
ld de, (v_fieldptr) ; retrieve field pointer
ld (de), a ; save byte count
pop hl ; get current address pointer
inc hl ; add 1 - hl points at next byte after end
ret ; finished.
query: defb 0x01,0x00 ; 16 bit flags field - std. recursive query
qdcount: defb 0x00,0x01 ; we only ever ask one question at a time
ancount: defw 0x0000 ; No answers in a query
nscount: defw 0x0000 ; No NS RRs in a query
arcount: defw 0x0000 ; No additional records
queryend:
| 35.195745 | 96 | 0.59219 |
01cec3baaa8fe32cfd61fa9b1afd33b1397b625b | 1,071 | asm | Assembly | programs/oeis/288/A288487.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/288/A288487.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/288/A288487.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A288487: Cuboids that fit in square rings from A288486 obtaining a fifth power.
; 1,8,75,400,1445,4056,9583,20000,38025,67240,112211,178608,273325,404600,582135,817216,1122833,1513800,2006875,2620880,3376821,4298008,5410175,6741600,8323225,10188776,12374883,14921200,17870525,21268920,25165831,29614208,34670625,40395400,46852715,54110736,62241733,71322200,81432975,92659360,105091241,118823208,133954675,150590000,168838605,188815096,210639383,234436800,260338225,288480200,319005051,352061008,387802325,426389400,467988895,512773856,560923833,612625000,668070275,727459440,790999261,858903608,931393575,1008697600,1091051585,1178699016,1271891083,1370886800,1475953125,1587365080,1705405871,1830367008,1962548425,2102258600,2249814675,2405542576,2569777133,2742862200,2925150775,3117005120,3318796881,3530907208,3753726875,3987656400,4233106165,4490496536,4760257983,5042831200,5338667225,5648227560,5971984291,6310420208,6664028925,7033315000,7418794055,7820992896,8240449633,8677713800,9133346475,9607920400
mov $1,$0
add $0,1
pow $1,2
add $1,1
pow $1,2
mul $0,$1
| 107.1 | 931 | 0.863679 |
e28e83c7b7cde6a2f72e2e2b44ef25c40da14666 | 496 | asm | Assembly | oeis/014/A014610.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/014/A014610.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/014/A014610.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A014610: Tetranacci numbers arising in connection with current algebras sp(2)_n.
; Submitted by Jamie Morken(s3)
; 3,5,10,19,37,71,137,264,509,981,1891,3645,7026,13543,26105,50319,96993,186960,360377,694649,1338979,2580965,4974970,9589563,18484477,35629975,68678985,132383000,255176437,491868397,948106819,1827534653,3522686306,6790196175
add $0,2
mov $2,1
mov $3,1
lpb $0
sub $0,1
add $5,$1
mov $1,$3
sub $3,$4
mov $4,$2
mov $2,$3
add $5,$4
mov $3,$5
add $3,2
lpe
mov $0,$1
| 24.8 | 225 | 0.711694 |
77f942aba01d66be84effa47e9cdb30a7637c117 | 449 | asm | Assembly | examples/demo-grammar/tinyc/src/samples/sample_4_logic.asm | fossabot/FlyLab | 78b53f03c92d7360bca882aa41be2ca0862b51a3 | [
"MIT"
] | null | null | null | examples/demo-grammar/tinyc/src/samples/sample_4_logic.asm | fossabot/FlyLab | 78b53f03c92d7360bca882aa41be2ca0862b51a3 | [
"MIT"
] | null | null | null | examples/demo-grammar/tinyc/src/samples/sample_4_logic.asm | fossabot/FlyLab | 78b53f03c92d7360bca882aa41be2ca0862b51a3 | [
"MIT"
] | null | null | null | FUNC @main:
push 0
push 0
and
print "0 && 0 is %d"
push 0
push 1
and
print "0 && 1 is %d"
push 1
push 0
and
print "1 && 0 is %d"
push 1
push 1
and
print "1 && 1 is %d"
push 0
push 0
or
print "0 || 0 is %d"
push 0
push 1
or
print "0 || 1 is %d"
push 1
push 0
or
print "1 || 0 is %d"
push 1
push 1
or
print "1 || 1 is %d"
push 1
not
print "!1 is %d"
push 0
not
print "!0 is %d"
push 0
ret ~
ENDFUNC
| 8.163636 | 21 | 0.52784 |
102cbe42e546eb5021359830b75475664230de13 | 711 | asm | Assembly | sources/chess.asm | gpont/TSU_ASM | 371c5fcd85be9f1ce48c8f9d0833af6793be288f | [
"MIT"
] | null | null | null | sources/chess.asm | gpont/TSU_ASM | 371c5fcd85be9f1ce48c8f9d0833af6793be288f | [
"MIT"
] | null | null | null | sources/chess.asm | gpont/TSU_ASM | 371c5fcd85be9f1ce48c8f9d0833af6793be288f | [
"MIT"
] | null | null | null | global chess
section .text
chess:
mov rax, rdi ; rax = x1
mov rbx, rsi ; rbx = x2
sub rax, rdx ; rax -= x3
.abs_rax:
neg rax
js .abs_rax ; if (SF=1 (rax < 0)) goto abs_rax
sub rbx, rcx ; rbx -= x4
.abs_rbx:
neg rbx
js .abs_rbx ; if (SF=1 (rbx < 0)) goto abs_rax
cmp rax, 1 ; if(rax == 1)
je .if_x1_sub_x3_eq_1
cmp rax, 2 ; if(rax == 2)
je .if_x1_sub_x3_eq_2
jmp .not_bitten
.if_x1_sub_x3_eq_1:
cmp rbx, 2
je .bitten ; if(ecx == 2)
jmp .not_bitten
.if_x1_sub_x3_eq_2:
cmp rbx, 1
je .bitten ; if(ecx == 1)
jmp .not_bitten
.bitten:
mov rax, 1
jmp .exit
.not_bitten:
mov rax, 0
.exit:
ret
| 14.8125 | 56 | 0.548523 |
feabe4d8fac461e5887886ef98961d8620b0f381 | 3,772 | asm | Assembly | Driver/Printer/PrintCom/Graphics/graphicsPrintSwathNike.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Driver/Printer/PrintCom/Graphics/graphicsPrintSwathNike.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Driver/Printer/PrintCom/Graphics/graphicsPrintSwathNike.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1994 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Dedicated WPs
FILE: graphicsPrintSwathNike.asm
AUTHOR: Dave Durran
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 11/16/94 Initial revision
DESCRIPTION:
$Id: graphicsPrintSwathNike.asm,v 1.1 97/04/18 11:51:25 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrintSwath
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Print a page-wide bitmap
CALLED BY: GLOBAL
PASS: bp - PState segment
dx.cx - VM file and block handle for Huge bitmap
RETURN: carry - set if some transmission error
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
none
REVISION HISTORY:
Name Date Description
---- ---- -----------
Dave 11/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrintSwath proc far
uses ax,bx,cx,dx,si,di,ds,es
.enter
mov es, bp ; es -> PState
; load the bitmap header into the PState
call LoadSwathHeader ; bitmap header into PS_swath
; load up the band width and height
call PrLoadPstateVars ; set up the pstate band Vars.
; get pointer to data
mov es:[PS_curColorNumber],0 ; init offset into scanline.
call DerefFirstScanline ; ds:si -> scan line zero
jcxz printLastBand
bandLoop:
push dx ; save band count
mov dx,es:[PS_bandHeight] ; print a full height band.
call PrPrintHighBand ; print a band from this swath.
pop dx
jc printError ; jmp with carry set
loop bandLoop
; if any remainder, then we need to send it, plus a shorter
; line feed
printLastBand:
tst dx ; any remainder ?
jz unlockVM ; jmp with carry clear
call PrPrintHighBand ; print last band
jnc unlockVM
printError:
mov es:[PS_dWP_Specific].DWPS_returnCode, PDR_PRINT_ERROR
; all done, unlock vmfile and leave
unlockVM:
call HugeArrayUnlock ; preserves flags
.leave
ret
PrintSwath endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrintFinishPage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Finish printing current page
CALLED BY: PrintEndPage
PASS: es = PState
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Joon 4/12/95 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrintFinishPage proc near
uses ax,bx,cx,ds,es
.enter
tst es:[PS_dWP_Specific].DWPS_returnCode
jnz done
mov al, es:[PS_printerType]
and al, mask PT_COLOR
cmp al, BMF_MONO
je done
EC < cmp al, BMF_3CMY >
EC < ERROR_NE -1 ;must be mono or cmy >
; Finish off color printing by finishing off cyan and magenta scanlines
tst es:[PS_bandHeight]
jz done ; abort if no bandHeight
mov es:[PS_dWP_Specific].DWPS_finishColor, TRUE
mov es:[PS_newScanNumber], 0
clr dx
mov ax, PRINT_HEAD_OFFSET_TO_CYAN
div es:[PS_bandHeight]
mov_tr cx, ax
jcxz lastBand
bandLoop:
push dx
mov dx,es:[PS_bandHeight] ; print a full height band.
call PrPrintHighBand ; print a band from this swath.
pop dx
jc done
loop bandLoop
lastBand:
tst dx
jz done
call PrPrintHighBand ; print last band
done:
.leave
ret
PrintFinishPage endp
| 22.452381 | 79 | 0.568134 |
e6674b39b744507560c2d582ff855b9edc5f7f39 | 1,084 | asm | Assembly | Appl/Preferences/PrefMgr/customSpin.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Appl/Preferences/PrefMgr/customSpin.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Appl/Preferences/PrefMgr/customSpin.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: calendar
FILE: customSpin.asm
AUTHOR: Don Reeves, February 7, 1990
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 2/7/90 Initial revision
Chris 7/22/92 Rewritten to use GenValue
Chris 1/28/93 Rewritten to use a popup list.
DESCRIPTION:
Implements the custom spin gadget, used to display "n" monikers
using a GenSpinGadget.
If an ActionDescriptor is provided (by setting the "action" field
in the .UI file, then the current index value is reported in CX
every time it is changed. No check for duplicity is made.
This version is slightly different from Calendar's -- it allows a
minimum offset, so you can display only monikers 10-18 in the list,
say.
$Id: customSpin.asm,v 1.1 97/04/04 16:27:20 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
| 29.297297 | 79 | 0.589483 |
15f644e56bcbe0b5011f63940b47635308ec6c80 | 1,666 | asm | Assembly | programs/oeis/301/A301571.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/301/A301571.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/301/A301571.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A301571: Number of vertices at distance 2 from a given vertex in the n-Keller graph.
; 0,10,29,84,247,734,2193,6568,19691,59058,177157,531452,1594335,4782982,14348921,43046736,129140179,387420506,1162261485,3486784420,10460353223,31381059630,94143178849,282429536504,847288609467,2541865828354,7625597485013,22876792454988,68630377364911,205891132094678,617673396283977,1853020188851872,5559060566555555,16677181699666602,50031545098999741,150094635296999156,450283905890997399,1350851717672992126,4052555153018976305,12157665459056928840,36472996377170786443,109418989131512359250,328256967394537077669,984770902183611232924,2954312706550833698687,8862938119652501095974,26588814358957503287833,79766443076872509863408,239299329230617529590131,717897987691852588770298,2153693963075557766310797,6461081889226673298932292,19383245667680019896796775,58149737003040059690390222,174449211009120179071170561,523347633027360537213511576,1570042899082081611640534619,4710128697246244834921603746,14130386091738734504764811125,42391158275216203514294433260,127173474825648610542883299663,381520424476945831628649898870,1144561273430837494885949696489,3433683820292512484657849089344,10301051460877537453973547267907,30903154382632612361920641803594,92709463147897837085761925410653,278128389443693511257285776231828,834385168331080533771857328695351,2503155504993241601315571986085918,7509466514979724803946715958257617,22528399544939174411840147874772712,67585198634817523235520443624317995,202755595904452569706561330872953842,608266787713357709119683992618861381
add $0,1
mov $1,3
add $1,$0
lpb $0
mov $2,3
pow $2,$0
mov $0,1
add $1,$2
lpe
sub $1,4
mov $0,$1
| 111.066667 | 1,473 | 0.909964 |
b18bb09ac8bded9cb4e4258fc3643d15c542293d | 390 | asm | Assembly | oeis/093/A093920.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/093/A093920.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/093/A093920.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A093920: Row sums of A093919.
; Submitted by Christian Krause
; 1,4,15,40,205,276,1939,4432,13689,18100,199111,200784,2610205,3136420,3191595,7012576,119213809,137103012,2604957247,2605199080,2608367181,3084857644,70951725835,71062911792,355315542025,442803520276
add $0,1
mov $2,$0
lpb $0
mov $3,$2
gcd $3,$0
mov $4,$0
sub $0,1
div $4,$3
mul $2,$4
add $1,$2
lpe
mov $0,$1
| 22.941176 | 201 | 0.717949 |
4890064b85387037c4eaeb3567fd82365bec8deb | 350 | asm | Assembly | oeis/081/A081069.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/081/A081069.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/081/A081069.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A081069: Lucas(4n)+2, or Lucas(2n)^2.
; Submitted by Jon Maiga
; 4,9,49,324,2209,15129,103684,710649,4870849,33385284,228826129,1568397609,10749957124,73681302249,505019158609,3461452808004,23725150497409,162614600673849,1114577054219524,7639424778862809
mov $2,1
lpb $0
sub $0,1
add $2,$1
add $1,$2
lpe
pow $1,2
mov $0,$1
mul $0,5
add $0,4
| 23.333333 | 191 | 0.745714 |
76efa17ad2f2aa8e60c27d7b08d93fd473c68fa4 | 431 | asm | Assembly | non_regression/basic_x86_linux.intel.s.asm | LRGH/plasmasm | 4cd50546c3dc895763d72dd60b7c46179c1916bc | [
"Apache-2.0"
] | 1 | 2021-02-28T21:31:18.000Z | 2021-02-28T21:31:18.000Z | non_regression/basic_x86_linux.intel.s.asm | LRGH/plasmasm | 4cd50546c3dc895763d72dd60b7c46179c1916bc | [
"Apache-2.0"
] | null | null | null | non_regression/basic_x86_linux.intel.s.asm | LRGH/plasmasm | 4cd50546c3dc895763d72dd60b7c46179c1916bc | [
"Apache-2.0"
] | null | null | null | .file "a00.c"
.intel_syntax noprefix
.text
.globl main
.type main, @function
main:
.cfi_startproc
push ebp
mov ebp, esp
sub esp, 16
mov DWORD PTR [ebp-4], 0
add DWORD PTR [ebp-4], 66
mov eax, DWORD PTR [ebp-4]
leave
ret
.cfi_endproc
.size main, .-main
# ----------------------
.ident "GCC: (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3"
.section .note.GNU-stack,"",@progbits
| 20.52381 | 51 | 0.559165 |
0c2a628c54645b7bc91223ec7037c92cc0baf2b3 | 1,550 | asm | Assembly | main/kernel/IDT/idt.asm | KlausAschenbrenner/KAOS | 4019923657e85739ccf3d1af722d4e551078271b | [
"MIT"
] | 1 | 2022-01-31T20:51:57.000Z | 2022-01-31T20:51:57.000Z | main64/kaosldr/idt/idt.asm | KlausAschenbrenner/KAOS | 4019923657e85739ccf3d1af722d4e551078271b | [
"MIT"
] | null | null | null | main64/kaosldr/idt/idt.asm | KlausAschenbrenner/KAOS | 4019923657e85739ccf3d1af722d4e551078271b | [
"MIT"
] | null | null | null | [bits 32]
[extern IsrHandler]
; Needed that the C code can call the Assembler function "IdtFlush"
[GLOBAL IdtFlush]
[GLOBAL RaiseInterrupt]
; The following macro emits the ISR assembly routine
%macro ISR_NOERRORCODE 1
[GLOBAL Isr%1]
Isr%1:
cli
push byte 0
push byte %1
jmp IsrCommonStub
%endmacro
; Emitting our 32 ISR assembly routines
ISR_NOERRORCODE 0
ISR_NOERRORCODE 1
ISR_NOERRORCODE 2
ISR_NOERRORCODE 3
ISR_NOERRORCODE 4
ISR_NOERRORCODE 5
ISR_NOERRORCODE 6
ISR_NOERRORCODE 7
ISR_NOERRORCODE 8
ISR_NOERRORCODE 9
ISR_NOERRORCODE 10
ISR_NOERRORCODE 11
ISR_NOERRORCODE 12
ISR_NOERRORCODE 13
ISR_NOERRORCODE 14
ISR_NOERRORCODE 15
ISR_NOERRORCODE 16
ISR_NOERRORCODE 17
ISR_NOERRORCODE 18
ISR_NOERRORCODE 19
ISR_NOERRORCODE 20
ISR_NOERRORCODE 21
ISR_NOERRORCODE 22
ISR_NOERRORCODE 23
ISR_NOERRORCODE 24
ISR_NOERRORCODE 25
ISR_NOERRORCODE 26
ISR_NOERRORCODE 27
ISR_NOERRORCODE 28
ISR_NOERRORCODE 29
ISR_NOERRORCODE 30
ISR_NOERRORCODE 31
; Common function for ISR handling
IsrCommonStub:
pusha
mov ax, ds
push eax
mov ax, 0x10
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
; Call the ISR handler that is implemented in C
call IsrHandler
pop eax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
popa
add esp, 8
sti
iret
; Loads the IDT table
IdtFlush:
mov eax, [esp + 4]
lidt [eax]
ret
; Raises some sample interrupts for testing
RaiseInterrupt:
int 0x0
int 0x1
int 0x10
int 0x16
ret | 17.222222 | 67 | 0.723226 |
cc0a77f421d0eefff08fe859f13ea62c1e5d4cbb | 610 | asm | Assembly | oeis/281/A281794.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/281/A281794.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/281/A281794.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A281794: The largest prime factor of (1+n^2)*(1+n^3).
; Submitted by Jon Maiga
; 1,2,5,7,17,13,37,43,19,73,101,61,29,157,197,211,257,29,307,181,401,421,463,53,577,601,677,73,757,421,67,37,331,151,1123,613,1297,137,67,1483,1601,547,1723,139,631,1013,109,103,461,1201,61,2551,541,919,2917,2971,3137,103,3307,1741,3541,1861,769,3907,241,2113,4357,4423,37,2381,4831,2521,5113,751,5477,97,5701,1951,6007,6163,173,6481,269,2269,7057,3613,2437,1069,1549,373,8101,8191,2791,199,8837,4513,1303,941,3169,313
seq $0,133073 ; a(n) = n^5 + n^3 + n^2.
seq $0,6530 ; Gpf(n): greatest prime dividing n, for n >= 2; a(1)=1.
| 87.142857 | 418 | 0.708197 |
8ac8272dbe244b08210fdfcd804e006e6140a08f | 35 | asm | Assembly | src/main/fragment/mos6502-common/vbsm1=pbsc1_derefidx_vbuyy_minus_pbsc2_derefidx_vbuyy.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | 2 | 2022-03-01T02:21:14.000Z | 2022-03-01T04:33:35.000Z | src/main/fragment/mos6502-common/vbsm1=pbsc1_derefidx_vbuyy_minus_pbsc2_derefidx_vbuyy.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | src/main/fragment/mos6502-common/vbsm1=pbsc1_derefidx_vbuyy_minus_pbsc2_derefidx_vbuyy.asm | jbrandwood/kickc | d4b68806f84f8650d51b0e3ef254e40f38b0ffad | [
"MIT"
] | null | null | null | sec
lda {c1},y
sbc {c2},y
sta {m1}
| 7 | 10 | 0.571429 |
853cf2a45a6f0cc186fd1656b6b273d3d2862f5a | 687 | asm | Assembly | oeis/020/A020992.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/020/A020992.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/020/A020992.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A020992: a(n) = a(n-1) + a(n-2) + a(n-3).
; Submitted by Jon Maiga
; 0,2,1,3,6,10,19,35,64,118,217,399,734,1350,2483,4567,8400,15450,28417,52267,96134,176818,325219,598171,1100208,2023598,3721977,6845783,12591358,23159118,42596259,78346735,144102112,265045106,487493953,896641171,1649180230,3033315354,5579136755,10261632339,18874084448,34714853542,63850570329,117439508319,216004932190,397295010838,730739451347,1344039394375,2472073856560,4546852702282,8362965953217,15381892512059,28291711167558,52036569632834,95710173312451,176038454112843,323785197058128
mov $2,2
mov $3,-1
lpb $0
sub $0,1
mov $1,$4
mov $4,$2
mov $2,$1
add $2,$3
mov $3,$1
add $4,$1
lpe
mov $0,$4
| 40.411765 | 493 | 0.770015 |
dc2aa8a769669415512d8a8836aace2b9183c5e8 | 605 | asm | Assembly | oeis/213/A213077.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/213/A213077.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/213/A213077.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A213077: a(n) = round(n^2 - sqrt(n)).
; Submitted by Jon Maiga
; 0,0,3,7,14,23,34,46,61,78,97,118,141,165,192,221,252,285,320,357,396,436,479,524,571,620,671,724,779,836,895,955,1018,1083,1150,1219,1290,1363,1438,1515,1594,1675,1758,1842,1929,2018,2109,2202,2297,2394,2493,2594,2697,2802,2909,3018,3129,3241,3356,3473,3592,3713,3836,3961,4088,4217,4348,4481,4616,4753,4892,5033,5176,5320,5467,5616,5767,5920,6075,6232,6391,6552,6715,6880,7047,7216,7387,7560,7735,7912,8091,8271,8454,8639,8826,9015,9206,9399,9594,9791
mov $1,$0
pow $0,2
add $0,40
lpb $1
sub $0,1
add $2,2
trn $1,$2
lpe
sub $0,40
| 43.214286 | 454 | 0.722314 |
781d911fefcb6086e2f14e3b2d63b45641773b1d | 227 | asm | Assembly | asm/hello.asm | watilde/cs101 | 20ab6bd1516f8a5987a020fb7244fc1716c5b101 | [
"MIT"
] | 3 | 2015-12-05T11:03:24.000Z | 2019-03-11T16:27:26.000Z | asm/hello.asm | watilde/cs101 | 20ab6bd1516f8a5987a020fb7244fc1716c5b101 | [
"MIT"
] | 1 | 2015-10-06T13:26:02.000Z | 2015-10-06T19:32:34.000Z | tasks/01-hello/hello.asm | pwittchen/learning-asm-x64-linux | 9a28e62e391c9bcde607ef3eaf5e4609d29c05e5 | [
"Apache-2.0"
] | null | null | null | section .data
msg db "hello, world!"
section .text
global _start
_start:
mov rax, 1
mov rdi, 1
mov rsi, msg
mov rdx, 13
syscall
mov rax, 60
mov rdi, 0
syscall
| 15.133333 | 31 | 0.506608 |
4fad628a7f5e57fa41a5d5aca9622763c7d8b6ea | 5,316 | asm | Assembly | Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48.log_21829_942.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48.log_21829_942.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/US/_zr_/i7-7700_9_0x48.log_21829_942.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r14
push %r9
push %rcx
push %rdi
push %rdx
lea addresses_A_ht+0x1022a, %rcx
nop
nop
nop
nop
nop
sub $51341, %r13
mov $0x6162636465666768, %r9
movq %r9, %xmm6
movups %xmm6, (%rcx)
nop
and %r9, %r9
lea addresses_WC_ht+0xe0aa, %r12
clflush (%r12)
nop
nop
nop
xor %rcx, %rcx
movl $0x61626364, (%r12)
nop
and %r9, %r9
lea addresses_WC_ht+0x1bdba, %r14
clflush (%r14)
nop
nop
sub $48804, %r12
movw $0x6162, (%r14)
nop
dec %rcx
lea addresses_normal_ht+0x1daa, %r9
nop
nop
nop
xor $58544, %rdi
movb (%r9), %r14b
nop
nop
nop
nop
sub $35035, %r14
lea addresses_normal_ht+0x10b8a, %rcx
dec %rdx
mov (%rcx), %r13d
nop
nop
nop
inc %rcx
lea addresses_A_ht+0x17b55, %r12
nop
nop
nop
add $15488, %rcx
mov $0x6162636465666768, %r14
movq %r14, %xmm1
movups %xmm1, (%r12)
nop
nop
nop
nop
nop
add %r13, %r13
pop %rdx
pop %rdi
pop %rcx
pop %r9
pop %r14
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r13
push %r14
push %r8
push %r9
push %rsi
// Faulty Load
lea addresses_US+0x28aa, %r10
nop
xor $55370, %r9
mov (%r10), %r13
lea oracles, %r10
and $0xff, %r13
shlq $12, %r13
mov (%r10,%r13,1), %r13
pop %rsi
pop %r9
pop %r8
pop %r14
pop %r13
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 3, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 5, 'size': 4, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': True, 'NT': False}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
| 43.57377 | 2,999 | 0.658954 |
e34f82f5bdd2c9f40891d62c35bbd2c985ecca7e | 745 | asm | Assembly | asm/6502/test/keyb.asm | rampa069/clc88 | 9da545b0d39f8288cdb1b9dd84835631de8840bf | [
"MIT"
] | 1 | 2022-03-25T03:41:05.000Z | 2022-03-25T03:41:05.000Z | asm/6502/test/keyb.asm | rampa069/clc88 | 9da545b0d39f8288cdb1b9dd84835631de8840bf | [
"MIT"
] | null | null | null | asm/6502/test/keyb.asm | rampa069/clc88 | 9da545b0d39f8288cdb1b9dd84835631de8840bf | [
"MIT"
] | null | null | null | icl '../os/symbols.asm'
org BOOTADDR
lda #0
ldy #0
ldx #OS_SET_VIDEO_MODE
jsr OS_CALL
next_frame:
lda FRAMECOUNT
wait:
cmp FRAMECOUNT
beq wait
jsr keybscan
jmp next_frame
keybscan:
mwa DISPLAY_START VRAM_TO_RAM
jsr lib_vram_to_ram
lda #0
sta KSTAT
sta SCREENPOS
next_reg:
ldy KSTAT
lda KEY_STATUS, y
next_bit:
rol
sta STATUS
lda #'0'
bcc key_off
lda #'1'
key_off:
ldy SCREENPOS
sta (RAM_TO_VRAM), y
iny
tya
cpy #8
beq next_row
sty SCREENPOS
lda STATUS
jmp next_bit
next_row:
inc KSTAT
lda KSTAT
cmp #16
bne next_line
rts
next_line:
lda #0
sta SCREENPOS
adw RAM_TO_VRAM #40
jmp next_reg
KSTAT .byte 0
SCREENPOS .byte 0
STATUS .byte 0
icl '../os/stdlib.asm'
| 11.640625 | 33 | 0.687248 |
58bebe3409eb498d7d50ed5bf3053ce7ef7ec66e | 57,395 | asm | Assembly | sanity.asm | MatanGilead/myxv6 | e3e56b63deba7bdf2f85079a4c303a36feaef0c9 | [
"MIT-0"
] | null | null | null | sanity.asm | MatanGilead/myxv6 | e3e56b63deba7bdf2f85079a4c303a36feaef0c9 | [
"MIT-0"
] | null | null | null | sanity.asm | MatanGilead/myxv6 | e3e56b63deba7bdf2f85079a4c303a36feaef0c9 | [
"MIT-0"
] | null | null | null |
_sanity: file format elf32-i386
Disassembly of section .text:
00000000 <getStatistics>:
#define IO "I\\O"
void
getStatistics(int n){
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 78 sub $0x78,%esp
int i;
int CPUtotalCounter=0;
6: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
int SCPUtotalCounter=0;
d: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int IOtotalCounter=0;
14: c7 45 e8 00 00 00 00 movl $0x0,-0x18(%ebp)
int CPUtotalRetime=0;
1b: c7 45 e4 00 00 00 00 movl $0x0,-0x1c(%ebp)
int SCPUtotalRetime=0;
22: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
int IOtotalRetime=0;
29: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
int CPUtotalRutime=0;
30: c7 45 d8 00 00 00 00 movl $0x0,-0x28(%ebp)
int SCPUtotalRutime=0;
37: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp)
int IOtotalRutime=0;
3e: c7 45 d0 00 00 00 00 movl $0x0,-0x30(%ebp)
int CPUtotalStime=0;
45: c7 45 cc 00 00 00 00 movl $0x0,-0x34(%ebp)
int SCPUtotalStime=0;
4c: c7 45 c8 00 00 00 00 movl $0x0,-0x38(%ebp)
int IOtotalStime=0;
53: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
for (i=0; i<3*n;i++){
5a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
61: e9 f5 00 00 00 jmp 15b <getStatistics+0x15b>
int retime;
int rutime;
int stime;
int pid=wait2(&retime,&rutime,&stime);
66: 8d 45 b0 lea -0x50(%ebp),%eax
69: 89 44 24 08 mov %eax,0x8(%esp)
6d: 8d 45 b4 lea -0x4c(%ebp),%eax
70: 89 44 24 04 mov %eax,0x4(%esp)
74: 8d 45 b8 lea -0x48(%ebp),%eax
77: 89 04 24 mov %eax,(%esp)
7a: e8 e5 06 00 00 call 764 <wait2>
7f: 89 45 bc mov %eax,-0x44(%ebp)
char* type;
if (pid%3==0){
82: 8b 4d bc mov -0x44(%ebp),%ecx
85: ba 56 55 55 55 mov $0x55555556,%edx
8a: 89 c8 mov %ecx,%eax
8c: f7 ea imul %edx
8e: 89 c8 mov %ecx,%eax
90: c1 f8 1f sar $0x1f,%eax
93: 29 c2 sub %eax,%edx
95: 89 d0 mov %edx,%eax
97: 01 c0 add %eax,%eax
99: 01 d0 add %edx,%eax
9b: 89 ca mov %ecx,%edx
9d: 29 c2 sub %eax,%edx
9f: 85 d2 test %edx,%edx
a1: 75 1f jne c2 <getStatistics+0xc2>
type=CPU;
a3: c7 45 c0 18 0c 00 00 movl $0xc18,-0x40(%ebp)
CPUtotalRetime+=retime;
aa: 8b 45 b8 mov -0x48(%ebp),%eax
ad: 01 45 e4 add %eax,-0x1c(%ebp)
CPUtotalRutime+=rutime;
b0: 8b 45 b4 mov -0x4c(%ebp),%eax
b3: 01 45 d8 add %eax,-0x28(%ebp)
CPUtotalStime+=stime;
b6: 8b 45 b0 mov -0x50(%ebp),%eax
b9: 01 45 cc add %eax,-0x34(%ebp)
CPUtotalCounter++;
bc: 83 45 f0 01 addl $0x1,-0x10(%ebp)
c0: eb 5e jmp 120 <getStatistics+0x120>
}
else if (pid%3==1) {
c2: 8b 4d bc mov -0x44(%ebp),%ecx
c5: ba 56 55 55 55 mov $0x55555556,%edx
ca: 89 c8 mov %ecx,%eax
cc: f7 ea imul %edx
ce: 89 c8 mov %ecx,%eax
d0: c1 f8 1f sar $0x1f,%eax
d3: 29 c2 sub %eax,%edx
d5: 89 d0 mov %edx,%eax
d7: 01 c0 add %eax,%eax
d9: 01 d0 add %edx,%eax
db: 89 ca mov %ecx,%edx
dd: 29 c2 sub %eax,%edx
df: 83 fa 01 cmp $0x1,%edx
e2: 75 1f jne 103 <getStatistics+0x103>
type=SCPU;
e4: c7 45 c0 1c 0c 00 00 movl $0xc1c,-0x40(%ebp)
SCPUtotalRetime+=retime;
eb: 8b 45 b8 mov -0x48(%ebp),%eax
ee: 01 45 e0 add %eax,-0x20(%ebp)
SCPUtotalRutime+=rutime;
f1: 8b 45 b4 mov -0x4c(%ebp),%eax
f4: 01 45 d4 add %eax,-0x2c(%ebp)
SCPUtotalStime+=stime;
f7: 8b 45 b0 mov -0x50(%ebp),%eax
fa: 01 45 c8 add %eax,-0x38(%ebp)
SCPUtotalCounter++;
fd: 83 45 ec 01 addl $0x1,-0x14(%ebp)
101: eb 1d jmp 120 <getStatistics+0x120>
}
else {
type=IO;
103: c7 45 c0 22 0c 00 00 movl $0xc22,-0x40(%ebp)
IOtotalRetime+=retime;
10a: 8b 45 b8 mov -0x48(%ebp),%eax
10d: 01 45 dc add %eax,-0x24(%ebp)
IOtotalRutime+=rutime;
110: 8b 45 b4 mov -0x4c(%ebp),%eax
113: 01 45 d0 add %eax,-0x30(%ebp)
IOtotalStime+=stime;
116: 8b 45 b0 mov -0x50(%ebp),%eax
119: 01 45 c4 add %eax,-0x3c(%ebp)
IOtotalCounter++;
11c: 83 45 e8 01 addl $0x1,-0x18(%ebp)
}
printf(1,"Process PID: %d, Type: %s, Wait: %d Running: %d Sleep: %d\n",pid,type,retime,rutime,stime);
120: 8b 4d b0 mov -0x50(%ebp),%ecx
123: 8b 55 b4 mov -0x4c(%ebp),%edx
126: 8b 45 b8 mov -0x48(%ebp),%eax
129: 89 4c 24 18 mov %ecx,0x18(%esp)
12d: 89 54 24 14 mov %edx,0x14(%esp)
131: 89 44 24 10 mov %eax,0x10(%esp)
135: 8b 45 c0 mov -0x40(%ebp),%eax
138: 89 44 24 0c mov %eax,0xc(%esp)
13c: 8b 45 bc mov -0x44(%ebp),%eax
13f: 89 44 24 08 mov %eax,0x8(%esp)
143: c7 44 24 04 28 0c 00 movl $0xc28,0x4(%esp)
14a: 00
14b: c7 04 24 01 00 00 00 movl $0x1,(%esp)
152: e8 fc 06 00 00 call 853 <printf>
int IOtotalRutime=0;
int CPUtotalStime=0;
int SCPUtotalStime=0;
int IOtotalStime=0;
for (i=0; i<3*n;i++){
157: 83 45 f4 01 addl $0x1,-0xc(%ebp)
15b: 8b 55 08 mov 0x8(%ebp),%edx
15e: 89 d0 mov %edx,%eax
160: 01 c0 add %eax,%eax
162: 01 d0 add %edx,%eax
164: 3b 45 f4 cmp -0xc(%ebp),%eax
167: 0f 8f f9 fe ff ff jg 66 <getStatistics+0x66>
IOtotalStime+=stime;
IOtotalCounter++;
}
printf(1,"Process PID: %d, Type: %s, Wait: %d Running: %d Sleep: %d\n",pid,type,retime,rutime,stime);
}
printf(1, "CPU Avg. Ready Time: %d\n", CPUtotalRetime/CPUtotalCounter);
16d: 8b 45 e4 mov -0x1c(%ebp),%eax
170: 89 c2 mov %eax,%edx
172: c1 fa 1f sar $0x1f,%edx
175: f7 7d f0 idivl -0x10(%ebp)
178: 89 44 24 08 mov %eax,0x8(%esp)
17c: c7 44 24 04 66 0c 00 movl $0xc66,0x4(%esp)
183: 00
184: c7 04 24 01 00 00 00 movl $0x1,(%esp)
18b: e8 c3 06 00 00 call 853 <printf>
printf(1, "SCPU Avg. Ready Time: %d\n", SCPUtotalRetime/SCPUtotalCounter);
190: 8b 45 e0 mov -0x20(%ebp),%eax
193: 89 c2 mov %eax,%edx
195: c1 fa 1f sar $0x1f,%edx
198: f7 7d ec idivl -0x14(%ebp)
19b: 89 44 24 08 mov %eax,0x8(%esp)
19f: c7 44 24 04 80 0c 00 movl $0xc80,0x4(%esp)
1a6: 00
1a7: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1ae: e8 a0 06 00 00 call 853 <printf>
printf(1, "IO Avg. Ready Time: %d\n\n", IOtotalRetime/IOtotalCounter);
1b3: 8b 45 dc mov -0x24(%ebp),%eax
1b6: 89 c2 mov %eax,%edx
1b8: c1 fa 1f sar $0x1f,%edx
1bb: f7 7d e8 idivl -0x18(%ebp)
1be: 89 44 24 08 mov %eax,0x8(%esp)
1c2: c7 44 24 04 9a 0c 00 movl $0xc9a,0x4(%esp)
1c9: 00
1ca: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1d1: e8 7d 06 00 00 call 853 <printf>
printf(1, "CPU Avg. Run Time: %d\n", CPUtotalRutime/CPUtotalCounter);
1d6: 8b 45 d8 mov -0x28(%ebp),%eax
1d9: 89 c2 mov %eax,%edx
1db: c1 fa 1f sar $0x1f,%edx
1de: f7 7d f0 idivl -0x10(%ebp)
1e1: 89 44 24 08 mov %eax,0x8(%esp)
1e5: c7 44 24 04 b5 0c 00 movl $0xcb5,0x4(%esp)
1ec: 00
1ed: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1f4: e8 5a 06 00 00 call 853 <printf>
printf(1, "SCPU Avg. Run Time: %d\n", SCPUtotalRutime/SCPUtotalCounter);
1f9: 8b 45 d4 mov -0x2c(%ebp),%eax
1fc: 89 c2 mov %eax,%edx
1fe: c1 fa 1f sar $0x1f,%edx
201: f7 7d ec idivl -0x14(%ebp)
204: 89 44 24 08 mov %eax,0x8(%esp)
208: c7 44 24 04 cd 0c 00 movl $0xccd,0x4(%esp)
20f: 00
210: c7 04 24 01 00 00 00 movl $0x1,(%esp)
217: e8 37 06 00 00 call 853 <printf>
printf(1, "IO Avg. Run Time: %d\n\n", IOtotalRutime/IOtotalCounter);
21c: 8b 45 d0 mov -0x30(%ebp),%eax
21f: 89 c2 mov %eax,%edx
221: c1 fa 1f sar $0x1f,%edx
224: f7 7d e8 idivl -0x18(%ebp)
227: 89 44 24 08 mov %eax,0x8(%esp)
22b: c7 44 24 04 e5 0c 00 movl $0xce5,0x4(%esp)
232: 00
233: c7 04 24 01 00 00 00 movl $0x1,(%esp)
23a: e8 14 06 00 00 call 853 <printf>
printf(1, "CPU Avg. Sleep Time: %d\n", (CPUtotalStime)/CPUtotalCounter);
23f: 8b 45 cc mov -0x34(%ebp),%eax
242: 89 c2 mov %eax,%edx
244: c1 fa 1f sar $0x1f,%edx
247: f7 7d f0 idivl -0x10(%ebp)
24a: 89 44 24 08 mov %eax,0x8(%esp)
24e: c7 44 24 04 fe 0c 00 movl $0xcfe,0x4(%esp)
255: 00
256: c7 04 24 01 00 00 00 movl $0x1,(%esp)
25d: e8 f1 05 00 00 call 853 <printf>
printf(1, "SCPU Avg. Sleep Time: %d\n", (SCPUtotalStime)/SCPUtotalCounter);
262: 8b 45 c8 mov -0x38(%ebp),%eax
265: 89 c2 mov %eax,%edx
267: c1 fa 1f sar $0x1f,%edx
26a: f7 7d ec idivl -0x14(%ebp)
26d: 89 44 24 08 mov %eax,0x8(%esp)
271: c7 44 24 04 18 0d 00 movl $0xd18,0x4(%esp)
278: 00
279: c7 04 24 01 00 00 00 movl $0x1,(%esp)
280: e8 ce 05 00 00 call 853 <printf>
printf(1, "IO Avg. Sleep Time: %d\n\n", (IOtotalStime)/IOtotalCounter);
285: 8b 45 c4 mov -0x3c(%ebp),%eax
288: 89 c2 mov %eax,%edx
28a: c1 fa 1f sar $0x1f,%edx
28d: f7 7d e8 idivl -0x18(%ebp)
290: 89 44 24 08 mov %eax,0x8(%esp)
294: c7 44 24 04 32 0d 00 movl $0xd32,0x4(%esp)
29b: 00
29c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2a3: e8 ab 05 00 00 call 853 <printf>
printf(1, "CPU Avg. Turnaround Time: %d\n", (CPUtotalStime+CPUtotalRutime+CPUtotalRetime)/CPUtotalCounter);
2a8: 8b 45 d8 mov -0x28(%ebp),%eax
2ab: 8b 55 cc mov -0x34(%ebp),%edx
2ae: 01 d0 add %edx,%eax
2b0: 03 45 e4 add -0x1c(%ebp),%eax
2b3: 89 c2 mov %eax,%edx
2b5: c1 fa 1f sar $0x1f,%edx
2b8: f7 7d f0 idivl -0x10(%ebp)
2bb: 89 44 24 08 mov %eax,0x8(%esp)
2bf: c7 44 24 04 50 0d 00 movl $0xd50,0x4(%esp)
2c6: 00
2c7: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2ce: e8 80 05 00 00 call 853 <printf>
printf(1, "SCPU Avg. Turnaround Time: %d\n", (SCPUtotalStime+SCPUtotalRutime+SCPUtotalRetime)/SCPUtotalCounter);
2d3: 8b 45 d4 mov -0x2c(%ebp),%eax
2d6: 8b 55 c8 mov -0x38(%ebp),%edx
2d9: 01 d0 add %edx,%eax
2db: 03 45 e0 add -0x20(%ebp),%eax
2de: 89 c2 mov %eax,%edx
2e0: c1 fa 1f sar $0x1f,%edx
2e3: f7 7d ec idivl -0x14(%ebp)
2e6: 89 44 24 08 mov %eax,0x8(%esp)
2ea: c7 44 24 04 70 0d 00 movl $0xd70,0x4(%esp)
2f1: 00
2f2: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2f9: e8 55 05 00 00 call 853 <printf>
printf(1, "IO Avg. Turnaround Time: %d\n\n", (IOtotalStime+IOtotalRutime+IOtotalRetime)/IOtotalCounter);
2fe: 8b 45 d0 mov -0x30(%ebp),%eax
301: 8b 55 c4 mov -0x3c(%ebp),%edx
304: 01 d0 add %edx,%eax
306: 03 45 dc add -0x24(%ebp),%eax
309: 89 c2 mov %eax,%edx
30b: c1 fa 1f sar $0x1f,%edx
30e: f7 7d e8 idivl -0x18(%ebp)
311: 89 44 24 08 mov %eax,0x8(%esp)
315: c7 44 24 04 90 0d 00 movl $0xd90,0x4(%esp)
31c: 00
31d: c7 04 24 01 00 00 00 movl $0x1,(%esp)
324: e8 2a 05 00 00 call 853 <printf>
}
329: c9 leave
32a: c3 ret
0000032b <runSanity>:
void
runSanity(){
32b: 55 push %ebp
32c: 89 e5 mov %esp,%ebp
32e: 53 push %ebx
32f: 83 ec 24 sub $0x24,%esp
int pid=getpid();
332: e8 0d 04 00 00 call 744 <getpid>
337: 89 45 ec mov %eax,-0x14(%ebp)
int i;
int j;
switch (pid%3){
33a: 8b 4d ec mov -0x14(%ebp),%ecx
33d: ba 56 55 55 55 mov $0x55555556,%edx
342: 89 c8 mov %ecx,%eax
344: f7 ea imul %edx
346: 89 c8 mov %ecx,%eax
348: c1 f8 1f sar $0x1f,%eax
34b: 89 d3 mov %edx,%ebx
34d: 29 c3 sub %eax,%ebx
34f: 89 d8 mov %ebx,%eax
351: 89 c2 mov %eax,%edx
353: 01 d2 add %edx,%edx
355: 01 c2 add %eax,%edx
357: 89 c8 mov %ecx,%eax
359: 29 d0 sub %edx,%eax
35b: 83 f8 01 cmp $0x1,%eax
35e: 74 34 je 394 <runSanity+0x69>
360: 83 f8 02 cmp $0x2,%eax
363: 74 5f je 3c4 <runSanity+0x99>
365: 85 c0 test %eax,%eax
367: 75 7c jne 3e5 <runSanity+0xba>
case 0:
for (i=0;i<NUM_OF_DUMMY_LOOPS;i++){
369: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
370: eb 1a jmp 38c <runSanity+0x61>
for (j=0;j<NUM_OF_ITERATIONS;j++){}
372: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
379: eb 04 jmp 37f <runSanity+0x54>
37b: 83 45 f0 01 addl $0x1,-0x10(%ebp)
37f: 81 7d f0 3f 42 0f 00 cmpl $0xf423f,-0x10(%ebp)
386: 7e f3 jle 37b <runSanity+0x50>
int pid=getpid();
int i;
int j;
switch (pid%3){
case 0:
for (i=0;i<NUM_OF_DUMMY_LOOPS;i++){
388: 83 45 f4 01 addl $0x1,-0xc(%ebp)
38c: 83 7d f4 63 cmpl $0x63,-0xc(%ebp)
390: 7e e0 jle 372 <runSanity+0x47>
for (j=0;j<NUM_OF_ITERATIONS;j++){}
}
break;
392: eb 52 jmp 3e6 <runSanity+0xbb>
case 1:
for(i=0;i<NUM_OF_DUMMY_LOOPS;i++){
394: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
39b: eb 1f jmp 3bc <runSanity+0x91>
for(j=0;j<NUM_OF_ITERATIONS;j++){}
39d: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
3a4: eb 04 jmp 3aa <runSanity+0x7f>
3a6: 83 45 f0 01 addl $0x1,-0x10(%ebp)
3aa: 81 7d f0 3f 42 0f 00 cmpl $0xf423f,-0x10(%ebp)
3b1: 7e f3 jle 3a6 <runSanity+0x7b>
yield();
3b3: e8 bc 03 00 00 call 774 <yield>
for (j=0;j<NUM_OF_ITERATIONS;j++){}
}
break;
case 1:
for(i=0;i<NUM_OF_DUMMY_LOOPS;i++){
3b8: 83 45 f4 01 addl $0x1,-0xc(%ebp)
3bc: 83 7d f4 63 cmpl $0x63,-0xc(%ebp)
3c0: 7e db jle 39d <runSanity+0x72>
for(j=0;j<NUM_OF_ITERATIONS;j++){}
yield();
}
break;
3c2: eb 22 jmp 3e6 <runSanity+0xbb>
case 2:
for(i=0;i<NUM_OF_DUMMY_LOOPS;i++){
3c4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
3cb: eb 10 jmp 3dd <runSanity+0xb2>
sleep(TIME_TO_SLEEP);
3cd: c7 04 24 01 00 00 00 movl $0x1,(%esp)
3d4: e8 7b 03 00 00 call 754 <sleep>
yield();
}
break;
case 2:
for(i=0;i<NUM_OF_DUMMY_LOOPS;i++){
3d9: 83 45 f4 01 addl $0x1,-0xc(%ebp)
3dd: 83 7d f4 63 cmpl $0x63,-0xc(%ebp)
3e1: 7e ea jle 3cd <runSanity+0xa2>
sleep(TIME_TO_SLEEP);
}
break;
3e3: eb 01 jmp 3e6 <runSanity+0xbb>
default:
break;
3e5: 90 nop
}
}
3e6: 83 c4 24 add $0x24,%esp
3e9: 5b pop %ebx
3ea: 5d pop %ebp
3eb: c3 ret
000003ec <main>:
int
main(int argc, char *argv[])
{
3ec: 55 push %ebp
3ed: 89 e5 mov %esp,%ebp
3ef: 83 e4 f0 and $0xfffffff0,%esp
3f2: 83 ec 20 sub $0x20,%esp
int i;
if(argc != 2)
3f5: 83 7d 08 02 cmpl $0x2,0x8(%ebp)
3f9: 74 05 je 400 <main+0x14>
exit();
3fb: e8 c4 02 00 00 call 6c4 <exit>
int n=atoi(argv[1]);
400: 8b 45 0c mov 0xc(%ebp),%eax
403: 83 c0 04 add $0x4,%eax
406: 8b 00 mov (%eax),%eax
408: 89 04 24 mov %eax,(%esp)
40b: e8 23 02 00 00 call 633 <atoi>
410: 89 44 24 18 mov %eax,0x18(%esp)
for (i=0; i<3*n;i++){
414: c7 44 24 1c 00 00 00 movl $0x0,0x1c(%esp)
41b: 00
41c: eb 1f jmp 43d <main+0x51>
int pid=fork();
41e: e8 99 02 00 00 call 6bc <fork>
423: 89 44 24 14 mov %eax,0x14(%esp)
if (pid==0) {
427: 83 7c 24 14 00 cmpl $0x0,0x14(%esp)
42c: 75 0a jne 438 <main+0x4c>
runSanity();
42e: e8 f8 fe ff ff call 32b <runSanity>
exit();
433: e8 8c 02 00 00 call 6c4 <exit>
int i;
if(argc != 2)
exit();
int n=atoi(argv[1]);
for (i=0; i<3*n;i++){
438: 83 44 24 1c 01 addl $0x1,0x1c(%esp)
43d: 8b 54 24 18 mov 0x18(%esp),%edx
441: 89 d0 mov %edx,%eax
443: 01 c0 add %eax,%eax
445: 01 d0 add %edx,%eax
447: 3b 44 24 1c cmp 0x1c(%esp),%eax
44b: 7f d1 jg 41e <main+0x32>
exit();
}
}
getStatistics(n);
44d: 8b 44 24 18 mov 0x18(%esp),%eax
451: 89 04 24 mov %eax,(%esp)
454: e8 a7 fb ff ff call 0 <getStatistics>
exit();
459: e8 66 02 00 00 call 6c4 <exit>
45e: 90 nop
45f: 90 nop
00000460 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
460: 55 push %ebp
461: 89 e5 mov %esp,%ebp
463: 57 push %edi
464: 53 push %ebx
asm volatile("cld; rep stosb" :
465: 8b 4d 08 mov 0x8(%ebp),%ecx
468: 8b 55 10 mov 0x10(%ebp),%edx
46b: 8b 45 0c mov 0xc(%ebp),%eax
46e: 89 cb mov %ecx,%ebx
470: 89 df mov %ebx,%edi
472: 89 d1 mov %edx,%ecx
474: fc cld
475: f3 aa rep stos %al,%es:(%edi)
477: 89 ca mov %ecx,%edx
479: 89 fb mov %edi,%ebx
47b: 89 5d 08 mov %ebx,0x8(%ebp)
47e: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
481: 5b pop %ebx
482: 5f pop %edi
483: 5d pop %ebp
484: c3 ret
00000485 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
485: 55 push %ebp
486: 89 e5 mov %esp,%ebp
488: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
48b: 8b 45 08 mov 0x8(%ebp),%eax
48e: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
491: 90 nop
492: 8b 45 0c mov 0xc(%ebp),%eax
495: 0f b6 10 movzbl (%eax),%edx
498: 8b 45 08 mov 0x8(%ebp),%eax
49b: 88 10 mov %dl,(%eax)
49d: 8b 45 08 mov 0x8(%ebp),%eax
4a0: 0f b6 00 movzbl (%eax),%eax
4a3: 84 c0 test %al,%al
4a5: 0f 95 c0 setne %al
4a8: 83 45 08 01 addl $0x1,0x8(%ebp)
4ac: 83 45 0c 01 addl $0x1,0xc(%ebp)
4b0: 84 c0 test %al,%al
4b2: 75 de jne 492 <strcpy+0xd>
;
return os;
4b4: 8b 45 fc mov -0x4(%ebp),%eax
}
4b7: c9 leave
4b8: c3 ret
000004b9 <strcmp>:
int
strcmp(const char *p, const char *q)
{
4b9: 55 push %ebp
4ba: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
4bc: eb 08 jmp 4c6 <strcmp+0xd>
p++, q++;
4be: 83 45 08 01 addl $0x1,0x8(%ebp)
4c2: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
4c6: 8b 45 08 mov 0x8(%ebp),%eax
4c9: 0f b6 00 movzbl (%eax),%eax
4cc: 84 c0 test %al,%al
4ce: 74 10 je 4e0 <strcmp+0x27>
4d0: 8b 45 08 mov 0x8(%ebp),%eax
4d3: 0f b6 10 movzbl (%eax),%edx
4d6: 8b 45 0c mov 0xc(%ebp),%eax
4d9: 0f b6 00 movzbl (%eax),%eax
4dc: 38 c2 cmp %al,%dl
4de: 74 de je 4be <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
4e0: 8b 45 08 mov 0x8(%ebp),%eax
4e3: 0f b6 00 movzbl (%eax),%eax
4e6: 0f b6 d0 movzbl %al,%edx
4e9: 8b 45 0c mov 0xc(%ebp),%eax
4ec: 0f b6 00 movzbl (%eax),%eax
4ef: 0f b6 c0 movzbl %al,%eax
4f2: 89 d1 mov %edx,%ecx
4f4: 29 c1 sub %eax,%ecx
4f6: 89 c8 mov %ecx,%eax
}
4f8: 5d pop %ebp
4f9: c3 ret
000004fa <strlen>:
uint
strlen(char *s)
{
4fa: 55 push %ebp
4fb: 89 e5 mov %esp,%ebp
4fd: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
500: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
507: eb 04 jmp 50d <strlen+0x13>
509: 83 45 fc 01 addl $0x1,-0x4(%ebp)
50d: 8b 45 fc mov -0x4(%ebp),%eax
510: 03 45 08 add 0x8(%ebp),%eax
513: 0f b6 00 movzbl (%eax),%eax
516: 84 c0 test %al,%al
518: 75 ef jne 509 <strlen+0xf>
;
return n;
51a: 8b 45 fc mov -0x4(%ebp),%eax
}
51d: c9 leave
51e: c3 ret
0000051f <memset>:
void*
memset(void *dst, int c, uint n)
{
51f: 55 push %ebp
520: 89 e5 mov %esp,%ebp
522: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
525: 8b 45 10 mov 0x10(%ebp),%eax
528: 89 44 24 08 mov %eax,0x8(%esp)
52c: 8b 45 0c mov 0xc(%ebp),%eax
52f: 89 44 24 04 mov %eax,0x4(%esp)
533: 8b 45 08 mov 0x8(%ebp),%eax
536: 89 04 24 mov %eax,(%esp)
539: e8 22 ff ff ff call 460 <stosb>
return dst;
53e: 8b 45 08 mov 0x8(%ebp),%eax
}
541: c9 leave
542: c3 ret
00000543 <strchr>:
char*
strchr(const char *s, char c)
{
543: 55 push %ebp
544: 89 e5 mov %esp,%ebp
546: 83 ec 04 sub $0x4,%esp
549: 8b 45 0c mov 0xc(%ebp),%eax
54c: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
54f: eb 14 jmp 565 <strchr+0x22>
if(*s == c)
551: 8b 45 08 mov 0x8(%ebp),%eax
554: 0f b6 00 movzbl (%eax),%eax
557: 3a 45 fc cmp -0x4(%ebp),%al
55a: 75 05 jne 561 <strchr+0x1e>
return (char*)s;
55c: 8b 45 08 mov 0x8(%ebp),%eax
55f: eb 13 jmp 574 <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
561: 83 45 08 01 addl $0x1,0x8(%ebp)
565: 8b 45 08 mov 0x8(%ebp),%eax
568: 0f b6 00 movzbl (%eax),%eax
56b: 84 c0 test %al,%al
56d: 75 e2 jne 551 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
56f: b8 00 00 00 00 mov $0x0,%eax
}
574: c9 leave
575: c3 ret
00000576 <gets>:
char*
gets(char *buf, int max)
{
576: 55 push %ebp
577: 89 e5 mov %esp,%ebp
579: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
57c: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
583: eb 44 jmp 5c9 <gets+0x53>
cc = read(0, &c, 1);
585: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
58c: 00
58d: 8d 45 ef lea -0x11(%ebp),%eax
590: 89 44 24 04 mov %eax,0x4(%esp)
594: c7 04 24 00 00 00 00 movl $0x0,(%esp)
59b: e8 3c 01 00 00 call 6dc <read>
5a0: 89 45 f0 mov %eax,-0x10(%ebp)
if(cc < 1)
5a3: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
5a7: 7e 2d jle 5d6 <gets+0x60>
break;
buf[i++] = c;
5a9: 8b 45 f4 mov -0xc(%ebp),%eax
5ac: 03 45 08 add 0x8(%ebp),%eax
5af: 0f b6 55 ef movzbl -0x11(%ebp),%edx
5b3: 88 10 mov %dl,(%eax)
5b5: 83 45 f4 01 addl $0x1,-0xc(%ebp)
if(c == '\n' || c == '\r')
5b9: 0f b6 45 ef movzbl -0x11(%ebp),%eax
5bd: 3c 0a cmp $0xa,%al
5bf: 74 16 je 5d7 <gets+0x61>
5c1: 0f b6 45 ef movzbl -0x11(%ebp),%eax
5c5: 3c 0d cmp $0xd,%al
5c7: 74 0e je 5d7 <gets+0x61>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
5c9: 8b 45 f4 mov -0xc(%ebp),%eax
5cc: 83 c0 01 add $0x1,%eax
5cf: 3b 45 0c cmp 0xc(%ebp),%eax
5d2: 7c b1 jl 585 <gets+0xf>
5d4: eb 01 jmp 5d7 <gets+0x61>
cc = read(0, &c, 1);
if(cc < 1)
break;
5d6: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
5d7: 8b 45 f4 mov -0xc(%ebp),%eax
5da: 03 45 08 add 0x8(%ebp),%eax
5dd: c6 00 00 movb $0x0,(%eax)
return buf;
5e0: 8b 45 08 mov 0x8(%ebp),%eax
}
5e3: c9 leave
5e4: c3 ret
000005e5 <stat>:
int
stat(char *n, struct stat *st)
{
5e5: 55 push %ebp
5e6: 89 e5 mov %esp,%ebp
5e8: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
5eb: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
5f2: 00
5f3: 8b 45 08 mov 0x8(%ebp),%eax
5f6: 89 04 24 mov %eax,(%esp)
5f9: e8 06 01 00 00 call 704 <open>
5fe: 89 45 f4 mov %eax,-0xc(%ebp)
if(fd < 0)
601: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
605: 79 07 jns 60e <stat+0x29>
return -1;
607: b8 ff ff ff ff mov $0xffffffff,%eax
60c: eb 23 jmp 631 <stat+0x4c>
r = fstat(fd, st);
60e: 8b 45 0c mov 0xc(%ebp),%eax
611: 89 44 24 04 mov %eax,0x4(%esp)
615: 8b 45 f4 mov -0xc(%ebp),%eax
618: 89 04 24 mov %eax,(%esp)
61b: e8 fc 00 00 00 call 71c <fstat>
620: 89 45 f0 mov %eax,-0x10(%ebp)
close(fd);
623: 8b 45 f4 mov -0xc(%ebp),%eax
626: 89 04 24 mov %eax,(%esp)
629: e8 be 00 00 00 call 6ec <close>
return r;
62e: 8b 45 f0 mov -0x10(%ebp),%eax
}
631: c9 leave
632: c3 ret
00000633 <atoi>:
int
atoi(const char *s)
{
633: 55 push %ebp
634: 89 e5 mov %esp,%ebp
636: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
639: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
640: eb 23 jmp 665 <atoi+0x32>
n = n*10 + *s++ - '0';
642: 8b 55 fc mov -0x4(%ebp),%edx
645: 89 d0 mov %edx,%eax
647: c1 e0 02 shl $0x2,%eax
64a: 01 d0 add %edx,%eax
64c: 01 c0 add %eax,%eax
64e: 89 c2 mov %eax,%edx
650: 8b 45 08 mov 0x8(%ebp),%eax
653: 0f b6 00 movzbl (%eax),%eax
656: 0f be c0 movsbl %al,%eax
659: 01 d0 add %edx,%eax
65b: 83 e8 30 sub $0x30,%eax
65e: 89 45 fc mov %eax,-0x4(%ebp)
661: 83 45 08 01 addl $0x1,0x8(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
665: 8b 45 08 mov 0x8(%ebp),%eax
668: 0f b6 00 movzbl (%eax),%eax
66b: 3c 2f cmp $0x2f,%al
66d: 7e 0a jle 679 <atoi+0x46>
66f: 8b 45 08 mov 0x8(%ebp),%eax
672: 0f b6 00 movzbl (%eax),%eax
675: 3c 39 cmp $0x39,%al
677: 7e c9 jle 642 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
679: 8b 45 fc mov -0x4(%ebp),%eax
}
67c: c9 leave
67d: c3 ret
0000067e <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
67e: 55 push %ebp
67f: 89 e5 mov %esp,%ebp
681: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
684: 8b 45 08 mov 0x8(%ebp),%eax
687: 89 45 fc mov %eax,-0x4(%ebp)
src = vsrc;
68a: 8b 45 0c mov 0xc(%ebp),%eax
68d: 89 45 f8 mov %eax,-0x8(%ebp)
while(n-- > 0)
690: eb 13 jmp 6a5 <memmove+0x27>
*dst++ = *src++;
692: 8b 45 f8 mov -0x8(%ebp),%eax
695: 0f b6 10 movzbl (%eax),%edx
698: 8b 45 fc mov -0x4(%ebp),%eax
69b: 88 10 mov %dl,(%eax)
69d: 83 45 fc 01 addl $0x1,-0x4(%ebp)
6a1: 83 45 f8 01 addl $0x1,-0x8(%ebp)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
6a5: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
6a9: 0f 9f c0 setg %al
6ac: 83 6d 10 01 subl $0x1,0x10(%ebp)
6b0: 84 c0 test %al,%al
6b2: 75 de jne 692 <memmove+0x14>
*dst++ = *src++;
return vdst;
6b4: 8b 45 08 mov 0x8(%ebp),%eax
}
6b7: c9 leave
6b8: c3 ret
6b9: 90 nop
6ba: 90 nop
6bb: 90 nop
000006bc <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
6bc: b8 01 00 00 00 mov $0x1,%eax
6c1: cd 40 int $0x40
6c3: c3 ret
000006c4 <exit>:
SYSCALL(exit)
6c4: b8 02 00 00 00 mov $0x2,%eax
6c9: cd 40 int $0x40
6cb: c3 ret
000006cc <wait>:
SYSCALL(wait)
6cc: b8 03 00 00 00 mov $0x3,%eax
6d1: cd 40 int $0x40
6d3: c3 ret
000006d4 <pipe>:
SYSCALL(pipe)
6d4: b8 04 00 00 00 mov $0x4,%eax
6d9: cd 40 int $0x40
6db: c3 ret
000006dc <read>:
SYSCALL(read)
6dc: b8 05 00 00 00 mov $0x5,%eax
6e1: cd 40 int $0x40
6e3: c3 ret
000006e4 <write>:
SYSCALL(write)
6e4: b8 10 00 00 00 mov $0x10,%eax
6e9: cd 40 int $0x40
6eb: c3 ret
000006ec <close>:
SYSCALL(close)
6ec: b8 15 00 00 00 mov $0x15,%eax
6f1: cd 40 int $0x40
6f3: c3 ret
000006f4 <kill>:
SYSCALL(kill)
6f4: b8 06 00 00 00 mov $0x6,%eax
6f9: cd 40 int $0x40
6fb: c3 ret
000006fc <exec>:
SYSCALL(exec)
6fc: b8 07 00 00 00 mov $0x7,%eax
701: cd 40 int $0x40
703: c3 ret
00000704 <open>:
SYSCALL(open)
704: b8 0f 00 00 00 mov $0xf,%eax
709: cd 40 int $0x40
70b: c3 ret
0000070c <mknod>:
SYSCALL(mknod)
70c: b8 11 00 00 00 mov $0x11,%eax
711: cd 40 int $0x40
713: c3 ret
00000714 <unlink>:
SYSCALL(unlink)
714: b8 12 00 00 00 mov $0x12,%eax
719: cd 40 int $0x40
71b: c3 ret
0000071c <fstat>:
SYSCALL(fstat)
71c: b8 08 00 00 00 mov $0x8,%eax
721: cd 40 int $0x40
723: c3 ret
00000724 <link>:
SYSCALL(link)
724: b8 13 00 00 00 mov $0x13,%eax
729: cd 40 int $0x40
72b: c3 ret
0000072c <mkdir>:
SYSCALL(mkdir)
72c: b8 14 00 00 00 mov $0x14,%eax
731: cd 40 int $0x40
733: c3 ret
00000734 <chdir>:
SYSCALL(chdir)
734: b8 09 00 00 00 mov $0x9,%eax
739: cd 40 int $0x40
73b: c3 ret
0000073c <dup>:
SYSCALL(dup)
73c: b8 0a 00 00 00 mov $0xa,%eax
741: cd 40 int $0x40
743: c3 ret
00000744 <getpid>:
SYSCALL(getpid)
744: b8 0b 00 00 00 mov $0xb,%eax
749: cd 40 int $0x40
74b: c3 ret
0000074c <sbrk>:
SYSCALL(sbrk)
74c: b8 0c 00 00 00 mov $0xc,%eax
751: cd 40 int $0x40
753: c3 ret
00000754 <sleep>:
SYSCALL(sleep)
754: b8 0d 00 00 00 mov $0xd,%eax
759: cd 40 int $0x40
75b: c3 ret
0000075c <uptime>:
SYSCALL(uptime)
75c: b8 0e 00 00 00 mov $0xe,%eax
761: cd 40 int $0x40
763: c3 ret
00000764 <wait2>:
SYSCALL(wait2)
764: b8 16 00 00 00 mov $0x16,%eax
769: cd 40 int $0x40
76b: c3 ret
0000076c <set_prio>:
SYSCALL(set_prio)
76c: b8 17 00 00 00 mov $0x17,%eax
771: cd 40 int $0x40
773: c3 ret
00000774 <yield>:
SYSCALL(yield)
774: b8 18 00 00 00 mov $0x18,%eax
779: cd 40 int $0x40
77b: c3 ret
0000077c <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
77c: 55 push %ebp
77d: 89 e5 mov %esp,%ebp
77f: 83 ec 28 sub $0x28,%esp
782: 8b 45 0c mov 0xc(%ebp),%eax
785: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
788: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
78f: 00
790: 8d 45 f4 lea -0xc(%ebp),%eax
793: 89 44 24 04 mov %eax,0x4(%esp)
797: 8b 45 08 mov 0x8(%ebp),%eax
79a: 89 04 24 mov %eax,(%esp)
79d: e8 42 ff ff ff call 6e4 <write>
}
7a2: c9 leave
7a3: c3 ret
000007a4 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
7a4: 55 push %ebp
7a5: 89 e5 mov %esp,%ebp
7a7: 83 ec 48 sub $0x48,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
7aa: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
7b1: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
7b5: 74 17 je 7ce <printint+0x2a>
7b7: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
7bb: 79 11 jns 7ce <printint+0x2a>
neg = 1;
7bd: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
7c4: 8b 45 0c mov 0xc(%ebp),%eax
7c7: f7 d8 neg %eax
7c9: 89 45 ec mov %eax,-0x14(%ebp)
7cc: eb 06 jmp 7d4 <printint+0x30>
} else {
x = xx;
7ce: 8b 45 0c mov 0xc(%ebp),%eax
7d1: 89 45 ec mov %eax,-0x14(%ebp)
}
i = 0;
7d4: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp)
do{
buf[i++] = digits[x % base];
7db: 8b 4d 10 mov 0x10(%ebp),%ecx
7de: 8b 45 ec mov -0x14(%ebp),%eax
7e1: ba 00 00 00 00 mov $0x0,%edx
7e6: f7 f1 div %ecx
7e8: 89 d0 mov %edx,%eax
7ea: 0f b6 90 38 10 00 00 movzbl 0x1038(%eax),%edx
7f1: 8d 45 dc lea -0x24(%ebp),%eax
7f4: 03 45 f4 add -0xc(%ebp),%eax
7f7: 88 10 mov %dl,(%eax)
7f9: 83 45 f4 01 addl $0x1,-0xc(%ebp)
}while((x /= base) != 0);
7fd: 8b 55 10 mov 0x10(%ebp),%edx
800: 89 55 d4 mov %edx,-0x2c(%ebp)
803: 8b 45 ec mov -0x14(%ebp),%eax
806: ba 00 00 00 00 mov $0x0,%edx
80b: f7 75 d4 divl -0x2c(%ebp)
80e: 89 45 ec mov %eax,-0x14(%ebp)
811: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
815: 75 c4 jne 7db <printint+0x37>
if(neg)
817: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
81b: 74 2a je 847 <printint+0xa3>
buf[i++] = '-';
81d: 8d 45 dc lea -0x24(%ebp),%eax
820: 03 45 f4 add -0xc(%ebp),%eax
823: c6 00 2d movb $0x2d,(%eax)
826: 83 45 f4 01 addl $0x1,-0xc(%ebp)
while(--i >= 0)
82a: eb 1b jmp 847 <printint+0xa3>
putc(fd, buf[i]);
82c: 8d 45 dc lea -0x24(%ebp),%eax
82f: 03 45 f4 add -0xc(%ebp),%eax
832: 0f b6 00 movzbl (%eax),%eax
835: 0f be c0 movsbl %al,%eax
838: 89 44 24 04 mov %eax,0x4(%esp)
83c: 8b 45 08 mov 0x8(%ebp),%eax
83f: 89 04 24 mov %eax,(%esp)
842: e8 35 ff ff ff call 77c <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
847: 83 6d f4 01 subl $0x1,-0xc(%ebp)
84b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
84f: 79 db jns 82c <printint+0x88>
putc(fd, buf[i]);
}
851: c9 leave
852: c3 ret
00000853 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
853: 55 push %ebp
854: 89 e5 mov %esp,%ebp
856: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
859: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
ap = (uint*)(void*)&fmt + 1;
860: 8d 45 0c lea 0xc(%ebp),%eax
863: 83 c0 04 add $0x4,%eax
866: 89 45 e8 mov %eax,-0x18(%ebp)
for(i = 0; fmt[i]; i++){
869: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
870: e9 7d 01 00 00 jmp 9f2 <printf+0x19f>
c = fmt[i] & 0xff;
875: 8b 55 0c mov 0xc(%ebp),%edx
878: 8b 45 f0 mov -0x10(%ebp),%eax
87b: 01 d0 add %edx,%eax
87d: 0f b6 00 movzbl (%eax),%eax
880: 0f be c0 movsbl %al,%eax
883: 25 ff 00 00 00 and $0xff,%eax
888: 89 45 e4 mov %eax,-0x1c(%ebp)
if(state == 0){
88b: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
88f: 75 2c jne 8bd <printf+0x6a>
if(c == '%'){
891: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
895: 75 0c jne 8a3 <printf+0x50>
state = '%';
897: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp)
89e: e9 4b 01 00 00 jmp 9ee <printf+0x19b>
} else {
putc(fd, c);
8a3: 8b 45 e4 mov -0x1c(%ebp),%eax
8a6: 0f be c0 movsbl %al,%eax
8a9: 89 44 24 04 mov %eax,0x4(%esp)
8ad: 8b 45 08 mov 0x8(%ebp),%eax
8b0: 89 04 24 mov %eax,(%esp)
8b3: e8 c4 fe ff ff call 77c <putc>
8b8: e9 31 01 00 00 jmp 9ee <printf+0x19b>
}
} else if(state == '%'){
8bd: 83 7d ec 25 cmpl $0x25,-0x14(%ebp)
8c1: 0f 85 27 01 00 00 jne 9ee <printf+0x19b>
if(c == 'd'){
8c7: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp)
8cb: 75 2d jne 8fa <printf+0xa7>
printint(fd, *ap, 10, 1);
8cd: 8b 45 e8 mov -0x18(%ebp),%eax
8d0: 8b 00 mov (%eax),%eax
8d2: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
8d9: 00
8da: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
8e1: 00
8e2: 89 44 24 04 mov %eax,0x4(%esp)
8e6: 8b 45 08 mov 0x8(%ebp),%eax
8e9: 89 04 24 mov %eax,(%esp)
8ec: e8 b3 fe ff ff call 7a4 <printint>
ap++;
8f1: 83 45 e8 04 addl $0x4,-0x18(%ebp)
8f5: e9 ed 00 00 00 jmp 9e7 <printf+0x194>
} else if(c == 'x' || c == 'p'){
8fa: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp)
8fe: 74 06 je 906 <printf+0xb3>
900: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp)
904: 75 2d jne 933 <printf+0xe0>
printint(fd, *ap, 16, 0);
906: 8b 45 e8 mov -0x18(%ebp),%eax
909: 8b 00 mov (%eax),%eax
90b: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
912: 00
913: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
91a: 00
91b: 89 44 24 04 mov %eax,0x4(%esp)
91f: 8b 45 08 mov 0x8(%ebp),%eax
922: 89 04 24 mov %eax,(%esp)
925: e8 7a fe ff ff call 7a4 <printint>
ap++;
92a: 83 45 e8 04 addl $0x4,-0x18(%ebp)
92e: e9 b4 00 00 00 jmp 9e7 <printf+0x194>
} else if(c == 's'){
933: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp)
937: 75 46 jne 97f <printf+0x12c>
s = (char*)*ap;
939: 8b 45 e8 mov -0x18(%ebp),%eax
93c: 8b 00 mov (%eax),%eax
93e: 89 45 f4 mov %eax,-0xc(%ebp)
ap++;
941: 83 45 e8 04 addl $0x4,-0x18(%ebp)
if(s == 0)
945: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
949: 75 27 jne 972 <printf+0x11f>
s = "(null)";
94b: c7 45 f4 b0 0d 00 00 movl $0xdb0,-0xc(%ebp)
while(*s != 0){
952: eb 1e jmp 972 <printf+0x11f>
putc(fd, *s);
954: 8b 45 f4 mov -0xc(%ebp),%eax
957: 0f b6 00 movzbl (%eax),%eax
95a: 0f be c0 movsbl %al,%eax
95d: 89 44 24 04 mov %eax,0x4(%esp)
961: 8b 45 08 mov 0x8(%ebp),%eax
964: 89 04 24 mov %eax,(%esp)
967: e8 10 fe ff ff call 77c <putc>
s++;
96c: 83 45 f4 01 addl $0x1,-0xc(%ebp)
970: eb 01 jmp 973 <printf+0x120>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
972: 90 nop
973: 8b 45 f4 mov -0xc(%ebp),%eax
976: 0f b6 00 movzbl (%eax),%eax
979: 84 c0 test %al,%al
97b: 75 d7 jne 954 <printf+0x101>
97d: eb 68 jmp 9e7 <printf+0x194>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
97f: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp)
983: 75 1d jne 9a2 <printf+0x14f>
putc(fd, *ap);
985: 8b 45 e8 mov -0x18(%ebp),%eax
988: 8b 00 mov (%eax),%eax
98a: 0f be c0 movsbl %al,%eax
98d: 89 44 24 04 mov %eax,0x4(%esp)
991: 8b 45 08 mov 0x8(%ebp),%eax
994: 89 04 24 mov %eax,(%esp)
997: e8 e0 fd ff ff call 77c <putc>
ap++;
99c: 83 45 e8 04 addl $0x4,-0x18(%ebp)
9a0: eb 45 jmp 9e7 <printf+0x194>
} else if(c == '%'){
9a2: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp)
9a6: 75 17 jne 9bf <printf+0x16c>
putc(fd, c);
9a8: 8b 45 e4 mov -0x1c(%ebp),%eax
9ab: 0f be c0 movsbl %al,%eax
9ae: 89 44 24 04 mov %eax,0x4(%esp)
9b2: 8b 45 08 mov 0x8(%ebp),%eax
9b5: 89 04 24 mov %eax,(%esp)
9b8: e8 bf fd ff ff call 77c <putc>
9bd: eb 28 jmp 9e7 <printf+0x194>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
9bf: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
9c6: 00
9c7: 8b 45 08 mov 0x8(%ebp),%eax
9ca: 89 04 24 mov %eax,(%esp)
9cd: e8 aa fd ff ff call 77c <putc>
putc(fd, c);
9d2: 8b 45 e4 mov -0x1c(%ebp),%eax
9d5: 0f be c0 movsbl %al,%eax
9d8: 89 44 24 04 mov %eax,0x4(%esp)
9dc: 8b 45 08 mov 0x8(%ebp),%eax
9df: 89 04 24 mov %eax,(%esp)
9e2: e8 95 fd ff ff call 77c <putc>
}
state = 0;
9e7: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
9ee: 83 45 f0 01 addl $0x1,-0x10(%ebp)
9f2: 8b 55 0c mov 0xc(%ebp),%edx
9f5: 8b 45 f0 mov -0x10(%ebp),%eax
9f8: 01 d0 add %edx,%eax
9fa: 0f b6 00 movzbl (%eax),%eax
9fd: 84 c0 test %al,%al
9ff: 0f 85 70 fe ff ff jne 875 <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
a05: c9 leave
a06: c3 ret
a07: 90 nop
00000a08 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
a08: 55 push %ebp
a09: 89 e5 mov %esp,%ebp
a0b: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
a0e: 8b 45 08 mov 0x8(%ebp),%eax
a11: 83 e8 08 sub $0x8,%eax
a14: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
a17: a1 54 10 00 00 mov 0x1054,%eax
a1c: 89 45 fc mov %eax,-0x4(%ebp)
a1f: eb 24 jmp a45 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
a21: 8b 45 fc mov -0x4(%ebp),%eax
a24: 8b 00 mov (%eax),%eax
a26: 3b 45 fc cmp -0x4(%ebp),%eax
a29: 77 12 ja a3d <free+0x35>
a2b: 8b 45 f8 mov -0x8(%ebp),%eax
a2e: 3b 45 fc cmp -0x4(%ebp),%eax
a31: 77 24 ja a57 <free+0x4f>
a33: 8b 45 fc mov -0x4(%ebp),%eax
a36: 8b 00 mov (%eax),%eax
a38: 3b 45 f8 cmp -0x8(%ebp),%eax
a3b: 77 1a ja a57 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
a3d: 8b 45 fc mov -0x4(%ebp),%eax
a40: 8b 00 mov (%eax),%eax
a42: 89 45 fc mov %eax,-0x4(%ebp)
a45: 8b 45 f8 mov -0x8(%ebp),%eax
a48: 3b 45 fc cmp -0x4(%ebp),%eax
a4b: 76 d4 jbe a21 <free+0x19>
a4d: 8b 45 fc mov -0x4(%ebp),%eax
a50: 8b 00 mov (%eax),%eax
a52: 3b 45 f8 cmp -0x8(%ebp),%eax
a55: 76 ca jbe a21 <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
a57: 8b 45 f8 mov -0x8(%ebp),%eax
a5a: 8b 40 04 mov 0x4(%eax),%eax
a5d: c1 e0 03 shl $0x3,%eax
a60: 89 c2 mov %eax,%edx
a62: 03 55 f8 add -0x8(%ebp),%edx
a65: 8b 45 fc mov -0x4(%ebp),%eax
a68: 8b 00 mov (%eax),%eax
a6a: 39 c2 cmp %eax,%edx
a6c: 75 24 jne a92 <free+0x8a>
bp->s.size += p->s.ptr->s.size;
a6e: 8b 45 f8 mov -0x8(%ebp),%eax
a71: 8b 50 04 mov 0x4(%eax),%edx
a74: 8b 45 fc mov -0x4(%ebp),%eax
a77: 8b 00 mov (%eax),%eax
a79: 8b 40 04 mov 0x4(%eax),%eax
a7c: 01 c2 add %eax,%edx
a7e: 8b 45 f8 mov -0x8(%ebp),%eax
a81: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
a84: 8b 45 fc mov -0x4(%ebp),%eax
a87: 8b 00 mov (%eax),%eax
a89: 8b 10 mov (%eax),%edx
a8b: 8b 45 f8 mov -0x8(%ebp),%eax
a8e: 89 10 mov %edx,(%eax)
a90: eb 0a jmp a9c <free+0x94>
} else
bp->s.ptr = p->s.ptr;
a92: 8b 45 fc mov -0x4(%ebp),%eax
a95: 8b 10 mov (%eax),%edx
a97: 8b 45 f8 mov -0x8(%ebp),%eax
a9a: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
a9c: 8b 45 fc mov -0x4(%ebp),%eax
a9f: 8b 40 04 mov 0x4(%eax),%eax
aa2: c1 e0 03 shl $0x3,%eax
aa5: 03 45 fc add -0x4(%ebp),%eax
aa8: 3b 45 f8 cmp -0x8(%ebp),%eax
aab: 75 20 jne acd <free+0xc5>
p->s.size += bp->s.size;
aad: 8b 45 fc mov -0x4(%ebp),%eax
ab0: 8b 50 04 mov 0x4(%eax),%edx
ab3: 8b 45 f8 mov -0x8(%ebp),%eax
ab6: 8b 40 04 mov 0x4(%eax),%eax
ab9: 01 c2 add %eax,%edx
abb: 8b 45 fc mov -0x4(%ebp),%eax
abe: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
ac1: 8b 45 f8 mov -0x8(%ebp),%eax
ac4: 8b 10 mov (%eax),%edx
ac6: 8b 45 fc mov -0x4(%ebp),%eax
ac9: 89 10 mov %edx,(%eax)
acb: eb 08 jmp ad5 <free+0xcd>
} else
p->s.ptr = bp;
acd: 8b 45 fc mov -0x4(%ebp),%eax
ad0: 8b 55 f8 mov -0x8(%ebp),%edx
ad3: 89 10 mov %edx,(%eax)
freep = p;
ad5: 8b 45 fc mov -0x4(%ebp),%eax
ad8: a3 54 10 00 00 mov %eax,0x1054
}
add: c9 leave
ade: c3 ret
00000adf <morecore>:
static Header*
morecore(uint nu)
{
adf: 55 push %ebp
ae0: 89 e5 mov %esp,%ebp
ae2: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
ae5: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
aec: 77 07 ja af5 <morecore+0x16>
nu = 4096;
aee: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
af5: 8b 45 08 mov 0x8(%ebp),%eax
af8: c1 e0 03 shl $0x3,%eax
afb: 89 04 24 mov %eax,(%esp)
afe: e8 49 fc ff ff call 74c <sbrk>
b03: 89 45 f4 mov %eax,-0xc(%ebp)
if(p == (char*)-1)
b06: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp)
b0a: 75 07 jne b13 <morecore+0x34>
return 0;
b0c: b8 00 00 00 00 mov $0x0,%eax
b11: eb 22 jmp b35 <morecore+0x56>
hp = (Header*)p;
b13: 8b 45 f4 mov -0xc(%ebp),%eax
b16: 89 45 f0 mov %eax,-0x10(%ebp)
hp->s.size = nu;
b19: 8b 45 f0 mov -0x10(%ebp),%eax
b1c: 8b 55 08 mov 0x8(%ebp),%edx
b1f: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
b22: 8b 45 f0 mov -0x10(%ebp),%eax
b25: 83 c0 08 add $0x8,%eax
b28: 89 04 24 mov %eax,(%esp)
b2b: e8 d8 fe ff ff call a08 <free>
return freep;
b30: a1 54 10 00 00 mov 0x1054,%eax
}
b35: c9 leave
b36: c3 ret
00000b37 <malloc>:
void*
malloc(uint nbytes)
{
b37: 55 push %ebp
b38: 89 e5 mov %esp,%ebp
b3a: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
b3d: 8b 45 08 mov 0x8(%ebp),%eax
b40: 83 c0 07 add $0x7,%eax
b43: c1 e8 03 shr $0x3,%eax
b46: 83 c0 01 add $0x1,%eax
b49: 89 45 ec mov %eax,-0x14(%ebp)
if((prevp = freep) == 0){
b4c: a1 54 10 00 00 mov 0x1054,%eax
b51: 89 45 f0 mov %eax,-0x10(%ebp)
b54: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
b58: 75 23 jne b7d <malloc+0x46>
base.s.ptr = freep = prevp = &base;
b5a: c7 45 f0 4c 10 00 00 movl $0x104c,-0x10(%ebp)
b61: 8b 45 f0 mov -0x10(%ebp),%eax
b64: a3 54 10 00 00 mov %eax,0x1054
b69: a1 54 10 00 00 mov 0x1054,%eax
b6e: a3 4c 10 00 00 mov %eax,0x104c
base.s.size = 0;
b73: c7 05 50 10 00 00 00 movl $0x0,0x1050
b7a: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
b7d: 8b 45 f0 mov -0x10(%ebp),%eax
b80: 8b 00 mov (%eax),%eax
b82: 89 45 f4 mov %eax,-0xc(%ebp)
if(p->s.size >= nunits){
b85: 8b 45 f4 mov -0xc(%ebp),%eax
b88: 8b 40 04 mov 0x4(%eax),%eax
b8b: 3b 45 ec cmp -0x14(%ebp),%eax
b8e: 72 4d jb bdd <malloc+0xa6>
if(p->s.size == nunits)
b90: 8b 45 f4 mov -0xc(%ebp),%eax
b93: 8b 40 04 mov 0x4(%eax),%eax
b96: 3b 45 ec cmp -0x14(%ebp),%eax
b99: 75 0c jne ba7 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
b9b: 8b 45 f4 mov -0xc(%ebp),%eax
b9e: 8b 10 mov (%eax),%edx
ba0: 8b 45 f0 mov -0x10(%ebp),%eax
ba3: 89 10 mov %edx,(%eax)
ba5: eb 26 jmp bcd <malloc+0x96>
else {
p->s.size -= nunits;
ba7: 8b 45 f4 mov -0xc(%ebp),%eax
baa: 8b 40 04 mov 0x4(%eax),%eax
bad: 89 c2 mov %eax,%edx
baf: 2b 55 ec sub -0x14(%ebp),%edx
bb2: 8b 45 f4 mov -0xc(%ebp),%eax
bb5: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
bb8: 8b 45 f4 mov -0xc(%ebp),%eax
bbb: 8b 40 04 mov 0x4(%eax),%eax
bbe: c1 e0 03 shl $0x3,%eax
bc1: 01 45 f4 add %eax,-0xc(%ebp)
p->s.size = nunits;
bc4: 8b 45 f4 mov -0xc(%ebp),%eax
bc7: 8b 55 ec mov -0x14(%ebp),%edx
bca: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
bcd: 8b 45 f0 mov -0x10(%ebp),%eax
bd0: a3 54 10 00 00 mov %eax,0x1054
return (void*)(p + 1);
bd5: 8b 45 f4 mov -0xc(%ebp),%eax
bd8: 83 c0 08 add $0x8,%eax
bdb: eb 38 jmp c15 <malloc+0xde>
}
if(p == freep)
bdd: a1 54 10 00 00 mov 0x1054,%eax
be2: 39 45 f4 cmp %eax,-0xc(%ebp)
be5: 75 1b jne c02 <malloc+0xcb>
if((p = morecore(nunits)) == 0)
be7: 8b 45 ec mov -0x14(%ebp),%eax
bea: 89 04 24 mov %eax,(%esp)
bed: e8 ed fe ff ff call adf <morecore>
bf2: 89 45 f4 mov %eax,-0xc(%ebp)
bf5: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
bf9: 75 07 jne c02 <malloc+0xcb>
return 0;
bfb: b8 00 00 00 00 mov $0x0,%eax
c00: eb 13 jmp c15 <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
c02: 8b 45 f4 mov -0xc(%ebp),%eax
c05: 89 45 f0 mov %eax,-0x10(%ebp)
c08: 8b 45 f4 mov -0xc(%ebp),%eax
c0b: 8b 00 mov (%eax),%eax
c0d: 89 45 f4 mov %eax,-0xc(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
c10: e9 70 ff ff ff jmp b85 <malloc+0x4e>
}
c15: c9 leave
c16: c3 ret
| 35.341749 | 114 | 0.445805 |
d8e9c4170060069b58affb48ae10b77449ba2b73 | 61 | asm | Assembly | pkgs/tools/yasm/src/modules/preprocs/nasm/tests/orgsect.asm | manggoguy/parsec-modified | d14edfb62795805c84a4280d67b50cca175b95af | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | pkgs/tools/yasm/src/modules/preprocs/nasm/tests/orgsect.asm | manggoguy/parsec-modified | d14edfb62795805c84a4280d67b50cca175b95af | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | pkgs/tools/yasm/src/modules/preprocs/nasm/tests/orgsect.asm | manggoguy/parsec-modified | d14edfb62795805c84a4280d67b50cca175b95af | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | ORG 100h
label:
db 5
STRUC Foo
.bar resb 4
ENDSTRUC
dw label
| 7.625 | 11 | 0.754098 |
432a4655d31bfad22245a09d26a2bccb68841c73 | 9,004 | asm | Assembly | test/movq.asm | killvxk/AssemblyLine | 2a20ec925532875c2f3bb5d423eb38a00bc5c91d | [
"Apache-2.0"
] | 147 | 2021-09-01T03:52:49.000Z | 2022-03-30T16:59:58.000Z | test/movq.asm | killvxk/AssemblyLine | 2a20ec925532875c2f3bb5d423eb38a00bc5c91d | [
"Apache-2.0"
] | 7 | 2021-09-10T07:03:36.000Z | 2022-03-03T23:30:58.000Z | test/movq.asm | killvxk/AssemblyLine | 2a20ec925532875c2f3bb5d423eb38a00bc5c91d | [
"Apache-2.0"
] | 19 | 2021-09-09T10:54:44.000Z | 2022-03-18T19:56:45.000Z | 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
| 15.365188 | 25 | 0.74267 |
370fe466b6e68988c9a6abb74add09125edd7977 | 75,738 | asm | Assembly | Tools/swat/Stub/main.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Tools/swat/Stub/main.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Tools/swat/Stub/main.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) Berkeley Softworks 1988 -- All Rights Reserved
PROJECT: PC GEOS
MODULE: Swat -- Debugging Stub
FILE: main.asm
AUTHOR: Adam de Boor, Nov 15, 1988
ROUTINES:
Name Description
---- -----------
SetInterrupt Set an interrupt vector to one of our own
routines
ResetInterrupt Restore an interrupt vector to what it used
to be.
Main Entry point
FetchArg Look up argument in command tail
CatchInterrupt Vector interrupt to special handler
IgnoreInterrupt Reset interrupt to previous handler
SaveState Switch to Stub-State
RestoreState Return to state prior to last SaveState
FindSwatTSRStub Look for a TSRed stub.
TransferControlToTSR Resume execution of the TSR.
REVISION HISTORY:
Name Date Description
---- ---- -----------
Adam 11/15/88 Initial revision
DESCRIPTION:
This is the main file for the Swat debugging stub.
It contains all the code for loading and relocating the kernel, as
well as starting up and various utility functions.
$Id: main.asm,v 2.50 97/05/23 08:16:15 weber Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
_Main = 1
KERNEL = 1
include stub.def
include geos.def ; for Semaphore
include ec.def ; for FatalErrors
include heap.def ; for HeapFlags
include geode.def
include thread.def ; for ThreadPriority
include Internal/heapInt.def ; ThreadPrivateData
include Internal/dos.def ; for BIOS_DATA_SEG
if _Regs_32
.386
endif
;==============================================================================
;
; Define the state block/stack segment contents
;
;==============================================================================
sstack segment
;
; Pretend we're the kernel.
;
tpd ThreadPrivateData <
0, ; TPD_blockHandle (none)
0, ; TPD_processHandle (?!)
sstack, ; TPD_dgroup
HID_KTHREAD, ; TPD_threadHandle
0, ; TPD_classPointer (none)
0, ; TPD_callVector
0, ; TPD_callTemporary
StackTop, ; TPD_stackBot
0, ; TPD_dataAX (don't care; placeholder)
0, ; TPD_dataBX (don't care; placeholder)
0, ; TPD_curPath (don't care; placeholder)
0 ; TPD_exceptionHandlers -- This must be zero in the
; stub in order for SysLockCommon to function
; properly. --JimG 5/15/96
>
public tpd ; for kernel.asm
;
; Our private stack.
;
StackTop label word
db STUB_STACK_SIZE dup (?)
StackBot label word
sstack ends
;==============================================================================
;
; Data definitions. Variables are kept in the code segment b/c it allows
; us to use cs: in difficult places. Besides, we don't have to be in ROM.
;
;==============================================================================
scode segment
ifdef ZOOMER
PIC1_Mask byte 0fdh ; Mask for PIC1 (the master). Rpc_Init
; masks in the com port's bit.
PIC2_Mask byte 0feh ; Mask for PIC2 (the slave)
COM_Mask1 byte ; Mask for the communications port,
COM_Mask2 byte
else
; inverse (for masking purposes)
PIC1_Mask byte 0feh ; Mask for PIC1 (the master). Rpc_Init
; masks in the com port's bit.
PIC2_Mask byte 0ffh ; Mask for PIC2 (the slave)
COM_Mask1 byte ; Mask for the communications port,
COM_Mask2 byte ; which may never be turned off.
; This is actually the com port mask's
; inverse (for masking purposes)
endif
PSP sptr ; Segment of current PSP
swatPSP sptr ; Segment of swat stubs original PSP
swatDrive byte ; original drive swat ran from
swatPath byte 64 dup (0) ; original path swat ran from
intsToIgnore byte 16 dup (0) ; byte set to ignore int
if USE_SPECIAL_MASK_MODE
noSpecialMaskMode word 0 ; non-zero to biff special mask mode
endif
if ENABLE_CHANNEL_CHECK
noChannelCheck word 0 ; non-zero to not give special attention
; to I/O channel check
endif
sysFlags SysFlags <> ; System status flags -- all 0 for init
stubCode word scode ; Segment in which we're running, since
; we can't compare against CS
if _Regs_32
STUB_USES_REG32 = 128
else
STUB_USES_REG32 = 0
endif
ifndef ZOOMER
stubType byte STUB_LOW or STUB_USES_REG32 ; Type of stub we are -- set to
; other stub type if INIT_HARDWARE
; goes well.
else
stubType byte STUB_ZOOMER or STUB_USES_REG32
endif
stubCounter word 0
ifndef NETWARE
waitValue dword
endif
doTSR byte 0
tsrSize word 0
assume cs:scode,ds:nothing,es:nothing,ss:sstack
if 0 ;; useful code should something trash memory before
;; Swat can even attach
bleah proc far
push ds
push bx
push bp
pushf
mov bp, sp
mov bx, 653h
mov ds, bx
cmp {byte}ds:[111h], 0xe8
lds bx, ss:[bp+8]
je ok
push ax
mov al, ds:[bx]
mov ah, 0eh
int 10h
pop ax
ok:
inc bx
mov ss:[bp+8], bx
popf
pop bp
pop bx
pop ds
ret
bleah endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Main
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Entry routine
CALLED BY: MS-DOS
PASS: es = PSP
RETURN: Nothing
DESTROYED: Everything
PSEUDO CODE/STRATEGY:
First of all, check if there already is a swat stub TSRed. If so,
transfer control to it.
Initialize the RPC module
Note /s switch.
Find kernel file in command tail
Copy kernel args down to the bottom of the tail and change the
tail length appropriately
Load kernel, performing relocation.
If /s, enter special loop waiting for connection.
Hand control over to the kernel.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/15/88 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
noStartee word 0
tsrMode word 0
Main proc far
if 0 ;; funky code for setting DR0 to trap a write to a byte that was
;; getting trashed (for which "bleah" was checking)
.inst byte 66h
mov ax, 6641h | .inst word 0 ; mov eax, 6641h
.inst byte 0fh, 23h, 0xc0 ; movs dr0, eax
.inst byte 66h
mov ax, 0x0303 | .inst word 0x0001
.inst byte 0fh, 23h, 0xf8 ; movs dr7, eax
endif
;; BLEAH a
mov cs:PSP, es ; Preserve PSP segment
mov cs:swatPSP, es
INIT_HARDWARE
if DEBUG and DEBUG_OUTPUT eq DOT_MONO_SCREEN
test ds:[sysFlags], mask stubTSR
jnz skipScreenReset
; clear the screen and set the initial blinking cursor
les di, cs:[curPos]
mov cx, SCREEN_SIZE/2
mov ax, (SCREEN_ATTR_NORMAL shl 8) or ' '
rep stosw
mov di, cs:[curPos].offset
mov ax, (SCREEN_ATTR_NORMAL or 0x80) or 0x7f
stosw
skipScreenReset:
endif
;
; Load es and ds properly
;
mov ax, cs
mov ds, ax
mov es, ax
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'M'
DA DEBUG_TSR, <pop ax>
;
; Look for a swat stub that TSRed. If found,
; transfer control to it.
;
call FindSwatTSRStub
;; BLEAH b
jnc noTSR
jmp TransferControlToTSR ;does not return.
.unreached
noTSR:
segmov ds, cs
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'N'
DA DEBUG_TSR, <pop ax>
; save away the current drive and path for downloading files
mov ah, MSDOS_GET_DEFAULT_DRIVE
int 21h
mov cs:swatDrive, al
mov al, '\\'
mov cs:swatPath, al
mov ah, MSDOS_GET_CURRENT_DIR
mov si, (offset swatPath) + 1
clr dl ; default drive
int 21h
;; BLEAH c
assume ds:cgroup, es:cgroup
call far ptr MainHandleInit
;; BLEAH d
LONG jc deathDeathDeath
mov ds:noStartee, bx ;Save /s flag
mov ds:tsrMode, cx ;Save /t flag
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 't'
DPW DEBUG_TSR, cx
DPC DEBUG_TSR, 's'
DPW DEBUG_TSR, bx
DA DEBUG_TSR, <pop ax>
;
; Load in the kernel. This fills in the kernelHeader structure
; stubInit is OVERWRITTEN by this call -- can no longer
; call things there.
;
; Kernel_Load sets up exe_cs and exe_ss in kernelHeader for us.
;
call Kernel_Load
;; BLEAH e
LONG jc deathDeathDeath
;
; Change in plans. To deal with DosExec we now load the loader as a
; separate entity with its own PSP and everything.
;
call MainFinishLoaderLoad
;; BLEAH f
LONG jc deathDeathDeath
;
; Point DS back at cgroup (points at kernel when Kernel_Load
; returns)
;
segmov ds,cs,ax
;
; Set up SS:SP for the kernel now.
;
mov ss, ds:[kernelHeader].exe_ss
mov sp, ds:[kernelHeader].exe_sp
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 's'
DPW DEBUG_TSR, ss
DPW DEBUG_TSR, sp
DA DEBUG_TSR, <pop ax>
;
; Stick in our hook at the base of the loader code segment
;
push es
mov es, ds:[kernelHeader].exe_cs
mov {word}es:[0], 0x9a9c ; PUSHF / CALL FAR PTR
mov {word}es:[2], offset KernelLoader
mov {word}es:[4], cs
pop es
;
; Set up interrupt frame for start of kernel in case we want
; to keep the kernel stopped...
;
sti
pushf
push ds:[kernelHeader].exe_cs
push ds:[kernelHeader].exe_ip
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'c'
DPW DEBUG_TSR, ds:[kernelHeader].exe_cs
DPW DEBUG_TSR, ds:[kernelHeader].exe_ip
DA DEBUG_TSR, <pop ax>
;
; kdata now lives at the base of the kernel; kcodeSeg is adjusted
; when we're told what resource kcode is -- ardeb 1/22/91
;
mov ax, ds:[kcodeSeg]
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'k'
DPW DEBUG_TSR, ax
DA DEBUG_TSR, <pop ax>
mov ds:[kdata], ax
mov ds:[loaderBase], ax ; also the initial base of
; the loader.
;; BLEAH g
;
; Flag initialization complete.
;
ornf ds:[sysFlags], mask initialized
;
; Set up es and ds as if the kernel had been invoked from the
; shell.
;
mov es, ds:[PSP]
mov ds, ds:[PSP]
;
; See if /s given
;
tst cs:noStartee ; Were it there, mahn?
jnz MainDontStart ; yow. keep that puppy stopped
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'Y'
DA DEBUG_TSR, <pop ax>
;
; No -- just do an iret to clear the stack and get going
;
RESTORE_STATE ; Deal with write-protect, etc...
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'Z'
DA DEBUG_TSR, <pop ax>
ornf cs:[sysFlags], mask running
iret
MainDontStart:
;
; Just do a normal state save and go wait for something to do
;
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'T'
DA DEBUG_TSR, <pop ax>
call SaveState
jmp Rpc_Run
noLoadMahn char 'Couldn''t load kernel: '
ecode char '00', '\r\n$'
ifdef ZOOMER
swatRunError char '\r\n','The loader.exe file is missing.', '\r\n'
char 'Please download this platform''s loader.exe'
char 'file and try again.','\r\n$'
else
swatRunError char '\r\n', "Couldn't run requested version of GEOS"
char '\r\n', 'Please make sure you are in the '
char 'correct EC or NC directory and try again','\r\n$'
endif
deathDeathDeath:
push ax
aam
xchg al, ah
or {word}ds:ecode, ax
segmov ds,cs
pop ax
mov dx, offset swatRunError
cmp ax, 2
je printError
mov dx, offset noLoadMahn
printError:
mov ah, 9
int 21h
mov ax, RPC_HALT_BPT
call IgnoreInterrupt
ifndef NETWARE
ifndef WINCOM
push cx
mov cx, 20
call Sleep
pop cx
endif
endif
ifdef NETWARE
segmov ds,cs
mov ax, 1
call NetWare_Exit
endif
ifdef WINCOM
segmov ds,cs
mov ax, 1
call WinCom_Exit
endif
EXIT_HARDWARE
mov ax, 4c01h
int 21h
.unreached
; mov ds:noStartee, -1
; jmp foo
Main endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
TransferControlToTSR
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Transfer control to the swat stub that is TSRed.
CALLED BY: Main
PASS: ds = PSP of TSR
RETURN: does not return
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 11/ 4/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
TransferControlToTSR proc near
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'T'
DPC DEBUG_TSR, 'S'
DPC DEBUG_TSR, 'R'
DA DEBUG_TSR, <pop ax>
;
; transfer control to TSRed instance of stub. ds = PSP of TSR.
; This is accomplished by setting our PSP_parentId to the PSP of
; the stub TSR, and setting PSP_saveQuit to the address to resume
; execution. When we exit, DOS will think that the stub had
; originally Exec'ed us, and will return execution at the
; PSP_saveQuit address.
;
mov dx, ds
mov cx, dx ;cx = PSP of TSR
add dx, 0x10 ;dx = code seg. of TSR
mov ax, cs:[PSP]
mov ds, ax
clr si ;ds:si = my PSP.
mov ds:[si].PSP_parentId, cx
mov ds:[si].PSP_saveQuit.segment, dx
mov ds:[si].PSP_saveQuit.offset, offset StubResume
;
; In addition, copy PSP_cmdTail to the TSR PSP, since it may have
; been destroyed (what really happens?)
;
mov si, PSP_cmdTail ;ds:si = my PSP_cmdTail
mov es, cx
mov di, si ;es:di = PSP_cmdTail of TSR
mov cx, CMD_TAIL_SIZE
rep movsb
;
; perform a standard exit
;
mov ax, MSDOS_QUIT_APPL shl 8
int 21h
.unreached
TransferControlToTSR endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FindSwatTSRStub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Look for the possible existence of a swat TSR stub.
CALLED BY: Main
PASS: nothing
RETURN: if swat stub TSR stub is found:
carry set
ds = PSP of stub.
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
Walk the MCB chain, using undocumented DOS stuff.
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 11/ 1/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FindSwatTSRStub proc near
uses ax,bx,cx,dx,si,di,es
.enter
;
; Get the first MCB in the chain by looking at offset -2 of the
; es:bx address returned by MSDOS_GET_DOS_TABLES.
;
mov ah, MSDOS_GET_DOS_TABLES
int 21h
mov ax, es:[bx-2]
mov es, ax
clr di
;
; Follow the MCB chain starting with es:0, looking for the
; signature of the swat stub, except that we're not interested
; in ourselves.
;
findLoop:
cmp es:[di].MCB_endMarker, 'M'
jne notFound ;end of MCB chain
mov ax, es:[di].MCB_PSP
tst ax
jz findNext ;skip free blocks
;
; Make sure we skip our own MCB, because even though we
; have the correct signature, we're only interested in
; the TSRed instance of the stub.
;
cmp ax, cs:[PSP]
je findNext
;
; Look for the right signature.
;
push es ;save MCB
;
; account for the difference between the PSP and cs in
; an EXE program. The PSP is 16 paragraphs below the
; start of the load image of a .exe file.
;
mov dx, ax ;save the PSP
add ax, 0x10 ;skip the PSP
mov ds, ax ;ds = cs of TSR (?)
mov si, offset swatStubSignature
segmov es, cs
mov di, offset swatStubSignature
mov cx, length swatStubSignature
repe cmpsb
pop es ;restore MCB
stc
mov ds, dx ;restore that PSP.
jz done
findNext:
;
; jump to the next MCB
;
clr di
mov ax, es
add ax, es:[di].MCB_size
inc ax ;is this necessary?
mov es, ax
jmp findLoop
notFound:
clc
done:
.leave
ret
FindSwatTSRStub endp
swatStubSignature char "GEOS Swat Stub", 0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StubResume
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: This is called by DOS when a stub loaded as TSR should
take over control.
CALLED BY: DOS
PASS: nothing -- all registers but cs:ip are suspect.
RETURN: never.
DESTROYED: nothing
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CL 11/ 1/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StubResume proc near
assume ds:nothing
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'S'
DPC DEBUG_TSR, 't'
DPC DEBUG_TSR, 'u'
DPC DEBUG_TSR, 'b'
DA DEBUG_TSR, <pop ax>
; Re-initialize stuff in dgroup. Since we can be re-executing
; after a TSR, we cannot count on idata and udata being
; automatically reinitialized.
;not necessary
DA DEBUG_TSR, <push ax>
DPW DEBUG_TSR, cs:[kernelCore]
DA DEBUG_TSR, <pop ax>
clr cs:[kernelCore]
mov cs:[sysFlags], mask stubTSR
mov dx, segment stubInit
mov ds, dx
clr ds:[loaderPos]
;
; Main expects es = PSP. We know that cs is the first segment,
; so the PSP = cs - 10h
;
mov ax, cs
sub ax, 10h
mov ds, ax
mov es, ax
jmp Main
.unreached
StubResume endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sleep
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: pause for a few moments to smell the roses
CALLED BY: GLOBAL
PASS: cx = number of seconds to smell
RETURN: Void.
DESTROYED: Nada.
PSEUDOCODE/STRATEGY:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; the BIOS location 40h:6ch contains a dword that gets incremented
; 18.2 times per second, I will use this to tick of ten seconds
; and if I have not yet got a sync I will timeout and abort
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use the calibrated value we got at startup since we want
interrupts off now (I am not sure why, but it goes off into
space if interrupts are on)
KNOWN BUGS/SIDEFFECTS/IDEAS:
use 16 instead of 18.2, close enough for me...
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 10/18/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
; random code for taking up CPU cycles
WasteTime macro
; add code here if machines ever get too fast
endm
ifndef NETWARE
Sleep proc far
uses cx, bx, ds, ax, dx
.enter
cli
shl cx ; use 16 instead of 18.2
shl cx
shl cx
shl cx
outerLoop:
push cx
mov cx, cs:[waitValue].low
mov dx, cs:[waitValue].high
; ok, lets deal with the low word...
waitLowLoop:
WasteTime
loop waitLowLoop
; now deal with the high loop
waitHighLoop:
tst dx
jz afterInnerLoop
clr cx
waitHighInnerLoop:
WasteTime
loop waitHighInnerLoop
dec dx
jmp waitHighLoop
afterInnerLoop:
pop cx
loop outerLoop
sti
.leave
ret
Sleep endp
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MainFinishLoaderLoad
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Perform the actual loading of the loader, now that Kernel_Load
has set everything up for us.
CALLED BY: Main
PASS: ds = cgroup
RETURN: carry set if couldn't load:
ax = error code
DESTROYED: ax, bx, cx, dx, si, di, bp
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 5/ 6/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
LoadProgramArgs struct
LPA_environment sptr ; environment for program
LPA_commandTail fptr ; command tail to use
LPA_fcb1 fptr ; FCB #1
LPA_fcb2 fptr ; FCB #2
LPA_ss_sp fptr ; OUT: ss:sp for new process
LPA_cs_ip fptr ; OUT: cs:ip for new process
LoadProgramArgs ends
MainFinishLoaderLoad proc near
lpa local LoadProgramArgs
.enter
;
; Shrink ourselves down appropriately.
;
tst ds:tsrMode
jz noTSR
mov bx, segment stubInit
;
; don't get rid of stubInit. Keep it all instead...
;
mov cx, offset endOfStubInit
shr cx
shr cx
shr cx
shr cx ; in paragraphs.
inc cx ;is anything getting chopped off?
add bx, cx
;
; place a new value in kcodeSeg, since we're not overwriting
; ourselves now.
;
mov ds:[kcodeSeg], bx
jmp resize
noTSR:
mov bx, ds:[kcodeSeg]
resize:
;; BLEAH A
mov ax, ds:[PSP]
sub bx, ax ; bx <- paragraphs needed
mov ds:[tsrSize], bx
mov es, ax ; es <- block to resize
mov ah, MSDOS_RESIZE_MEM_BLK
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'r'
DPW DEBUG_TSR, bx
DA DEBUG_TSR, <pop ax>
int 21h
;; BLEAH B
;
; Set up the parameter block and load the beast.
;
mov ss:[lpa].LPA_environment, 0
mov ax, ds:[PSP]
mov ss:[lpa].LPA_commandTail.segment, ax
mov ss:[lpa].LPA_commandTail.offset, PSP_cmdTail
mov ss:[lpa].LPA_fcb1.segment, ax
mov ss:[lpa].LPA_fcb1.offset, offset PSP_fcb1
mov ss:[lpa].LPA_fcb2.segment, ax
mov ss:[lpa].LPA_fcb2.offset, offset PSP_fcb2
if DEBUG and DEBUG_INIT
mov si, offset kernelName
call DebugPrintString
push ds
lds si, ss:[lpa].LPA_commandTail
inc si
call DebugPrintString
pop ds
endif
;
; XXX: Under MS-DOS 5 & 6, this call somehow mystically trashes
; the low word of the video BIOS interrupt. I have no idea how it
; manages this, and an extended trace with netswat revealed only that
; the thing blows up when stepping through IPXODI (re-entrancy, you
; know). Rather than figure out what the f*** microsoft is doing
; wrong, I'm just going to preserve the offset across the call.
; -- ardeb 3/23/94
;
clr ax
mov es, ax
push es:[10h*fptr].offset
segmov es, ss
lea bx, ss:[lpa]
mov dx, offset kernelName
mov ax, (MSDOS_EXEC shl 8) or MSESF_LOAD
push bp, ds
int 21h ; XXX: on 2.X, this biffs everything
; but CS:IP
;; BLEAH C
pop bp, ds
mov bx, 0 ; don't mess with carry or error code
mov es, bx
pop es:[10h*fptr].offset
jc done
;
; Fetch the new process's PSP.
;
mov ah, MSDOS_GET_PSP
int 21h
;; BLEAH D
DPW DEBUG_INIT, bx
mov ds:[PSP], bx
;
; Set the termination address properly so it doesn't come back to just
; after the int 21h, above
;
mov es, bx
mov es:[PSP_saveQuit].segment, cs
mov es:[PSP_saveQuit].offset, offset MainGeosExited
;
; Record PSP+16 as the actual kcodeSeg etc.
;
add bx, size ProgramSegmentPrefix shr 4
mov ds:[kdata], bx
mov ds:[kcodeSeg], bx
;
; Fetch the cs:ip and ss:sp for the kernel and store them away in the
; kernelHeader for our caller to use.
;
mov ax, ss:[lpa].LPA_cs_ip.segment
mov ds:[kernelHeader].exe_cs, ax
mov ax, ss:[lpa].LPA_cs_ip.offset
mov ds:[kernelHeader].exe_ip, ax
mov ax, ss:[lpa].LPA_ss_sp.segment
mov ds:[kernelHeader].exe_ss, ax
mov ax, ss:[lpa].LPA_ss_sp.offset
mov ds:[kernelHeader].exe_sp, ax
clc
done:
;; BLEAH E
.leave
ret
MainFinishLoaderLoad endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MainGeosExited
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Place to which DOS returns when geos finally exits.
CALLED BY: DOS
PASS: nothing -- all registers but cs:ip are suspect
RETURN: never
DESTROYED: us
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 5/ 6/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if DEBUG and DEBUG_OUTPUT eq DOT_BUFFER
debugPtrPtr nptr debugPtr ; so Swat can find the
; thing easily...
endif
uffDa word MainGeosExited
MainGeosExited proc far
;
; clear the attached flag *now* so SaveState doesn't try to dick
; with non-existent currentThread variable.
;
; 10/19/95: release processor exceptions first, since once we clear
; the attached flag, RpcExit won't -- ardeb
;
mov ss, cs:[our_SS]
mov sp, offset StackBot
test cs:[sysFlags], mask attached
jz save_State
push ds
segmov ds, cs
call Kernel_ReleaseExceptions
andnf ds:[sysFlags], not mask attached
pop ds
save_State:
pushf ; create suitable frame
push cs ; for SaveState
push cs:[uffDa]
call SaveState ; I think this should be
; ok, as we'll probably
; be on our own stack
; anyway...
segmov ds, cs
DA DEBUG_TSR, <push ax>
DPS DEBUG_TSR, <MGE>
DA DEBUG_TSR, <pop ax>
;
; Get the return code from Geos to check if it TSRed. If
; Geos TSRed, then remember that fact because then the stub
; must also TSR.
;
mov ah, 4dh
int 21h
DA DEBUG_TSR, <push ax>
DPB DEBUG_TSR, ah
DPW DEBUG_TSR, ds:[sysFlags]
DA DEBUG_TSR, <pop ax>
cmp ah, DSEC_TSR
jne notTSR
or ds:[sysFlags], mask geosTSR
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 't'
DPW DEBUG_TSR, ds:[sysFlags]
DA DEBUG_TSR, <pop ax>
notTSR:
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'n'
DA DEBUG_TSR, <pop ax>
;
; Notify UNIX of exit. UNIX will in turn instruct us to
; exit, so life will be groovy (but we'll be dead).
; Note we need to record that GEOS is gone so RpcExit
; doesn't go to EndGeos again.
;
or ds:[sysFlags], MASK geosgone
test ds:[sysFlags], mask connected
jz handleUnattachedExit
tst ds:[doTSR]
jnz dontReallyExit
mov ax, RPC_EXIT
clr cx
call Rpc_Call
jmp Rpc_Run
handleUnattachedExit:
;
; The kernel is exiting. Pretend we received an RPC_EXIT call.
; It will reset the necessary vectors etc. and then call
; DOS to exit.
;
DA DEBUG_TSR, <push ax>
DPC DEBUG_TSR, 'Z'
DPW DEBUG_TSR, ds
DPW DEBUG_TSR, ds:[sysFlags]
DA DEBUG_TSR, <pop ax>
jmp RpcExit
dontReallyExit:
mov ax, 3100h ; TSR
mov dx, ds:[tsrSize]
int 21h
.UNREACHED
MainGeosExited endp
if DEBUG
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DebugPrintString
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Print a null-terminated string
CALLED BY: Debugging things
PASS: ds:si = null-terminated string to print
ah = attribute
RETURN: nothing
DESTROYED:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 1/13/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DebugPrintStringFar proc far
call DebugPrintString
ret
DebugPrintStringFar endp
DebugPrintString proc near
uses al, si
.enter
printLoop:
lodsb
tst al
jz done
call DebugPrintChar
jmp printLoop
done:
.leave
ret
DebugPrintString endp
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DebugPrintByte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Print a byte in HEX on the screen
CALLED BY: Debugging things
PASS: AL = byte to print
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
adam 6/27/88 Initial Revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
nibbles db "0123456789ABCDEF"
DebugPrintByteFar proc far
call DebugPrintByte
ret
DebugPrintByteFar endp
DebugPrintByte proc near
push bx
push ax
mov bx, offset nibbles
shr al, 1
shr al, 1
shr al, 1
shr al, 1
and al, 0fh
xlatb cs:
mov ah, SCREEN_ATTR_NORMAL
call DebugPrintChar
pop ax
push ax
and al, 0fh
xlatb cs:
mov ah, SCREEN_ATTR_NORMAL
call DebugPrintChar
mov ax, (SCREEN_ATTR_NORMAL shl 8) or ' '
call DebugPrintChar
pop ax
pop bx
ret
DebugPrintByte endp
COMMENT }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DebugPrintWord
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Print a word in HEX on the screen
CALLED BY: Debugging things
PASS: AX = byte to print
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
adam 6/27/88 Initial Revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%}
DebugPrintWordFar proc far
call DebugPrintWord
ret
DebugPrintWordFar endp
DebugPrintWord proc near
uses ax, bx, cx
.enter
mov bx, offset nibbles
mov cl, 4
xchg al, ah
ror al, cl
call printNibble
ror al, cl
call printNibble
xchg al, ah
ror al, cl
call printNibble
ror al, cl
call printNibble
mov ax, (SCREEN_ATTR_NORMAL shl 8) or ' '
call DebugPrintChar
.leave
ret
printNibble:
push ax
and al, 0fh
xlatb cs:
mov ah, SCREEN_ATTR_NORMAL
call DebugPrintChar
pop ax
retn
DebugPrintWord endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DebugPrintChar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Print the passed character to the screen, obeying the
attribute request, if possible.
CALLED BY: Debugging things
PASS: ah = attribute
al = character
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 7/12/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
DebugPrintCharFar proc far
call DebugPrintChar
ret
DebugPrintCharFar endp
if DEBUG_OUTPUT eq DOT_BIOS
ifdef ZOOMER
charNum word 0
endif
DebugPrintChar proc near
uses ax
.enter
ifdef ZOOMER
cmp charNum, 1300
jl printChar
push bx, dx, ax
mov ah, 2
mov bh, 0
mov dx, 0
int 10h
pop bx, dx, ax
mov cs:[charNum], 0
printChar:
inc cs:[charNum]
endif
ifdef RESPONDER
;Fucking buggy bios...
push bx, dx, si, bp
clr bx
endif
PENE < pushf >
PENE < push bx >
PENE < clr bx >
mov ah, 0xe
int 10h
PENE < pop bx >
PENE < popf >
ifdef RESPONDER
pop bx, dx, si, bp
endif
.leave
ret
DebugPrintChar endp
elif DEBUG_OUTPUT eq DOT_BUFFER
debugPtr nptr.char debugBuf ; current position in buffer
debugBufSize word DEBUG_RING_BUF_SIZE ; size of buffer, for ddebug
; to use
debugMagic word 0xadeb ; my initials, again
debugBuf char DEBUG_RING_BUF_SIZE dup(0)
DebugPrintChar proc near
uses di
.enter
ifdef WINCOM
push bx, dx
mov bx, VDD_FUNC_SHOW_OUTPUT_CHAR
mov dx, ax ; char and attribute
call CallVDD
pop bx, dx
endif ; WINCOM
mov di, cs:[debugPtr]
push ax
cmp ah, SCREEN_ATTR_INV
jne storeChar
or al, 0x80
storeChar:
mov cs:[di], al
pop ax
inc di
cmp di, offset debugBuf + size debugBuf
jb done
mov di, offset debugBuf
done:
mov cs:[debugPtr], di
.leave
ret
DebugPrintChar endp
else
.assert DEBUG_OUTPUT eq DOT_MONO_SCREEN
SCREEN_SEG equ 0xb000
SCREEN_SIZE equ (80*2)*25 ; total # bytes in screen
MonoScreen segment at SCREEN_SEG
screenBase label word
MonoScreen ends
curPos fptr.word screenBase; current location in mono screen
DebugPrintChar proc near
uses es, di
.enter
les di, cs:[curPos]
stosw
cmp di, SCREEN_SIZE
jb setCursor
clr di
setCursor:
mov {word}es:[di], ((SCREEN_ATTR_NORMAL or 0x80) shl 8) or \
0x7f
mov cs:[curPos].offset, di
.leave
ret
DebugPrintChar endp
endif
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CatchInterrupt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Revector the indicated interrupt to one of our IRQ routines.
CALLED BY: main, RpcCatch
PASS: AL = interrupt # to be intercepted
Interrupts OFF
RETURN: Nothing
DESTROYED: AX
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Doesn't use SetInterrupt because most of the work there would be
duplicated here just to figure the correct element of InterruptHandlers
to use.
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/16/88 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CatchInterruptFar proc far
call CatchInterrupt
ret
CatchInterruptFar endp
CatchInterrupt proc near
push es ; Save needed registers
push bx
push dx
push si
clr ah ; Clear out high byte
clr bx ; Set ES to 0 for addressing vector
; table
mov es, bx
shl ax, 1 ; AX *= 4 to give vector address
shl ax, 1
mov bx, ax
shl ax, 1 ; * 8 to give offset into
; InterruptHandlers of interception
; record.
add ax, offset InterruptHandlers
mov dx, ax ; DX gets offset of actual handler code
add ax, 4 ; Offset to storage for old vector
mov si, ax ; That goes into SI
mov ax, es:2[bx] ; Fetch current CS
cmp ax, ds:stubCode ; Make sure it's not already caught
je CI2 ; It is...
mov 2[si], ax ; Not caught -- save it
mov es:2[bx], cs ; Store ours
mov ax, es:[bx] ; Fetch IP of vector
mov [si], ax ; Save it
mov es:[bx], dx ; Store ours
CI2:
pop si ; Restore registers
pop dx
pop bx
pop es
ret
CatchInterrupt endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IgnoreInterrupt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Restore the indicated interrupt to its previous value
CALLED BY: RpcExit
PASS: AL = interrupt # to be intercepted
Interrupts OFF
RETURN: Nothing
DESTROYED: AX
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/16/88 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
IgnoreInterrupt proc near
push es ; Save needed registers
push bx
push si
clr ah ; Clear out high byte
clr bx ; Set ES to 0 for addressing vector
; table
mov es, bx
shl ax, 1 ; AX *= 4 to give vector address
shl ax, 1
mov bx, ax
shl ax, 1 ; * 8 to give offset into
; InterruptHandlers of interception
; record.
add ax, offset InterruptHandlers + 4
mov si, ax ; That goes into SI
mov ax, es:2[bx] ; Make sure it's actually caught
cmp ax, ds:stubCode
jne II2 ; It's not -- do nothing
mov ax, 2[si] ; Fetch old CS
mov es:2[bx], ax ; Stuff it
mov ax, [si] ; Fetch old IP
mov es:[bx], ax ; Stuff that
mov word ptr [si+2],0; Indicate vector is free
II2:
pop si ; Restore registers
pop bx
pop es
ret
IgnoreInterrupt endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IRQCommon
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Common code to send off notification of a stop to UNIX
CALLED BY: InterrupHandlers
PASS: [SP] = halt code
RETURN: No
DESTROYED: Everything saved
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 2/ 8/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
haltCodeAddr word ; Address of interrupt code
assume ds:nothing,es:nothing,ss:nothing
IRQCommon proc near
WRITE_ENABLE
pop cs:haltCodeAddr ; Return address goes in haltCodeAddr
; so we can get the reason for the
; stoppage
call SaveState
assume ds:cgroup, es:cgroup, ss:sstack
;XXX put return address back on the new stack (WHY?)
push cs:[haltCodeAddr]
;
; Deal with timing-breakpoint calibration....
;
test ds:[sysFlags], mask calibrating
jz fetchHaltCode
jmp TB_CalibrateLoop
fetchHaltCode:
;
; Since this thing isn't re-entrant and getting interrupted
; in a REP with an override causes evil things to happen, we
; keep interrupts off until the call is actually made.
;
; Fetch the fault code and store it in the args
;
mov bx, ds:[haltCodeAddr]
mov al, [bx]
IRQCommon_StoreHaltCode label near
clr ah
mov ({HaltArgs}ds:[rpc_ToHost]).ha_reason, ax
;
; If stopped on a breakpoint, back the IP up to the bpt's
; address so we don't need to write the registers each time...
;
cmp al, RPC_HALT_BPT
jne IC1
dec [bp].state_ip
IC1:
; get the curXIPage if any
mov ax, -1
tst ds:[xipHeader]
jz gotXIPPage
push es, di
mov es, ds:[kdata]
mov di, ds:[curXIPPageOff]
mov ax, es:[di]
pop es, di
gotXIPPage:
mov ({HaltArgs}ds:[rpc_ToHost]).ha_curXIPPage, ax
;
; Fetch the active thread and store it. If execing a DOS
; prog, pretend it's the kernel thread that's running.
;
mov ax, [bp].state_thread
test ds:[sysFlags], mask dosexec
jz IC1_5
clr ax
IC1_5:
mov ({HaltArgs}ds:[rpc_ToHost]).ha_thread, ax
mov di, offset ({HaltArgs}rpc_ToHost).ha_regs
call Rpc_LoadRegs
;
; Handle breakpoints. Bpt_Check will only
; return if the breakpoint is to be taken.
;
cmp ({HaltArgs}ds:[rpc_ToHost]).ha_reason, RPC_HALT_BPT
jne IC2
call Bpt_Check
IC2:
mov ax, RPC_HALT ; Load RPC parameters here so
mov cx, size HaltArgs ; CHECK_NMI can change them if
mov bx, offset rpc_ToHost ; it wants
cmp ({HaltArgs}ds:[rpc_ToHost]).ha_reason, RPC_HALT_NMI
jne IC2_5
CHECK_NMI
IC2_5:
;
; If not connected, don't send the call...duhhh
;
test ds:[sysFlags], mask connected
jz IC3
call Rpc_Call ; This will turn on interrupts once
; the message is copied into the output
; queue.
IC3:
eni ; Handle skipped call...
;XXX discard return address from stack, since we won't need it
pop ax
jmp Rpc_Run ; Wait for a continue message to come
; in. Rpc_Run will take care of
; returning to the proper context.
IRQCommon endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
InterruptHandlers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: These are the handlers for all the various possible
interrupts.
CALLED BY: CPU
PASS: Nothing
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
A handler consists of a near call to the IRQCommon code, followed by
the interrupt number invoked, followed by the former contents of the
vector for that interrupt. The idea is for IRQCommon to pop the
return address from the stack and have instant access to the
interrupt number and where to jump to if the interrupt is to be
continued.
We only allocate 16 vectors for the low 16 interrupts that we've
got to be able to catch, then another 16 for Swat to do with
as it sees fit. A vector with a saved-vector segment of 0 is
considered free and can be allocated by Swat at any time.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/16/88 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
defineIRQH macro num
;; public IRQ&num
IRQ&num:
call IRQCommon ; Do the regular things
.unreached
byte num ; Interrupt that caused the stop
dword 0 ; Previous vector
endm
word NUM_VECTORS ; So Swat knows how many there are.
InterruptHandlers label near
IRQ_NUM = 0
.warn -unref ; these are referenced indirectly via
; InterruptHandlers
rept NUM_VECTORS
defineIRQH %IRQ_NUM
IRQ_NUM = IRQ_NUM+1
endm
.warn @unref
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FetchTimer0
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Fetch the current value of timer 0, for one reason or
another
CALLED BY: EXTERNAL
PASS: nothing
RETURN: ax = timer 0 counter
DESTROYED: nothing (flags preserved)
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 4/14/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
FetchTimer0 proc near
.enter
pushf
cli
ifdef ZOOMER
;
; Read the word value from the timer. The cruft here is a near-
; duplicate of the kernel's ReadTimer routine. We do not, as it does,
; have access to the currentTimerCount variable, so we just assume the
; maximum value. Note also that the Zoomer timer counts up, while
; the PC timer counts down. All the code expects it to count down,
; so...
;
in ax, TIMER_IO_1_GET_COUNT
tst ax
jz useTickCount
neg ax
add ax, GEOS_TIMER_VALUE
jns haveCount
useTickCount:
mov ax, GEOS_TIMER_VALUE-1
haveCount:
inc ax ; count from 1, not 0
else
;
; Latch timer 0's current counter value. We make sure interrupts are
; off so no one comes along and gives the chip another command before
; we can finish the read...
;
mov al, TIMER_COMMAND_0_READ_COUNTER
out TIMER_IO_COMMAND, al
jmp $+2 ; I/O delay
;
; Now read the two bytes of the value from the timer.
;
in al, TIMER_IO_0_LATCH ; al <- low byte
mov ah, al
jmp $+2 ; I/O delay
in al, TIMER_IO_0_LATCH
xchg al, ah ; return in proper order
endif
push cs
call safePopf
.leave
ret
safePopf:
iret
FetchTimer0 endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SaveState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Save the current state and switch to our own context
CALLED BY: Interrupt handlers (IRQCommon, etc.)
PASS: Interrupts off.
RETURN: Interrupts still off.
ds, es, ss, sp set up
prev_SS, prev_SP set to SS:SP on entry to this function
currentThreadOff set for kernel thread.
bp points to the start of the state block.
DESTROYED: ax, bx
PSEUDO CODE/STRATEGY:
Carefully switch to our stack (wherever we left off),
preserving SS:SP in prev_SS:prev_SP
Push all registers
Push the currentThreadOff and set it to the kernel thread
Push the interrupt controller masks
Set our interrupt masks
Set ds, es to our segment (in cs)
Copy return address from previous stack to ours
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/16/88 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if _Regs_32
prev_SP dword 0 ; SP after save
else
prev_SP word 0 ; SP after save
endif
prev_SS word 0 ; SS before save
our_SS word sstack ; Only way to load SS w/o using another
; register (which we haven't got).
ssRetAddr word ? ; Our return address.
ssTimerCount word ; Count in timer 0 when state last
; saved
ssResumeTimerCountPtr nptr.word 0 ; Place to store count that's in
; timer 0 when we restore state
; 0 if not to store it.
assume ds:nothing, es:nothing, ss:nothing
SaveState proc near
;
; Deal with write-protection, etc.
;
SAVE_STATE
DA DEBUG_ENTER_EXIT, <push ax>
DPC DEBUG_ENTER_EXIT, 'e'
DA DEBUG_ENTER_EXIT, <pop ax>
;
; Remove our return address from the stack
;
pop cs:ssRetAddr
push ax
call FetchTimer0
mov cs:[ssTimerCount], ax
pop ax
;
; Switch to our stack, saving the previous one in
; prev_SS:prev_SP. If we were already on our stack, don't
; change SS:SP at all.
;
mov cs:prev_SS, ss
if _Regs_32
mov cs:prev_SP, esp
else
mov {word}cs:prev_SP, sp
endif
push ax
mov ax, cs:our_SS
cmp cs:prev_SS, ax
pop ax
je SS1
mov ss, cs:our_SS
mov sp, offset StackBot
SS1:
assume ss:sstack
;
; Save all the registers mostly in the order dictated
; by an IbmRegs structure so they can be copied in easily.
;
if _Regs_32
push edi
push esi
push ebp
push cs:prev_SP
push ebx
push edx
push ecx
push eax
else
push di
push si
push bp
push {word}cs:prev_SP
push bx
push dx
push cx
push ax
endif
if _Regs_32
.inst db 0Fh, 0A8h ; push gs
.inst db 0Fh, 0A0h ; push fs
endif
push es
push cs:prev_SS
push ds
;
; Now the pertinent kernel variables:
; currentThread
;
mov ax, HID_KTHREAD ; Assume we don't know and make it
; the kernel...
test cs:sysFlags, MASK attached
jz SS2
mov ds, cs:kdata
mov bx, cs:currentThreadOff
; fetch current thread and switch to kernel context at the
; same time (prevents context switches, in theory)
xchg ax, [bx]
;
; KLUDGE: Make sure the saveSS field of the handle for the
; current thread contains the actual SS for the thread.
; THIS BREAKS THE NON-INTERFERENCE DIRECTIVE. Unfortunately,
; if one uses -b and encounters a thread that cswitched in
; DOS and hasn't cswitched again now it's out, Swat will
; choke b/c the saveSS for the thread will be wrong. Rather
; than making the kernel do extra work all the time, we simply
; make sure the saveSS for the current thread reflects its
; actual value.
;
cmp ax, HID_KTHREAD
je SS2 ; Kernel thread has no real handle, so
; don't try and write to it.
mov bx, ax
mov ax, cs:prev_SS
cmp ax, cs:kdata ; There's one point where we're in
; a thread but still running on the
; kernel stack. If we step through
; there, we don't want to biff things,
; so don't store ss if it's the
je SS1_9 ; kernel stack.
mov ds:[bx].HT_saveSS, ax
SS1_9:
mov ax, bx
SS2:
push ax
;
; Fetch the interrupt controller masks both into ax.
;
in al, PIC2_REG
mov ah, al
in al, PIC1_REG
ifdef ZOOMER
and al, 0fch
else
and al, 0feh
endif
; Make sure timer interrupt is
; enabled on return (might have been
; disabled for single-stepping). If
; function that continues wants it
; disabled, it will have to set the
; bit here itself.
push ax
;
; Fetch flags, cs and ip from the previous stack.
;
if _Regs_32
mov bx, cs:prev_SS
mov ds, bx
mov ebx, cs:prev_SP
else
lds bx, dword ptr cs:prev_SP
endif
push 4[bx] ; Fetch flags
push 2[bx] ; Fetch cs
push [bx] ; Fetch ip
;
; Save the timer interrupt vector and use our own
;
clr ax
mov ds,ax ;ds = interrupt block
push ds:[TIMER_INT_VECTOR].segment
push ds:[TIMER_INT_VECTOR].offset
mov ds:[TIMER_INT_VECTOR].segment,cs
mov ds:[TIMER_INT_VECTOR].offset,offset StubTimerInt
if INTEL_BREAKPOINT_SUPPORT
;
; save the hardware breakpoint status, then clear it
; so the next person to save state doesn't think they also are
; handling a breakpoint
;
movsp eax, dr6
use32 < push ax >
and ax, not ( mask DR6L_B3 or mask DR6L_B2 \
or mask DR6L_B1 or mask DR6L_B0 )
movsp dr6, eax
;
; save the breakpoint state, then disable all breakpoints so
; we don't trigger one from within the stub
;
movsp eax, dr7
use32 < push ax >
and ax, not ( mask DR7L_L0 or mask DR7L_G0 \
or mask DR7L_L1 or mask DR7L_G1 \
or mask DR7L_L2 or mask DR7L_G2 \
or mask DR7L_L3 or mask DR7L_G3 )
movsp dr7, eax
endif
;
; Point bp at the state block just created.
;
mov bp, sp
;
; Adjust for iret frame on stack
;
add {word}([bp].state_sp), 6
;
; Want our data, thank you.
;
mov ax, cs
mov ds, ax
mov es, ax
assume ds:cgroup, es:cgroup
call Bpt_Uninstall
;
; Make sure DF is clear so we don't get nailed by anyone
; but ourselves... (also provides kernel with what it
; expects in case we're about to go to EndGeos...)
;
cld
if USE_SPECIAL_MASK_MODE
;
; Switch the first (maybe only) interrupt controller into
; "special mask mode" whereby interrupts from non-masked
; levels are enabled when the mask register is set. This
; allows us to field breakpoints in service routines for and
; intercept interrupts that are of a higher priority than
; our own serial port.
;
tst noSpecialMaskMode
jnz skipSMM
mov al, 01101000b ; This be enable special mask mode.
; Refer to p. 7-129 of Intel
; Component Data Catalog
out PIC1_REG-1, al ; Need to write to 20h, not 21h...
skipSMM:
mov al, 00001011b ; Fetch the in-service register
out PIC1_REG-1, al ; when reading PIC1_REG-1
out PIC2_REG-1, al ; or PIC2_REG-1
;
; Now install our state. First the interrupt controller masks.
; We merge in the current state of the masks to avoid enabling
; any interrupt we just intercepted.
;
cmp sp, StackTop+SIZE StateBlock+STACK_SLOP
jbe SSMaskAll
in al, PIC1_REG-1 ; Fetch in-service register
or al, PIC1_Mask ; Merge in bits we want masked
and al, COM_Mask1 ; Make sure we're still on...
out PIC1_REG, al ; Set interrupt mask
; XXX: this should kill a Tandy 1000TX
in al, PIC2_REG-1 ; Fetch in-service register
or al, PIC2_Mask ; Merge in bits we want masked
and al, COM_Mask2
out PIC2_REG, al ; Set interrupt mask
else
; EVENTUALLY THIS SHOULD BE DEALT WITH FOR THE ZOOMER!!
ifndef WINCOM
ifndef ZOOMER
;
; Switch the first interrupt controller into a mode where our
; serial line is the highest-priority interrupt in the chip.
;
mov al, ds:[com_IntLevel]
cmp al, 8
jb adjust1stController
sub al, 9 ; make level just above comm IRQ be
; the lowest priority
andnf al, 7
ornf al, 11000000b ; OCW2 with R=1, SL=1, EOI=0
; (q.v. p. 7-129 of Intel Component
; Data Catalog)
out PIC2_REG-1, al
mov al, 2 ; pretend com_IntLevel is 2 -- the
; cascade IRQ level for the 2nd
; controller into the 1st
adjust1stController:
dec al ; make level just above our serial
; port be the lowest priority
or al, 11000000b ; OCW2 with R=1, SL=1, EOI=0
; (c.f. p. 7-129 of Intel
; Component Data Catalog)
out PIC1_REG-1, al
else
; ramp the thing up.. XXX how do we restore it?
mov dx, ds:[comIrq]
clr al
out dx, al
setPrior:
endif ; not ZOOMER
endif ; not WINCOM
;
; Now install our state, setting the interrupt masks to what they
; should be.
;
cmp sp, offset StackTop+SIZE StateBlock+STACK_SLOP
jbe SSMaskAll
mov al, ds:[PIC1_Mask]
out PIC1_REG, al
mov al, ds:[PIC2_Mask]
out PIC2_REG, al
endif ; not special mask mode
;
; Return via the saved return address
;
jmp ds:[ssRetAddr]
SSMaskAll:
;
; Can't take another interrupt (no room on stack) so disable
; all interrupts but our own.
;
mov al, 0ffh
mov ah, ds:[COM_Mask2]
not ah
and al, ah
out PIC2_REG, al
ifndef ZOOMER
mov al, 0xfe
else
mov al, 0xfd
endif
mov ah, ds:[COM_Mask1]
not ah
and al, ah
out PIC1_REG, al
jmp ds:[ssRetAddr]
SaveState endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RestoreState
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Restore the previous state pointed to by bp
CALLED BY: ?
PASS: bp = address of state block to restore
RETURN: all registers, kernel variables restored
DESTROYED: all registers
PSEUDO CODE/STRATEGY:
Pop return address into a vector for jumping through
Disable interrupts
Pop rest of stack back to state block
Pop the components
Return through saved return address
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 11/16/88 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
rsRetAddr word ; Our return address, since it'd be a
; pain to place it on the old stack
; (since we can't use sp for indexing)
; when we can just as easily jump
; through it.
assume ds:cgroup,es:cgroup,ss:sstack
RestoreState proc near
dsi ; No interrupts here
pop ds:[rsRetAddr] ; Fetch our return address
call Bpt_Install
mov sp, bp ; Get back to state block
if DEBUG and DEBUG_INIT
;
; Set the running flag the first time we get off the stub stack, so we
; know to no longer install bpts when on the stub stack in Bpt_Install,
; as stub initialization is complete.
;
cmp ss:[bp].state_ss, sstack
je doRestore
mov ax, ss:[bp].state_cs
cmp ax, scode
jb doRestore
cmp ax, 0xf000
ja doRestore
ornf ds:[sysFlags], mask running
doRestore:
endif
if INTEL_BREAKPOINT_SUPPORT
;
; restore hardware breakpoint state but clear the status
; register so we will have a clean slate for the next stop
;
use32 < pop ax >
movsp dr7, eax
use32 < pop ax >
clr32 ax
movsp dr6, eax
endif
;
; Restore the timer interrupt vector
;
clr ax
mov ds,ax ;ds = interrupt block
pop ds:[TIMER_INT_VECTOR].offset
pop ds:[TIMER_INT_VECTOR].segment
segmov ds,cs,ax
;
; Set up CS:IP and flags
;
mov es, [bp].state_ss
assume es:nothing
mov di, [bp].state_sp
sub di, 6 ; Make room for iret frame
cld
mov [bp].state_sp, di
pop ax ; IP
stosw
pop ax ; CS
stosw
pop ax ; FLAGS
stosw
;
; Disable special mask mode if going back to real operation
; (sp is within the final state block on the stack).
;
cmp sp, offset StackBot-size StateBlock
jb RS2
ifndef ZOOMER
if USE_SPECIAL_MASK_MODE
tst noSpecialMaskMode
jnz RS2
mov al, 01001000b ; This be disable special mask mode.
; Refer to p. 7-129 of Intel
; Component Data Catalog
out PIC1_REG-1, al ; Need to write to 20h, not 21h...
else
mov al, 11000111b ; Make level 7 be the lowest priority
out PIC1_REG-1, al
out PIC2_REG-1, al
endif
else
; reset to level 4...?
mov dx, ds:[comIrq]
mov al, 4
out dx, al
resetPrior:
endif
RS2:
;
; Now the interrupt controller masks
;
pop ax
out PIC1_REG, al
mov al, ah
out PIC2_REG, al
;
; currentThread. SaveState will have stored HID_KTHREAD in
; this slot if it didn't know where to find currentThread when
; the state was saved. If we actually were attached and
; currentThread was HID_KTHREAD when we came in, we don't
; need to store the variable back anyway, as we set
; currentThread to zero on entry...
;
pop ax
cmp ax, HID_KTHREAD
je RS1
mov bx, ds:[currentThreadOff]
mov ds, ds:[kdata]
mov [bx], ax
RS1:
assume ds:nothing
;
; Registers
;
pop ds
pop cs:prev_SS
pop es
if _Regs_32
.inst db 0fh, 0a1h ;pop fs
.inst db 0fh, 0a9h ;pop gs
endif
if _Regs_32
pop eax
pop ecx
pop edx
pop ebx
pop cs:prev_SP
pop ebp
pop esi
pop edi
mov esp, cs:prev_SP
else
pop ax
pop cx
pop dx
pop bx
pop cs:prev_SP
pop bp
pop si
pop di
mov sp, cs:prev_SP
endif
mov ss, cs:prev_SS
assume ss:nothing
tst cs:[ssResumeTimerCountPtr]
jz done
push ax, bx
clr bx
xchg bx, cs:[ssResumeTimerCountPtr]
call FetchTimer0
mov cs:[bx], ax
pop ax, bx
done:
DA DEBUG_ENTER_EXIT, <push ax>
DPC DEBUG_ENTER_EXIT, 'E'
DA DEBUG_ENTER_EXIT, <pop ax>
;
; Write-protect, enable breakpoints and trace-buffer, etc.
;
RESTORE_STATE
;
; Return
;
jmp cs:rsRetAddr
RestoreState endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ResumeFromInterrupt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Resume after an interrupt
CALLED BY: INTERNAL
PASS: ss:bp - state block
RETURN: does not return
DESTROYED: n/a
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
if (not in hardware breakpoint)
restore state
16-bit iret
else
set up to step over next instruction
restore state
rewrite stack as 32-bit interrupt frame
set RF in saved flags
32-bit iret
endif
REVISION HISTORY:
Name Date Description
---- ---- -----------
weber 5/14/97 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ResumeFromInterrupt proc near
if INTEL_BREAKPOINT_SUPPORT
;
; read the breakpoint state
;
DPC DEBUG_HWBRK, 'R'
DA DEBUG_HWBRK, <mov ax, ss:[bp].state_dr6.low>
DPB DEBUG_HWBRK, al
;
; are we in a breakpoint?
;
test ss:[bp].state_dr6.low, \
mask DR6L_B3 or mask DR6L_B2 \
or mask DR6L_B1 or mask DR6L_B0
jnz inBreak
;
; not in a breakpoint - just do a normal iret
;
normal:
call RestoreState
iret
inBreak:
DPC DEBUG_HWBRK, 'b'
;
; if no instruction breakpoint was taken, we do not need
; to do anything fancy
;
call IBpt_CheckType
jz normal
;
; set up to skip the breakpoint
; if we emulate the instruction, then we are no longer at the
; breakpoint so we can continue normally
;
call IBpt_Skip
jc normal
;
; unwind the stack and restore all the thread registers
;
call RestoreState
;
; make room to expand 16-bit stack to a 32-bit stack
;
sub sp, (size Interrupt32Stack - size Interrupt16Stack)
push bp
mov bp, sp
add bp, 2 ; ignore saved BP
;
; shuffle the data
;
clr ss:[bp].I32S_eip.high
segmov ss:[bp].I32S_eip.low, ss:[bp].TS_I16.I16S_ip
segmov ss:[bp].I32S_cs, ss:[bp].TS_I16.I16S_cs
segmov ss:[bp].I32S_eflags.low, ss:[bp].TS_I16.I16S_flags
;
; the caller will get our extended flags, but with RF set
;
push ax
use32 < pushf >
pop ax ; eflags.low
pop ax ; eflags.high
or ax, mask ECPU_RF
mov ss:[bp].I32S_eflags.high, ax
pop ax
;
; make note of the current stack
;
if 0
DA DEBUG_HWBRK, <push ax>
DA DEBUG_HWBRK, <mov bp, sp>
DPC DEBUG_HWBRK, 'P'
DPW DEBUG_HWBRK, sp
DPS DEBUG_HWBRK, <S: >
DPW DEBUG_HWBRK, <ss:[bp]> ; should be ax
DPW DEBUG_HWBRK, <ss:[bp]+2> ; should be bp
DPW DEBUG_HWBRK, <ss:[bp]+4> ; should be ip
DPW DEBUG_HWBRK, <ss:[bp]+6> ; should be 0
DPW DEBUG_HWBRK, <ss:[bp]+8> ; should be cs
DPW DEBUG_HWBRK, <ss:[bp]+10> ; undefined
DPW DEBUG_HWBRK, <ss:[bp]+12> ; should be flags.low
DPW DEBUG_HWBRK, <ss:[bp]+14> ; should be flags.high
DPW DEBUG_HWBRK, <ss:[bp]+16> ; application data
DA DEBUG_HWBRK, <pop ax>
endif
;
; return to caller
;
pop bp
use32 < iret >
else ; not INTEL_BREAKPOINT_SUPPORT
call RestoreState
iret
endif
ResumeFromInterrupt endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StubTimerInt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Handle timer interrupts by turning off the floppy's drive
motor, if need be, and upping our internal counter.
CALLED BY: Hardware
PASS: Nothing
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
tony 8/31/88 Initial Revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StubTimerInt proc far
push ax
push ds
;
; Deliver the specific EOI for this level (timer at level 0). The
; EOI has to be specific since the controller will be in
; special-mask mode when we're called (since we're only called in
; the stub's context).
;
ifdef ZOOMER
mov al, 2 ; TIMER1 interrupt level is 2
out ICEOIPORT, al
else
mov al,I8259_SPEOI
out I8259_COMMAND,al
; take care of floppy drive's motor
mov ax,BIOS_DATA_SEG ;address BIOS variables
mov ds,ax
dec byte ptr ds:[BIOSMotorCount]
jnz afterMotor
push dx
and byte ptr ds:[BIOSMotorStatus],not BIOS_MOTOR_BITS
mov al,BIOS_CMD_MOTOR_OFF
mov dx,BIOS_MOTOR_PORT
out dx,al
pop dx
afterMotor:
endif
segmov ds, cgroup, ax
inc ds:[stubCounter]
pop ds
pop ax
iret
StubTimerInt endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EmulateInterrupt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Pretend to have executed the two-byte software interrupt
at es:di
NOTE: THIS FUNCTION CANNOT WORK IF state_ss IS sstack
CALLED BY: Bpt_Skip, Rpc_Step
PASS: es:di = cs:ip of patient
ax = interrupt instruction
ss:bp = StateBlock
RETURN: nothing
DESTROYED: ax, es, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 9/26/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
EmulateInterrupt proc near
.enter
DA DEBUG_BPT, <push ax>
DPC DEBUG_BPT, 'i'
DA DEBUG_BPT, <pop ax>
push di, es ; save patient's current cs:ip
;
; Set our saved cs:ip to the start of the interrupt handler so
; when we continue, we continue there.
;
clr di
mov es, di
mov al, ah ; al <- interrupt #
clr ah
shl ax ; *4 to index the interrupt
shl ax ; vector table
mov_tr di, ax
mov ax, es:[di].offset
mov ss:[bp].state_ip, ax
mov ax, es:[di].segment
mov ss:[bp].state_cs, ax
;
; Push the return address and flags onto the stack as if the interrupt
; had been taken by the processor...
;
mov es, ss:[bp].state_ss
mov di, ss:[bp].state_sp
sub di, 6
mov ax, ss:[bp].state_flags
andnf ax, NOT TFlag ; Clear TF so it doesn't single-step
; on return (unless we want it to)
mov es:[di][4], ax ; push flags
pop es:[di][2] ; push cs
pop ax
inc ax ; advance beyond software
inc ax ; interrupt instruction
mov es:[di][0], ax ; push ip
mov ss:[bp].state_sp, di
.leave
ret
EmulateInterrupt endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SetInterrupt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set an interrupt w/o consulting MS-DOS, saving the old value
CALLED BY: Com_Init
PASS: ax = interrupt number to alter
bx = place (4-byte) to store old value
dx = new offset
ds = cgroup (relocated, if stub not in original place)
RETURN: Nothing
DESTROYED: ax
PSEUDO CODE/STRATEGY:
Sets es to segment 0, copies old value out, places new offset and cs
in vector.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
adam 6/7/88 Initial Revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SetInterrupt proc far
push es ; preserve registers we'll use
push cx
push bp
clr cx ; Place segment 0 in es.
mov es, cx
shl ax,1 ; Multiply vector # by 4 to get vector
shl ax,1 ; address and place that in bp so we've
mov bp, ax ; got a pointer register to it
dsi ; no interrupts while we're adjusting
; the vectors, thank you.
mov ax, es:[bp] ; First replace offset value
mov [bx], ax
mov es:[bp], dx
mov ax, es:2[bp] ; Then the segment value
mov 2[bx], ax
mov ax, ds:stubCode
mov es:2[bp], ax
eni ; Can now allow interrupts
pop bp ; Restore trashed registers
pop cx
pop es
ret
SetInterrupt endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ResetInterrupt
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reset an interrupt vector we modified
CALLED BY: Com_Exit
PASS: ax = vector number to reset
bx = area (4-byte) from which to restore it
RETURN: Nothing
DESTROYED: ax
PSEUDO CODE/STRATEGY:
Make es point to segment 0 and copy the old vector in w/o regard for
what's there.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
adam 6/7/88 Initial Revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ResetInterrupt proc far
push es ; Preserve registers we'll use
push di
push cx
shl ax,1 ; Form address for vector and place in
shl ax,1 ; bp so we can indirect
mov di, ax
clr cx ; Make es be zero
mov es, cx
dsi ; No interrupts during modification
mov ax, [bx] ; Copy vector elements in
stosw ; DF cleared by SaveState...
mov ax, 2[bx]
stosw
eni ; Interrupts now ok
pop cx ; Restore trashed registers
pop di
pop es
ret
ResetInterrupt endp
scode ends
stubInit segment
assume cs:stubInit, ds:cgroup, es:cgroup
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FetchArg
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Fetch an arg from the command tail
CALLED BY: Com_Init, Main, Kernel_Load
PASS: ES:DI = address of desired arg
ES:BX = place to store succeeding word -- 0 if no value
for arg.
DX = number of bytes in value space.
RETURN: BX = address after word (or 1 if arg takes no value)
DESTROYED: SI, AX, DX
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 9/29/88 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
loaderPos word 0 ; offset of "loader.exe" arg in our
; command tail. this is non-zero
; if we've found it already.
FetchArg proc near
push cx
push ds
push es ; THESE THREE MUST BE IN ORDER
push di ; ...
push bp ; ...
mov bp, sp
mov es, ds:[PSP]
mov ds, ds:[PSP]
cld ; just to be sure
call FAGetTailLength ; ds:si <- start of tail, cx <- # of
; chars to scan
jcxz FAFail
mov di, si ; SCAS uses di
FAFindSlash:
mov al, '/' ; look for /
repne scasb ; do it, babe.
jne FAFail ; Didn't find /
lds si, 2[bp] ; Fetch arg name
FACmp:
lodsb ; Load next arg char
tst al ; See if it's null
jz FAEqual ; Yes -- consider it a match
scasb ; Compare it with the next tail char
loope FACmp ; Continue the scan unless we hit the
; end of the tail or we mismatched.
jne FAFindSlash ; Nope -- look for next arg. Must
; be done in this order to ensure
; that CX keeps track of the tail
; properly. Since REPNE checks CX
; first, even if CX is zero at this
; point, we'll get to FAFail from
; the JNE up above (ZF will be
; unchanged).
lodsb ; Might have hit the end of the arg,
; too. Check for final null
tst al
jne FAFail ; Nope -- no such arg
;FALLTHRU
FAEqual:
tst bx ; See if arg takes a value
jnz FAEqual2 ; yes
inc bx ; No -- set bx as a flag
jmp short FACopyDone2
FAEqual2:
jcxz FAFail ; require : but none here...
mov al, ':' ; Args are separated from their
; values by a colon -- find it
scasb
jnz FAFail ; If hit end of tail (even if last
; char is :), arg invalid
;FACopy:
mov si, di ; Need tail pointer in si for lodsb
FACopy2:
lods byte ptr es:[si]; Copy bytes in until the end of
; the tail or we hit a space or slash
cmp al, ' '
je FACopyDone
cmp al, '/'
je FACopyDone
cmp al, '\t'
je FACopyDone
mov [bx], al ; Store the value byte
inc bx ; Next place in value
dec dx ; See if out of room in value
jz FACopyDone2 ; Yes.
loop short FACopy2 ; Go back as long as there's stuff in
; the tail.
FACopyDone:
mov byte ptr [bx], 0; Null-terminate the value, if there's
; room.
FACopyDone2:
FAFail:
pop bp
pop di ; Remove di from stack
pop es
pop ds
pop cx
ret
FetchArg endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FAGetTailLength
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Fetch the start and number of chars in the command tail
CALLED BY: (INTERNAL) FetchArg
PASS: ds, es = PSP
RETURN: cx = # chars
si = first char of tail to scan
DESTROYED: ax, di
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 4/25/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
if 0
FAGetTailLengthFar proc far
call FAGetTailLength
ret
FAGetTailLengthFar endp
endif
FAGetTailLength proc near
.enter
mov cx, cs:[loaderPos]
jcxz locateLoader
computeLength:
mov si, 81h
sub cx, si
DPC DEBUG_INIT, 'L'
DPW DEBUG_INIT, cx
.leave
ret
locateLoader:
mov si, 80h ; Start search from beginning
; of tail.
cld ; Search forward.
lodsb ; Fetch the tail length
cbw ; Convert the length
mov cx, ax ; Store count in cx
mov di, si
findLoaderLoop:
mov al, ' '
repe scasb
je foundIt ; => went to end of string. di is
; exact offset of first char not
; included in arg searches
mov ah, es:[di-1] ; ah <- first non-space
cmp ah, '/' ; switch start?
jne foundItButWereOneTooFarIn ; no, but es:di points
; to 2d char of loader
; name, so must
; back it up
repne scasb ; is switch -- skip to first blank
je findLoaderLoop ; hit blank, so keep looking
jmp foundIt ; else hit end of tail
foundItButWereOneTooFarIn:
dec di
foundIt:
mov cs:[loaderPos], di ; record for next time
mov cx, di
jmp computeLength
FAGetTailLength endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MainHandleInit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Deal with one-time initialization stuff for Main before
stubInit is overwritten
CALLED BY: Main
PASS: DS=ES=cgroup
RETURN: BX = non-zero if /s given
CX = non-zero if /t given
intsToIgnore set if /i given
mask isPC in sysFlags set if running on PC
PIC1_Mask & PIC2_Mask set to initial interrupt controller
mask registers
DESTROYED: AX, ...
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 7/26/89 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
hardwareArg byte 'H',0 ; String for /h match
hardwareBuf byte 0
ignoreInt byte 'i',0 ; String for /i match
ignoreBuf byte 5 dup (0)
noStart byte 's', 0 ; String for /s match
tsrFlag byte 't', 0 ; String for /t match
if USE_SPECIAL_MASK_MODE
noSpecialMM byte 'I', 0 ; String for /I match
endif
if ENABLE_CHANNEL_CHECK
noChannelCheckStr char 'C', 0 ; String for /C match
endif
doTsrFlag char 'T', 0 ; string for /T match
MainHandleInit proc far
; try to figure out how fast this PC is...
; I want to put in a delay loop if we error when starting up,
; but for some reason if I loop with interrupts on it seems to
; go off into space, so I will try it this way...sigh
ifndef NETWARE
call CalibrateWaitLoop
endif
;
; Always catch breakpoints so if the thing dies before swat
; can attach, it can still be debugged.
;
mov ax, RPC_HALT_BPT
call CatchInterruptFar
;
; Fetch initial interrupt controller registers. We don't
; care about them except that the timer interrupt should be
; off when we're inside here...
;
in al, PIC2_REG
mov ah, al
in al, PIC1_REG
;or al, 1 ;disables timer interrupts
;while in the stub
mov word ptr ds:[PIC1_Mask], ax
;
; Determine whether we are on PC or AT to handle different
; baud rates/interrupts/etc.
; On the AT, the KBD_CONTROL location cannot have
; its high bit changed. So we try and change it. If it
; changes, voila, it's not an AT.
;
KBD_CONTROL = 61h
in al,KBD_CONTROL ; get special info
mov ah,al ; save info it ah
or al,mask XP61_KBD_STROBE ; set high bit
out KBD_CONTROL,al ;
in al,KBD_CONTROL ; read back new special info
xchg al,ah ; save our changed? results
out KBD_CONTROL,al ; and return kbd to orig state
test ah,mask XP61_KBD_STROBE ; check if high bit changed
jz isAT ; Nope.
or ds:[sysFlags], MASK isPC; Note we're on PC
isAT:
mov di, offset hardwareArg
mov bx, offset hardwareBuf
mov dx, size hardwareBuf
push es
segmov es, cs
assume es:stubInit
call FetchArg
cmp bx, offset hardwareBuf
je gotHardware ; use default
; since we only have two types of hardware right now
; just assume it's the ZOOMER
mov bl, es:[hardwareBuf]
mov ax, HT_PC
cmp bl, 'P'
je setHardwareType
mov ax, HT_ZOOMER
setHardwareType:
call Com_SetHardwareType
gotHardware:
pop es
assume es:cgroup
;
; Initialize communication system
;
call Rpc_Init
jc done
;
; Look for interrupt ignore flag:
; /i:n ignore level N interrupts
;
push es
segmov es, cs, di ; Point ES at segment for
; strings.
assume es:stubInit
call IgnoreInit
if USE_SPECIAL_MASK_MODE
;
; Look for /I -- don't use special mask mode
;
mov di, offset noSpecialMM
clr bx ; no arg needed or desired
call FetchArg
mov noSpecialMaskMode, bx
endif
if ENABLE_CHANNEL_CHECK
mov di, offset noChannelCheckStr
clr bx ; no arg needed or desired
call FetchArg
mov ds:[noChannelCheck], bx
tst bx
jnz findSlashS
test ds:[sysFlags], mask isPC
jnz enableXTChannelCheck
in al, 61h
andnf al, not mask IPB_ENABLE_IOCHK
jmp $+2
out 61h, al
jmp findSlashS
enableXTChannelCheck:
in al, 61h
andnf al, not mask XP61_ENABLE_IOCHK
jmp $+2
out 61h, al
findSlashS:
endif
;
; Look for /T -- always TSR, don't exit.
;
mov di, offset doTsrFlag
clr bx ; no arg needed or desired
call FetchArg
mov ds:[doTSR], bl
;
;
; Look for /t -- TSR mode, don't let stub overwrite itself.
;
mov di, offset tsrFlag
clr bx
call FetchArg
mov cx, bx ;return cx = /t passed.
;
; Look for /s -- don't let the kernel start running
;
mov di, offset noStart
clr bx ; no arg needed or desired
call FetchArg ;return bx = /s passed
pop es ; Point ES back at cgroup
push cx ;save cx return value.
call Bpt_Init
pop cx
clc
done:
assume es:cgroup
ret
MainHandleInit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CalibrateWaitLoop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS:
CALLED BY: GLOBAL
PASS: es = scode
RETURN: put the number of loops made for one clock tick
DESTROYED: Nada.
PSEUDOCODE/STRATEGY:
KNOWN BUGS/SIDEFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 10/18/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ifdef ZOOMER
CalibrateWaitLoop proc near
; just put in some hardwired numbers for Zoomer
mov es:[waitValue].high, 0
mov es:[waitValue].low, 1000h
ret
CalibrateWaitLoop endp
else
ifndef NETWARE
CalibrateWaitLoop proc near
uses cx, ds, bx, dx, ax
.enter
mov bx, 40h
mov ds, bx
mov bx, 6ch
mov ax, ds:[bx]
waitLoop1:
cmp ax, ds:[bx]
je waitLoop1
; ok we got the first one, now wait for the second one
clr cx
mov dx, cx
mov ax, ds:[bx]
waitLoop2:
cmp ax, ds:[bx]
jne done
add cx, 1
jcxz overFlow
; ok waste some clock cycles
WasteTime
jmp waitLoop2
overFlow:
inc dx
jmp waitLoop2
done:
mov es:[waitValue].low, cx
mov es:[waitValue].high, dx
DPW DEBUG_EXIT, es:[waitValue].low
DPW DEBUG_EXIT, es:[waitValue].high
.leave
ret
CalibrateWaitLoop endp
endif
endif
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
IgnoreInit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: see if we should ignore any interrupts from the environment
(ignoreed if passed a 'i' flag)
if so, fill in addIgnore buffer
CALLED BY: GLOBAL
PASS: nothing
RETURN: Void.
DESTROYED: Nada.
PSEUDOCODE/STRATEGY:
KNOWN BUGS/SIDEFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
jimmy 9/21/93 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ignoreVar db "SWATNOIGNORE="
IgnoreInit proc near
uses ds, ax, bx, cx, di, es
.enter
ifdef ZOOMER
jmp done
endif
mov di, offset ignoreInt
mov bx, offset ignoreBuf
mov dx, length ignoreBuf
call FetchArg
mov di, offset ignoreBuf
cmp bx, offset ignoreBuf ; if bx changed we got it
jne gotit
push ds
; call GetPSP ; ds <- gets the PSP segment
mov ax, ds:[swatPSP]
mov es, ax
mov es, es:[2ch] ; PSP_ENV_SEG
push cs
pop ds
clr ax
mov di, ax
doString:
;
; See if the variable matches what we're looking for.
;
mov si, offset ignoreVar
mov cx, length ignoreVar
repe cmpsb
je noIntGiven ; => matches up to the =, so it's
; ours...
dec di ; deal with mismatch on null byte...
mov cx, -1
repne scasb
cmp es:[di], al ; double null (i.e. end of environment)
jne doString ; => no
; ok, not there so default to ignoring int 13 = 0dh
pop ds
push cs
pop es
mov di, offset ignoreBuf
mov ax, 'd'
mov es:[di], ax
inc bx
jmp gotit
noIntGiven:
pop ds
dec ds:[intsToIgnore][RPC_HALT_GP]
done:
.leave
ret
gotit:
intLoop:
mov al, es:[di] ;get char
cmp al, 'A' ;check for 'A' to 'F'
jb noAF
cmp al, 'F'
ja noAF
sub al, 'A' - 10
jmp gotInt
noAF:
cmp al, 'a' ;check for 'a' to 'f'
jb noaf
cmp al, 'f'
ja noaf
sub al, 'a' - 10
jmp gotInt
noaf:
cmp al, '0' ;check for '0' to '9'
jb afterInts
cmp al, '9'
ja afterInts
sub al, '0'
gotInt:
clr ah
mov si, ax
dec ds:[intsToIgnore][si]
inc di
cmp di, bx
jnz intLoop
jmp afterInts
afterInts:
jmp done
IgnoreInit endp
stubInit ends
end Main
| 22.792055 | 79 | 0.623544 |
b9e0eaa9414972958dfb51ea61c844ad8cd084ea | 1,758 | asm | Assembly | kernel/nano_core/src/boot/arch_x86_64/multiboot_header.asm | jacob-earle/Theseus | d53038328d1a39c69ffff6e32226394e8c957e33 | [
"MIT"
] | 1,822 | 2020-09-20T07:30:38.000Z | 2022-03-31T18:18:48.000Z | kernel/nano_core/src/boot/arch_x86_64/multiboot_header.asm | Qwaz/Theseus | fbe80b056c75b23e4b51cf0bbd47cf17f05da671 | [
"MIT"
] | 102 | 2020-08-31T22:45:32.000Z | 2022-03-25T09:34:54.000Z | kernel/nano_core/src/boot/arch_x86_64/multiboot_header.asm | Qwaz/Theseus | fbe80b056c75b23e4b51cf0bbd47cf17f05da671 | [
"MIT"
] | 87 | 2020-09-01T21:47:00.000Z | 2022-03-12T03:16:58.000Z | ; Declare a multiboot2-compliant header, which indicates this program iss a bootable kernel image.
; This must be the first section in the kernel image, which is accomplished via our linker script.
; It must also be aligned to a 4-byte boundary.
section .multiboot_header ; Permissions are the same as .rodata by default
align 4
multiboot_header_start:
dd 0xe85250d6 ; Multiboot2 header magic number
dd 0 ; Run in protected i386 (32-bit) mode
dd multiboot_header_end - multiboot_header_start ; header length
; checksum
dd 0x100000000 - (0xe85250d6 + 0 + (multiboot_header_end - multiboot_header_start))
; Place optional header tags here, after the checksum above. Documentation is here:
; <https://www.gnu.org/software/grub/manual/multiboot2/multiboot.html#Header-tags>
; Note: all tags must be aligned to 8-byte boundaries.
; Below is the framebuffer tag, used to request a graphical (non-text) framebuffer and specify its size.
; By default, we ask the bootloader to switch modes to a graphical framebuffer for us,
; though this can be disabled by defining `VGA_TEXT_MODE`.
;
; NOTE: TODO: uncomment the below sections when we are ready to enable
; early boot-time usage of the graphical framebuffer by default.
;
; %ifndef VGA_TEXT_MODE
; align 8
; dw 5 ; type (5 means framebuffer tag)
; dw 0 ; flags. Bit 0 = `1` means this tag is optional, Bit 0 = `0` means it's mandatory.
; dd 20 ; size of this tag (20)
; dd 1280 ; width (in pixels)
; dd 1024 ; height (in pixels)
; dd 32 ; depth (pixel size in bits)
; %endif
; This marks the end of the tag region.
align 8
dw 0 ; type (0 means terminator tag)
dw 0 ; flags
dd 8 ; size of this tag
multiboot_header_end:
| 42.878049 | 104 | 0.716155 |
f64cd9c7c98802709855560de87cb196a4589b68 | 21,968 | asm | Assembly | forktest.asm | ShwetiMahajan/xv6_schedulersOS | 35efdf3d33562ec290331a7ee246e65af19e7e2e | [
"MIT-0"
] | null | null | null | forktest.asm | ShwetiMahajan/xv6_schedulersOS | 35efdf3d33562ec290331a7ee246e65af19e7e2e | [
"MIT-0"
] | null | null | null | forktest.asm | ShwetiMahajan/xv6_schedulersOS | 35efdf3d33562ec290331a7ee246e65af19e7e2e | [
"MIT-0"
] | null | null | null |
_forktest: file format elf32-i386
Disassembly of section .text:
00000000 <printf>:
#define N 1000
void
printf(int fd, char *s, ...)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 83 ec 14 sub $0x14,%esp
7: 8b 5d 0c mov 0xc(%ebp),%ebx
write(fd, s, strlen(s));
a: 89 1c 24 mov %ebx,(%esp)
d: e8 7e 01 00 00 call 190 <strlen>
12: 89 5c 24 04 mov %ebx,0x4(%esp)
16: 89 44 24 08 mov %eax,0x8(%esp)
1a: 8b 45 08 mov 0x8(%ebp),%eax
1d: 89 04 24 mov %eax,(%esp)
20: e8 33 03 00 00 call 358 <write>
}
25: 83 c4 14 add $0x14,%esp
28: 5b pop %ebx
29: 5d pop %ebp
2a: c3 ret
2b: 90 nop
2c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000030 <forktest>:
void
forktest(void)
{
30: 55 push %ebp
31: 89 e5 mov %esp,%ebp
33: 53 push %ebx
int n, pid;
printf(1, "fork test\n");
34: 31 db xor %ebx,%ebx
write(fd, s, strlen(s));
}
void
forktest(void)
{
36: 83 ec 14 sub $0x14,%esp
int n, pid;
printf(1, "fork test\n");
39: c7 44 24 04 d8 03 00 movl $0x3d8,0x4(%esp)
40: 00
41: c7 04 24 01 00 00 00 movl $0x1,(%esp)
48: e8 b3 ff ff ff call 0 <printf>
4d: eb 0e jmp 5d <forktest+0x2d>
4f: 90 nop
for(n=0; n<N; n++){
pid = fork();
if(pid < 0)
break;
if(pid == 0)
50: 74 72 je c4 <forktest+0x94>
{
int n, pid;
printf(1, "fork test\n");
for(n=0; n<N; n++){
52: 83 c3 01 add $0x1,%ebx
55: 81 fb e8 03 00 00 cmp $0x3e8,%ebx
5b: 74 4b je a8 <forktest+0x78>
pid = fork();
5d: e8 ce 02 00 00 call 330 <fork>
if(pid < 0)
62: 83 f8 00 cmp $0x0,%eax
65: 7d e9 jge 50 <forktest+0x20>
if(n == N){
printf(1, "fork claimed to work N times!\n", N);
exit();
}
for(; n > 0; n--){
67: 85 db test %ebx,%ebx
69: 74 13 je 7e <forktest+0x4e>
6b: 90 nop
6c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(wait() < 0){
70: e8 cb 02 00 00 call 340 <wait>
75: 85 c0 test %eax,%eax
77: 78 50 js c9 <forktest+0x99>
if(n == N){
printf(1, "fork claimed to work N times!\n", N);
exit();
}
for(; n > 0; n--){
79: 83 eb 01 sub $0x1,%ebx
7c: 75 f2 jne 70 <forktest+0x40>
7e: 66 90 xchg %ax,%ax
printf(1, "wait stopped early\n");
exit();
}
}
if(wait() != -1){
80: e8 bb 02 00 00 call 340 <wait>
85: 83 f8 ff cmp $0xffffffff,%eax
88: 75 58 jne e2 <forktest+0xb2>
printf(1, "wait got too many\n");
exit();
}
printf(1, "fork test OK\n");
8a: c7 44 24 04 0a 04 00 movl $0x40a,0x4(%esp)
91: 00
92: c7 04 24 01 00 00 00 movl $0x1,(%esp)
99: e8 62 ff ff ff call 0 <printf>
}
9e: 83 c4 14 add $0x14,%esp
a1: 5b pop %ebx
a2: 5d pop %ebp
a3: c3 ret
a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(pid == 0)
exit();
}
if(n == N){
printf(1, "fork claimed to work N times!\n", N);
a8: c7 44 24 08 e8 03 00 movl $0x3e8,0x8(%esp)
af: 00
b0: c7 44 24 04 18 04 00 movl $0x418,0x4(%esp)
b7: 00
b8: c7 04 24 01 00 00 00 movl $0x1,(%esp)
bf: e8 3c ff ff ff call 0 <printf>
exit();
c4: e8 6f 02 00 00 call 338 <exit>
}
for(; n > 0; n--){
if(wait() < 0){
printf(1, "wait stopped early\n");
c9: c7 44 24 04 e3 03 00 movl $0x3e3,0x4(%esp)
d0: 00
d1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
d8: e8 23 ff ff ff call 0 <printf>
exit();
dd: e8 56 02 00 00 call 338 <exit>
}
}
if(wait() != -1){
printf(1, "wait got too many\n");
e2: c7 44 24 04 f7 03 00 movl $0x3f7,0x4(%esp)
e9: 00
ea: c7 04 24 01 00 00 00 movl $0x1,(%esp)
f1: e8 0a ff ff ff call 0 <printf>
exit();
f6: e8 3d 02 00 00 call 338 <exit>
fb: 90 nop
fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
00000100 <main>:
printf(1, "fork test OK\n");
}
int
main(void)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 83 e4 f0 and $0xfffffff0,%esp
forktest();
106: e8 25 ff ff ff call 30 <forktest>
exit();
10b: e8 28 02 00 00 call 338 <exit>
00000110 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
110: 55 push %ebp
111: 31 d2 xor %edx,%edx
113: 89 e5 mov %esp,%ebp
115: 8b 45 08 mov 0x8(%ebp),%eax
118: 53 push %ebx
119: 8b 5d 0c mov 0xc(%ebp),%ebx
11c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *os;
os = s;
while((*s++ = *t++) != 0)
120: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
124: 88 0c 10 mov %cl,(%eax,%edx,1)
127: 83 c2 01 add $0x1,%edx
12a: 84 c9 test %cl,%cl
12c: 75 f2 jne 120 <strcpy+0x10>
;
return os;
}
12e: 5b pop %ebx
12f: 5d pop %ebp
130: c3 ret
131: eb 0d jmp 140 <strcmp>
133: 90 nop
134: 90 nop
135: 90 nop
136: 90 nop
137: 90 nop
138: 90 nop
139: 90 nop
13a: 90 nop
13b: 90 nop
13c: 90 nop
13d: 90 nop
13e: 90 nop
13f: 90 nop
00000140 <strcmp>:
int
strcmp(const char *p, const char *q)
{
140: 55 push %ebp
141: 89 e5 mov %esp,%ebp
143: 8b 4d 08 mov 0x8(%ebp),%ecx
146: 53 push %ebx
147: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
14a: 0f b6 01 movzbl (%ecx),%eax
14d: 84 c0 test %al,%al
14f: 75 14 jne 165 <strcmp+0x25>
151: eb 25 jmp 178 <strcmp+0x38>
153: 90 nop
154: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p++, q++;
158: 83 c1 01 add $0x1,%ecx
15b: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
15e: 0f b6 01 movzbl (%ecx),%eax
161: 84 c0 test %al,%al
163: 74 13 je 178 <strcmp+0x38>
165: 0f b6 1a movzbl (%edx),%ebx
168: 38 d8 cmp %bl,%al
16a: 74 ec je 158 <strcmp+0x18>
16c: 0f b6 db movzbl %bl,%ebx
16f: 0f b6 c0 movzbl %al,%eax
172: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
174: 5b pop %ebx
175: 5d pop %ebp
176: c3 ret
177: 90 nop
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
178: 0f b6 1a movzbl (%edx),%ebx
17b: 31 c0 xor %eax,%eax
17d: 0f b6 db movzbl %bl,%ebx
180: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
182: 5b pop %ebx
183: 5d pop %ebp
184: c3 ret
185: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
189: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000190 <strlen>:
uint
strlen(char *s)
{
190: 55 push %ebp
int n;
for(n = 0; s[n]; n++)
191: 31 d2 xor %edx,%edx
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
193: 89 e5 mov %esp,%ebp
int n;
for(n = 0; s[n]; n++)
195: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
197: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
19a: 80 39 00 cmpb $0x0,(%ecx)
19d: 74 0c je 1ab <strlen+0x1b>
19f: 90 nop
1a0: 83 c2 01 add $0x1,%edx
1a3: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
1a7: 89 d0 mov %edx,%eax
1a9: 75 f5 jne 1a0 <strlen+0x10>
;
return n;
}
1ab: 5d pop %ebp
1ac: c3 ret
1ad: 8d 76 00 lea 0x0(%esi),%esi
000001b0 <memset>:
void*
memset(void *dst, int c, uint n)
{
1b0: 55 push %ebp
1b1: 89 e5 mov %esp,%ebp
1b3: 8b 55 08 mov 0x8(%ebp),%edx
1b6: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
1b7: 8b 4d 10 mov 0x10(%ebp),%ecx
1ba: 8b 45 0c mov 0xc(%ebp),%eax
1bd: 89 d7 mov %edx,%edi
1bf: fc cld
1c0: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
1c2: 89 d0 mov %edx,%eax
1c4: 5f pop %edi
1c5: 5d pop %ebp
1c6: c3 ret
1c7: 89 f6 mov %esi,%esi
1c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000001d0 <strchr>:
char*
strchr(const char *s, char c)
{
1d0: 55 push %ebp
1d1: 89 e5 mov %esp,%ebp
1d3: 8b 45 08 mov 0x8(%ebp),%eax
1d6: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
1da: 0f b6 10 movzbl (%eax),%edx
1dd: 84 d2 test %dl,%dl
1df: 75 11 jne 1f2 <strchr+0x22>
1e1: eb 15 jmp 1f8 <strchr+0x28>
1e3: 90 nop
1e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
1e8: 83 c0 01 add $0x1,%eax
1eb: 0f b6 10 movzbl (%eax),%edx
1ee: 84 d2 test %dl,%dl
1f0: 74 06 je 1f8 <strchr+0x28>
if(*s == c)
1f2: 38 ca cmp %cl,%dl
1f4: 75 f2 jne 1e8 <strchr+0x18>
return (char*)s;
return 0;
}
1f6: 5d pop %ebp
1f7: c3 ret
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
1f8: 31 c0 xor %eax,%eax
if(*s == c)
return (char*)s;
return 0;
}
1fa: 5d pop %ebp
1fb: 90 nop
1fc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
200: c3 ret
201: eb 0d jmp 210 <atoi>
203: 90 nop
204: 90 nop
205: 90 nop
206: 90 nop
207: 90 nop
208: 90 nop
209: 90 nop
20a: 90 nop
20b: 90 nop
20c: 90 nop
20d: 90 nop
20e: 90 nop
20f: 90 nop
00000210 <atoi>:
return r;
}
int
atoi(const char *s)
{
210: 55 push %ebp
int n;
n = 0;
while('0' <= *s && *s <= '9')
211: 31 c0 xor %eax,%eax
return r;
}
int
atoi(const char *s)
{
213: 89 e5 mov %esp,%ebp
215: 8b 4d 08 mov 0x8(%ebp),%ecx
218: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
219: 0f b6 11 movzbl (%ecx),%edx
21c: 8d 5a d0 lea -0x30(%edx),%ebx
21f: 80 fb 09 cmp $0x9,%bl
222: 77 1c ja 240 <atoi+0x30>
224: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = n*10 + *s++ - '0';
228: 0f be d2 movsbl %dl,%edx
22b: 83 c1 01 add $0x1,%ecx
22e: 8d 04 80 lea (%eax,%eax,4),%eax
231: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
235: 0f b6 11 movzbl (%ecx),%edx
238: 8d 5a d0 lea -0x30(%edx),%ebx
23b: 80 fb 09 cmp $0x9,%bl
23e: 76 e8 jbe 228 <atoi+0x18>
n = n*10 + *s++ - '0';
return n;
}
240: 5b pop %ebx
241: 5d pop %ebp
242: c3 ret
243: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000250 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
250: 55 push %ebp
251: 89 e5 mov %esp,%ebp
253: 56 push %esi
254: 8b 45 08 mov 0x8(%ebp),%eax
257: 53 push %ebx
258: 8b 5d 10 mov 0x10(%ebp),%ebx
25b: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
25e: 85 db test %ebx,%ebx
260: 7e 14 jle 276 <memmove+0x26>
n = n*10 + *s++ - '0';
return n;
}
void*
memmove(void *vdst, void *vsrc, int n)
262: 31 d2 xor %edx,%edx
264: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
*dst++ = *src++;
268: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
26c: 88 0c 10 mov %cl,(%eax,%edx,1)
26f: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
272: 39 da cmp %ebx,%edx
274: 75 f2 jne 268 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
276: 5b pop %ebx
277: 5e pop %esi
278: 5d pop %ebp
279: c3 ret
27a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000280 <stat>:
return buf;
}
int
stat(char *n, struct stat *st)
{
280: 55 push %ebp
281: 89 e5 mov %esp,%ebp
283: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
286: 8b 45 08 mov 0x8(%ebp),%eax
return buf;
}
int
stat(char *n, struct stat *st)
{
289: 89 5d f8 mov %ebx,-0x8(%ebp)
28c: 89 75 fc mov %esi,-0x4(%ebp)
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
28f: be ff ff ff ff mov $0xffffffff,%esi
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
294: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
29b: 00
29c: 89 04 24 mov %eax,(%esp)
29f: e8 d4 00 00 00 call 378 <open>
if(fd < 0)
2a4: 85 c0 test %eax,%eax
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
2a6: 89 c3 mov %eax,%ebx
if(fd < 0)
2a8: 78 19 js 2c3 <stat+0x43>
return -1;
r = fstat(fd, st);
2aa: 8b 45 0c mov 0xc(%ebp),%eax
2ad: 89 1c 24 mov %ebx,(%esp)
2b0: 89 44 24 04 mov %eax,0x4(%esp)
2b4: e8 d7 00 00 00 call 390 <fstat>
close(fd);
2b9: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
2bc: 89 c6 mov %eax,%esi
close(fd);
2be: e8 9d 00 00 00 call 360 <close>
return r;
}
2c3: 89 f0 mov %esi,%eax
2c5: 8b 5d f8 mov -0x8(%ebp),%ebx
2c8: 8b 75 fc mov -0x4(%ebp),%esi
2cb: 89 ec mov %ebp,%esp
2cd: 5d pop %ebp
2ce: c3 ret
2cf: 90 nop
000002d0 <gets>:
return 0;
}
char*
gets(char *buf, int max)
{
2d0: 55 push %ebp
2d1: 89 e5 mov %esp,%ebp
2d3: 57 push %edi
2d4: 56 push %esi
2d5: 31 f6 xor %esi,%esi
2d7: 53 push %ebx
2d8: 83 ec 2c sub $0x2c,%esp
2db: 8b 7d 08 mov 0x8(%ebp),%edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
2de: eb 06 jmp 2e6 <gets+0x16>
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
2e0: 3c 0a cmp $0xa,%al
2e2: 74 39 je 31d <gets+0x4d>
2e4: 89 de mov %ebx,%esi
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
2e6: 8d 5e 01 lea 0x1(%esi),%ebx
2e9: 3b 5d 0c cmp 0xc(%ebp),%ebx
2ec: 7d 31 jge 31f <gets+0x4f>
cc = read(0, &c, 1);
2ee: 8d 45 e7 lea -0x19(%ebp),%eax
2f1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
2f8: 00
2f9: 89 44 24 04 mov %eax,0x4(%esp)
2fd: c7 04 24 00 00 00 00 movl $0x0,(%esp)
304: e8 47 00 00 00 call 350 <read>
if(cc < 1)
309: 85 c0 test %eax,%eax
30b: 7e 12 jle 31f <gets+0x4f>
break;
buf[i++] = c;
30d: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
311: 88 44 1f ff mov %al,-0x1(%edi,%ebx,1)
if(c == '\n' || c == '\r')
315: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
319: 3c 0d cmp $0xd,%al
31b: 75 c3 jne 2e0 <gets+0x10>
31d: 89 de mov %ebx,%esi
break;
}
buf[i] = '\0';
31f: c6 04 37 00 movb $0x0,(%edi,%esi,1)
return buf;
}
323: 89 f8 mov %edi,%eax
325: 83 c4 2c add $0x2c,%esp
328: 5b pop %ebx
329: 5e pop %esi
32a: 5f pop %edi
32b: 5d pop %ebp
32c: c3 ret
32d: 90 nop
32e: 90 nop
32f: 90 nop
00000330 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
330: b8 01 00 00 00 mov $0x1,%eax
335: cd 40 int $0x40
337: c3 ret
00000338 <exit>:
SYSCALL(exit)
338: b8 02 00 00 00 mov $0x2,%eax
33d: cd 40 int $0x40
33f: c3 ret
00000340 <wait>:
SYSCALL(wait)
340: b8 03 00 00 00 mov $0x3,%eax
345: cd 40 int $0x40
347: c3 ret
00000348 <pipe>:
SYSCALL(pipe)
348: b8 04 00 00 00 mov $0x4,%eax
34d: cd 40 int $0x40
34f: c3 ret
00000350 <read>:
SYSCALL(read)
350: b8 05 00 00 00 mov $0x5,%eax
355: cd 40 int $0x40
357: c3 ret
00000358 <write>:
SYSCALL(write)
358: b8 10 00 00 00 mov $0x10,%eax
35d: cd 40 int $0x40
35f: c3 ret
00000360 <close>:
SYSCALL(close)
360: b8 15 00 00 00 mov $0x15,%eax
365: cd 40 int $0x40
367: c3 ret
00000368 <kill>:
SYSCALL(kill)
368: b8 06 00 00 00 mov $0x6,%eax
36d: cd 40 int $0x40
36f: c3 ret
00000370 <exec>:
SYSCALL(exec)
370: b8 07 00 00 00 mov $0x7,%eax
375: cd 40 int $0x40
377: c3 ret
00000378 <open>:
SYSCALL(open)
378: b8 0f 00 00 00 mov $0xf,%eax
37d: cd 40 int $0x40
37f: c3 ret
00000380 <mknod>:
SYSCALL(mknod)
380: b8 11 00 00 00 mov $0x11,%eax
385: cd 40 int $0x40
387: c3 ret
00000388 <unlink>:
SYSCALL(unlink)
388: b8 12 00 00 00 mov $0x12,%eax
38d: cd 40 int $0x40
38f: c3 ret
00000390 <fstat>:
SYSCALL(fstat)
390: b8 08 00 00 00 mov $0x8,%eax
395: cd 40 int $0x40
397: c3 ret
00000398 <link>:
SYSCALL(link)
398: b8 13 00 00 00 mov $0x13,%eax
39d: cd 40 int $0x40
39f: c3 ret
000003a0 <mkdir>:
SYSCALL(mkdir)
3a0: b8 14 00 00 00 mov $0x14,%eax
3a5: cd 40 int $0x40
3a7: c3 ret
000003a8 <chdir>:
SYSCALL(chdir)
3a8: b8 09 00 00 00 mov $0x9,%eax
3ad: cd 40 int $0x40
3af: c3 ret
000003b0 <dup>:
SYSCALL(dup)
3b0: b8 0a 00 00 00 mov $0xa,%eax
3b5: cd 40 int $0x40
3b7: c3 ret
000003b8 <getpid>:
SYSCALL(getpid)
3b8: b8 0b 00 00 00 mov $0xb,%eax
3bd: cd 40 int $0x40
3bf: c3 ret
000003c0 <sbrk>:
SYSCALL(sbrk)
3c0: b8 0c 00 00 00 mov $0xc,%eax
3c5: cd 40 int $0x40
3c7: c3 ret
000003c8 <sleep>:
SYSCALL(sleep)
3c8: b8 0d 00 00 00 mov $0xd,%eax
3cd: cd 40 int $0x40
3cf: c3 ret
000003d0 <set_tickets>:
SYSCALL(set_tickets)
3d0: b8 16 00 00 00 mov $0x16,%eax
3d5: cd 40 int $0x40
3d7: c3 ret
| 27.087546 | 58 | 0.416424 |
b3196c076321d32ac7ac5a50598e5694a05d6e6b | 712 | asm | Assembly | programs/oeis/163/A163109.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/163/A163109.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/163/A163109.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A163109: a(n) = phi(tau(n)).
; 1,1,1,2,1,2,1,2,2,2,1,2,1,2,2,4,1,2,1,2,2,2,1,4,2,2,2,2,1,4,1,2,2,2,2,6,1,2,2,4,1,4,1,2,2,2,1,4,2,2,2,2,1,4,2,4,2,2,1,4,1,2,2,6,2,4,1,2,2,4,1,4,1,2,2,2,2,4,1,4,4,2,1,4,2,2,2,4,1,4,2,2,2,2,2,4,1,2,2,6,1,4,1,4,4,2,1,4,1,4,2,4,1,4,2,2,2,2,2,8,2,2,2,2,2,4,1,4,2,4,1,4,2,2,4,4,1,4,1,4,2,2,2,8,2,2,2,2,1,4,1,4,2,4,2,4,1,2,2,4,2,4,1,2,4,2,1,8,2,4,2,2,1,4,2,4,2,2,1,6,1,4,2,4,2,4,2,2,4,4,1,6,1,2,4,6,1,4,1,4,2,2,2,4,2,2,2,4,2,8,1,2,2,2,2,8,2,2,2,4,2,4,1,4,6,2,1,4,1,4,4,4,1,4,2,2,2,4,1,8,1,2,2,2,2,4,2,4,2,4
cal $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n.
sub $0,1
cal $0,10 ; Euler totient function phi(n): count numbers <= n and prime to n.
mov $1,$0
| 89 | 501 | 0.537921 |
974792accf1f0ba1e7f6917ed27531cce110bc3d | 109 | asm | Assembly | libsrc/_DEVELOPMENT/stdlib/c/sdcc_iy/abort.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/stdlib/c/sdcc_iy/abort.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/stdlib/c/sdcc_iy/abort.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; _Noreturn void abort(void)
SECTION code_stdlib
PUBLIC _abort
EXTERN asm_abort
defc _abort = asm_abort
| 9.909091 | 28 | 0.788991 |
85fa0710e0ccd74116a7f2c438203e7e42e4094c | 1,434 | asm | Assembly | programs/oeis/208/A208994.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/208/A208994.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/208/A208994.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A208994: Number of 3-bead necklaces labeled with numbers -n..n not allowing reversal, with sum zero and first differences in -n..n.
; 1,1,3,5,7,11,15,19,25,31,37,45,53,61,71,81,91,103,115,127,141,155,169,185,201,217,235,253,271,291,311,331,353,375,397,421,445,469,495,521,547,575,603,631,661,691,721,753,785,817,851,885,919,955,991,1027,1065,1103,1141,1181,1221,1261,1303,1345,1387,1431,1475,1519,1565,1611,1657,1705,1753,1801,1851,1901,1951,2003,2055,2107,2161,2215,2269,2325,2381,2437,2495,2553,2611,2671,2731,2791,2853,2915,2977,3041,3105,3169,3235,3301,3367,3435,3503,3571,3641,3711,3781,3853,3925,3997,4071,4145,4219,4295,4371,4447,4525,4603,4681,4761,4841,4921,5003,5085,5167,5251,5335,5419,5505,5591,5677,5765,5853,5941,6031,6121,6211,6303,6395,6487,6581,6675,6769,6865,6961,7057,7155,7253,7351,7451,7551,7651,7753,7855,7957,8061,8165,8269,8375,8481,8587,8695,8803,8911,9021,9131,9241,9353,9465,9577,9691,9805,9919,10035,10151,10267,10385,10503,10621,10741,10861,10981,11103,11225,11347,11471,11595,11719,11845,11971,12097,12225,12353,12481,12611,12741,12871,13003,13135,13267,13401,13535,13669,13805,13941,14077,14215,14353,14491,14631,14771,14911,15053,15195,15337,15481,15625,15769,15915,16061,16207,16355,16503,16651,16801,16951,17101,17253,17405,17557,17711,17865,18019,18175,18331,18487,18645,18803,18961,19121,19281,19441,19603,19765,19927,20091,20255,20419,20585,20751
mov $1,$0
add $1,1
mul $1,$0
div $1,3
add $1,1
| 159.333333 | 1,251 | 0.785914 |
cfcda1f62143aa0dd4e90b7c0fd21e0a3eaa9c03 | 571 | asm | Assembly | oeis/320/A320283.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/320/A320283.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/320/A320283.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A320283: Lexicographical ordering of pure imaginary integers in the base (-1+i) numeral system.
; Submitted by Christian Krause
; 0,1,-2,-1,-4,-3,-6,-5,8,9,6,7,4,5,2,3,16,17,14,15,12,13,10,11,24,25,22,23,20,21,18,19,-32,-31,-34,-33,-36,-35,-38,-37,-24,-23,-26,-25,-28,-27,-30,-29,-16,-15,-18,-17,-20,-19,-22,-21,-8,-7,-10,-9,-12,-11,-14,-13,-64,-63,-66,-65,-68,-67,-70,-69,-56,-55,-58,-57,-60,-59,-62,-61,-48,-47,-50,-49,-52,-51,-54,-53,-40,-39,-42,-41,-44,-43,-46,-45,-96,-95,-98,-97
mul $0,2
seq $0,73791 ; Replace 4^k with (-4)^k in base 4 expansion of n.
div $0,2
| 71.375 | 356 | 0.590193 |
8c7ce753f6b0c0060e2ac2f5810a91dd8918dd72 | 546 | asm | Assembly | oeis/016/A016774.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/016/A016774.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/016/A016774.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A016774: a(n) = (3*n)^10.
; 0,59049,60466176,3486784401,61917364224,576650390625,3570467226624,16679880978201,63403380965376,205891132094649,590490000000000,1531578985264449,3656158440062976,8140406085191601,17080198121677824,34050628916015625,64925062108545024,119042423827613001,210832519264920576,362033331456891249,604661760000000000,984930291881790849,1568336880910795776,2446194060654759801,3743906242624487424,5631351470947265625,8335775831236199424,12157665459056928801,17490122876598091776,24842341419143568849
pow $0,10
mul $0,59049
| 91 | 493 | 0.897436 |
07e50023ceac5bac816a09920422645f3ab1536c | 386 | asm | Assembly | programs/oeis/287/A287657.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/287/A287657.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/287/A287657.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A287657: {0->01, 1->10}-transform of the infinite Fibonacci word A003849.
; 0,1,1,0,0,1,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,0,1
seq $0,187576 ; Rank transform of the sequence 2*floor((n-1)/2)); complement of A187577.
add $0,1
mod $0,2
| 55.142857 | 201 | 0.593264 |
668b0e5ce365a72eec3613c108fd87da5e56faca | 498 | asm | Assembly | Day-36/lodsb_stosb.asm | MasumBhai/50-Day-challenge-with-Assembly-Language | aadeb6c4a022d089afb10fd22ffd2a768c32036e | [
"CC0-1.0"
] | 1 | 2021-04-07T09:50:40.000Z | 2021-04-07T09:50:40.000Z | Day-36/lodsb_stosb.asm | MasumBhai/50-Day-challenge-with-Assembly-Language | aadeb6c4a022d089afb10fd22ffd2a768c32036e | [
"CC0-1.0"
] | null | null | null | Day-36/lodsb_stosb.asm | MasumBhai/50-Day-challenge-with-Assembly-Language | aadeb6c4a022d089afb10fd22ffd2a768c32036e | [
"CC0-1.0"
] | null | null | null | .model small
.stack 100h
include 'emu8086.inc'
.data
n_line db 0ah,0dh,"$"
str1 db 'ABC'
str2 db 3 dup(?)
.code
main proc
mov ax,@data
mov ds,ax
mov cx,3
@str_loop:
lodsb
add al,3
stosb
loop @str_loop
;lea si,str2
;mov ah,2
;lea si,str2
;mov dl,[si]
;int 21h
lea dx,str2
mov ah,9
int 21h
@stop:
mov ah,4ch ;terminate
int 21h
main endp
end main
| 12.769231 | 36 | 0.487952 |
6dfac270906895d95fdbe4d3847d8374304f4ff1 | 43 | asm | Assembly | Testcases/random2.asm | 5ayam5/COL216-A4 | 8052ceccb01c830244ae48cf09540af989896069 | [
"MIT"
] | null | null | null | Testcases/random2.asm | 5ayam5/COL216-A4 | 8052ceccb01c830244ae48cf09540af989896069 | [
"MIT"
] | null | null | null | Testcases/random2.asm | 5ayam5/COL216-A4 | 8052ceccb01c830244ae48cf09540af989896069 | [
"MIT"
] | 2 | 2021-05-17T18:40:48.000Z | 2021-05-19T05:46:05.000Z | lw $t2, 1000
lw $t0, 2000
addi $t0, $t1, 1
| 10.75 | 16 | 0.581395 |
f5e3baf315a005d2833ae380a8584bb385ddcda3 | 338 | asm | Assembly | src/kernel/exe/multiboot.asm | zelinf/MyOS | 87ba8abb4713fbeab9d98f862023af0bf6ea2349 | [
"MIT"
] | 2 | 2018-03-09T02:19:59.000Z | 2018-03-09T05:38:18.000Z | src/kernel/exe/multiboot.asm | IsumiF/MyOS | 87ba8abb4713fbeab9d98f862023af0bf6ea2349 | [
"MIT"
] | null | null | null | src/kernel/exe/multiboot.asm | IsumiF/MyOS | 87ba8abb4713fbeab9d98f862023af0bf6ea2349 | [
"MIT"
] | null | null | null | [BITS 32]
section .multiboot
header_start:
dd 0x1BADB002 ; magic number (multiboot 2)
dd 0 ; architecture 0 (protected mode i386)
; checksum
dd (0 - 0x1BADB002)
dd header_end - header_start ; header length
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
header_end:
| 15.363636 | 71 | 0.565089 |
9b4bba351519b2f9b6db25a660561c6808f1403e | 7,314 | asm | Assembly | P6/data_P6_2/cal_R_same_test62.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | 1 | 2022-01-23T09:24:47.000Z | 2022-01-23T09:24:47.000Z | P6/data_P6_2/cal_R_same_test62.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | null | null | null | P6/data_P6_2/cal_R_same_test62.asm | alxzzhou/BUAA_CO_2020 | b54bf367081a5a11701ebc3fc78a23494aecca9e | [
"Apache-2.0"
] | null | null | null | lui $1,55387
ori $1,$1,20737
lui $2,53563
ori $2,$2,18417
lui $3,44382
ori $3,$3,45165
lui $4,12316
ori $4,$4,63550
lui $5,35029
ori $5,$5,48129
lui $6,41039
ori $6,$6,22407
mthi $1
mtlo $2
sec0:
nop
nop
nop
xor $3,$6,$6
sec1:
nop
nop
or $6,$5,$1
xor $5,$6,$6
sec2:
nop
nop
addiu $6,$2,8650
xor $2,$6,$6
sec3:
nop
nop
mflo $6
xor $3,$6,$6
sec4:
nop
nop
lw $6,0($0)
xor $3,$6,$6
sec5:
nop
or $6,$2,$2
nop
xor $5,$6,$6
sec6:
nop
slt $6,$2,$6
or $6,$3,$0
xor $3,$6,$6
sec7:
nop
addu $6,$1,$3
addiu $6,$4,29520
xor $3,$6,$6
sec8:
nop
subu $6,$5,$2
mfhi $6
xor $4,$6,$6
sec9:
nop
and $6,$1,$3
lw $6,8($0)
xor $5,$6,$6
sec10:
nop
addiu $6,$3,-16418
nop
xor $3,$6,$6
sec11:
nop
xori $6,$4,43622
slt $6,$0,$2
xor $4,$6,$6
sec12:
nop
slti $6,$1,22541
addiu $6,$1,-23286
xor $3,$6,$6
sec13:
nop
slti $6,$5,-22210
mflo $6
xor $3,$6,$6
sec14:
nop
xori $6,$3,57264
lh $6,16($0)
xor $5,$6,$6
sec15:
nop
mflo $6
nop
xor $3,$6,$6
sec16:
nop
mflo $6
subu $6,$2,$2
xor $3,$6,$6
sec17:
nop
mflo $6
ori $6,$4,58608
xor $3,$6,$6
sec18:
nop
mfhi $6
mfhi $6
xor $1,$6,$6
sec19:
nop
mflo $6
lhu $6,14($0)
xor $3,$6,$6
sec20:
nop
lw $6,0($0)
nop
xor $3,$6,$6
sec21:
nop
lh $6,8($0)
sltu $6,$4,$6
xor $2,$6,$6
sec22:
nop
lw $6,16($0)
addiu $6,$3,-1921
xor $0,$6,$6
sec23:
nop
lhu $6,6($0)
mflo $6
xor $2,$6,$6
sec24:
nop
lb $6,0($0)
lhu $6,6($0)
xor $3,$6,$6
sec25:
subu $6,$3,$1
nop
nop
xor $2,$6,$6
sec26:
and $6,$3,$5
nop
nor $6,$5,$2
xor $1,$6,$6
sec27:
slt $6,$2,$4
nop
xori $6,$3,23400
xor $1,$6,$6
sec28:
and $6,$5,$6
nop
mfhi $6
xor $0,$6,$6
sec29:
nor $6,$0,$3
nop
lhu $6,12($0)
xor $3,$6,$6
sec30:
nor $6,$4,$2
or $6,$2,$3
nop
xor $3,$6,$6
sec31:
addu $6,$3,$2
slt $6,$5,$3
or $6,$5,$6
xor $3,$6,$6
sec32:
sltu $6,$3,$1
slt $6,$3,$4
slti $6,$5,-13794
xor $4,$6,$6
sec33:
and $6,$2,$0
xor $6,$1,$2
mfhi $6
xor $4,$6,$6
sec34:
nor $6,$3,$1
or $6,$4,$2
lb $6,12($0)
xor $4,$6,$6
sec35:
and $6,$3,$3
lui $6,24386
nop
xor $3,$6,$6
sec36:
and $6,$4,$4
sltiu $6,$4,17762
subu $6,$4,$4
xor $3,$6,$6
sec37:
slt $6,$4,$3
slti $6,$3,26514
slti $6,$2,22115
xor $2,$6,$6
sec38:
subu $6,$1,$2
lui $6,24587
mfhi $6
xor $4,$6,$6
sec39:
xor $6,$3,$4
xori $6,$4,56561
lh $6,16($0)
xor $1,$6,$6
sec40:
sltu $6,$5,$3
mfhi $6
nop
xor $5,$6,$6
sec41:
xor $6,$3,$5
mflo $6
addu $6,$4,$4
xor $0,$6,$6
sec42:
and $6,$0,$4
mflo $6
addiu $6,$3,14885
xor $3,$6,$6
sec43:
or $6,$4,$2
mfhi $6
mflo $6
xor $4,$6,$6
sec44:
xor $6,$1,$3
mfhi $6
lb $6,0($0)
xor $5,$6,$6
sec45:
addu $6,$5,$0
lh $6,4($0)
nop
xor $4,$6,$6
sec46:
or $6,$5,$3
lbu $6,10($0)
subu $6,$2,$6
xor $3,$6,$6
sec47:
subu $6,$4,$4
lh $6,6($0)
sltiu $6,$1,19864
xor $4,$6,$6
sec48:
or $6,$2,$4
lb $6,2($0)
mflo $6
xor $4,$6,$6
sec49:
addu $6,$1,$6
lb $6,15($0)
lw $6,0($0)
xor $0,$6,$6
sec50:
andi $6,$2,2305
nop
nop
xor $5,$6,$6
sec51:
xori $6,$5,17813
nop
slt $6,$3,$2
xor $3,$6,$6
sec52:
ori $6,$5,27546
nop
lui $6,12049
xor $4,$6,$6
sec53:
lui $6,698
nop
mfhi $6
xor $4,$6,$6
sec54:
slti $6,$4,2129
nop
lw $6,0($0)
xor $3,$6,$6
sec55:
andi $6,$0,35360
addu $6,$2,$4
nop
xor $2,$6,$6
sec56:
xori $6,$5,18502
nor $6,$2,$3
slt $6,$0,$3
xor $4,$6,$6
sec57:
andi $6,$5,43458
subu $6,$0,$1
sltiu $6,$2,-14224
xor $2,$6,$6
sec58:
sltiu $6,$2,17272
xor $6,$2,$2
mflo $6
xor $6,$6,$6
sec59:
slti $6,$1,-25561
and $6,$6,$3
lhu $6,6($0)
xor $5,$6,$6
sec60:
addiu $6,$4,19385
slti $6,$1,8404
nop
xor $1,$6,$6
sec61:
xori $6,$6,296
andi $6,$2,53021
addu $6,$2,$3
xor $2,$6,$6
sec62:
andi $6,$5,64156
lui $6,1942
lui $6,52878
xor $1,$6,$6
sec63:
sltiu $6,$3,-12188
andi $6,$1,22145
mfhi $6
xor $5,$6,$6
sec64:
slti $6,$1,-10458
sltiu $6,$2,12391
lw $6,8($0)
xor $2,$6,$6
sec65:
xori $6,$5,27064
mfhi $6
nop
xor $5,$6,$6
sec66:
slti $6,$5,2294
mfhi $6
and $6,$0,$2
xor $4,$6,$6
sec67:
addiu $6,$3,19769
mfhi $6
ori $6,$1,2018
xor $3,$6,$6
sec68:
ori $6,$0,38542
mflo $6
mflo $6
xor $4,$6,$6
sec69:
slti $6,$2,10570
mfhi $6
lhu $6,2($0)
xor $4,$6,$6
sec70:
ori $6,$4,28118
lhu $6,8($0)
nop
xor $5,$6,$6
sec71:
lui $6,4016
lb $6,10($0)
and $6,$1,$2
xor $3,$6,$6
sec72:
ori $6,$3,31095
lhu $6,6($0)
ori $6,$5,17901
xor $4,$6,$6
sec73:
sltiu $6,$2,-29837
lhu $6,14($0)
mflo $6
xor $4,$6,$6
sec74:
andi $6,$2,2952
lb $6,10($0)
lh $6,12($0)
xor $0,$6,$6
sec75:
mfhi $6
nop
nop
xor $0,$6,$6
sec76:
mfhi $6
nop
and $6,$4,$3
xor $2,$6,$6
sec77:
mflo $6
nop
slti $6,$4,-1346
xor $3,$6,$6
sec78:
mfhi $6
nop
mflo $6
xor $4,$6,$6
sec79:
mfhi $6
nop
lhu $6,14($0)
xor $3,$6,$6
sec80:
mflo $6
or $6,$6,$6
nop
xor $3,$6,$6
sec81:
mflo $6
sltu $6,$2,$2
or $6,$0,$5
xor $5,$6,$6
sec82:
mfhi $6
subu $6,$0,$1
xori $6,$3,15294
xor $2,$6,$6
sec83:
mflo $6
sltu $6,$5,$3
mflo $6
xor $4,$6,$6
sec84:
mflo $6
slt $6,$3,$3
lbu $6,0($0)
xor $6,$6,$6
sec85:
mfhi $6
slti $6,$3,-10298
nop
xor $5,$6,$6
sec86:
mfhi $6
addiu $6,$4,-2303
or $6,$5,$3
xor $6,$6,$6
sec87:
mfhi $6
addiu $6,$2,21629
addiu $6,$1,-31852
xor $4,$6,$6
sec88:
mflo $6
ori $6,$2,17712
mflo $6
xor $3,$6,$6
sec89:
mfhi $6
addiu $6,$6,-1802
lhu $6,16($0)
xor $1,$6,$6
sec90:
mfhi $6
mflo $6
nop
xor $0,$6,$6
sec91:
mflo $6
mflo $6
sltu $6,$4,$3
xor $3,$6,$6
sec92:
mflo $6
mfhi $6
xori $6,$4,13089
xor $3,$6,$6
sec93:
mfhi $6
mflo $6
mflo $6
xor $4,$6,$6
sec94:
mflo $6
mfhi $6
lb $6,5($0)
xor $0,$6,$6
sec95:
mflo $6
lb $6,11($0)
nop
xor $4,$6,$6
sec96:
mflo $6
lbu $6,10($0)
xor $6,$2,$2
xor $0,$6,$6
sec97:
mfhi $6
lbu $6,14($0)
slti $6,$2,5176
xor $3,$6,$6
sec98:
mflo $6
lb $6,4($0)
mflo $6
xor $5,$6,$6
sec99:
mflo $6
lhu $6,8($0)
lb $6,7($0)
xor $3,$6,$6
sec100:
lbu $6,12($0)
nop
nop
xor $3,$6,$6
sec101:
lh $6,2($0)
nop
or $6,$0,$6
xor $3,$6,$6
sec102:
lw $6,4($0)
nop
slti $6,$3,2388
xor $2,$6,$6
sec103:
lb $6,0($0)
nop
mfhi $6
xor $4,$6,$6
sec104:
lbu $6,4($0)
nop
lb $6,15($0)
xor $3,$6,$6
sec105:
lb $6,3($0)
addu $6,$3,$5
nop
xor $3,$6,$6
sec106:
lb $6,1($0)
sltu $6,$3,$5
addu $6,$3,$2
xor $4,$6,$6
sec107:
lbu $6,16($0)
nor $6,$0,$6
addiu $6,$3,915
xor $4,$6,$6
sec108:
lh $6,6($0)
nor $6,$6,$3
mflo $6
xor $3,$6,$6
sec109:
lw $6,16($0)
sltu $6,$3,$4
lbu $6,8($0)
xor $3,$6,$6
sec110:
lhu $6,16($0)
sltiu $6,$6,16472
nop
xor $3,$6,$6
sec111:
lb $6,7($0)
addiu $6,$2,-5754
sltu $6,$0,$3
xor $0,$6,$6
sec112:
lb $6,3($0)
addiu $6,$3,1061
slti $6,$4,-749
xor $4,$6,$6
sec113:
lw $6,0($0)
slti $6,$0,13956
mfhi $6
xor $3,$6,$6
sec114:
lbu $6,9($0)
addiu $6,$4,31906
lh $6,10($0)
xor $4,$6,$6
sec115:
lhu $6,10($0)
mfhi $6
nop
xor $6,$6,$6
sec116:
lb $6,0($0)
mflo $6
nor $6,$3,$4
xor $4,$6,$6
sec117:
lbu $6,15($0)
mfhi $6
addiu $6,$1,-20200
xor $2,$6,$6
sec118:
lbu $6,4($0)
mflo $6
mfhi $6
xor $1,$6,$6
sec119:
lb $6,3($0)
mflo $6
lhu $6,8($0)
xor $2,$6,$6
sec120:
lw $6,4($0)
lw $6,12($0)
nop
xor $4,$6,$6
sec121:
lw $6,0($0)
lb $6,4($0)
sltu $6,$3,$6
xor $3,$6,$6
sec122:
lbu $6,12($0)
lbu $6,2($0)
slti $6,$4,-1326
xor $4,$6,$6
sec123:
lbu $6,6($0)
lhu $6,2($0)
mflo $6
xor $4,$6,$6
sec124:
lw $6,12($0)
lbu $6,10($0)
lhu $6,12($0)
xor $4,$6,$6
| 11.428125 | 19 | 0.522013 |
6dcf777f9f95bf9ce14f238e2f329566698eb1db | 475 | asm | Assembly | Lab3/lab3_5.asm | chintamanand/Embedded-Systems-Project | 8e5651ad699dce8b4c962edb492c910200e00f36 | [
"MIT"
] | null | null | null | Lab3/lab3_5.asm | chintamanand/Embedded-Systems-Project | 8e5651ad699dce8b4c962edb492c910200e00f36 | [
"MIT"
] | null | null | null | Lab3/lab3_5.asm | chintamanand/Embedded-Systems-Project | 8e5651ad699dce8b4c962edb492c910200e00f36 | [
"MIT"
] | null | null | null | AREA RESET, DATA, READONLY
EXPORT __Vectors
__Vectors
DCD 0x10001000
DCD Reset_Handler
ALIGN
AREA myCode6, CODE, READONLY
ENTRY
EXPORT Reset_Handler
Reset_Handler
LDR R0, =NUM1
LDR R1, [R0]
LDR R0, =NUM2
LDR R2, [R0]
MOV R3,R1
MOV R4,R2
UP CMP R3,R4
BEQ EXIT
ADDHI R4,R4,R2
ADDLO R3,R3,R1
B UP
EXIT
LDR R0,=RESULT
STR R4,[R0]
STOP B STOP
NUM1 DCD 9
NUM2 DCD 6
AREA DATASEG, DATA, READWRITE
RESULT DCD 0
END
| 13.571429 | 31 | 0.652632 |
cad76fa50aa2e244460b5b55677f03fb42bc149d | 879 | asm | Assembly | src/dict.asm | Veltas/zenv | 71d358d369a9746aa7d38d48157625d1b6ccf5dc | [
"MIT"
] | 6 | 2020-06-01T19:03:05.000Z | 2021-12-21T22:39:05.000Z | src/dict.asm | Veltas/zenv | 71d358d369a9746aa7d38d48157625d1b6ccf5dc | [
"MIT"
] | 8 | 2020-06-13T13:40:29.000Z | 2021-09-17T15:28:36.000Z | src/dict.asm | Veltas/zenv | 71d358d369a9746aa7d38d48157625d1b6ccf5dc | [
"MIT"
] | null | null | null | ; vi:syntax=z80
; ZEnv - Forth for the ZX Spectrum
; Copyright 2021 (C) - Christopher Leonard, MIT Licence
; https://github.com/veltas/zenv
; Dictionary words
; \ Remove named word and everything in dictionary after
; ( " name" --)
; : FORGET
HEADER forget, "FORGET", 0
forget:
CALL colon_code
; BL WORD
DX bl: DX word
; ( str)
; SYM-LAST @
DX sym_last: DX fetch
; ( str sym)
; BEGIN
.begin:
; ?DUP 0= IF CWHAT? THEN
DX question_dup: DX zero_equals: DX if_raw: DB .then-$-1: DX cwhat_question
.then:
; 2DUP >SYM ROT COUNT COMPARE WHILE
DX two_dup: DX to_sym: DX rot: DX count: DX compare: DX if_raw
DB .repeat-$-1
; @
DX fetch
; REPEAT
DX again_raw
DB .begin-$+256
.repeat:
; NIP
DX nip
; ( sym)
; DUP @ SWAP
DX dup: DX fetch: DX swap
; ( prev-sym sym)
; H !
DX h_: DX store
; ( prev-sym)
; SYM-LAST ! ;
DX sym_last: DX store: DX exit
| 18.702128 | 77 | 0.641638 |
45a66b7e3ae8689ad430225054b00d29bd49b4b4 | 595 | asm | Assembly | libsrc/_DEVELOPMENT/string/c/sccz80/_memstrcpy_.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 640 | 2017-01-14T23:33:45.000Z | 2022-03-30T11:28:42.000Z | libsrc/_DEVELOPMENT/string/c/sccz80/_memstrcpy_.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 1,600 | 2017-01-15T16:12:02.000Z | 2022-03-31T12:11:12.000Z | libsrc/_DEVELOPMENT/string/c/sccz80/_memstrcpy_.asm | Frodevan/z88dk | f27af9fe840ff995c63c80a73673ba7ee33fffac | [
"ClArtistic"
] | 215 | 2017-01-17T10:43:03.000Z | 2022-03-23T17:25:02.000Z |
; char *_memstrcpy_(void *p, char *s, size_t n)
SECTION code_clib
SECTION code_string
PUBLIC _memstrcpy_
EXTERN asm__memstrcpy
_memstrcpy_:
IF __CPU_GBZ80__ | __CPU_INTEL__
ld hl,sp+2
ld c,(hl)
inc hl
ld b,(hl)
inc hl
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ld a,(hl+)
ld h,(hl)
ld l,e
ld e,a
ld a,h
ld h,d
ld d,a
ELSE
pop af
pop bc
pop hl
pop de
push de
push hl
push bc
push af
ENDIF
jp asm__memstrcpy
; SDCC bridge for Classic
IF __CLASSIC
PUBLIC __memstrcpy_
defc __memstrcpy_ = _memstrcpy_
ENDIF
| 12.142857 | 47 | 0.620168 |
c087f44c5d5732f275d627c48301d06adcfc037d | 3,947 | asm | Assembly | cycle_check/cycle_check.asm | 42Bastian/lynx_hacking | a40edd223a4759d64f20a940ef5eb826a0fdd02d | [
"Apache-2.0"
] | 12 | 2020-07-05T16:47:54.000Z | 2022-02-12T21:21:16.000Z | cycle_check/cycle_check.asm | 42Bastian/lynx_hacking | a40edd223a4759d64f20a940ef5eb826a0fdd02d | [
"Apache-2.0"
] | null | null | null | cycle_check/cycle_check.asm | 42Bastian/lynx_hacking | a40edd223a4759d64f20a940ef5eb826a0fdd02d | [
"Apache-2.0"
] | 1 | 2021-01-18T06:47:25.000Z | 2021-01-18T06:47:25.000Z | ****************
*
* chained_scbs.asm
*
* (c) 42Bastian Schick
*
* July 2019
*
DEBUG set 1
Baudrate set 62500
_1000HZ_TIMER set 7
IRQ_SWITCHBUF_USR set 1
include <includes\hardware.inc>
****************
MACRO DoSWITCH
dec SWITCHFlag
.\wait_vbl
bit SWITCHFlag
bmi .\wait_vbl
ENDM
****************
* macros
include <macros/help.mac>
include <macros/if_while.mac>
include <macros/font.mac>
include <macros/mikey.mac>
include <macros/suzy.mac>
include <macros/irq.mac>
include <macros/newkey.mac>
include <macros/debug.mac>
****************
* variables
include <vardefs/debug.var>
include <vardefs/help.var>
include <vardefs/font.var>
include <vardefs/mikey.var>
include <vardefs/suzy.var>
include <vardefs/irq.var>
include <vardefs/newkey.var>
include <vardefs/serial.var>
include <vardefs/1000Hz.var>
****************************************************
BEGIN_ZP
ptr ds 2
ptr1 ds 2
ptr2 ds 2
tmp ds 1
*********************
END_ZP
BEGIN_MEM
irq_vektoren ds 16
ALIGN 4
screen0 ds SCREEN.LEN
screen1 ds SCREEN.LEN
END_MEM
run LOMEM
ECHO "START :%HLOMEM ZP : %HNEXT_ZP"
Start::
sei
cld
CLEAR_MEM
CLEAR_ZP
ldx #0
txs
INITMIKEY
INITSUZY
SETRGB pal
INITIRQ irq_vektoren
INITKEY
INITFONT LITTLEFNT,RED,WHITE
FRAMERATE 75
jsr InitComLynx
SETIRQ 2,VBL
SCRBASE screen0,screen1
SET_MINMAX 0,0,160,102
lda #0
//-> ora #SIGNED_MATH
//-> ora #USE_AKKU
ora _SPRSYS
sta SPRSYS
sta _SPRSYS
lda #$ff
sta TIMER7+TIM_BAKUP
lda #TIM_64us|TIM_RELOAD|TIM_COUNT
sta TIMER7+TIM_CNTRL1
cli
again::
sec
stz $ff
stz TIMER7+TIM_CNT
ldx #1024/256
lda #255
jmp test
ALIGN 1024
test:
.l
MACRO j
stz MATHE_C
sta MATHE_C+1
stz MATHE_E
sta MATHE_E+1
.\w bit SPRSYS
bmi .\w
ENDM
REPT 256
j
ENDR
dex
beq .x1
jmp .l
.x1
sei
lda TIMER7+TIM_CNT
cli
eor #$ff
inc
stz $fda0
stz CurrX
jsr PrintDezA
DoSWITCH
jmp again
MACRO SKIP1
dc.b $02
ENDM
; 75Hz | 60Hz | 50Hz
; iter opcode count us cycles | count us cycles | count us cycles |
; of 64us per opcode | of 64us per opcode | of 64us per opcode |
; ---------------------------------------------------------------------------------
; 32K xb,x3 152 0.297 1 | 148 0.289 1 | 145 0.283 1
; 16K NOP 152 0.594 2 | 147 0.578 2 | 144 0.563 2
; 16K x2 152 0.594 2 | |
; 16K adc imm 152 0.594 2 | |
; 8K pha 131 1.02 3.4 | | 124
; 8K pla 177 1.38 4.7 | |
; 8K adc zp 130 1.02 3.4 | |
; 8K adc abs 169 1.32 4.4 | 163 1.27 4.4 | 160
; 8K lda zp,x 169 1.32 4.4 | 163 1.27 4.4 | 160
; 8K jmp 122 0.953 3.2 | |
; 8K bra 122 0.953 3.2 | |
; 8K bCC n/t 76 0.598 2.1 | |
; 8K bCC /t 122 0.953 3.2 | |
; 8K $dc,$fc 169 1.32 4.4 | |
; 4K $5c 177 2.77 2.6 | |
; 4K inc abs 130 2.03 6.8 | |
; 4K inc zp 111 1.73 5.8 | |
; 1K stz nn
; n/t not taken
; /t taken
****************
VBL::
dec $fda0
IRQ_SWITCHBUF
END_IRQ
****************
_cls:: lda #<clsSCB
ldy #>clsSCB
jmp DrawSprite
clsSCB
dc.b $0,$10,0
dc.w 0,clsDATA
dc.w 0,0
dc.w $100*10,$100*102
clsCOLOR
dc.b $00
clsDATA
dc.b 2,%01111100
dc.b 0
****************
* INCLUDES
include <includes/draw_spr.inc>
include <includes/irq.inc>
include <includes/1000Hz.inc>
include <includes/serial.inc>
include <includes/font.inc>
include <includes/font2.hlp>
include <includes/newkey.inc>
include <includes/debug.inc>
include <includes/hexdez.inc>
align 2
pal
STANDARD_PAL
| 19.44335 | 83 | 0.532303 |
02eb87e7fa58b813328dd88ac3edab32251826ce | 463 | asm | Assembly | data/pokemon/base_stats/hoenn/illumise.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | null | null | null | data/pokemon/base_stats/hoenn/illumise.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | null | null | null | data/pokemon/base_stats/hoenn/illumise.asm | Dev727/ancientplatinum | 8b212a1728cc32a95743e1538b9eaa0827d013a7 | [
"blessing"
] | null | null | null | db 0 ; 314 DEX NO
db 65, 47, 55, 85, 73, 75
; hp atk def spd sat sdf
db BUG, BUG ; type
db 150 ; catch rate
db 146 ; base exp
db NO_ITEM, NO_ITEM ; items
db GENDER_F100 ; gender ratio
db 100 ; unknown 1
db 15 ; step cycles to hatch
db 5 ; unknown 2
INCBIN "gfx/pokemon/hoenn/illumise/front.dimensions"
db 0, 0, 0, 0 ; padding
db GROWTH_FLUCTUATING ; growth rate
dn EGG_BUG, EGG_HUMANSHAPE ; egg groups
; tm/hm learnset
tmhm
; end
| 21.045455 | 53 | 0.665227 |
2e576a76694d6d11ef94c8c7c03fd7e1417c0fa7 | 348 | asm | Assembly | oeis/162/A162993.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/162/A162993.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/162/A162993.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A162993: The second left hand column of triangle A162990
; Submitted by Jamie Morken(s3)
; 9,144,3600,129600,6350400,406425600,32920473600,3292047360000,398337730560000,57360633200640000,9693947010908160000,1900013614137999360000,427503063181049856000000
add $0,2
mov $1,$0
add $0,1
lpb $1
mul $0,$1
sub $1,1
lpe
pow $0,2
div $0,36
mul $0,9
| 23.2 | 165 | 0.775862 |
f38d55b106ee0563c1adc172ed7bd613ddf20bff | 1,743 | asm | Assembly | programs/oeis/167/A167167.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/167/A167167.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/167/A167167.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A167167: A001045 with a(0) replaced by -1.
; -1,1,1,3,5,11,21,43,85,171,341,683,1365,2731,5461,10923,21845,43691,87381,174763,349525,699051,1398101,2796203,5592405,11184811,22369621,44739243,89478485,178956971,357913941,715827883,1431655765,2863311531,5726623061,11453246123,22906492245,45812984491,91625968981,183251937963,366503875925,733007751851,1466015503701,2932031007403,5864062014805,11728124029611,23456248059221,46912496118443,93824992236885,187649984473771,375299968947541,750599937895083,1501199875790165,3002399751580331,6004799503160661,12009599006321323,24019198012642645,48038396025285291,96076792050570581,192153584101141163,384307168202282325,768614336404564651,1537228672809129301,3074457345618258603,6148914691236517205,12297829382473034411,24595658764946068821,49191317529892137643,98382635059784275285,196765270119568550571,393530540239137101141,787061080478274202283,1574122160956548404565,3148244321913096809131,6296488643826193618261,12592977287652387236523,25185954575304774473045,50371909150609548946091,100743818301219097892181,201487636602438195784363,402975273204876391568725,805950546409752783137451,1611901092819505566274901,3223802185639011132549803,6447604371278022265099605,12895208742556044530199211,25790417485112089060398421,51580834970224178120796843,103161669940448356241593685,206323339880896712483187371,412646679761793424966374741,825293359523586849932749483,1650586719047173699865498965,3301173438094347399730997931,6602346876188694799461995861,13204693752377389598923991723,26409387504754779197847983445,52818775009509558395695966891,105637550019019116791391933781,211275100038038233582783867563
mov $1,2
pow $1,$0
add $1,4
mul $1,2
div $1,6
sub $1,2
lpb $0
mov $0,$2
add $1,1
lpe
mov $0,$1
| 116.2 | 1,597 | 0.905336 |
58c699e941fcf9abe5e4f280d49b5ba2400fd010 | 3,288 | asm | Assembly | test_programs/ise.asm | mfkiwl/QNICE-FPGA-hyperRAM | aabc8291ac1e0c4666c51f84acddf599d7521e53 | [
"BSD-3-Clause"
] | 53 | 2016-04-12T07:22:49.000Z | 2022-03-25T09:24:48.000Z | test_programs/ise.asm | mfkiwl/QNICE-FPGA-hyperRAM | aabc8291ac1e0c4666c51f84acddf599d7521e53 | [
"BSD-3-Clause"
] | 196 | 2020-06-05T04:59:50.000Z | 2021-03-13T21:27:11.000Z | test_programs/ise.asm | mfkiwl/QNICE-FPGA-hyperRAM | aabc8291ac1e0c4666c51f84acddf599d7521e53 | [
"BSD-3-Clause"
] | 15 | 2017-07-31T11:26:56.000Z | 2022-02-22T14:22:46.000Z | ; Test program for reproducing "The ISE vs. Vivado riddle" as described on
; GitHub here: https://github.com/sy2002/QNICE-FPGA/issues/4
;
; What this program does: Reset the hardware cycle counter (which is increased
; at each clock cycle - as the time of making 50 MHz) and the hardware
; instruction counter (which is increased at each new instruction fetch).
;
; Both counters can be used together to measure the MIPS throughput of
; QNICE-FPGA, for example by running the two performance test programs
; "test_programs/mandel_perf_test.asm" and
; "test_programs/q-tris_perf_test.asm": Both versions of these demos will
; output the amount of cycles and the amount of instructions after they end.
;
; What is expected as an output is something like this:
;
; Amount of cycles used: 000000000041
; Amount of instructions performed: 000000000012
;
; These values are hexadecimal values.
;
; done by sy2002 in July 2020
#include "../dist_kit/sysdef.asm"
#include "../dist_kit/monitor.def"
.ORG 0x8000
; start the counters (reset also starts them)
MOVE IO$CYC_STATE, R0 ; reset hw cycle counter
MOVE 1, @R0
MOVE IO$INS_STATE, R0 ; reset hw instruction counter
MOVE 1, @R0
; do some work
MOVE 1, R1
MOVE 2, R2
MOVE 3, R3
MOVE 4, R4
XOR R1, R1
ADD R1, R2
XOR R3, R2
SUB R4, R2
NOP
NOP
NOP
MOVE 5, R5
MOVE 6, R6
ADD R6, R4
; stop the counters
MOVE IO$CYC_STATE, R0
MOVE 0, @R0
MOVE IO$INS_STATE, R0
MOVE 0, @R0
; output cycle counter
MOVE STR_CYC, R8
SYSCALL(puts, 1)
MOVE IO$CYC_HI, R1
MOVE @R1, R8
SYSCALL(puthex, 1) ; output hi word of 48bit counter
MOVE IO$CYC_MID, R1
MOVE @R1, R8
SYSCALL(puthex, 1) ; output mid word of 48bit counter
MOVE IO$CYC_LO, R1
MOVE @R1, R8
SYSCALL(puthex, 1) ; output lo word of 48bit counter
SYSCALL(crlf, 1)
; output instruction counter
MOVE STR_INS, R8
SYSCALL(puts, 1)
MOVE IO$INS_HI, R1
MOVE @R1, R8
SYSCALL(puthex, 1) ; output hi word of 48bit counter
MOVE IO$INS_MID, R1
MOVE @R1, R8
SYSCALL(puthex, 1) ; output mid word of 48bit counter
MOVE IO$INS_LO, R1
MOVE @R1, R8
SYSCALL(puthex, 1) ; output lo word of 48bit counter
SYSCALL(crlf, 1)
SYSCALL(exit, 1)
STR_CYC .ASCII_W "Amount of cycles used: "
STR_INS .ASCII_W "Amount if instructions performed: "
| 37.363636 | 93 | 0.497871 |
2e3fd239da6bc8092b63a77eb6c4b9f1b350c4e7 | 5,563 | asm | Assembly | ee/wman/version.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ee/wman/version.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ee/wman/version.asm | olifink/smsqe | c546d882b26566a46d71820d1539bed9ea8af108 | [
"BSD-2-Clause"
] | null | null | null | ; Window manager Version 1988 Tony Tebby QJUMP
xdef wm_vers
xdef wm.pver
; V1.04 WM.DRBDR added
;
; V1.05 Zero text pointers allowed, information blobs corrected
;
; V1.06 CHWIN returns size change. Initial pointer set rel hit
; area. Fixed window sizes accepted by SETUP. BREAK
; detected. Pending newline problems in information windows
; removed. Menu sub-window paper set before scrolling.
;
; V1.07 Lots of new routines. SSCLR and ARROW made regular fmt.
;
; V1.08 CHWIN fixed for secondaries/cursor keys.
;
; V1.09 Non-cleared info windows allowed.
; Vectors $48 to $74 added.
;
; V1.10 Setup correct number of columns > 3.
; Set pointer position correctly in odd position
; application sub-window.
;
; V1.11 Returns user defined message if no PTR.
;
; V1.12 Fractional scaling bug fixed.
;
; V1.13 WM.MSECT extended to accept cursor keys, SPACE and ENTER
; in arrow rows.
; DO/ENTER in arrow row of single item menu section made
; equivalent to HIT/SPACE.
; Cosmetic improvements to menu and current item handling.
;
; V1.14 WM.DROBJ updated to draw sprites 1 to 7 in the right
; place.
;
; V1.15 Sleep and wake event keystrokes added to WM.RPTR.
; Characters in the range $09 to $1f recognised in WM.RPTR.
;
; V1.16 Improved wake. Control codes less than 9 accepted.
; WM.RNAME, WM.ENAME return terminator in D1 as it should.
;
; V1.17 (int) Pan/scroll bars at last.
;
; V1.18 (int) Pan/scroll arrows made optional, bars tidied up.
;
; V1.19 (int) WM.SWAPP corrected for application windows >0.
; Improvements to out of window keystrokes.
; WM.CHWIN now allows cursor keys for pull down window
; moves - regardless of circumstances.
;
; V1.20 (int) Out of window wake accepted again (went in 1.19).
;
; V1.21 (int) DO anywhere in window accepted.
;
; V1.22 (int) Constant Spacing in menus.
;
; V1.23 (int) Repeated selection key handled.
; Dragging on pan/scroll bars implemented.
;
; V1.24 Improvements to FSIZE for windows variable in two dims.
;
; V1.25 Further improvements to pan/scroll bars.
;
; V1.26 WM.STLOB status set OK.
; WM.UPBAR added.
;
; V1.27 WM.SWLIT now sets cursor position using justification.
; WM.RNAME WN.ENAME start from cursor position.
;
; V1.28 Pan/scroll bars with no sections cleared (V1.26, V1.27)
;
; V1.29 Sub-window select keystroke (-1 in D2) re-introduced.
;
; V1.30 Sub-window control routine called only on move or hit.
; Window origin scaleable.
; DRBAR can draw full length bar (V1.26-V1.29).
; Event with no loose item accepted anywhere in window.
;
; V1.31 Underline nth character of text type -n.
; WM.MHIT returns D4=0 if action or control routine called.
;
; V1.32 DO item action routine called on DO in window
;
; V1.33 Text position set before character size set (prevents
; spurious scroll
;
; V1.34 Split cannot generate empty sections.
;
; V1.35 Character size only set if non-standard.
; Requires 1.46 Pointer.
;
; V1.36 WDRAW corrected so as not to smash d5/d6 (error in 1.35).
;
; V1.37 Scaling of menu spacing.
; Fixed menu spacing (first spacing negative) allowed
; in definition.
;
; V1.38 Minimum limit for window rounded up to 4 pixel boundary.
;
; V1.39 CHWIN does not smash D4 and D7 on move.
;
; V1.40 Underline permitted for text starting with spaces.
;
; V1.41 WM.RNAME WM.ENAME does not edit text longer than window.
;
; V1.42 Extended WM.RNAME WM.ENAME
;
; V1.43 Set window resets character size to 0,0
;
; V1.44 Pan and scroll bars corrected for border >1
;
; V1.45 V1.44 Corrected
;
; V1.46 CSIZE reset when no info text item
;
; V1.47 Corrects version 1.46
;
; First SMSQ/E version
; V1.48 allows error messages longer than 40 characters
;
; V1.49 Attempts to remove 4096 item / row / column problems
;
; V1.50 WM.RPTRT introduced
;
; V1.51 and returns on job event
;
; V1.52 and checks explicitly for D3 reset by app sw hit
;
; V1.53 underscore checks improved
;
; V1.54 high colour definition introduced (early test version)
;
; V1.55 high colour changes finished (MK)
; introduced system palette (MK)
; wm.setsp, wm.getsp, wm.trap3 added (MK)
; rewrote most of the scroll/pan bar draw routines (MK)
;
; V2.00 wm.opw, wm.ssclr, wm.jbpal added (MK)
; Sprites may be drawn differently depending on the item
; status (WL + MK)
;
; V2.01 New window move routines & Config Block (WL + MK)
; Bugfix for object drawing & wman rptr routines (WL & MK)
; Fixed bug for stippled borders in WMAN (WL)
;
; V2.02 Fixed WM_BLOCK (GG + MK)
;
; V2.03 Fixed pointer save on new move operation (wl)
;
; V2.04 Fixed spurious outline when using outline move, on mouse button release
;
; V2.05 New vector wm_cpspr to copy a sprite definition (MK)
; Fixed error return of wm.jbpal (MK)
; Double 3d border type fixed (MK)
;
; V2.06 New window move with transparency (wl)
;
; V2.07 menu appsub wdw may have csizes for text objects (wl)
;
; V2.08 QDOS version optimized for space (MK)
wm_vers equ '2.08'
wm.pver equ '2.02'
end
| 32.91716 | 86 | 0.641381 |
c76cfb4195e692ee030589ad5fd54c537a3d88a3 | 1,893 | asm | Assembly | 1. Sorting/bubblesort.asm | neelpatel224/ELL305-Computer-Architecture-Assignments | 6fcb365af864df079467106015a384c1188589aa | [
"MIT"
] | null | null | null | 1. Sorting/bubblesort.asm | neelpatel224/ELL305-Computer-Architecture-Assignments | 6fcb365af864df079467106015a384c1188589aa | [
"MIT"
] | 1 | 2021-11-30T09:09:37.000Z | 2021-11-30T09:11:59.000Z | 1. Sorting/bubblesort.asm | neelpatel224/ELL305-Computer-Architecture-Assignments | 6fcb365af864df079467106015a384c1188589aa | [
"MIT"
] | null | null | null | .bubblesort:
@ ADD YOUR CODE HERE
@ r2 = start (start address of array)
@ r3 = n (number of elements in array)
mul r4, r3, 4
sub r4, r4, 4 @ r4 = end (end address of array)
mov r9, -1 @ r9 = i for nloop (goes from 0 to n-1)
.nloop:
add r9, r9, 1 @ increment in nloop counter
mov r5, r2 @ r5 = current address
mul r10, r9, 4
sub r10, r4, r10 @ r10 = end address for inner loop (after this address, all elements are sorted)
.loop:
add r6, r5, 4 @ r6 = next address
ld r7, [r5] @ r7 = value at r5
ld r8, [r6] @ r8 = value at r6
cmp r8, r7
bgt .skip @ if r7 <= r8, no need for swap
beq .skip
st r8, [r5] @ swapping
st r7, [r6]
.skip:
nop
mov r5, r6 @ update current address for next loop
cmp r4, r6 @ check loop breaking condition
bgt .loop
cmp r3, r9 @ check nloop breaking condition
bgt .nloop
ret
.main:
@ Loading the values as an array into the registers
mov r0, 0
mov r1, 12 @ replace 12 with the number to be sorted
st r1, 0[r0]
mov r1, 7 @ replace 7 with the number to be sorted
st r1, 4[r0]
mov r1, 11 @ replace 11 with the number to be sorted
st r1, 8[r0]
mov r1, 9 @ replace 9 with the number to be sorted
st r1, 12[r0]
mov r1, 3 @ replace 3 with the number to be sorted
st r1, 16[r0]
mov r1, 15 @ replace 15 with the number to be sorted
st r1, 20[r0]
@ EXTEND ON SIMILAR LINES FOR MORE NUMBERS
mov r2, 0 @ Starting address of the array
@ Retreive the end address of the array
mov r3, 6 @ REPLACE 6 WITH N, where, N is the number of numbers being sorted
@ ADD YOUR CODE HERE
call .bubblesort
@ ADD YOUR CODE HERE
@ Print statements
ld r1, 0[r0]
.print r1
ld r1, 4[r0]
.print r1
ld r1, 8[r0]
.print r1
ld r1, 12[r0]
.print r1
ld r1, 16[r0]
.print r1
ld r1, 20[r0]
.print r1
@ EXTEND ON SIMILAR LINES FOR MORE NUMBERS
| 21.511364 | 99 | 0.628632 |
86136e720b7e4794b5310ea0c1e4c4023703efd1 | 416 | asm | Assembly | unittests/32Bit_ASM/PrimaryGroup/5_FF_02_2.asm | cobalt2727/FEX | 13087f8425aeaad28dc81bed46a83e1d72ff0db8 | [
"MIT"
] | 628 | 2020-03-06T14:01:32.000Z | 2022-03-31T06:35:14.000Z | unittests/32Bit_ASM/PrimaryGroup/5_FF_02_2.asm | cobalt2727/FEX | 13087f8425aeaad28dc81bed46a83e1d72ff0db8 | [
"MIT"
] | 576 | 2020-03-06T08:25:12.000Z | 2022-03-30T04:05:29.000Z | unittests/32Bit_ASM/PrimaryGroup/5_FF_02_2.asm | cobalt2727/FEX | 13087f8425aeaad28dc81bed46a83e1d72ff0db8 | [
"MIT"
] | 38 | 2020-03-07T06:10:00.000Z | 2022-03-29T09:27:36.000Z | %ifdef CONFIG
{
"RegData": {
"RAX": "0x41424344"
},
"Mode": "32BIT"
}
%endif
mov edi, 0xe0000000
lea esp, [edi + 8 * 4]
mov eax, 0x41424344
mov [edi + 8 * 0], eax
mov eax, 0x51525354
mov [edi + 8 * 1], eax
mov eax, 0
db 0xFF
db 0x15
dd .jmp_data
jmp .end
.call_tgt:
mov eax, [edi + 8 * 0]
ret
; Couple things that could catch failure
mov eax, 0
jmp .end
mov eax, 0
.end:
hlt
.jmp_data:
dd .call_tgt
| 10.947368 | 40 | 0.625 |
f3d6ad81dd43f6178014112c057dc3ee36a5cfde | 36,762 | asm | Assembly | Driver/Keyboard/keyboardInit.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 504 | 2018-11-18T03:35:53.000Z | 2022-03-29T01:02:51.000Z | Driver/Keyboard/keyboardInit.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 96 | 2018-11-19T21:06:50.000Z | 2022-03-06T10:26:48.000Z | Driver/Keyboard/keyboardInit.asm | steakknife/pcgeos | 95edd7fad36df400aba9bab1d56e154fc126044a | [
"Apache-2.0"
] | 73 | 2018-11-19T20:46:53.000Z | 2022-03-29T00:59:26.000Z | COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1990 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: keyboardInit.asm
AUTHOR: Gene Anderson, Feb 8, 1990
ROUTINES:
Name Description
---- -----------
KbdInit initialize the keyboard driver
KbdExit clean up and exit the keyboard driver
KbdWriteCmd write a command byte to the keyboard
KbdReadData read a data byte from the keyboard
KbdWriteData write a data byte from the keyboard
KbdSetOptions set geos.ini file specified options
REVISION HISTORY:
Name Date Description
---- ---- -----------
Gene 2/ 8/90 Initial revision
DESCRIPTION:
Initialization and exit routines for keyboard driver
$Id: keyboardInit.asm,v 1.1 97/04/18 11:47:08 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
ifidn HARDWARE_TYPE, <PC>
Movable segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdInit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize the keyboard driver
CALLED BY: KbdStrategy
PASS: ds - seg addr of idata
RETURN: carry - set on error
DESTROYED: ax, bx, cx, dx, si
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
keyboardCategoryStr char "keyboard", 0
keyboardTypematicStr char "keyboardTypematic", 0
keyboardDoesLEDS char "keyboardDoesLEDs", 0
keyboardAltGrStr char "keyboardAltGr", 0
keyboardShiftRelStr char "keyboardShiftRelease", 0
keyboardSwapCtrlStr char "keyboardSwapCtrl", 0
keyboardForceXT char "forceXT", 0
keyboardForceAT char "forceAT", 0
KbdInitFar proc far
uses es
.enter
mov ax, ds
mov es, ax ;es <- seg addr of idata
EC < test ds:[kbdStratFlags], mask KSF_HAVE_INT_VEC >
EC < ERROR_NZ KBD_NESTED_INIT ;>
;show we have int vec now.
or ds:[kbdStratFlags], mask KSF_HAVE_INT_VEC
mov ds:[kbdOutputProcHandle],-1 ;init to NO process (-1)
;
; See if the controller is XT- or AT-style.
;
call CheckControllerType
;
; Set up to catch the keyboard interrupt.
;
INT_OFF ;disable ints while setting
mov ax, SDI_KEYBOARD
mov bx, segment Resident
mov cx, offset Resident:KbdInterrupt
mov di, offset kbdVector
call SysCatchDeviceInterrupt ;install our interrrupt handler
; Flush keyboard buffer by setting the head pointer to equal tail pointer
push ds, ax
mov ax, BIOS_SEG
mov ds, ax
mov ax, ds:[BIOS_KEYBOARD_BUFFER_TAIL_POINTER]
mov ds:[BIOS_KEYBOARD_BUFFER_HEAD_POINTER], ax
pop ds, ax
; Make sure keyboard interrupt enabled in 8259
in al, ICMASKPORT
and al, not (1 shl SDI_KEYBOARD) ;keyboard interrupts at level 1
out ICMASKPORT, al
INT_ON ;turn interrupts back on
;
; See if the geos.ini file option "keyboardDoesLEDs"
; is set. This means this is an XT-level machine
; that actually has a semi-intelligent keyboard controller,
; and it won't freeze up when told to toggle the LEDs.
;
mov dx, offset keyboardDoesLEDS
mov bl, mask KO_DOES_LEDS
call CheckKeyboardOption
clr cx ;cx <- timeout count
KI_Empty:
in al, KBD_STATUS_PORT ;wait for data buffer empty
test al, mask KSB_INPUT_BUFFER_FULL ;test for input buffer full
loopnz KI_Empty ;if full, loop & wait
push es
mov ax, BIOS_SEG ; state from BIOS. The bits
mov es, ax ; are in the same order in
mov al, es:[BIOS_KBD_STATE] ; BIOS-land as in our land,
mov cl, BIOS_KBD_SCROLL_LOCK_OFFSET ; but are in a different
shr al, cl ; place
and al, 7 ; mask out all but three
mov ds:[kbdModeIndState], al ; interesting bits.
mov ds:[kbdToggleState], al
pop es
mov ah, al ;ah <- current state
mov al, KBD_CMD_SET_LED ;al <- command to send
call SetKbdStateFar ;set kbd LED's correctly
;
; See if there are settings in geos.ini file to set the
; typematic rate and delay. Otherwise, don't mess with
; them at all so users that set them don't get upset.
;
push ds
segmov ds, cs, cx
mov si, offset keyboardCategoryStr ;ds:si <- ptr to category
mov dx, offset keyboardTypematicStr ;cx:dx <- ptr to key
call InitFileReadInteger ;ax == integer
pop ds
jc afterTypematic ;branch if no entry
andnf al, mask KT_TYPEMATIC_MAN \
or mask KT_TYPEMATIC_EXP \
or mask KT_DELAY
mov ds:[kbdTypematicState], al
mov ah, al ;ah <- current state
mov al, KBD_CMD_SET_TYPEMATIC ;al <- command
call SetKbdStateFar
afterTypematic:
;
; See if this a #$%@?! European keyboard, and make
; the right <Alt> key behave the same as <Ctrl><Alt>
; if it is...
;
call KbdSetOptions
if PZ_PCGEOS ; Pizza
mov al, KBD_CMD_SET_JAPANESE_MODE
out KBD_COMMAND_PORT, al ; set Japanese mode
endif
mov bx, offset kbdMonitor
mov al, ML_DRIVER ; put at Processing LEVEL 20
; (conversion to hardware
; independent info)
mov cx, segment Resident ; segment for monitor routine
mov dx, offset Resident:KbdMonRoutine ; routine to use
call ImAddMonitor ; Add Kbd driver as an
; input monitor
; Returns process handle of
; User Input manager
mov ds:[kbdOutputProcHandle], bx ; copy process handle
.leave
clc ; no error
ret
KbdInitFar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckKeyboardOption
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check a keyboard driver geos.ini file option
CALLED BY: KbdInit(), KbdSetOptions()
PASS: cs:dx - ptr to key ASCIIZ string
ds - seg addr of idata
bl - KeyboardOptions to set
RETURN: carry - clear if keyboard option set
DESTROYED: cx, si
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
eca 1/ 8/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckKeyboardOption proc near
.enter
;
; Check the appropriate category
;
push ds
segmov ds, cs, cx
mov si, offset keyboardCategoryStr
call InitFileReadBoolean
pop ds
jc error ;branch if error
tst al ;clear carry
jz error ;branch if FALSE
ornf ds:keyboardOptions, bl ;set bit in options
done:
.leave
ret
error:
stc
jmp done
CheckKeyboardOption endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdSetOptions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Make the right <Alt> key a <Alt Gr> key and other options
CALLED BY: KbdInit()
PASS: ds - seg addr of idata
RETURN: none
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
eca 1/ 7/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdSetOptions proc near
uses cx, dx, si, di
.enter
;
; See if the geos.ini file sets "keyboardAltGr = TRUE"
;
mov dx, offset keyboardAltGrStr
mov bl, mask KO_ALT_GR
call CheckKeyboardOption
jc notAltGr ;branch if FALSE
;
; Set the right <Alt> key to act as <Ctrl><Alt>,
; and return <Alt Gr> for a character value.
;
if DBCS_PCGEOS
mov ds:KeyboardMap.KT_keyDefTab[\
(SCANCODE_RIGHT_ALT-1)*(size KeyDef)].KD_char, C_SYS_ALT_GR
else
mov ds:KeyboardMap.KT_keyDefTab[\
(SCANCODE_RIGHT_ALT-1)*(size KeyDef)].KD_char, VC_ALT_GR
endif
mov ds:KeyboardMap.KT_keyDefTab[\
(SCANCODE_RIGHT_ALT-1)*(size KeyDef)].KD_shiftChar,\
RCTRL or RALT
notAltGr:
;
; See if the geos.ini file sets "keyboardShiftRelease = TRUE"
; Set the <Shift> keys to release the <Caps Lock> key if it is.
;
mov dx, offset keyboardShiftRelStr
mov bl, mask KO_SHIFT_RELEASE
call CheckKeyboardOption
;
; See if geos.ini file sets "keyboardSwapCtrl = TRUE"
;
mov dx, offset keyboardSwapCtrlStr
mov bl, mask KO_SWAP_CTRL
;
; Is the option already set? If it is already set, we've
; (theorectically) already been called. This check is done
; to prevent things like swapping <Ctrl> and <Caps Lock>
; from occuring twice when task-switching to and from PC/GEOS.
;
test ds:keyboardOptions, bl
jnz notSwapCtrl ;branch if already set
call CheckKeyboardOption
jc notSwapCtrl
;
; Swap the meaning of left <Ctrl> and <Caps Lock>
;
push es
lea si, ds:KeyboardMap.KT_keyDefTab[\
(SCANCODE_LEFT_CTRL-1)*(size KeyDef)]
lea di, ds:KeyboardMap.KT_keyDefTab[\
(SCANCODE_CAPS_LOCK-1)*(size KeyDef)]
mov cx, (size KeyDef) ;cx <- # bytes to swap
ko_loop:
lodsb ;mov al, ds:[si++]
xchg ds:[di], al
mov ds:[si][-1], al
inc di
loop ko_loop
pop es
notSwapCtrl:
.leave
ret
KbdSetOptions endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdExit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Clean up after ourselves
CALLED BY: KbdStrategy
PASS: ds - seg addr of idata
RETURN: carry - set on error
DESTROYED: ax, cx, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
adam 6/8/88 Initial Revision
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdExitFar proc far
uses es
.enter
mov ds:kbdShiftState, 0 ;no modifiers down
call KeyboardTrackBiosShiftFar
mov ax, ds
mov es, ax ;es <- seg addr of idata
;
; If this an AT, put the controller back the way we found it
;
test ds:kbdStratFlags, mask KSF_USE_PC_ACK
jnz skipReset ; Skip this if on PC
call KbdResetCommandByte
skipReset:
EC < test ds:[kbdStratFlags], mask KSF_HAVE_INT_VEC ;>
EC < ERROR_Z KBD_NESTED_EXIT ;>
;
; Reset the interrupt vector. NOTE: we do this after resetting
; the command byte, because on some machines, namely those
; with the new AMI extended BIOS, the act of reading the
; keyboard status via KBD_CMD_GET_CCB causes a spurious keyboard
; interrupt. The old interrupt vector sees the status value 45h
; as a scan code for <Num Lock>, which causes it to toggle the
; LED. However, because this isn't a real press, it never
; gets a release, leaving the keyboard in a sort of <Num Lock>
; limbo where it is neither on nor off. Our interrupt vector
; is already hacked to deal with spurious interrupts, and so
; we blissfully ignore the silly thing. -- eca 2/23/93
;
mov ax, SDI_KEYBOARD
mov di, offset kbdVector
call SysResetDeviceInterrupt
mov bx, offset kbdMonitor ;ds:bx <- ptr to monitor
mov al, mask MF_REMOVE_IMMEDIATE ;al <- flags to monitor rout
call ImRemoveMonitor ;remove monitor
andnf ds:[kbdStratFlags], not mask KSF_HAVE_INT_VEC
.leave
clc ;no error
ret
KbdExitFar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdResetCommandByte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reset the 8042's command byte to what it was on entry.
CALLED BY: KbdExitFar, KbdSuspendFar
PASS: ds = dgroup
RETURN: nothing
DESTROYED: ax, dx, cx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 5/30/92 Extracted from KbdExitFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdResetCommandByte proc near
.enter
;
; First check to see if the command byte has changed. If not,
; we're done. The reason we do this is that the controllers
; on some machines don't respond quickly enough. Rather than
; put in delay loops (which I first tried, and couldn't find
; delays long enough that worked), this approach was used.
; Without this, the keyboard will behave fine in PC/GEOS, but
; locks up when exiting (and hence when back in DOS) -- eca 5/20/92
;
test ds:[kbdStratFlags], mask KSF_HOTKEY_PENDING
jnz reset ; cannot get command byte if
; hotkey is pending, as that
; would overwrite input
; buffer, which must contain
; scancode for external agent
; on whose behalf the hotkey
; was registered.
call KbdGetCCB
cmp al, ds:[kbdCmdByte] ;command byte changed?
je done
reset:
;
; The command byte is actually different, so set it back.
;
mov ah, KBD_CMD_SET_CCB ; Set controller command byte
call KbdWriteCmd
mov ah, ds:[kbdCmdByte] ; back the way it was
test ds:[kbdStratFlags], mask KSF_HOTKEY_PENDING
jz writeCmdByte
ornf ah, mask KCB_DISABLE_KEYBOARD ; keep it disabled
writeCmdByte:
call KbdWriteData
done:
.leave
ret
KbdResetCommandByte endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdGetCCB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Read the Controller Command Byte from the 8042.
CALLED BY: (INTERNAL) KbdResetCommandByte, CheckControllerType
PASS: nothing
RETURN: al = command byte
DESTROYED: ah, cx
SIDE EFFECTS: any received ACK or RESEND from the keyboard is *dropped*
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 2/23/94 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdGetCCB proc near
.enter
;
; Disable keyboard interrupts for the duration, so the command byte
; is not interpreted as a keystroke (the command byte we use happens
; to also be the scan code for the NumLock key; reading the byte as
; a keystroke results in the set-LED sequence being sent, the ACKs for
; which overwrite the command byte and we, and the keyboard, get mighty
; confused).
;
in al, ICMASKPORT
push ax
ornf al, (1 shl SDI_KEYBOARD) ;keyboard interrupts at level 1
out ICMASKPORT, al
tryAgain:
mov ah, KBD_CMD_GET_CCB ;ah <- info requested
call KbdWriteCmd ;get controller command byte
call KbdReadData
cmp al, KBD_RESP_ACK
je tryAgain ; don't treat ACK coming back
; from the keyboard (WHY IS
cmp al, KBD_RESP_RESEND ; IT COMING BACK? WE DIDN'T
je tryAgain ; TALK TO THE SILLY THING)
; as a command byte.
;
; Reset the SDI_KEYBOARD bit to what it was before
;
pop cx
xchg ax, cx
out ICMASKPORT, al
mov_tr ax, cx
.leave
ret
KbdGetCCB endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdSuspendFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Reset the 8042 to its original state.
CALLED BY: DR_SUSPEND
PASS: cx:dx = buffer for error message
ds = dgroup (from KbdStrategy)
RETURN: carry set on error
DESTROYED: ax, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 5/19/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdSuspendFar proc far
uses cx
.enter
call KbdResetCommandByte
clc
.leave
ret
KbdSuspendFar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdUnsuspendFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set the 8042 to the state we want it in.
CALLED BY: DR_UNSUSPEND
PASS: ds = dgroup (from KbdStrategy)
RETURN: nothing
DESTROYED: ax, di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 5/19/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdUnsuspendFar proc far
uses cx
.enter
mov ah, KBD_CMD_SET_CCB
call KbdWriteCmd
mov ah, ds:[kbdCmdByte]
;
; Keep only these bits.
;
andnf ah, mask KCB_XT_KEYBOARD or mask KCB_AUX_IEN or \
mask KCB_SYSTEM_FLAG
;
; If KCB_XT_KEYBOARD set, don't set KCB_XLATE_SCAN_CODES...just in
; case.
;
mov al, mask KCB_XLATE_SCAN_CODES or \
mask KCB_INTERRUPT_ENABLE
; see comment of 7/16/92, below.
; test ah, mask KCB_XT_KEYBOARD
; jz setCmd
; mov al, mask KCB_INTERRUPT_ENABLE
;setCmd:
ornf ah, al
call KbdWriteData
.leave
ret
KbdUnsuspendFar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdWriteCmd, KbdWriteData
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Sends a byte to the keyboard controller command or
data port, making sure the buffer is empty first. Since
the controller provides no interrupt for its input buffer
being empty, we have to busy wait (generally a very small
amount of time, if any, fortunately).
CALLED BY: INTERNAL
PASS: ah - CMD/data to send
RETURN: none
DESTROYED: ax, cx
KNOWN BUGS/SIDE EFFECTS/IDEAS:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdWriteCmd proc near
call WaitABit ;cx <- timeout count = 0
KSC10:
in al, KBD_STATUS_PORT ;wait for buffer empty
test al, mask KSB_INPUT_BUFFER_FULL ;test for input buffer full
loopnz KSC10 ;if full, loop & wait
mov al,ah ;al <- command byte
out KBD_COMMAND_PORT, al ;out to KBD_COMMAND_PORT
ret
KbdWriteCmd endp
KbdWriteData proc near
call WaitABit ;cx <- timeout count = 0
KSD10:
in al, KBD_STATUS_PORT ;wait for buffer empty
test al, mask KSB_INPUT_BUFFER_FULL ;test for input buffer full
loopnz KSD10 ;if full, loop & wait
mov al,ah ;al <- data byte
out KBD_DATA_PORT, al ;out to KBD_DATA_PORT
ret
KbdWriteData endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
WaitABit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Wait a small amount of time for hardware to catch up...
CALLED BY: (F)UTILITY
PASS: none
RETURN: cx = 0
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
This routine exists simply because PC keyboard hardware is
sometimes scrod. This routine waits a little bit, the idea
being allowing the keyboard hardware some time to do what it
was told to do.
This is only called during DR_INIT and DR_EXIT when we are
writing to and reading from the keyboard controller, so the
concept of a delay loop isn't as horrendous as it may sound.
-- eca 5/20/92
REVISION HISTORY:
Name Date Description
---- ---- -----------
eca 5/20/92 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
WaitABit proc near
mov cx, 0xeca
waitLoop:
jmp $+2 ;clear ye olde pre-fetch queue
loop waitLoop
ret
WaitABit endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdReadData
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Retrieves a data byte from the keyboard controller, waiting
for it to be available
CALLED BY: UTILITY
PASS: none
RETURN: al - Data byte
DESTROYED: none
KNOWN BUGS/SIDE EFFECTS/IDEAS:
Since this routine busy-waits, it should not be used in
cases where the data is not expected to be available
immediately.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdReadData proc near
call WaitABit ;cx <- timeout count = 0
KGD10:
in al, KBD_STATUS_PORT ;wait for buffer full
test al, mask KSB_OUTPUT_BUFFER_FULL ;test for ouput buffer full
loopz KGD10 ;if not, loop & wait
in al, KBD_DATA_PORT ;al <- byte from KBD_DATA_PORT
ret
KbdReadData endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckControllerType
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Check to see if this keyboard communicates as an XT or AT.
CALLED BY: KbdInitFar()
PASS: ds - seg addr of dgroup
RETURN: ds:kbdStratFlags - set to KSF_USE_PC_ACK if appropriate
carry - set if XT
DESTROYED: none
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
gene 4/12/91 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckControllerType proc near
uses ax
.enter
mov dx, offset keyboardForceAT
mov bl, mask KO_FORCE_AT
call CheckKeyboardOption
jnc isAT ;branch if TRUE
mov dx, offset keyboardForceXT
mov bl, mask KO_FORCE_XT
call CheckKeyboardOption
INT_OFF
jnc isXT ;branch if TRUE
;
; Determine whether we are on PC or AT to handle different
; keyboards. On the AT the KBD_PC_CTRL_PORT location can not
; have its high bit changed. So we try and change it. If it
; changes, voila, it's not an AT.
;
; NOTE: attempting to base this decision based on the
; CPU type is a bad idea, since the usage of keyboard
; controllers is not consistent between XT- and AT-level
; machines. This test seems to generate better results.
;
in al, KBD_PC_CTRL_PORT ;al <- get special info
mov ah,al ;ah <- save info
or al, KBD_ACKNOWLEDGE ;set high bit
out KBD_PC_CTRL_PORT, al ;
in al,KBD_PC_CTRL_PORT ;al <- new special info
xchg al,ah ;ah <- changed? results
out KBD_PC_CTRL_PORT, al ;return kbd to orig state
test ah, KBD_ACKNOWLEDGE ;high bit changed?
jz isAT ;branch if unchanged (ie. AT)
;
; The controller is XT-style, so we must send ACKs.
;
isXT:
ornf ds:kbdStratFlags, mask KSF_USE_PC_ACK
done:
INT_ON
.leave
ret
;
; The controller is AT-style. Tell it to emulate
; an XT-style controller since that's what we
; speak to.
; This controller can handle LEDs.
; This controller does not need ACKs.
;
isAT:
INT_OFF
ornf ds:keyboardOptions, mask KO_DOES_LEDS
andnf ds:kbdStratFlags, not (mask KSF_USE_PC_ACK)
;
; NOTE: This causes anything already buffered to be overwritten
;
call KbdGetCCB
;
; For some reason, some keyboard controllers (eg. Gateway)
; have the "disable keyboard" bit set when we read the command
; byte. This is bad thing, so we ignore this bit. Whether this
; is due to timing (too little time between writing to the command
; port and reading from the data port), cosmic rays, or what, I'm
; not sure, but this seems a reasonable precaution -- eca 5/20/92
;
andnf al, not (mask KCB_DISABLE_KEYBOARD)
mov ds:[kbdCmdByte], al ;save the command value
push ax
mov ah, KBD_CMD_SET_CCB ;Request setting of controller
call KbdWriteCmd ; command byte
pop ax
;
; Set our version of the command byte. If the controller is set
; to support an XT keyboard or to interrupt on its auxiliary port, we
; maintain those settings. We always tell it to xlate from AT to XT
; scan codes (in theory, this should not conflict with KCB_XT_KEYBOARD)
; and to interrupt when data are available.
;
mov ah, mask KCB_XLATE_SCAN_CODES or \
mask KCB_INTERRUPT_ENABLE
;
; If KCB_XT_KEYBOARD set, don't set KCB_XLATE_SCAN_CODES...just in
; case.
;
; 7/16/92: there's a Compaq laptop (2810) on which the KCB_XT_KEYBOARD
; doesn't seem to indicate what we think it indicates. If we don't
; set both KCB_XT_KEYBOARD and KCB_XLATE_SCAN_CODES, we get hosed.
; So we set them both, since it seems to do no harm on other machines;
; we were just being cautious when we coded this -- ardeb
;
; test al, mask KCB_XT_KEYBOARD
; jz setCmd
; mov ah, mask KCB_INTERRUPT_ENABLE
;setCmd:
andnf al, mask KCB_XT_KEYBOARD or mask KCB_AUX_IEN or \
mask KCB_SYSTEM_FLAG
or ah, al
call KbdWriteData
jmp done
CheckControllerType endp
Movable ends
endif
if VG230SCAN
Movable segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdInitFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize the keyboard driver
CALLED BY: KbdInit
PASS: DS = DGroup
RETURN: Carry = Set if error
DESTROYED: AX, BX, CX, DX
PSEUDO CODE/STRATEGY:
Install interrupt vector & initialize state
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/17/92 Initial version
Todd 12/19/94 Stolen for Jedi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdInitFar proc far
.enter
;
; Intercept that-there Keyboard IRQ, and turn off
; INT's so we don't get a char while we're partially
; dressed. Yeek!
mov ax, SDI_KEYBOARD
mov bx, segment Resident
mov cx, offset Resident:KbdInterrupt
mov di, offset kbdVector
INT_OFF
call SysCatchDeviceInterrupt ;install our interrrupt handler
;
; Add ourselves to the input monitor chain
mov al, ML_DRIVER
mov bx, offset kbdMonitor
mov cx, segment KbdMonRoutine
mov dx, offset KbdMonRoutine
call ImAddMonitor ; input manager hande => BX
mov ds:[kbdOutputProcHandle], bx
;
; Re-enable INT's. We're decent.
INT_ON
.leave
ret
KbdInitFar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdExitFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Clean up after ourselves
CALLED BY: KbdExit
PASS: DS = DGroup
RETURN: Carry = Set if error
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
We leave keyboard scanning disabled
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/17/92 Initial version
Todd 12/19/94 Stolen for Jedi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdExitFar proc far
.enter
; Replace the interrupt vector
;
mov ax, SDI_KEYBOARD
mov di, offset kbdVector
call SysResetDeviceInterrupt
;
; Remove the keyboard monitor
mov bx, offset kbdMonitor ; Monitor => DS:BX
mov al, mask MF_REMOVE_IMMEDIATE
call ImRemoveMonitor ; remove monitor
clc
.leave
ret
KbdExitFar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdSuspendFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Suspend keyboard input
CALLED BY: KbdSuspend
PASS: DS = DGroup
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/17/92 Initial version
Todd 12/19/94 Stolen for Jedi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdSuspendFar proc far
clc
ret
KbdSuspendFar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdUnsuspendFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Unsuspend keyboard input
CALLED BY: KbdUnsuspend
PASS: DS = DGroup
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/17/92 Initial version
Todd 12/19/94 Stolen for Jedi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdUnsuspendFar proc far
clc
ret
KbdUnsuspendFar endp
Movable ends
endif
if _E3G_KBD_SCAN
;
; All of the I/O for Responder is done in the responder library. For
; Penelope, since we don't plan on all the I/O changing as it did
; Responder, the I/O is done directly in this driver. I'd expect any
; future products with the E3G to do the same.
;
Movable segment resource
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdInitFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Initialize the E3G keyboard driver
CALLED BY: KbdInit
PASS: DS = DGroup
RETURN: Carry = Set if error
DESTROYED: AX, BX, CX, DX
PSEUDO CODE/STRATEGY:
Install interrupt vector & initialize state
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/17/92 Initial version
SSH 05/02/95 Responder version
JimG 06/11/96 E3G common version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
keyboardCategoryStr char "keyboard", 0
keyboardTypematicStr char "keyboardTypematic", 0
KbdInitFar proc far
.enter
;
; This keyboard driver loads the KeyDefTable's and
; ExtendedDefTable's from a resource. This is done so that we can
; localize the keyboard driver without having to compile a new
; version.
;
call KbdKeyTableInit
;
; Intercept that-there Keyboard IRQ, and turn off
; INT's so we don't get a char while we're partially
; dressed. Yeek!
;
INT_OFF
;
; For Penelope, enable the scanning keyboard. On the OP1
; prototypes, the default is to use the standard PC keyboard.
;
PENE < mov dx, E3G_GLOBALDIS >
PENE < in ax, dx >
PENE < and ax, not mask EGDF_DISKS ; Enable Kbd Scan >
PENE < out dx, ax >
;
; Enable the key scanner and mask the IRQ.
;
; Enables keyboard IRQ and registers with the keyboard/digitizer
; interlock mechanism.
;
PENE < mov cl, PKDID_KEYBOARD >
PENE < call PeneKDIRegister >
; Register a callback for a timer for Penelope which is used to
; pause before unmasking the digitizer interrupt because of
; these annoying capacitors that effectively hold the touchint
; line high for a certain amount of time after a keyscan.
;
PENE < push di >
PENE < mov dx, segment KbdPeneTimerCB >
PENE < mov di, offset KbdPeneTimerCB >
PENE < call PeneTimerRegister >
PENE < pop di >
;
; Setup the scanmode and the debounce time (KBCTRL).
;
mov al, KBD_INT_MODE
KbdE3G_SetCtrl
;
; Enable all the row sense inputs by setting the keyboard interrupt
; enabled register (KBINTEN).
;
mov ax, KBD_INT_ALL_MASK
KbdE3G_SetIntEnable
;
; Drive out on all columns (KBOUT).
;
mov al, 0x00
KbdE3G_SetScanOut
;
; Enable all the keyboard scan columns (KBENABLE).
;
mov al, KBD_SCAN_ALL_MASK
KbdE3G_SetScanEnable
;
; Read the high keyboard return register (KBIN) to clear interrupt.
;
KbdE3G_GetInput
;
; Set the new interraupt handler vector.
;
push es
mov bx, segment Resident
mov cx, offset Resident:KbdInterrupt
segmov es, ds, di
mov di, offset kbdVector
PENE < mov ax, PENE_KEYBOARD_IRQ >
PENE < call SysCatchDeviceInterrupt >
pop es
;
; Add ourselves to the input monitor chain
;
mov al, ML_DRIVER
mov bx, offset kbdMonitor
mov cx, segment KbdMonRoutine
mov dx, offset KbdMonRoutine
call ImAddMonitor ; input manager hande => BX
mov ds:[kbdOutputProcHandle], bx
;
; Re-enable INT's. We're decent.
;
INT_ON
;
; Send a non-specific EOI to the interraupt controler.
;
mov al, IC_GENEOI
out IC2_CMDPORT, al
out IC1_CMDPORT, al
;
; See if there are settings in geos.ini file to set the
; typematic rate and delay.
;
; The typematic is stored the following way:
;
; High byte: Typematic delay (value * 25ms = delay).
; Low byte: Typematic rate (1000/(value * 25ms) = rate).
;
; If there is no entry we use the default value KBD_TYPEMATIC.
;
push ds
segmov ds, cs, cx
mov si, offset keyboardCategoryStr
mov dx, offset keyboardTypematicStr
call InitFileReadInteger ; ax == integer
pop ds
jc done ; branch if no entry
;
; Store the typematic value in dgroup.
;
mov ds:[kbdTypematicValue], ax
done:
.leave
clc
ret
KbdInitFar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdKeyTableInit
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy the KeyDef tables from the keyboard data file into
dgroup.
CALLED BY: KbdInitFar
PASS: ds - dgroup
RETURN: nothing
DESTROYED: nothing
SIDE EFFECTS:
dgroup's KbdKeyDefTable and KbdExtendedDefTable Initialized.
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
SH 5/11/95 Initial version
JimG 06/11/96 E3G common version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdKeyTableInit proc near
uses ds
.enter
;
; Change to the current language privdata directory.
;
call FilePushDir
mov ax, SP_PRIVATE_DATA
call FileSetStandardPath
;
; Open the keyboard data file. If FileOpen returns an error
; then we bail and use the English version as default.
;
push ds
mov al, FILE_ACCESS_R or FILE_DENY_RW
segmov ds, cs
mov dx, offset cs:[kbdDataFile]
call FileOpen ; ax <- FileHandle
pop ds
jc done
;
; Copy the KeyDef's from the file into dgroup.
;
mov bx, ax ; bx <- FileHandle
clr al
mov cx, KBD_MAX_KEY_DEF * (size KeyDef)
mov dx, offset KbdKeyDefTable
call FileRead
;
; Copy the ExtendedDef's from the file into dgroup.
;
clr al
mov cx, KBD_MAX_EXTENDED_DEF * (size ExtendedDef)
mov dx, offset KbdExtendedDefTable
call FileRead
;
; Close the file and be on our marry way.
;
call FileClose
done:
call FilePopDir
.leave
ret
KbdKeyTableInit endp
kbdDataFile char "KBD\\keymap.dat",0
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdExitFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Clean up after ourselves
CALLED BY: KbdExit
PASS: DS = DGroup
RETURN: Carry = Set if error
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
We leave keyboard scanning disabled
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/17/92 Initial version
SSH 05/02/95 Responder version
JimG 06/11/96 E3G common version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdExitFar proc far
uses es
.enter
;
; Disable the scan logic and IRQ.
;
; Disables keyboard IRQ and unregisters with the keyboard/digitizer
; interlock mechanism.
;
PENE < mov cl, PKDID_KEYBOARD >
PENE < call PeneKDIUnregister >
;
; Replace the interrupt vector
;
segmov es, ds
mov di, offset kbdVector
PENE < mov ax, PENE_KEYBOARD_IRQ >
PENE < call SysResetDeviceInterrupt >
;
; Remove the keyboard monitor
;
mov bx, offset kbdMonitor ; Monitor => DS:BX
mov al, mask MF_REMOVE_IMMEDIATE
call ImRemoveMonitor ; remove monitor
clc
.leave
ret
KbdExitFar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdSuspendFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Suspend keyboard input
CALLED BY: KbdSuspend
PASS: DS = DGroup
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/17/92 Initial version
SSH 05/02/95 Responder version
JimG 06/11/96 E3G common version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdSuspendFar proc far
clc
ret
KbdSuspendFar endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
KbdUnsuspendFar
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Unsuspend keyboard input
CALLED BY: KbdUnsuspend
PASS: DS = DGroup
RETURN: Nothing
DESTROYED: Nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Don 11/17/92 Initial version
SSH 05/02/95 Responder version
JimG 06/11/96 E3G common version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
KbdUnsuspendFar proc far
clc
ret
KbdUnsuspendFar endp
Movable ends
endif ; _E3G_KBD_SCAN
| 26.296137 | 79 | 0.598362 |
c7f30dacf35e9cf2d1e9ddc76bee1da85e996b42 | 98,322 | asm | Assembly | src/lesson04b/kernel8.asm | rohanrajnair/p1-kernel | e887fa85c84813369598a1cbcba1830ec379346b | [
"MIT"
] | 11 | 2020-08-26T14:45:01.000Z | 2022-03-26T14:06:50.000Z | src/lesson04b/kernel8.asm | rohanrajnair/p1-kernel | e887fa85c84813369598a1cbcba1830ec379346b | [
"MIT"
] | null | null | null | src/lesson04b/kernel8.asm | rohanrajnair/p1-kernel | e887fa85c84813369598a1cbcba1830ec379346b | [
"MIT"
] | 19 | 2020-08-12T01:10:30.000Z | 2022-03-05T13:03:18.000Z |
build/kernel8.elf: file format elf64-littleaarch64
Disassembly of section .text.boot:
0000000000080000 <_start>:
.section ".text.boot"
.globl _start
_start:
mrs x0, mpidr_el1
80000: d53800a0 mrs x0, mpidr_el1
and x0, x0,#0xFF // Check processor id
80004: 92401c00 and x0, x0, #0xff
cbz x0, master // Hang for all non-primary CPU
80008: b4000060 cbz x0, 80014 <master>
b proc_hang
8000c: 14000001 b 80010 <proc_hang>
0000000000080010 <proc_hang>:
proc_hang:
b proc_hang
80010: 14000000 b 80010 <proc_hang>
0000000000080014 <master>:
master:
ldr x0, =SCTLR_VALUE_MMU_DISABLED // System control register
80014: 58000220 ldr x0, 80058 <el1_entry+0x20>
msr sctlr_el1, x0
80018: d5181000 msr sctlr_el1, x0
ldr x0, =HCR_VALUE // Hypervisor Configuration (EL2)
8001c: 58000220 ldr x0, 80060 <el1_entry+0x28>
msr hcr_el2, x0
80020: d51c1100 msr hcr_el2, x0
#ifdef USE_QEMU // xzl: qemu boots from EL2. cannot do things to EL3
ldr x0, =SPSR_VALUE
80024: 58000220 ldr x0, 80068 <el1_entry+0x30>
msr spsr_el2, x0
80028: d51c4000 msr spsr_el2, x0
adr x0, el1_entry
8002c: 10000060 adr x0, 80038 <el1_entry>
msr elr_el2, x0
80030: d51c4020 msr elr_el2, x0
adr x0, el1_entry
msr elr_el3, x0
#endif
eret
80034: d69f03e0 eret
0000000000080038 <el1_entry>:
el1_entry:
adr x0, bss_begin
80038: 10019e00 adr x0, 833f8 <bss_begin>
adr x1, bss_end
8003c: 10405e81 adr x1, 100c0c <bss_end>
sub x1, x1, x0
80040: cb000021 sub x1, x1, x0
bl memzero
80044: 94000b75 bl 82e18 <memzero>
mov sp, #LOW_MEMORY
80048: b26a03ff mov sp, #0x400000 // #4194304
bl kernel_main
8004c: 94000215 bl 808a0 <kernel_main>
b proc_hang // should never come here
80050: 17fffff0 b 80010 <proc_hang>
80054: 00000000 .inst 0x00000000 ; undefined
80058: 30d00800 .word 0x30d00800
8005c: 00000000 .word 0x00000000
80060: 80000000 .word 0x80000000
80064: 00000000 .word 0x00000000
80068: 000001c5 .word 0x000001c5
8006c: 00000000 .word 0x00000000
Disassembly of section .text:
0000000000080800 <process>:
#include "fork.h"
#include "sched.h"
#include "mini_uart.h"
void process(char *array)
{
80800: a9bd7bfd stp x29, x30, [sp, #-48]!
80804: 910003fd mov x29, sp
80808: f9000fa0 str x0, [x29, #24]
while (1) {
for (int i = 0; i < 5; i++){
8080c: b9002fbf str wzr, [x29, #44]
80810: 1400000c b 80840 <process+0x40>
uart_send(array[i]);
80814: b9802fa0 ldrsw x0, [x29, #44]
80818: f9400fa1 ldr x1, [x29, #24]
8081c: 8b000020 add x0, x1, x0
80820: 39400000 ldrb w0, [x0]
80824: 940000a5 bl 80ab8 <uart_send>
delay(5000000);
80828: d2896800 mov x0, #0x4b40 // #19264
8082c: f2a00980 movk x0, #0x4c, lsl #16
80830: 940004b4 bl 81b00 <delay>
for (int i = 0; i < 5; i++){
80834: b9402fa0 ldr w0, [x29, #44]
80838: 11000400 add w0, w0, #0x1
8083c: b9002fa0 str w0, [x29, #44]
80840: b9402fa0 ldr w0, [x29, #44]
80844: 7100101f cmp w0, #0x4
80848: 54fffe6d b.le 80814 <process+0x14>
8084c: 17fffff0 b 8080c <process+0xc>
0000000000080850 <process2>:
}
}
}
void process2(char *array)
{
80850: a9bd7bfd stp x29, x30, [sp, #-48]!
80854: 910003fd mov x29, sp
80858: f9000fa0 str x0, [x29, #24]
while (1) {
for (int i = 0; i < 5; i++){
8085c: b9002fbf str wzr, [x29, #44]
80860: 1400000c b 80890 <process2+0x40>
uart_send(array[i]);
80864: b9802fa0 ldrsw x0, [x29, #44]
80868: f9400fa1 ldr x1, [x29, #24]
8086c: 8b000020 add x0, x1, x0
80870: 39400000 ldrb w0, [x0]
80874: 94000091 bl 80ab8 <uart_send>
delay(5000000);
80878: d2896800 mov x0, #0x4b40 // #19264
8087c: f2a00980 movk x0, #0x4c, lsl #16
80880: 940004a0 bl 81b00 <delay>
for (int i = 0; i < 5; i++){
80884: b9402fa0 ldr w0, [x29, #44]
80888: 11000400 add w0, w0, #0x1
8088c: b9002fa0 str w0, [x29, #44]
80890: b9402fa0 ldr w0, [x29, #44]
80894: 7100101f cmp w0, #0x4
80898: 54fffe6d b.le 80864 <process2+0x14>
8089c: 17fffff0 b 8085c <process2+0xc>
00000000000808a0 <kernel_main>:
}
}
}
void kernel_main(void)
{
808a0: a9be7bfd stp x29, x30, [sp, #-32]!
808a4: 910003fd mov x29, sp
uart_init();
808a8: 940000bd bl 80b9c <uart_init>
init_printf(0, putc);
808ac: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
808b0: f940a400 ldr x0, [x0, #328]
808b4: aa0003e1 mov x1, x0
808b8: d2800000 mov x0, #0x0 // #0
808bc: 940003d6 bl 81814 <init_printf>
printf("kernel boots\n");
808c0: d0000000 adrp x0, 82000 <vectors>
808c4: 9139e000 add x0, x0, #0xe78
808c8: 940003e1 bl 8184c <tfp_printf>
irq_vector_init();
808cc: 94000490 bl 81b0c <irq_vector_init>
generic_timer_init();
808d0: 94000470 bl 81a90 <generic_timer_init>
enable_interrupt_controller();
808d4: 94000024 bl 80964 <enable_interrupt_controller>
enable_irq();
808d8: 94000490 bl 81b18 <enable_irq>
int res = copy_process((unsigned long)&process, (unsigned long)"12345");
808dc: 90000000 adrp x0, 80000 <_start>
808e0: 91200002 add x2, x0, #0x800
808e4: d0000000 adrp x0, 82000 <vectors>
808e8: 913a2000 add x0, x0, #0xe88
808ec: aa0003e1 mov x1, x0
808f0: aa0203e0 mov x0, x2
808f4: 94000199 bl 80f58 <copy_process>
808f8: b9001fa0 str w0, [x29, #28]
if (res != 0) {
808fc: b9401fa0 ldr w0, [x29, #28]
80900: 7100001f cmp w0, #0x0
80904: 540000a0 b.eq 80918 <kernel_main+0x78> // b.none
printf("error while starting process 1");
80908: d0000000 adrp x0, 82000 <vectors>
8090c: 913a4000 add x0, x0, #0xe90
80910: 940003cf bl 8184c <tfp_printf>
return;
80914: 14000012 b 8095c <kernel_main+0xbc>
}
res = copy_process((unsigned long)&process2, (unsigned long)"abcde");
80918: 90000000 adrp x0, 80000 <_start>
8091c: 91214002 add x2, x0, #0x850
80920: d0000000 adrp x0, 82000 <vectors>
80924: 913ac000 add x0, x0, #0xeb0
80928: aa0003e1 mov x1, x0
8092c: aa0203e0 mov x0, x2
80930: 9400018a bl 80f58 <copy_process>
80934: b9001fa0 str w0, [x29, #28]
if (res != 0) {
80938: b9401fa0 ldr w0, [x29, #28]
8093c: 7100001f cmp w0, #0x0
80940: 540000a0 b.eq 80954 <kernel_main+0xb4> // b.none
printf("error while starting process 2");
80944: d0000000 adrp x0, 82000 <vectors>
80948: 913ae000 add x0, x0, #0xeb8
8094c: 940003c0 bl 8184c <tfp_printf>
return;
80950: 14000003 b 8095c <kernel_main+0xbc>
}
while (1){
schedule();
80954: 9400013a bl 80e3c <schedule>
80958: 17ffffff b 80954 <kernel_main+0xb4>
}
}
8095c: a8c27bfd ldp x29, x30, [sp], #32
80960: d65f03c0 ret
0000000000080964 <enable_interrupt_controller>:
"FIQ_INVALID_EL0_32",
"ERROR_INVALID_EL0_32"
};
void enable_interrupt_controller()
{
80964: a9bf7bfd stp x29, x30, [sp, #-16]!
80968: 910003fd mov x29, sp
// Enables Core 0 Timers interrupt control for the generic timer
put32(TIMER_INT_CTRL_0, TIMER_INT_CTRL_0_VALUE);
8096c: 52800041 mov w1, #0x2 // #2
80970: d2800800 mov x0, #0x40 // #64
80974: f2a80000 movk x0, #0x4000, lsl #16
80978: 9400045e bl 81af0 <put32>
}
8097c: d503201f nop
80980: a8c17bfd ldp x29, x30, [sp], #16
80984: d65f03c0 ret
0000000000080988 <show_invalid_entry_message>:
void show_invalid_entry_message(int type, unsigned long esr, unsigned long address)
{
80988: a9bd7bfd stp x29, x30, [sp, #-48]!
8098c: 910003fd mov x29, sp
80990: b9002fa0 str w0, [x29, #44]
80994: f90013a1 str x1, [x29, #32]
80998: f9000fa2 str x2, [x29, #24]
printf("%s, ESR: %x, address: %x\r\n", entry_error_messages[type], esr, address);
8099c: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
809a0: 9105c000 add x0, x0, #0x170
809a4: b9802fa1 ldrsw x1, [x29, #44]
809a8: f8617801 ldr x1, [x0, x1, lsl #3]
809ac: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
809b0: 91016000 add x0, x0, #0x58
809b4: f9400fa3 ldr x3, [x29, #24]
809b8: f94013a2 ldr x2, [x29, #32]
809bc: 940003a4 bl 8184c <tfp_printf>
}
809c0: d503201f nop
809c4: a8c37bfd ldp x29, x30, [sp], #48
809c8: d65f03c0 ret
00000000000809cc <handle_irq>:
void handle_irq(void)
{
809cc: a9be7bfd stp x29, x30, [sp, #-32]!
809d0: 910003fd mov x29, sp
// Each Core has its own pending local intrrupts register
unsigned int irq = get32(INT_SOURCE_0);
809d4: d2800c00 mov x0, #0x60 // #96
809d8: f2a80000 movk x0, #0x4000, lsl #16
809dc: 94000447 bl 81af8 <get32>
809e0: b9001fa0 str w0, [x29, #28]
switch (irq) {
809e4: b9401fa0 ldr w0, [x29, #28]
809e8: 7100081f cmp w0, #0x2
809ec: 54000061 b.ne 809f8 <handle_irq+0x2c> // b.any
case (GENERIC_TIMER_INTERRUPT):
handle_generic_timer_irq();
809f0: 9400042f bl 81aac <handle_generic_timer_irq>
break;
809f4: 14000005 b 80a08 <handle_irq+0x3c>
default:
printf("Unknown pending irq: %x\r\n", irq);
809f8: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
809fc: 9101e000 add x0, x0, #0x78
80a00: b9401fa1 ldr w1, [x29, #28]
80a04: 94000392 bl 8184c <tfp_printf>
}
80a08: d503201f nop
80a0c: a8c27bfd ldp x29, x30, [sp], #32
80a10: d65f03c0 ret
0000000000080a14 <get_free_page>:
#include "mm.h"
static unsigned short mem_map [ PAGING_PAGES ] = {0,};
unsigned long get_free_page()
{
80a14: d10043ff sub sp, sp, #0x10
for (int i = 0; i < PAGING_PAGES; i++){
80a18: b9000fff str wzr, [sp, #12]
80a1c: 14000014 b 80a6c <get_free_page+0x58>
if (mem_map[i] == 0){
80a20: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80a24: 910fe000 add x0, x0, #0x3f8
80a28: b9800fe1 ldrsw x1, [sp, #12]
80a2c: 78617800 ldrh w0, [x0, x1, lsl #1]
80a30: 7100001f cmp w0, #0x0
80a34: 54000161 b.ne 80a60 <get_free_page+0x4c> // b.any
mem_map[i] = 1;
80a38: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80a3c: 910fe000 add x0, x0, #0x3f8
80a40: b9800fe1 ldrsw x1, [sp, #12]
80a44: 52800022 mov w2, #0x1 // #1
80a48: 78217802 strh w2, [x0, x1, lsl #1]
return LOW_MEMORY + i*PAGE_SIZE;
80a4c: b9400fe0 ldr w0, [sp, #12]
80a50: 11100000 add w0, w0, #0x400
80a54: 53144c00 lsl w0, w0, #12
80a58: 93407c00 sxtw x0, w0
80a5c: 1400000a b 80a84 <get_free_page+0x70>
for (int i = 0; i < PAGING_PAGES; i++){
80a60: b9400fe0 ldr w0, [sp, #12]
80a64: 11000400 add w0, w0, #0x1
80a68: b9000fe0 str w0, [sp, #12]
80a6c: b9400fe1 ldr w1, [sp, #12]
80a70: 529d7fe0 mov w0, #0xebff // #60415
80a74: 72a00060 movk w0, #0x3, lsl #16
80a78: 6b00003f cmp w1, w0
80a7c: 54fffd2d b.le 80a20 <get_free_page+0xc>
}
}
return 0;
80a80: d2800000 mov x0, #0x0 // #0
}
80a84: 910043ff add sp, sp, #0x10
80a88: d65f03c0 ret
0000000000080a8c <free_page>:
void free_page(unsigned long p){
80a8c: d10043ff sub sp, sp, #0x10
80a90: f90007e0 str x0, [sp, #8]
mem_map[(p - LOW_MEMORY) / PAGE_SIZE] = 0;
80a94: f94007e0 ldr x0, [sp, #8]
80a98: d1500000 sub x0, x0, #0x400, lsl #12
80a9c: d34cfc01 lsr x1, x0, #12
80aa0: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80aa4: 910fe000 add x0, x0, #0x3f8
80aa8: 7821781f strh wzr, [x0, x1, lsl #1]
}
80aac: d503201f nop
80ab0: 910043ff add sp, sp, #0x10
80ab4: d65f03c0 ret
0000000000080ab8 <uart_send>:
#include "utils.h"
#include "peripherals/mini_uart.h"
#include "peripherals/gpio.h"
void uart_send ( char c )
{
80ab8: a9be7bfd stp x29, x30, [sp, #-32]!
80abc: 910003fd mov x29, sp
80ac0: 39007fa0 strb w0, [x29, #31]
while(1) {
if(get32(AUX_MU_LSR_REG)&0x20)
80ac4: d28a0a80 mov x0, #0x5054 // #20564
80ac8: f2a7e420 movk x0, #0x3f21, lsl #16
80acc: 9400040b bl 81af8 <get32>
80ad0: 121b0000 and w0, w0, #0x20
80ad4: 7100001f cmp w0, #0x0
80ad8: 54000041 b.ne 80ae0 <uart_send+0x28> // b.any
80adc: 17fffffa b 80ac4 <uart_send+0xc>
break;
80ae0: d503201f nop
}
put32(AUX_MU_IO_REG,c);
80ae4: 39407fa0 ldrb w0, [x29, #31]
80ae8: 2a0003e1 mov w1, w0
80aec: d28a0800 mov x0, #0x5040 // #20544
80af0: f2a7e420 movk x0, #0x3f21, lsl #16
80af4: 940003ff bl 81af0 <put32>
}
80af8: d503201f nop
80afc: a8c27bfd ldp x29, x30, [sp], #32
80b00: d65f03c0 ret
0000000000080b04 <uart_recv>:
char uart_recv ( void )
{
80b04: a9bf7bfd stp x29, x30, [sp, #-16]!
80b08: 910003fd mov x29, sp
while(1) {
if(get32(AUX_MU_LSR_REG)&0x01)
80b0c: d28a0a80 mov x0, #0x5054 // #20564
80b10: f2a7e420 movk x0, #0x3f21, lsl #16
80b14: 940003f9 bl 81af8 <get32>
80b18: 12000000 and w0, w0, #0x1
80b1c: 7100001f cmp w0, #0x0
80b20: 54000041 b.ne 80b28 <uart_recv+0x24> // b.any
80b24: 17fffffa b 80b0c <uart_recv+0x8>
break;
80b28: d503201f nop
}
return(get32(AUX_MU_IO_REG)&0xFF);
80b2c: d28a0800 mov x0, #0x5040 // #20544
80b30: f2a7e420 movk x0, #0x3f21, lsl #16
80b34: 940003f1 bl 81af8 <get32>
80b38: 12001c00 and w0, w0, #0xff
}
80b3c: a8c17bfd ldp x29, x30, [sp], #16
80b40: d65f03c0 ret
0000000000080b44 <uart_send_string>:
void uart_send_string(char* str)
{
80b44: a9bd7bfd stp x29, x30, [sp, #-48]!
80b48: 910003fd mov x29, sp
80b4c: f9000fa0 str x0, [x29, #24]
for (int i = 0; str[i] != '\0'; i ++) {
80b50: b9002fbf str wzr, [x29, #44]
80b54: 14000009 b 80b78 <uart_send_string+0x34>
uart_send((char)str[i]);
80b58: b9802fa0 ldrsw x0, [x29, #44]
80b5c: f9400fa1 ldr x1, [x29, #24]
80b60: 8b000020 add x0, x1, x0
80b64: 39400000 ldrb w0, [x0]
80b68: 97ffffd4 bl 80ab8 <uart_send>
for (int i = 0; str[i] != '\0'; i ++) {
80b6c: b9402fa0 ldr w0, [x29, #44]
80b70: 11000400 add w0, w0, #0x1
80b74: b9002fa0 str w0, [x29, #44]
80b78: b9802fa0 ldrsw x0, [x29, #44]
80b7c: f9400fa1 ldr x1, [x29, #24]
80b80: 8b000020 add x0, x1, x0
80b84: 39400000 ldrb w0, [x0]
80b88: 7100001f cmp w0, #0x0
80b8c: 54fffe61 b.ne 80b58 <uart_send_string+0x14> // b.any
}
}
80b90: d503201f nop
80b94: a8c37bfd ldp x29, x30, [sp], #48
80b98: d65f03c0 ret
0000000000080b9c <uart_init>:
void uart_init ( void )
{
80b9c: a9be7bfd stp x29, x30, [sp, #-32]!
80ba0: 910003fd mov x29, sp
unsigned int selector;
selector = get32(GPFSEL1);
80ba4: d2800080 mov x0, #0x4 // #4
80ba8: f2a7e400 movk x0, #0x3f20, lsl #16
80bac: 940003d3 bl 81af8 <get32>
80bb0: b9001fa0 str w0, [x29, #28]
selector &= ~(7<<12); // clean gpio14
80bb4: b9401fa0 ldr w0, [x29, #28]
80bb8: 12117000 and w0, w0, #0xffff8fff
80bbc: b9001fa0 str w0, [x29, #28]
selector |= 2<<12; // set alt5 for gpio14
80bc0: b9401fa0 ldr w0, [x29, #28]
80bc4: 32130000 orr w0, w0, #0x2000
80bc8: b9001fa0 str w0, [x29, #28]
selector &= ~(7<<15); // clean gpio15
80bcc: b9401fa0 ldr w0, [x29, #28]
80bd0: 120e7000 and w0, w0, #0xfffc7fff
80bd4: b9001fa0 str w0, [x29, #28]
selector |= 2<<15; // set alt5 for gpio15
80bd8: b9401fa0 ldr w0, [x29, #28]
80bdc: 32100000 orr w0, w0, #0x10000
80be0: b9001fa0 str w0, [x29, #28]
put32(GPFSEL1,selector);
80be4: b9401fa1 ldr w1, [x29, #28]
80be8: d2800080 mov x0, #0x4 // #4
80bec: f2a7e400 movk x0, #0x3f20, lsl #16
80bf0: 940003c0 bl 81af0 <put32>
put32(GPPUD,0);
80bf4: 52800001 mov w1, #0x0 // #0
80bf8: d2801280 mov x0, #0x94 // #148
80bfc: f2a7e400 movk x0, #0x3f20, lsl #16
80c00: 940003bc bl 81af0 <put32>
delay(150);
80c04: d28012c0 mov x0, #0x96 // #150
80c08: 940003be bl 81b00 <delay>
put32(GPPUDCLK0,(1<<14)|(1<<15));
80c0c: 52980001 mov w1, #0xc000 // #49152
80c10: d2801300 mov x0, #0x98 // #152
80c14: f2a7e400 movk x0, #0x3f20, lsl #16
80c18: 940003b6 bl 81af0 <put32>
delay(150);
80c1c: d28012c0 mov x0, #0x96 // #150
80c20: 940003b8 bl 81b00 <delay>
put32(GPPUDCLK0,0);
80c24: 52800001 mov w1, #0x0 // #0
80c28: d2801300 mov x0, #0x98 // #152
80c2c: f2a7e400 movk x0, #0x3f20, lsl #16
80c30: 940003b0 bl 81af0 <put32>
put32(AUX_ENABLES,1); //Enable mini uart (this also enables access to it registers)
80c34: 52800021 mov w1, #0x1 // #1
80c38: d28a0080 mov x0, #0x5004 // #20484
80c3c: f2a7e420 movk x0, #0x3f21, lsl #16
80c40: 940003ac bl 81af0 <put32>
put32(AUX_MU_CNTL_REG,0); //Disable auto flow control and disable receiver and transmitter (for now)
80c44: 52800001 mov w1, #0x0 // #0
80c48: d28a0c00 mov x0, #0x5060 // #20576
80c4c: f2a7e420 movk x0, #0x3f21, lsl #16
80c50: 940003a8 bl 81af0 <put32>
put32(AUX_MU_IER_REG,0); //Disable receive and transmit interrupts
80c54: 52800001 mov w1, #0x0 // #0
80c58: d28a0880 mov x0, #0x5044 // #20548
80c5c: f2a7e420 movk x0, #0x3f21, lsl #16
80c60: 940003a4 bl 81af0 <put32>
put32(AUX_MU_LCR_REG,3); //Enable 8 bit mode
80c64: 52800061 mov w1, #0x3 // #3
80c68: d28a0980 mov x0, #0x504c // #20556
80c6c: f2a7e420 movk x0, #0x3f21, lsl #16
80c70: 940003a0 bl 81af0 <put32>
put32(AUX_MU_MCR_REG,0); //Set RTS line to be always high
80c74: 52800001 mov w1, #0x0 // #0
80c78: d28a0a00 mov x0, #0x5050 // #20560
80c7c: f2a7e420 movk x0, #0x3f21, lsl #16
80c80: 9400039c bl 81af0 <put32>
put32(AUX_MU_BAUD_REG,270); //Set baud rate to 115200
80c84: 528021c1 mov w1, #0x10e // #270
80c88: d28a0d00 mov x0, #0x5068 // #20584
80c8c: f2a7e420 movk x0, #0x3f21, lsl #16
80c90: 94000398 bl 81af0 <put32>
put32(AUX_MU_CNTL_REG,3); //Finally, enable transmitter and receiver
80c94: 52800061 mov w1, #0x3 // #3
80c98: d28a0c00 mov x0, #0x5060 // #20576
80c9c: f2a7e420 movk x0, #0x3f21, lsl #16
80ca0: 94000394 bl 81af0 <put32>
}
80ca4: d503201f nop
80ca8: a8c27bfd ldp x29, x30, [sp], #32
80cac: d65f03c0 ret
0000000000080cb0 <putc>:
// This function is required by printf function
void putc ( void* p, char c)
{
80cb0: a9be7bfd stp x29, x30, [sp, #-32]!
80cb4: 910003fd mov x29, sp
80cb8: f9000fa0 str x0, [x29, #24]
80cbc: 39005fa1 strb w1, [x29, #23]
uart_send(c);
80cc0: 39405fa0 ldrb w0, [x29, #23]
80cc4: 97ffff7d bl 80ab8 <uart_send>
}
80cc8: d503201f nop
80ccc: a8c27bfd ldp x29, x30, [sp], #32
80cd0: d65f03c0 ret
0000000000080cd4 <preempt_disable>:
struct task_struct * task[NR_TASKS] = {&(init_task), };
int nr_tasks = 1;
void preempt_disable(void)
{
current->preempt_count++;
80cd4: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80cd8: 9107c000 add x0, x0, #0x1f0
80cdc: f9400000 ldr x0, [x0]
80ce0: f9404001 ldr x1, [x0, #128]
80ce4: 91000421 add x1, x1, #0x1
80ce8: f9004001 str x1, [x0, #128]
}
80cec: d503201f nop
80cf0: d65f03c0 ret
0000000000080cf4 <preempt_enable>:
void preempt_enable(void)
{
current->preempt_count--;
80cf4: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80cf8: 9107c000 add x0, x0, #0x1f0
80cfc: f9400000 ldr x0, [x0]
80d00: f9404001 ldr x1, [x0, #128]
80d04: d1000421 sub x1, x1, #0x1
80d08: f9004001 str x1, [x0, #128]
}
80d0c: d503201f nop
80d10: d65f03c0 ret
0000000000080d14 <_schedule>:
void _schedule(void)
{
80d14: a9bd7bfd stp x29, x30, [sp, #-48]!
80d18: 910003fd mov x29, sp
/* ensure no context happens in the following code region
80d1c: 97ffffee bl 80cd4 <preempt_disable>
we still leave irq on, because irq handler may set a task to be TASK_RUNNING, which
will be picked up by the scheduler below */
preempt_disable();
int next,c;
80d20: 12800000 mov w0, #0xffffffff // #-1
80d24: b9002ba0 str w0, [x29, #40]
struct task_struct * p;
80d28: b9002fbf str wzr, [x29, #44]
while (1) {
80d2c: b90027bf str wzr, [x29, #36]
80d30: 1400001a b 80d98 <_schedule+0x84>
c = -1; // the maximum counter of all tasks
80d34: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80d38: 9107e000 add x0, x0, #0x1f8
80d3c: b98027a1 ldrsw x1, [x29, #36]
80d40: f8617800 ldr x0, [x0, x1, lsl #3]
80d44: f9000fa0 str x0, [x29, #24]
next = 0;
80d48: f9400fa0 ldr x0, [x29, #24]
80d4c: f100001f cmp x0, #0x0
80d50: 540001e0 b.eq 80d8c <_schedule+0x78> // b.none
80d54: f9400fa0 ldr x0, [x29, #24]
80d58: f9403400 ldr x0, [x0, #104]
80d5c: f100001f cmp x0, #0x0
80d60: 54000161 b.ne 80d8c <_schedule+0x78> // b.any
80d64: f9400fa0 ldr x0, [x29, #24]
80d68: f9403801 ldr x1, [x0, #112]
80d6c: b9802ba0 ldrsw x0, [x29, #40]
80d70: eb00003f cmp x1, x0
80d74: 540000cd b.le 80d8c <_schedule+0x78>
80d78: f9400fa0 ldr x0, [x29, #24]
80d7c: f9403800 ldr x0, [x0, #112]
80d80: b9002ba0 str w0, [x29, #40]
/* Iterates over all tasks and tries to find a task in
80d84: b94027a0 ldr w0, [x29, #36]
80d88: b9002fa0 str w0, [x29, #44]
while (1) {
80d8c: b94027a0 ldr w0, [x29, #36]
80d90: 11000400 add w0, w0, #0x1
80d94: b90027a0 str w0, [x29, #36]
80d98: b94027a0 ldr w0, [x29, #36]
80d9c: 7100fc1f cmp w0, #0x3f
80da0: 54fffcad b.le 80d34 <_schedule+0x20>
TASK_RUNNING state with the maximum counter. If such
a task is found, we immediately break from the while loop
and switch to this task. */
80da4: b9402ba0 ldr w0, [x29, #40]
80da8: 7100001f cmp w0, #0x0
80dac: 54000341 b.ne 80e14 <_schedule+0x100> // b.any
for (int i = 0; i < NR_TASKS; i++){
p = task[i];
80db0: b90023bf str wzr, [x29, #32]
80db4: 14000014 b 80e04 <_schedule+0xf0>
if (p && p->state == TASK_RUNNING && p->counter > c) {
80db8: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80dbc: 9107e000 add x0, x0, #0x1f8
80dc0: b98023a1 ldrsw x1, [x29, #32]
80dc4: f8617800 ldr x0, [x0, x1, lsl #3]
80dc8: f9000fa0 str x0, [x29, #24]
c = p->counter;
80dcc: f9400fa0 ldr x0, [x29, #24]
80dd0: f100001f cmp x0, #0x0
80dd4: 54000120 b.eq 80df8 <_schedule+0xe4> // b.none
next = i;
80dd8: f9400fa0 ldr x0, [x29, #24]
80ddc: f9403800 ldr x0, [x0, #112]
80de0: 9341fc01 asr x1, x0, #1
80de4: f9400fa0 ldr x0, [x29, #24]
80de8: f9403c00 ldr x0, [x0, #120]
80dec: 8b000021 add x1, x1, x0
80df0: f9400fa0 ldr x0, [x29, #24]
80df4: f9003801 str x1, [x0, #112]
p = task[i];
80df8: b94023a0 ldr w0, [x29, #32]
80dfc: 11000400 add w0, w0, #0x1
80e00: b90023a0 str w0, [x29, #32]
80e04: b94023a0 ldr w0, [x29, #32]
80e08: 7100fc1f cmp w0, #0x3f
80e0c: 54fffd6d b.le 80db8 <_schedule+0xa4>
int next,c;
80e10: 17ffffc4 b 80d20 <_schedule+0xc>
80e14: d503201f nop
}
}
if (c) {
break;
80e18: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80e1c: 9107e000 add x0, x0, #0x1f8
80e20: b9802fa1 ldrsw x1, [x29, #44]
80e24: f8617800 ldr x0, [x0, x1, lsl #3]
80e28: 9400000f bl 80e64 <switch_to>
}
80e2c: 97ffffb2 bl 80cf4 <preempt_enable>
80e30: d503201f nop
80e34: a8c37bfd ldp x29, x30, [sp], #48
80e38: d65f03c0 ret
0000000000080e3c <schedule>:
/* If no such task is found, this is either because i) no
task is in TASK_RUNNING state or ii) all such tasks have 0 counters.
in our current implemenation which misses TASK_WAIT, only condition ii) is possible.
80e3c: a9bf7bfd stp x29, x30, [sp, #-16]!
80e40: 910003fd mov x29, sp
Hence, we recharge counters. Bump counters for all tasks once. */
80e44: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80e48: 9107c000 add x0, x0, #0x1f0
80e4c: f9400000 ldr x0, [x0]
80e50: f900381f str xzr, [x0, #112]
80e54: 97ffffb0 bl 80d14 <_schedule>
for (int i = 0; i < NR_TASKS; i++) {
80e58: d503201f nop
80e5c: a8c17bfd ldp x29, x30, [sp], #16
80e60: d65f03c0 ret
0000000000080e64 <switch_to>:
p = task[i];
if (p) {
p->counter = (p->counter >> 1) + p->priority;
80e64: a9bd7bfd stp x29, x30, [sp, #-48]!
80e68: 910003fd mov x29, sp
80e6c: f9000fa0 str x0, [x29, #24]
}
80e70: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80e74: 9107c000 add x0, x0, #0x1f0
80e78: f9400000 ldr x0, [x0]
80e7c: f9400fa1 ldr x1, [x29, #24]
80e80: eb00003f cmp x1, x0
80e84: 540001a0 b.eq 80eb8 <switch_to+0x54> // b.none
}
}
80e88: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80e8c: 9107c000 add x0, x0, #0x1f0
80e90: f9400000 ldr x0, [x0]
80e94: f90017a0 str x0, [x29, #40]
switch_to(task[next]);
80e98: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80e9c: 9107c000 add x0, x0, #0x1f0
80ea0: f9400fa1 ldr x1, [x29, #24]
80ea4: f9000001 str x1, [x0]
preempt_enable();
80ea8: f9400fa1 ldr x1, [x29, #24]
80eac: f94017a0 ldr x0, [x29, #40]
80eb0: 940007de bl 82e28 <cpu_switch_to>
80eb4: 14000002 b 80ebc <switch_to+0x58>
}
80eb8: d503201f nop
}
80ebc: a8c37bfd ldp x29, x30, [sp], #48
80ec0: d65f03c0 ret
0000000000080ec4 <schedule_tail>:
void schedule(void)
80ec4: a9bf7bfd stp x29, x30, [sp, #-16]!
80ec8: 910003fd mov x29, sp
{
80ecc: 97ffff8a bl 80cf4 <preempt_enable>
current->counter = 0;
80ed0: d503201f nop
80ed4: a8c17bfd ldp x29, x30, [sp], #16
80ed8: d65f03c0 ret
0000000000080edc <timer_tick>:
_schedule();
}
void switch_to(struct task_struct * next)
80edc: a9bf7bfd stp x29, x30, [sp, #-16]!
80ee0: 910003fd mov x29, sp
{
80ee4: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80ee8: 9107c000 add x0, x0, #0x1f0
80eec: f9400000 ldr x0, [x0]
80ef0: f9403801 ldr x1, [x0, #112]
80ef4: d1000421 sub x1, x1, #0x1
80ef8: f9003801 str x1, [x0, #112]
if (current == next)
80efc: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80f00: 9107c000 add x0, x0, #0x1f0
80f04: f9400000 ldr x0, [x0]
80f08: f9403800 ldr x0, [x0, #112]
80f0c: f100001f cmp x0, #0x0
80f10: 540001ec b.gt 80f4c <timer_tick+0x70>
80f14: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80f18: 9107c000 add x0, x0, #0x1f0
80f1c: f9400000 ldr x0, [x0]
80f20: f9404000 ldr x0, [x0, #128]
80f24: f100001f cmp x0, #0x0
80f28: 5400012c b.gt 80f4c <timer_tick+0x70>
return;
struct task_struct * prev = current;
current = next;
80f2c: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80f30: 9107c000 add x0, x0, #0x1f0
80f34: f9400000 ldr x0, [x0]
80f38: f900381f str xzr, [x0, #112]
cpu_switch_to(prev, next);
80f3c: 940002f7 bl 81b18 <enable_irq>
}
80f40: 97ffff75 bl 80d14 <_schedule>
80f44: 940002f7 bl 81b20 <disable_irq>
80f48: 14000002 b 80f50 <timer_tick+0x74>
return;
80f4c: d503201f nop
void schedule_tail(void) {
80f50: a8c17bfd ldp x29, x30, [sp], #16
80f54: d65f03c0 ret
0000000000080f58 <copy_process>:
#include "mm.h"
#include "sched.h"
#include "entry.h"
int copy_process(unsigned long fn, unsigned long arg)
{
80f58: a9bd7bfd stp x29, x30, [sp, #-48]!
80f5c: 910003fd mov x29, sp
80f60: f9000fa0 str x0, [x29, #24]
80f64: f9000ba1 str x1, [x29, #16]
preempt_disable();
80f68: 97ffff5b bl 80cd4 <preempt_disable>
struct task_struct *p;
p = (struct task_struct *) get_free_page();
80f6c: 97fffeaa bl 80a14 <get_free_page>
80f70: f90017a0 str x0, [x29, #40]
if (!p)
80f74: f94017a0 ldr x0, [x29, #40]
80f78: f100001f cmp x0, #0x0
80f7c: 54000061 b.ne 80f88 <copy_process+0x30> // b.any
return 1;
80f80: 52800020 mov w0, #0x1 // #1
80f84: 1400002d b 81038 <copy_process+0xe0>
p->priority = current->priority;
80f88: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80f8c: f9409800 ldr x0, [x0, #304]
80f90: f9400000 ldr x0, [x0]
80f94: f9403c01 ldr x1, [x0, #120]
80f98: f94017a0 ldr x0, [x29, #40]
80f9c: f9003c01 str x1, [x0, #120]
p->state = TASK_RUNNING;
80fa0: f94017a0 ldr x0, [x29, #40]
80fa4: f900341f str xzr, [x0, #104]
p->counter = p->priority;
80fa8: f94017a0 ldr x0, [x29, #40]
80fac: f9403c01 ldr x1, [x0, #120]
80fb0: f94017a0 ldr x0, [x29, #40]
80fb4: f9003801 str x1, [x0, #112]
p->preempt_count = 1; //disable preemtion until schedule_tail
80fb8: f94017a0 ldr x0, [x29, #40]
80fbc: d2800021 mov x1, #0x1 // #1
80fc0: f9004001 str x1, [x0, #128]
p->cpu_context.x19 = fn;
80fc4: f94017a0 ldr x0, [x29, #40]
80fc8: f9400fa1 ldr x1, [x29, #24]
80fcc: f9000001 str x1, [x0]
p->cpu_context.x20 = arg;
80fd0: f94017a0 ldr x0, [x29, #40]
80fd4: f9400ba1 ldr x1, [x29, #16]
80fd8: f9000401 str x1, [x0, #8]
p->cpu_context.pc = (unsigned long)ret_from_fork;
80fdc: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
80fe0: f940a801 ldr x1, [x0, #336]
80fe4: f94017a0 ldr x0, [x29, #40]
80fe8: f9003001 str x1, [x0, #96]
p->cpu_context.sp = (unsigned long)p + THREAD_SIZE;
80fec: f94017a0 ldr x0, [x29, #40]
80ff0: 91400401 add x1, x0, #0x1, lsl #12
80ff4: f94017a0 ldr x0, [x29, #40]
80ff8: f9002c01 str x1, [x0, #88]
int pid = nr_tasks++;
80ffc: f0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
81000: f9409c00 ldr x0, [x0, #312]
81004: b9400000 ldr w0, [x0]
81008: 11000402 add w2, w0, #0x1
8100c: d0000001 adrp x1, 83000 <cpu_switch_to+0x1d8>
81010: f9409c21 ldr x1, [x1, #312]
81014: b9000022 str w2, [x1]
81018: b90027a0 str w0, [x29, #36]
task[pid] = p;
8101c: d0000000 adrp x0, 83000 <cpu_switch_to+0x1d8>
81020: f940a000 ldr x0, [x0, #320]
81024: b98027a1 ldrsw x1, [x29, #36]
81028: f94017a2 ldr x2, [x29, #40]
8102c: f8217802 str x2, [x0, x1, lsl #3]
preempt_enable();
81030: 97ffff31 bl 80cf4 <preempt_enable>
return 0;
81034: 52800000 mov w0, #0x0 // #0
}
81038: a8c37bfd ldp x29, x30, [sp], #48
8103c: d65f03c0 ret
0000000000081040 <ui2a>:
}
#endif
static void ui2a(unsigned int num, unsigned int base, int uc,char * bf)
{
81040: d100c3ff sub sp, sp, #0x30
81044: b9001fe0 str w0, [sp, #28]
81048: b9001be1 str w1, [sp, #24]
8104c: b90017e2 str w2, [sp, #20]
81050: f90007e3 str x3, [sp, #8]
int n=0;
81054: b9002fff str wzr, [sp, #44]
unsigned int d=1;
81058: 52800020 mov w0, #0x1 // #1
8105c: b9002be0 str w0, [sp, #40]
while (num/d >= base)
81060: 14000005 b 81074 <ui2a+0x34>
d*=base;
81064: b9402be1 ldr w1, [sp, #40]
81068: b9401be0 ldr w0, [sp, #24]
8106c: 1b007c20 mul w0, w1, w0
81070: b9002be0 str w0, [sp, #40]
while (num/d >= base)
81074: b9401fe1 ldr w1, [sp, #28]
81078: b9402be0 ldr w0, [sp, #40]
8107c: 1ac00820 udiv w0, w1, w0
81080: b9401be1 ldr w1, [sp, #24]
81084: 6b00003f cmp w1, w0
81088: 54fffee9 b.ls 81064 <ui2a+0x24> // b.plast
while (d!=0) {
8108c: 1400002f b 81148 <ui2a+0x108>
int dgt = num / d;
81090: b9401fe1 ldr w1, [sp, #28]
81094: b9402be0 ldr w0, [sp, #40]
81098: 1ac00820 udiv w0, w1, w0
8109c: b90027e0 str w0, [sp, #36]
num%= d;
810a0: b9401fe0 ldr w0, [sp, #28]
810a4: b9402be1 ldr w1, [sp, #40]
810a8: 1ac10802 udiv w2, w0, w1
810ac: b9402be1 ldr w1, [sp, #40]
810b0: 1b017c41 mul w1, w2, w1
810b4: 4b010000 sub w0, w0, w1
810b8: b9001fe0 str w0, [sp, #28]
d/=base;
810bc: b9402be1 ldr w1, [sp, #40]
810c0: b9401be0 ldr w0, [sp, #24]
810c4: 1ac00820 udiv w0, w1, w0
810c8: b9002be0 str w0, [sp, #40]
if (n || dgt>0 || d==0) {
810cc: b9402fe0 ldr w0, [sp, #44]
810d0: 7100001f cmp w0, #0x0
810d4: 540000e1 b.ne 810f0 <ui2a+0xb0> // b.any
810d8: b94027e0 ldr w0, [sp, #36]
810dc: 7100001f cmp w0, #0x0
810e0: 5400008c b.gt 810f0 <ui2a+0xb0>
810e4: b9402be0 ldr w0, [sp, #40]
810e8: 7100001f cmp w0, #0x0
810ec: 540002e1 b.ne 81148 <ui2a+0x108> // b.any
*bf++ = dgt+(dgt<10 ? '0' : (uc ? 'A' : 'a')-10);
810f0: b94027e0 ldr w0, [sp, #36]
810f4: 7100241f cmp w0, #0x9
810f8: 5400010d b.le 81118 <ui2a+0xd8>
810fc: b94017e0 ldr w0, [sp, #20]
81100: 7100001f cmp w0, #0x0
81104: 54000060 b.eq 81110 <ui2a+0xd0> // b.none
81108: 528006e0 mov w0, #0x37 // #55
8110c: 14000004 b 8111c <ui2a+0xdc>
81110: 52800ae0 mov w0, #0x57 // #87
81114: 14000002 b 8111c <ui2a+0xdc>
81118: 52800600 mov w0, #0x30 // #48
8111c: b94027e1 ldr w1, [sp, #36]
81120: 12001c22 and w2, w1, #0xff
81124: f94007e1 ldr x1, [sp, #8]
81128: 91000423 add x3, x1, #0x1
8112c: f90007e3 str x3, [sp, #8]
81130: 0b020000 add w0, w0, w2
81134: 12001c00 and w0, w0, #0xff
81138: 39000020 strb w0, [x1]
++n;
8113c: b9402fe0 ldr w0, [sp, #44]
81140: 11000400 add w0, w0, #0x1
81144: b9002fe0 str w0, [sp, #44]
while (d!=0) {
81148: b9402be0 ldr w0, [sp, #40]
8114c: 7100001f cmp w0, #0x0
81150: 54fffa01 b.ne 81090 <ui2a+0x50> // b.any
}
}
*bf=0;
81154: f94007e0 ldr x0, [sp, #8]
81158: 3900001f strb wzr, [x0]
}
8115c: d503201f nop
81160: 9100c3ff add sp, sp, #0x30
81164: d65f03c0 ret
0000000000081168 <i2a>:
static void i2a (int num, char * bf)
{
81168: a9be7bfd stp x29, x30, [sp, #-32]!
8116c: 910003fd mov x29, sp
81170: b9001fa0 str w0, [x29, #28]
81174: f9000ba1 str x1, [x29, #16]
if (num<0) {
81178: b9401fa0 ldr w0, [x29, #28]
8117c: 7100001f cmp w0, #0x0
81180: 5400012a b.ge 811a4 <i2a+0x3c> // b.tcont
num=-num;
81184: b9401fa0 ldr w0, [x29, #28]
81188: 4b0003e0 neg w0, w0
8118c: b9001fa0 str w0, [x29, #28]
*bf++ = '-';
81190: f9400ba0 ldr x0, [x29, #16]
81194: 91000401 add x1, x0, #0x1
81198: f9000ba1 str x1, [x29, #16]
8119c: 528005a1 mov w1, #0x2d // #45
811a0: 39000001 strb w1, [x0]
}
ui2a(num,10,0,bf);
811a4: b9401fa0 ldr w0, [x29, #28]
811a8: f9400ba3 ldr x3, [x29, #16]
811ac: 52800002 mov w2, #0x0 // #0
811b0: 52800141 mov w1, #0xa // #10
811b4: 97ffffa3 bl 81040 <ui2a>
}
811b8: d503201f nop
811bc: a8c27bfd ldp x29, x30, [sp], #32
811c0: d65f03c0 ret
00000000000811c4 <a2d>:
static int a2d(char ch)
{
811c4: d10043ff sub sp, sp, #0x10
811c8: 39003fe0 strb w0, [sp, #15]
if (ch>='0' && ch<='9')
811cc: 39403fe0 ldrb w0, [sp, #15]
811d0: 7100bc1f cmp w0, #0x2f
811d4: 540000e9 b.ls 811f0 <a2d+0x2c> // b.plast
811d8: 39403fe0 ldrb w0, [sp, #15]
811dc: 7100e41f cmp w0, #0x39
811e0: 54000088 b.hi 811f0 <a2d+0x2c> // b.pmore
return ch-'0';
811e4: 39403fe0 ldrb w0, [sp, #15]
811e8: 5100c000 sub w0, w0, #0x30
811ec: 14000014 b 8123c <a2d+0x78>
else if (ch>='a' && ch<='f')
811f0: 39403fe0 ldrb w0, [sp, #15]
811f4: 7101801f cmp w0, #0x60
811f8: 540000e9 b.ls 81214 <a2d+0x50> // b.plast
811fc: 39403fe0 ldrb w0, [sp, #15]
81200: 7101981f cmp w0, #0x66
81204: 54000088 b.hi 81214 <a2d+0x50> // b.pmore
return ch-'a'+10;
81208: 39403fe0 ldrb w0, [sp, #15]
8120c: 51015c00 sub w0, w0, #0x57
81210: 1400000b b 8123c <a2d+0x78>
else if (ch>='A' && ch<='F')
81214: 39403fe0 ldrb w0, [sp, #15]
81218: 7101001f cmp w0, #0x40
8121c: 540000e9 b.ls 81238 <a2d+0x74> // b.plast
81220: 39403fe0 ldrb w0, [sp, #15]
81224: 7101181f cmp w0, #0x46
81228: 54000088 b.hi 81238 <a2d+0x74> // b.pmore
return ch-'A'+10;
8122c: 39403fe0 ldrb w0, [sp, #15]
81230: 5100dc00 sub w0, w0, #0x37
81234: 14000002 b 8123c <a2d+0x78>
else return -1;
81238: 12800000 mov w0, #0xffffffff // #-1
}
8123c: 910043ff add sp, sp, #0x10
81240: d65f03c0 ret
0000000000081244 <a2i>:
static char a2i(char ch, char** src,int base,int* nump)
{
81244: a9bc7bfd stp x29, x30, [sp, #-64]!
81248: 910003fd mov x29, sp
8124c: 3900bfa0 strb w0, [x29, #47]
81250: f90013a1 str x1, [x29, #32]
81254: b9002ba2 str w2, [x29, #40]
81258: f9000fa3 str x3, [x29, #24]
char* p= *src;
8125c: f94013a0 ldr x0, [x29, #32]
81260: f9400000 ldr x0, [x0]
81264: f9001fa0 str x0, [x29, #56]
int num=0;
81268: b90037bf str wzr, [x29, #52]
int digit;
while ((digit=a2d(ch))>=0) {
8126c: 14000010 b 812ac <a2i+0x68>
if (digit>base) break;
81270: b94033a1 ldr w1, [x29, #48]
81274: b9402ba0 ldr w0, [x29, #40]
81278: 6b00003f cmp w1, w0
8127c: 5400026c b.gt 812c8 <a2i+0x84>
num=num*base+digit;
81280: b94037a1 ldr w1, [x29, #52]
81284: b9402ba0 ldr w0, [x29, #40]
81288: 1b007c20 mul w0, w1, w0
8128c: b94033a1 ldr w1, [x29, #48]
81290: 0b000020 add w0, w1, w0
81294: b90037a0 str w0, [x29, #52]
ch=*p++;
81298: f9401fa0 ldr x0, [x29, #56]
8129c: 91000401 add x1, x0, #0x1
812a0: f9001fa1 str x1, [x29, #56]
812a4: 39400000 ldrb w0, [x0]
812a8: 3900bfa0 strb w0, [x29, #47]
while ((digit=a2d(ch))>=0) {
812ac: 3940bfa0 ldrb w0, [x29, #47]
812b0: 97ffffc5 bl 811c4 <a2d>
812b4: b90033a0 str w0, [x29, #48]
812b8: b94033a0 ldr w0, [x29, #48]
812bc: 7100001f cmp w0, #0x0
812c0: 54fffd8a b.ge 81270 <a2i+0x2c> // b.tcont
812c4: 14000002 b 812cc <a2i+0x88>
if (digit>base) break;
812c8: d503201f nop
}
*src=p;
812cc: f94013a0 ldr x0, [x29, #32]
812d0: f9401fa1 ldr x1, [x29, #56]
812d4: f9000001 str x1, [x0]
*nump=num;
812d8: f9400fa0 ldr x0, [x29, #24]
812dc: b94037a1 ldr w1, [x29, #52]
812e0: b9000001 str w1, [x0]
return ch;
812e4: 3940bfa0 ldrb w0, [x29, #47]
}
812e8: a8c47bfd ldp x29, x30, [sp], #64
812ec: d65f03c0 ret
00000000000812f0 <putchw>:
static void putchw(void* putp,putcf putf,int n, char z, char* bf)
{
812f0: a9bc7bfd stp x29, x30, [sp, #-64]!
812f4: 910003fd mov x29, sp
812f8: f90017a0 str x0, [x29, #40]
812fc: f90013a1 str x1, [x29, #32]
81300: b9001fa2 str w2, [x29, #28]
81304: 39006fa3 strb w3, [x29, #27]
81308: f9000ba4 str x4, [x29, #16]
char fc=z? '0' : ' ';
8130c: 39406fa0 ldrb w0, [x29, #27]
81310: 7100001f cmp w0, #0x0
81314: 54000060 b.eq 81320 <putchw+0x30> // b.none
81318: 52800600 mov w0, #0x30 // #48
8131c: 14000002 b 81324 <putchw+0x34>
81320: 52800400 mov w0, #0x20 // #32
81324: 3900dfa0 strb w0, [x29, #55]
char ch;
char* p=bf;
81328: f9400ba0 ldr x0, [x29, #16]
8132c: f9001fa0 str x0, [x29, #56]
while (*p++ && n > 0)
81330: 14000004 b 81340 <putchw+0x50>
n--;
81334: b9401fa0 ldr w0, [x29, #28]
81338: 51000400 sub w0, w0, #0x1
8133c: b9001fa0 str w0, [x29, #28]
while (*p++ && n > 0)
81340: f9401fa0 ldr x0, [x29, #56]
81344: 91000401 add x1, x0, #0x1
81348: f9001fa1 str x1, [x29, #56]
8134c: 39400000 ldrb w0, [x0]
81350: 7100001f cmp w0, #0x0
81354: 54000120 b.eq 81378 <putchw+0x88> // b.none
81358: b9401fa0 ldr w0, [x29, #28]
8135c: 7100001f cmp w0, #0x0
81360: 54fffeac b.gt 81334 <putchw+0x44>
while (n-- > 0)
81364: 14000005 b 81378 <putchw+0x88>
putf(putp,fc);
81368: f94013a2 ldr x2, [x29, #32]
8136c: 3940dfa1 ldrb w1, [x29, #55]
81370: f94017a0 ldr x0, [x29, #40]
81374: d63f0040 blr x2
while (n-- > 0)
81378: b9401fa0 ldr w0, [x29, #28]
8137c: 51000401 sub w1, w0, #0x1
81380: b9001fa1 str w1, [x29, #28]
81384: 7100001f cmp w0, #0x0
81388: 54ffff0c b.gt 81368 <putchw+0x78>
while ((ch= *bf++))
8138c: 14000005 b 813a0 <putchw+0xb0>
putf(putp,ch);
81390: f94013a2 ldr x2, [x29, #32]
81394: 3940dba1 ldrb w1, [x29, #54]
81398: f94017a0 ldr x0, [x29, #40]
8139c: d63f0040 blr x2
while ((ch= *bf++))
813a0: f9400ba0 ldr x0, [x29, #16]
813a4: 91000401 add x1, x0, #0x1
813a8: f9000ba1 str x1, [x29, #16]
813ac: 39400000 ldrb w0, [x0]
813b0: 3900dba0 strb w0, [x29, #54]
813b4: 3940dba0 ldrb w0, [x29, #54]
813b8: 7100001f cmp w0, #0x0
813bc: 54fffea1 b.ne 81390 <putchw+0xa0> // b.any
}
813c0: d503201f nop
813c4: a8c47bfd ldp x29, x30, [sp], #64
813c8: d65f03c0 ret
00000000000813cc <tfp_format>:
void tfp_format(void* putp,putcf putf,char *fmt, va_list va)
{
813cc: a9ba7bfd stp x29, x30, [sp, #-96]!
813d0: 910003fd mov x29, sp
813d4: f9000bf3 str x19, [sp, #16]
813d8: f9001fa0 str x0, [x29, #56]
813dc: f9001ba1 str x1, [x29, #48]
813e0: f90017a2 str x2, [x29, #40]
813e4: aa0303f3 mov x19, x3
char bf[12];
char ch;
while ((ch=*(fmt++))) {
813e8: 140000fd b 817dc <tfp_format+0x410>
if (ch!='%')
813ec: 39417fa0 ldrb w0, [x29, #95]
813f0: 7100941f cmp w0, #0x25
813f4: 540000c0 b.eq 8140c <tfp_format+0x40> // b.none
putf(putp,ch);
813f8: f9401ba2 ldr x2, [x29, #48]
813fc: 39417fa1 ldrb w1, [x29, #95]
81400: f9401fa0 ldr x0, [x29, #56]
81404: d63f0040 blr x2
81408: 140000f5 b 817dc <tfp_format+0x410>
else {
char lz=0;
8140c: 39017bbf strb wzr, [x29, #94]
#ifdef PRINTF_LONG_SUPPORT
char lng=0;
#endif
int w=0;
81410: b9004fbf str wzr, [x29, #76]
ch=*(fmt++);
81414: f94017a0 ldr x0, [x29, #40]
81418: 91000401 add x1, x0, #0x1
8141c: f90017a1 str x1, [x29, #40]
81420: 39400000 ldrb w0, [x0]
81424: 39017fa0 strb w0, [x29, #95]
if (ch=='0') {
81428: 39417fa0 ldrb w0, [x29, #95]
8142c: 7100c01f cmp w0, #0x30
81430: 54000101 b.ne 81450 <tfp_format+0x84> // b.any
ch=*(fmt++);
81434: f94017a0 ldr x0, [x29, #40]
81438: 91000401 add x1, x0, #0x1
8143c: f90017a1 str x1, [x29, #40]
81440: 39400000 ldrb w0, [x0]
81444: 39017fa0 strb w0, [x29, #95]
lz=1;
81448: 52800020 mov w0, #0x1 // #1
8144c: 39017ba0 strb w0, [x29, #94]
}
if (ch>='0' && ch<='9') {
81450: 39417fa0 ldrb w0, [x29, #95]
81454: 7100bc1f cmp w0, #0x2f
81458: 54000189 b.ls 81488 <tfp_format+0xbc> // b.plast
8145c: 39417fa0 ldrb w0, [x29, #95]
81460: 7100e41f cmp w0, #0x39
81464: 54000128 b.hi 81488 <tfp_format+0xbc> // b.pmore
ch=a2i(ch,&fmt,10,&w);
81468: 910133a1 add x1, x29, #0x4c
8146c: 9100a3a0 add x0, x29, #0x28
81470: aa0103e3 mov x3, x1
81474: 52800142 mov w2, #0xa // #10
81478: aa0003e1 mov x1, x0
8147c: 39417fa0 ldrb w0, [x29, #95]
81480: 97ffff71 bl 81244 <a2i>
81484: 39017fa0 strb w0, [x29, #95]
if (ch=='l') {
ch=*(fmt++);
lng=1;
}
#endif
switch (ch) {
81488: 39417fa0 ldrb w0, [x29, #95]
8148c: 71018c1f cmp w0, #0x63
81490: 540011c0 b.eq 816c8 <tfp_format+0x2fc> // b.none
81494: 71018c1f cmp w0, #0x63
81498: 5400010c b.gt 814b8 <tfp_format+0xec>
8149c: 7100941f cmp w0, #0x25
814a0: 54001940 b.eq 817c8 <tfp_format+0x3fc> // b.none
814a4: 7101601f cmp w0, #0x58
814a8: 54000b60 b.eq 81614 <tfp_format+0x248> // b.none
814ac: 7100001f cmp w0, #0x0
814b0: 54001a80 b.eq 81800 <tfp_format+0x434> // b.none
putchw(putp,putf,w,0,va_arg(va, char*));
break;
case '%' :
putf(putp,ch);
default:
break;
814b4: 140000c9 b 817d8 <tfp_format+0x40c>
switch (ch) {
814b8: 7101cc1f cmp w0, #0x73
814bc: 54001440 b.eq 81744 <tfp_format+0x378> // b.none
814c0: 7101cc1f cmp w0, #0x73
814c4: 5400008c b.gt 814d4 <tfp_format+0x108>
814c8: 7101901f cmp w0, #0x64
814cc: 540005c0 b.eq 81584 <tfp_format+0x1b8> // b.none
break;
814d0: 140000c2 b 817d8 <tfp_format+0x40c>
switch (ch) {
814d4: 7101d41f cmp w0, #0x75
814d8: 54000080 b.eq 814e8 <tfp_format+0x11c> // b.none
814dc: 7101e01f cmp w0, #0x78
814e0: 540009a0 b.eq 81614 <tfp_format+0x248> // b.none
break;
814e4: 140000bd b 817d8 <tfp_format+0x40c>
ui2a(va_arg(va, unsigned int),10,0,bf);
814e8: b9401a60 ldr w0, [x19, #24]
814ec: f9400261 ldr x1, [x19]
814f0: 7100001f cmp w0, #0x0
814f4: 540000eb b.lt 81510 <tfp_format+0x144> // b.tstop
814f8: aa0103e0 mov x0, x1
814fc: 91002c00 add x0, x0, #0xb
81500: 927df000 and x0, x0, #0xfffffffffffffff8
81504: f9000260 str x0, [x19]
81508: aa0103e0 mov x0, x1
8150c: 1400000f b 81548 <tfp_format+0x17c>
81510: 11002002 add w2, w0, #0x8
81514: b9001a62 str w2, [x19, #24]
81518: b9401a62 ldr w2, [x19, #24]
8151c: 7100005f cmp w2, #0x0
81520: 540000ed b.le 8153c <tfp_format+0x170>
81524: aa0103e0 mov x0, x1
81528: 91002c00 add x0, x0, #0xb
8152c: 927df000 and x0, x0, #0xfffffffffffffff8
81530: f9000260 str x0, [x19]
81534: aa0103e0 mov x0, x1
81538: 14000004 b 81548 <tfp_format+0x17c>
8153c: f9400661 ldr x1, [x19, #8]
81540: 93407c00 sxtw x0, w0
81544: 8b000020 add x0, x1, x0
81548: b9400000 ldr w0, [x0]
8154c: 910143a1 add x1, x29, #0x50
81550: aa0103e3 mov x3, x1
81554: 52800002 mov w2, #0x0 // #0
81558: 52800141 mov w1, #0xa // #10
8155c: 97fffeb9 bl 81040 <ui2a>
putchw(putp,putf,w,lz,bf);
81560: b9404fa0 ldr w0, [x29, #76]
81564: 910143a1 add x1, x29, #0x50
81568: aa0103e4 mov x4, x1
8156c: 39417ba3 ldrb w3, [x29, #94]
81570: 2a0003e2 mov w2, w0
81574: f9401ba1 ldr x1, [x29, #48]
81578: f9401fa0 ldr x0, [x29, #56]
8157c: 97ffff5d bl 812f0 <putchw>
break;
81580: 14000097 b 817dc <tfp_format+0x410>
i2a(va_arg(va, int),bf);
81584: b9401a60 ldr w0, [x19, #24]
81588: f9400261 ldr x1, [x19]
8158c: 7100001f cmp w0, #0x0
81590: 540000eb b.lt 815ac <tfp_format+0x1e0> // b.tstop
81594: aa0103e0 mov x0, x1
81598: 91002c00 add x0, x0, #0xb
8159c: 927df000 and x0, x0, #0xfffffffffffffff8
815a0: f9000260 str x0, [x19]
815a4: aa0103e0 mov x0, x1
815a8: 1400000f b 815e4 <tfp_format+0x218>
815ac: 11002002 add w2, w0, #0x8
815b0: b9001a62 str w2, [x19, #24]
815b4: b9401a62 ldr w2, [x19, #24]
815b8: 7100005f cmp w2, #0x0
815bc: 540000ed b.le 815d8 <tfp_format+0x20c>
815c0: aa0103e0 mov x0, x1
815c4: 91002c00 add x0, x0, #0xb
815c8: 927df000 and x0, x0, #0xfffffffffffffff8
815cc: f9000260 str x0, [x19]
815d0: aa0103e0 mov x0, x1
815d4: 14000004 b 815e4 <tfp_format+0x218>
815d8: f9400661 ldr x1, [x19, #8]
815dc: 93407c00 sxtw x0, w0
815e0: 8b000020 add x0, x1, x0
815e4: b9400000 ldr w0, [x0]
815e8: 910143a1 add x1, x29, #0x50
815ec: 97fffedf bl 81168 <i2a>
putchw(putp,putf,w,lz,bf);
815f0: b9404fa0 ldr w0, [x29, #76]
815f4: 910143a1 add x1, x29, #0x50
815f8: aa0103e4 mov x4, x1
815fc: 39417ba3 ldrb w3, [x29, #94]
81600: 2a0003e2 mov w2, w0
81604: f9401ba1 ldr x1, [x29, #48]
81608: f9401fa0 ldr x0, [x29, #56]
8160c: 97ffff39 bl 812f0 <putchw>
break;
81610: 14000073 b 817dc <tfp_format+0x410>
ui2a(va_arg(va, unsigned int),16,(ch=='X'),bf);
81614: b9401a60 ldr w0, [x19, #24]
81618: f9400261 ldr x1, [x19]
8161c: 7100001f cmp w0, #0x0
81620: 540000eb b.lt 8163c <tfp_format+0x270> // b.tstop
81624: aa0103e0 mov x0, x1
81628: 91002c00 add x0, x0, #0xb
8162c: 927df000 and x0, x0, #0xfffffffffffffff8
81630: f9000260 str x0, [x19]
81634: aa0103e0 mov x0, x1
81638: 1400000f b 81674 <tfp_format+0x2a8>
8163c: 11002002 add w2, w0, #0x8
81640: b9001a62 str w2, [x19, #24]
81644: b9401a62 ldr w2, [x19, #24]
81648: 7100005f cmp w2, #0x0
8164c: 540000ed b.le 81668 <tfp_format+0x29c>
81650: aa0103e0 mov x0, x1
81654: 91002c00 add x0, x0, #0xb
81658: 927df000 and x0, x0, #0xfffffffffffffff8
8165c: f9000260 str x0, [x19]
81660: aa0103e0 mov x0, x1
81664: 14000004 b 81674 <tfp_format+0x2a8>
81668: f9400661 ldr x1, [x19, #8]
8166c: 93407c00 sxtw x0, w0
81670: 8b000020 add x0, x1, x0
81674: b9400004 ldr w4, [x0]
81678: 39417fa0 ldrb w0, [x29, #95]
8167c: 7101601f cmp w0, #0x58
81680: 1a9f17e0 cset w0, eq // eq = none
81684: 12001c00 and w0, w0, #0xff
81688: 2a0003e1 mov w1, w0
8168c: 910143a0 add x0, x29, #0x50
81690: aa0003e3 mov x3, x0
81694: 2a0103e2 mov w2, w1
81698: 52800201 mov w1, #0x10 // #16
8169c: 2a0403e0 mov w0, w4
816a0: 97fffe68 bl 81040 <ui2a>
putchw(putp,putf,w,lz,bf);
816a4: b9404fa0 ldr w0, [x29, #76]
816a8: 910143a1 add x1, x29, #0x50
816ac: aa0103e4 mov x4, x1
816b0: 39417ba3 ldrb w3, [x29, #94]
816b4: 2a0003e2 mov w2, w0
816b8: f9401ba1 ldr x1, [x29, #48]
816bc: f9401fa0 ldr x0, [x29, #56]
816c0: 97ffff0c bl 812f0 <putchw>
break;
816c4: 14000046 b 817dc <tfp_format+0x410>
putf(putp,(char)(va_arg(va, int)));
816c8: b9401a60 ldr w0, [x19, #24]
816cc: f9400261 ldr x1, [x19]
816d0: 7100001f cmp w0, #0x0
816d4: 540000eb b.lt 816f0 <tfp_format+0x324> // b.tstop
816d8: aa0103e0 mov x0, x1
816dc: 91002c00 add x0, x0, #0xb
816e0: 927df000 and x0, x0, #0xfffffffffffffff8
816e4: f9000260 str x0, [x19]
816e8: aa0103e0 mov x0, x1
816ec: 1400000f b 81728 <tfp_format+0x35c>
816f0: 11002002 add w2, w0, #0x8
816f4: b9001a62 str w2, [x19, #24]
816f8: b9401a62 ldr w2, [x19, #24]
816fc: 7100005f cmp w2, #0x0
81700: 540000ed b.le 8171c <tfp_format+0x350>
81704: aa0103e0 mov x0, x1
81708: 91002c00 add x0, x0, #0xb
8170c: 927df000 and x0, x0, #0xfffffffffffffff8
81710: f9000260 str x0, [x19]
81714: aa0103e0 mov x0, x1
81718: 14000004 b 81728 <tfp_format+0x35c>
8171c: f9400661 ldr x1, [x19, #8]
81720: 93407c00 sxtw x0, w0
81724: 8b000020 add x0, x1, x0
81728: b9400000 ldr w0, [x0]
8172c: 12001c00 and w0, w0, #0xff
81730: f9401ba2 ldr x2, [x29, #48]
81734: 2a0003e1 mov w1, w0
81738: f9401fa0 ldr x0, [x29, #56]
8173c: d63f0040 blr x2
break;
81740: 14000027 b 817dc <tfp_format+0x410>
putchw(putp,putf,w,0,va_arg(va, char*));
81744: b9404fa5 ldr w5, [x29, #76]
81748: b9401a60 ldr w0, [x19, #24]
8174c: f9400261 ldr x1, [x19]
81750: 7100001f cmp w0, #0x0
81754: 540000eb b.lt 81770 <tfp_format+0x3a4> // b.tstop
81758: aa0103e0 mov x0, x1
8175c: 91003c00 add x0, x0, #0xf
81760: 927df000 and x0, x0, #0xfffffffffffffff8
81764: f9000260 str x0, [x19]
81768: aa0103e0 mov x0, x1
8176c: 1400000f b 817a8 <tfp_format+0x3dc>
81770: 11002002 add w2, w0, #0x8
81774: b9001a62 str w2, [x19, #24]
81778: b9401a62 ldr w2, [x19, #24]
8177c: 7100005f cmp w2, #0x0
81780: 540000ed b.le 8179c <tfp_format+0x3d0>
81784: aa0103e0 mov x0, x1
81788: 91003c00 add x0, x0, #0xf
8178c: 927df000 and x0, x0, #0xfffffffffffffff8
81790: f9000260 str x0, [x19]
81794: aa0103e0 mov x0, x1
81798: 14000004 b 817a8 <tfp_format+0x3dc>
8179c: f9400661 ldr x1, [x19, #8]
817a0: 93407c00 sxtw x0, w0
817a4: 8b000020 add x0, x1, x0
817a8: f9400000 ldr x0, [x0]
817ac: aa0003e4 mov x4, x0
817b0: 52800003 mov w3, #0x0 // #0
817b4: 2a0503e2 mov w2, w5
817b8: f9401ba1 ldr x1, [x29, #48]
817bc: f9401fa0 ldr x0, [x29, #56]
817c0: 97fffecc bl 812f0 <putchw>
break;
817c4: 14000006 b 817dc <tfp_format+0x410>
putf(putp,ch);
817c8: f9401ba2 ldr x2, [x29, #48]
817cc: 39417fa1 ldrb w1, [x29, #95]
817d0: f9401fa0 ldr x0, [x29, #56]
817d4: d63f0040 blr x2
break;
817d8: d503201f nop
while ((ch=*(fmt++))) {
817dc: f94017a0 ldr x0, [x29, #40]
817e0: 91000401 add x1, x0, #0x1
817e4: f90017a1 str x1, [x29, #40]
817e8: 39400000 ldrb w0, [x0]
817ec: 39017fa0 strb w0, [x29, #95]
817f0: 39417fa0 ldrb w0, [x29, #95]
817f4: 7100001f cmp w0, #0x0
817f8: 54ffdfa1 b.ne 813ec <tfp_format+0x20> // b.any
}
}
}
abort:;
817fc: 14000002 b 81804 <tfp_format+0x438>
goto abort;
81800: d503201f nop
}
81804: d503201f nop
81808: f9400bf3 ldr x19, [sp, #16]
8180c: a8c67bfd ldp x29, x30, [sp], #96
81810: d65f03c0 ret
0000000000081814 <init_printf>:
void init_printf(void* putp,void (*putf) (void*,char))
{
81814: d10043ff sub sp, sp, #0x10
81818: f90007e0 str x0, [sp, #8]
8181c: f90003e1 str x1, [sp]
stdout_putf=putf;
81820: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
81824: 912fe000 add x0, x0, #0xbf8
81828: f94003e1 ldr x1, [sp]
8182c: f9000001 str x1, [x0]
stdout_putp=putp;
81830: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
81834: 91300000 add x0, x0, #0xc00
81838: f94007e1 ldr x1, [sp, #8]
8183c: f9000001 str x1, [x0]
}
81840: d503201f nop
81844: 910043ff add sp, sp, #0x10
81848: d65f03c0 ret
000000000008184c <tfp_printf>:
void tfp_printf(char *fmt, ...)
{
8184c: a9b67bfd stp x29, x30, [sp, #-160]!
81850: 910003fd mov x29, sp
81854: f9001fa0 str x0, [x29, #56]
81858: f90037a1 str x1, [x29, #104]
8185c: f9003ba2 str x2, [x29, #112]
81860: f9003fa3 str x3, [x29, #120]
81864: f90043a4 str x4, [x29, #128]
81868: f90047a5 str x5, [x29, #136]
8186c: f9004ba6 str x6, [x29, #144]
81870: f9004fa7 str x7, [x29, #152]
va_list va;
va_start(va,fmt);
81874: 910283a0 add x0, x29, #0xa0
81878: f90023a0 str x0, [x29, #64]
8187c: 910283a0 add x0, x29, #0xa0
81880: f90027a0 str x0, [x29, #72]
81884: 910183a0 add x0, x29, #0x60
81888: f9002ba0 str x0, [x29, #80]
8188c: 128006e0 mov w0, #0xffffffc8 // #-56
81890: b9005ba0 str w0, [x29, #88]
81894: b9005fbf str wzr, [x29, #92]
tfp_format(stdout_putp,stdout_putf,fmt,va);
81898: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
8189c: 91300000 add x0, x0, #0xc00
818a0: f9400004 ldr x4, [x0]
818a4: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
818a8: 912fe000 add x0, x0, #0xbf8
818ac: f9400005 ldr x5, [x0]
818b0: 910043a2 add x2, x29, #0x10
818b4: 910103a3 add x3, x29, #0x40
818b8: a9400460 ldp x0, x1, [x3]
818bc: a9000440 stp x0, x1, [x2]
818c0: a9410460 ldp x0, x1, [x3, #16]
818c4: a9010440 stp x0, x1, [x2, #16]
818c8: 910043a0 add x0, x29, #0x10
818cc: aa0003e3 mov x3, x0
818d0: f9401fa2 ldr x2, [x29, #56]
818d4: aa0503e1 mov x1, x5
818d8: aa0403e0 mov x0, x4
818dc: 97fffebc bl 813cc <tfp_format>
va_end(va);
}
818e0: d503201f nop
818e4: a8ca7bfd ldp x29, x30, [sp], #160
818e8: d65f03c0 ret
00000000000818ec <putcp>:
static void putcp(void* p,char c)
{
818ec: d10043ff sub sp, sp, #0x10
818f0: f90007e0 str x0, [sp, #8]
818f4: 39001fe1 strb w1, [sp, #7]
*(*((char**)p))++ = c;
818f8: f94007e0 ldr x0, [sp, #8]
818fc: f9400000 ldr x0, [x0]
81900: 91000402 add x2, x0, #0x1
81904: f94007e1 ldr x1, [sp, #8]
81908: f9000022 str x2, [x1]
8190c: 39401fe1 ldrb w1, [sp, #7]
81910: 39000001 strb w1, [x0]
}
81914: d503201f nop
81918: 910043ff add sp, sp, #0x10
8191c: d65f03c0 ret
0000000000081920 <tfp_sprintf>:
void tfp_sprintf(char* s,char *fmt, ...)
{
81920: a9b77bfd stp x29, x30, [sp, #-144]!
81924: 910003fd mov x29, sp
81928: f9001fa0 str x0, [x29, #56]
8192c: f9001ba1 str x1, [x29, #48]
81930: f90033a2 str x2, [x29, #96]
81934: f90037a3 str x3, [x29, #104]
81938: f9003ba4 str x4, [x29, #112]
8193c: f9003fa5 str x5, [x29, #120]
81940: f90043a6 str x6, [x29, #128]
81944: f90047a7 str x7, [x29, #136]
va_list va;
va_start(va,fmt);
81948: 910243a0 add x0, x29, #0x90
8194c: f90023a0 str x0, [x29, #64]
81950: 910243a0 add x0, x29, #0x90
81954: f90027a0 str x0, [x29, #72]
81958: 910183a0 add x0, x29, #0x60
8195c: f9002ba0 str x0, [x29, #80]
81960: 128005e0 mov w0, #0xffffffd0 // #-48
81964: b9005ba0 str w0, [x29, #88]
81968: b9005fbf str wzr, [x29, #92]
tfp_format(&s,putcp,fmt,va);
8196c: 910043a2 add x2, x29, #0x10
81970: 910103a3 add x3, x29, #0x40
81974: a9400460 ldp x0, x1, [x3]
81978: a9000440 stp x0, x1, [x2]
8197c: a9410460 ldp x0, x1, [x3, #16]
81980: a9010440 stp x0, x1, [x2, #16]
81984: 910043a2 add x2, x29, #0x10
81988: 90000000 adrp x0, 81000 <copy_process+0xa8>
8198c: 9123b001 add x1, x0, #0x8ec
81990: 9100e3a0 add x0, x29, #0x38
81994: aa0203e3 mov x3, x2
81998: f9401ba2 ldr x2, [x29, #48]
8199c: 97fffe8c bl 813cc <tfp_format>
putcp(&s,0);
819a0: 9100e3a0 add x0, x29, #0x38
819a4: 52800001 mov w1, #0x0 // #0
819a8: 97ffffd1 bl 818ec <putcp>
va_end(va);
}
819ac: d503201f nop
819b0: a8c97bfd ldp x29, x30, [sp], #144
819b4: d65f03c0 ret
00000000000819b8 <timer_init>:
/* These are for Arm generic timer.
They are fully functional on both QEMU and Rpi3
Recommended.
*/
void generic_timer_init ( void )
819b8: a9bf7bfd stp x29, x30, [sp, #-16]!
819bc: 910003fd mov x29, sp
{
819c0: d2860080 mov x0, #0x3004 // #12292
819c4: f2a7e000 movk x0, #0x3f00, lsl #16
819c8: 9400004c bl 81af8 <get32>
819cc: 2a0003e1 mov w1, w0
819d0: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
819d4: 91302000 add x0, x0, #0xc08
819d8: b9000001 str w1, [x0]
gen_timer_init();
819dc: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
819e0: 91302000 add x0, x0, #0xc08
819e4: b9400001 ldr w1, [x0]
819e8: 5281a800 mov w0, #0xd40 // #3392
819ec: 72a00060 movk w0, #0x3, lsl #16
819f0: 0b000021 add w1, w1, w0
819f4: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
819f8: 91302000 add x0, x0, #0xc08
819fc: b9000001 str w1, [x0]
gen_timer_reset();
81a00: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
81a04: 91302000 add x0, x0, #0xc08
81a08: b9400000 ldr w0, [x0]
81a0c: 2a0003e1 mov w1, w0
81a10: d2860200 mov x0, #0x3010 // #12304
81a14: f2a7e000 movk x0, #0x3f00, lsl #16
81a18: 94000036 bl 81af0 <put32>
}
81a1c: d503201f nop
81a20: a8c17bfd ldp x29, x30, [sp], #16
81a24: d65f03c0 ret
0000000000081a28 <handle_timer_irq>:
void handle_generic_timer_irq( void )
{
81a28: a9bf7bfd stp x29, x30, [sp, #-16]!
81a2c: 910003fd mov x29, sp
gen_timer_reset();
81a30: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
81a34: 91302000 add x0, x0, #0xc08
81a38: b9400001 ldr w1, [x0]
81a3c: 5281a800 mov w0, #0xd40 // #3392
81a40: 72a00060 movk w0, #0x3, lsl #16
81a44: 0b000021 add w1, w1, w0
81a48: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
81a4c: 91302000 add x0, x0, #0xc08
81a50: b9000001 str w1, [x0]
timer_tick();
81a54: f00003e0 adrp x0, 100000 <bss_begin+0x7cc08>
81a58: 91302000 add x0, x0, #0xc08
81a5c: b9400000 ldr w0, [x0]
81a60: 2a0003e1 mov w1, w0
81a64: d2860200 mov x0, #0x3010 // #12304
81a68: f2a7e000 movk x0, #0x3f00, lsl #16
81a6c: 94000021 bl 81af0 <put32>
}
81a70: 52800041 mov w1, #0x2 // #2
81a74: d2860000 mov x0, #0x3000 // #12288
81a78: f2a7e000 movk x0, #0x3f00, lsl #16
81a7c: 9400001d bl 81af0 <put32>
81a80: 97fffd17 bl 80edc <timer_tick>
/*
81a84: d503201f nop
81a88: a8c17bfd ldp x29, x30, [sp], #16
81a8c: d65f03c0 ret
0000000000081a90 <generic_timer_init>:
These are for "System Timer". They are NOT in use by this project.
I leave the code here FYI.
Rpi3: System Timer works fine. Can generate intrerrupts and be used as a counter for timekeeping.
81a90: a9bf7bfd stp x29, x30, [sp, #-16]!
81a94: 910003fd mov x29, sp
QEMU: System Timer can be used for timekeeping. Cannot generate interrupts.
81a98: 9400000c bl 81ac8 <gen_timer_init>
See our documentation:
81a9c: 9400000e bl 81ad4 <gen_timer_reset>
https://fxlin.github.io/p1-kernel/lesson03/rpi-os/#fyi-other-timers-on-rpi3
81aa0: d503201f nop
81aa4: a8c17bfd ldp x29, x30, [sp], #16
81aa8: d65f03c0 ret
0000000000081aac <handle_generic_timer_irq>:
*/
const unsigned int interval = 200000;
81aac: a9bf7bfd stp x29, x30, [sp, #-16]!
81ab0: 910003fd mov x29, sp
unsigned int curVal = 0;
81ab4: 94000008 bl 81ad4 <gen_timer_reset>
81ab8: 97fffd09 bl 80edc <timer_tick>
void timer_init ( void )
81abc: d503201f nop
81ac0: a8c17bfd ldp x29, x30, [sp], #16
81ac4: d65f03c0 ret
0000000000081ac8 <gen_timer_init>:
* https://developer.arm.com/docs/ddi0487/ca/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile
*/
.globl gen_timer_init
gen_timer_init:
mov x0, #1
81ac8: d2800020 mov x0, #0x1 // #1
msr CNTP_CTL_EL0, x0
81acc: d51be220 msr cntp_ctl_el0, x0
ret
81ad0: d65f03c0 ret
0000000000081ad4 <gen_timer_reset>:
.globl gen_timer_reset
gen_timer_reset:
mov x0, #1
81ad4: d2800020 mov x0, #0x1 // #1
lsl x0, x0, #24
81ad8: d3689c00 lsl x0, x0, #24
msr CNTP_TVAL_EL0, x0
81adc: d51be200 msr cntp_tval_el0, x0
81ae0: d65f03c0 ret
0000000000081ae4 <get_el>:
.globl get_el
get_el:
mrs x0, CurrentEL
81ae4: d5384240 mrs x0, currentel
lsr x0, x0, #2
81ae8: d342fc00 lsr x0, x0, #2
ret
81aec: d65f03c0 ret
0000000000081af0 <put32>:
.globl put32
put32:
str w1,[x0]
81af0: b9000001 str w1, [x0]
ret
81af4: d65f03c0 ret
0000000000081af8 <get32>:
.globl get32
get32:
ldr w0,[x0]
81af8: b9400000 ldr w0, [x0]
ret
81afc: d65f03c0 ret
0000000000081b00 <delay>:
.globl delay
delay:
subs x0, x0, #1
81b00: f1000400 subs x0, x0, #0x1
bne delay
81b04: 54ffffe1 b.ne 81b00 <delay> // b.any
ret
81b08: d65f03c0 ret
0000000000081b0c <irq_vector_init>:
.globl irq_vector_init
irq_vector_init:
adr x0, vectors // load VBAR_EL1 with virtual
81b0c: 100027a0 adr x0, 82000 <vectors>
msr vbar_el1, x0 // vector table address
81b10: d518c000 msr vbar_el1, x0
ret
81b14: d65f03c0 ret
0000000000081b18 <enable_irq>:
.globl enable_irq
enable_irq:
msr daifclr, #2
81b18: d50342ff msr daifclr, #0x2
ret
81b1c: d65f03c0 ret
0000000000081b20 <disable_irq>:
.globl disable_irq
disable_irq:
msr daifset, #2
81b20: d50342df msr daifset, #0x2
ret
81b24: d65f03c0 ret
...
0000000000082000 <vectors>:
* Exception vectors.
*/
.align 11
.globl vectors
vectors:
ventry sync_invalid_el1t // Synchronous EL1t
82000: 140001e1 b 82784 <sync_invalid_el1t>
82004: d503201f nop
82008: d503201f nop
8200c: d503201f nop
82010: d503201f nop
82014: d503201f nop
82018: d503201f nop
8201c: d503201f nop
82020: d503201f nop
82024: d503201f nop
82028: d503201f nop
8202c: d503201f nop
82030: d503201f nop
82034: d503201f nop
82038: d503201f nop
8203c: d503201f nop
82040: d503201f nop
82044: d503201f nop
82048: d503201f nop
8204c: d503201f nop
82050: d503201f nop
82054: d503201f nop
82058: d503201f nop
8205c: d503201f nop
82060: d503201f nop
82064: d503201f nop
82068: d503201f nop
8206c: d503201f nop
82070: d503201f nop
82074: d503201f nop
82078: d503201f nop
8207c: d503201f nop
ventry irq_invalid_el1t // IRQ EL1t
82080: 140001da b 827e8 <irq_invalid_el1t>
82084: d503201f nop
82088: d503201f nop
8208c: d503201f nop
82090: d503201f nop
82094: d503201f nop
82098: d503201f nop
8209c: d503201f nop
820a0: d503201f nop
820a4: d503201f nop
820a8: d503201f nop
820ac: d503201f nop
820b0: d503201f nop
820b4: d503201f nop
820b8: d503201f nop
820bc: d503201f nop
820c0: d503201f nop
820c4: d503201f nop
820c8: d503201f nop
820cc: d503201f nop
820d0: d503201f nop
820d4: d503201f nop
820d8: d503201f nop
820dc: d503201f nop
820e0: d503201f nop
820e4: d503201f nop
820e8: d503201f nop
820ec: d503201f nop
820f0: d503201f nop
820f4: d503201f nop
820f8: d503201f nop
820fc: d503201f nop
ventry fiq_invalid_el1t // FIQ EL1t
82100: 140001d3 b 8284c <fiq_invalid_el1t>
82104: d503201f nop
82108: d503201f nop
8210c: d503201f nop
82110: d503201f nop
82114: d503201f nop
82118: d503201f nop
8211c: d503201f nop
82120: d503201f nop
82124: d503201f nop
82128: d503201f nop
8212c: d503201f nop
82130: d503201f nop
82134: d503201f nop
82138: d503201f nop
8213c: d503201f nop
82140: d503201f nop
82144: d503201f nop
82148: d503201f nop
8214c: d503201f nop
82150: d503201f nop
82154: d503201f nop
82158: d503201f nop
8215c: d503201f nop
82160: d503201f nop
82164: d503201f nop
82168: d503201f nop
8216c: d503201f nop
82170: d503201f nop
82174: d503201f nop
82178: d503201f nop
8217c: d503201f nop
ventry error_invalid_el1t // Error EL1t
82180: 140001cc b 828b0 <error_invalid_el1t>
82184: d503201f nop
82188: d503201f nop
8218c: d503201f nop
82190: d503201f nop
82194: d503201f nop
82198: d503201f nop
8219c: d503201f nop
821a0: d503201f nop
821a4: d503201f nop
821a8: d503201f nop
821ac: d503201f nop
821b0: d503201f nop
821b4: d503201f nop
821b8: d503201f nop
821bc: d503201f nop
821c0: d503201f nop
821c4: d503201f nop
821c8: d503201f nop
821cc: d503201f nop
821d0: d503201f nop
821d4: d503201f nop
821d8: d503201f nop
821dc: d503201f nop
821e0: d503201f nop
821e4: d503201f nop
821e8: d503201f nop
821ec: d503201f nop
821f0: d503201f nop
821f4: d503201f nop
821f8: d503201f nop
821fc: d503201f nop
ventry sync_invalid_el1h // Synchronous EL1h
82200: 140001c5 b 82914 <sync_invalid_el1h>
82204: d503201f nop
82208: d503201f nop
8220c: d503201f nop
82210: d503201f nop
82214: d503201f nop
82218: d503201f nop
8221c: d503201f nop
82220: d503201f nop
82224: d503201f nop
82228: d503201f nop
8222c: d503201f nop
82230: d503201f nop
82234: d503201f nop
82238: d503201f nop
8223c: d503201f nop
82240: d503201f nop
82244: d503201f nop
82248: d503201f nop
8224c: d503201f nop
82250: d503201f nop
82254: d503201f nop
82258: d503201f nop
8225c: d503201f nop
82260: d503201f nop
82264: d503201f nop
82268: d503201f nop
8226c: d503201f nop
82270: d503201f nop
82274: d503201f nop
82278: d503201f nop
8227c: d503201f nop
ventry el1_irq // IRQ EL1h
82280: 140002b8 b 82d60 <el1_irq>
82284: d503201f nop
82288: d503201f nop
8228c: d503201f nop
82290: d503201f nop
82294: d503201f nop
82298: d503201f nop
8229c: d503201f nop
822a0: d503201f nop
822a4: d503201f nop
822a8: d503201f nop
822ac: d503201f nop
822b0: d503201f nop
822b4: d503201f nop
822b8: d503201f nop
822bc: d503201f nop
822c0: d503201f nop
822c4: d503201f nop
822c8: d503201f nop
822cc: d503201f nop
822d0: d503201f nop
822d4: d503201f nop
822d8: d503201f nop
822dc: d503201f nop
822e0: d503201f nop
822e4: d503201f nop
822e8: d503201f nop
822ec: d503201f nop
822f0: d503201f nop
822f4: d503201f nop
822f8: d503201f nop
822fc: d503201f nop
ventry fiq_invalid_el1h // FIQ EL1h
82300: 1400019e b 82978 <fiq_invalid_el1h>
82304: d503201f nop
82308: d503201f nop
8230c: d503201f nop
82310: d503201f nop
82314: d503201f nop
82318: d503201f nop
8231c: d503201f nop
82320: d503201f nop
82324: d503201f nop
82328: d503201f nop
8232c: d503201f nop
82330: d503201f nop
82334: d503201f nop
82338: d503201f nop
8233c: d503201f nop
82340: d503201f nop
82344: d503201f nop
82348: d503201f nop
8234c: d503201f nop
82350: d503201f nop
82354: d503201f nop
82358: d503201f nop
8235c: d503201f nop
82360: d503201f nop
82364: d503201f nop
82368: d503201f nop
8236c: d503201f nop
82370: d503201f nop
82374: d503201f nop
82378: d503201f nop
8237c: d503201f nop
ventry error_invalid_el1h // Error EL1h
82380: 14000197 b 829dc <error_invalid_el1h>
82384: d503201f nop
82388: d503201f nop
8238c: d503201f nop
82390: d503201f nop
82394: d503201f nop
82398: d503201f nop
8239c: d503201f nop
823a0: d503201f nop
823a4: d503201f nop
823a8: d503201f nop
823ac: d503201f nop
823b0: d503201f nop
823b4: d503201f nop
823b8: d503201f nop
823bc: d503201f nop
823c0: d503201f nop
823c4: d503201f nop
823c8: d503201f nop
823cc: d503201f nop
823d0: d503201f nop
823d4: d503201f nop
823d8: d503201f nop
823dc: d503201f nop
823e0: d503201f nop
823e4: d503201f nop
823e8: d503201f nop
823ec: d503201f nop
823f0: d503201f nop
823f4: d503201f nop
823f8: d503201f nop
823fc: d503201f nop
ventry sync_invalid_el0_64 // Synchronous 64-bit EL0
82400: 14000190 b 82a40 <sync_invalid_el0_64>
82404: d503201f nop
82408: d503201f nop
8240c: d503201f nop
82410: d503201f nop
82414: d503201f nop
82418: d503201f nop
8241c: d503201f nop
82420: d503201f nop
82424: d503201f nop
82428: d503201f nop
8242c: d503201f nop
82430: d503201f nop
82434: d503201f nop
82438: d503201f nop
8243c: d503201f nop
82440: d503201f nop
82444: d503201f nop
82448: d503201f nop
8244c: d503201f nop
82450: d503201f nop
82454: d503201f nop
82458: d503201f nop
8245c: d503201f nop
82460: d503201f nop
82464: d503201f nop
82468: d503201f nop
8246c: d503201f nop
82470: d503201f nop
82474: d503201f nop
82478: d503201f nop
8247c: d503201f nop
ventry irq_invalid_el0_64 // IRQ 64-bit EL0
82480: 14000189 b 82aa4 <irq_invalid_el0_64>
82484: d503201f nop
82488: d503201f nop
8248c: d503201f nop
82490: d503201f nop
82494: d503201f nop
82498: d503201f nop
8249c: d503201f nop
824a0: d503201f nop
824a4: d503201f nop
824a8: d503201f nop
824ac: d503201f nop
824b0: d503201f nop
824b4: d503201f nop
824b8: d503201f nop
824bc: d503201f nop
824c0: d503201f nop
824c4: d503201f nop
824c8: d503201f nop
824cc: d503201f nop
824d0: d503201f nop
824d4: d503201f nop
824d8: d503201f nop
824dc: d503201f nop
824e0: d503201f nop
824e4: d503201f nop
824e8: d503201f nop
824ec: d503201f nop
824f0: d503201f nop
824f4: d503201f nop
824f8: d503201f nop
824fc: d503201f nop
ventry fiq_invalid_el0_64 // FIQ 64-bit EL0
82500: 14000182 b 82b08 <fiq_invalid_el0_64>
82504: d503201f nop
82508: d503201f nop
8250c: d503201f nop
82510: d503201f nop
82514: d503201f nop
82518: d503201f nop
8251c: d503201f nop
82520: d503201f nop
82524: d503201f nop
82528: d503201f nop
8252c: d503201f nop
82530: d503201f nop
82534: d503201f nop
82538: d503201f nop
8253c: d503201f nop
82540: d503201f nop
82544: d503201f nop
82548: d503201f nop
8254c: d503201f nop
82550: d503201f nop
82554: d503201f nop
82558: d503201f nop
8255c: d503201f nop
82560: d503201f nop
82564: d503201f nop
82568: d503201f nop
8256c: d503201f nop
82570: d503201f nop
82574: d503201f nop
82578: d503201f nop
8257c: d503201f nop
ventry error_invalid_el0_64 // Error 64-bit EL0
82580: 1400017b b 82b6c <error_invalid_el0_64>
82584: d503201f nop
82588: d503201f nop
8258c: d503201f nop
82590: d503201f nop
82594: d503201f nop
82598: d503201f nop
8259c: d503201f nop
825a0: d503201f nop
825a4: d503201f nop
825a8: d503201f nop
825ac: d503201f nop
825b0: d503201f nop
825b4: d503201f nop
825b8: d503201f nop
825bc: d503201f nop
825c0: d503201f nop
825c4: d503201f nop
825c8: d503201f nop
825cc: d503201f nop
825d0: d503201f nop
825d4: d503201f nop
825d8: d503201f nop
825dc: d503201f nop
825e0: d503201f nop
825e4: d503201f nop
825e8: d503201f nop
825ec: d503201f nop
825f0: d503201f nop
825f4: d503201f nop
825f8: d503201f nop
825fc: d503201f nop
ventry sync_invalid_el0_32 // Synchronous 32-bit EL0
82600: 14000174 b 82bd0 <sync_invalid_el0_32>
82604: d503201f nop
82608: d503201f nop
8260c: d503201f nop
82610: d503201f nop
82614: d503201f nop
82618: d503201f nop
8261c: d503201f nop
82620: d503201f nop
82624: d503201f nop
82628: d503201f nop
8262c: d503201f nop
82630: d503201f nop
82634: d503201f nop
82638: d503201f nop
8263c: d503201f nop
82640: d503201f nop
82644: d503201f nop
82648: d503201f nop
8264c: d503201f nop
82650: d503201f nop
82654: d503201f nop
82658: d503201f nop
8265c: d503201f nop
82660: d503201f nop
82664: d503201f nop
82668: d503201f nop
8266c: d503201f nop
82670: d503201f nop
82674: d503201f nop
82678: d503201f nop
8267c: d503201f nop
ventry irq_invalid_el0_32 // IRQ 32-bit EL0
82680: 1400016d b 82c34 <irq_invalid_el0_32>
82684: d503201f nop
82688: d503201f nop
8268c: d503201f nop
82690: d503201f nop
82694: d503201f nop
82698: d503201f nop
8269c: d503201f nop
826a0: d503201f nop
826a4: d503201f nop
826a8: d503201f nop
826ac: d503201f nop
826b0: d503201f nop
826b4: d503201f nop
826b8: d503201f nop
826bc: d503201f nop
826c0: d503201f nop
826c4: d503201f nop
826c8: d503201f nop
826cc: d503201f nop
826d0: d503201f nop
826d4: d503201f nop
826d8: d503201f nop
826dc: d503201f nop
826e0: d503201f nop
826e4: d503201f nop
826e8: d503201f nop
826ec: d503201f nop
826f0: d503201f nop
826f4: d503201f nop
826f8: d503201f nop
826fc: d503201f nop
ventry fiq_invalid_el0_32 // FIQ 32-bit EL0
82700: 14000166 b 82c98 <fiq_invalid_el0_32>
82704: d503201f nop
82708: d503201f nop
8270c: d503201f nop
82710: d503201f nop
82714: d503201f nop
82718: d503201f nop
8271c: d503201f nop
82720: d503201f nop
82724: d503201f nop
82728: d503201f nop
8272c: d503201f nop
82730: d503201f nop
82734: d503201f nop
82738: d503201f nop
8273c: d503201f nop
82740: d503201f nop
82744: d503201f nop
82748: d503201f nop
8274c: d503201f nop
82750: d503201f nop
82754: d503201f nop
82758: d503201f nop
8275c: d503201f nop
82760: d503201f nop
82764: d503201f nop
82768: d503201f nop
8276c: d503201f nop
82770: d503201f nop
82774: d503201f nop
82778: d503201f nop
8277c: d503201f nop
ventry error_invalid_el0_32 // Error 32-bit EL0
82780: 1400015f b 82cfc <error_invalid_el0_32>
0000000000082784 <sync_invalid_el1t>:
sync_invalid_el1t:
handle_invalid_entry SYNC_INVALID_EL1t
82784: d10443ff sub sp, sp, #0x110
82788: a90007e0 stp x0, x1, [sp]
8278c: a9010fe2 stp x2, x3, [sp, #16]
82790: a90217e4 stp x4, x5, [sp, #32]
82794: a9031fe6 stp x6, x7, [sp, #48]
82798: a90427e8 stp x8, x9, [sp, #64]
8279c: a9052fea stp x10, x11, [sp, #80]
827a0: a90637ec stp x12, x13, [sp, #96]
827a4: a9073fee stp x14, x15, [sp, #112]
827a8: a90847f0 stp x16, x17, [sp, #128]
827ac: a9094ff2 stp x18, x19, [sp, #144]
827b0: a90a57f4 stp x20, x21, [sp, #160]
827b4: a90b5ff6 stp x22, x23, [sp, #176]
827b8: a90c67f8 stp x24, x25, [sp, #192]
827bc: a90d6ffa stp x26, x27, [sp, #208]
827c0: a90e77fc stp x28, x29, [sp, #224]
827c4: d5384036 mrs x22, elr_el1
827c8: d5384017 mrs x23, spsr_el1
827cc: a90f5bfe stp x30, x22, [sp, #240]
827d0: f90083f7 str x23, [sp, #256]
827d4: d2800000 mov x0, #0x0 // #0
827d8: d5385201 mrs x1, esr_el1
827dc: d5384022 mrs x2, elr_el1
827e0: 97fff86a bl 80988 <show_invalid_entry_message>
827e4: 1400018c b 82e14 <err_hang>
00000000000827e8 <irq_invalid_el1t>:
irq_invalid_el1t:
handle_invalid_entry IRQ_INVALID_EL1t
827e8: d10443ff sub sp, sp, #0x110
827ec: a90007e0 stp x0, x1, [sp]
827f0: a9010fe2 stp x2, x3, [sp, #16]
827f4: a90217e4 stp x4, x5, [sp, #32]
827f8: a9031fe6 stp x6, x7, [sp, #48]
827fc: a90427e8 stp x8, x9, [sp, #64]
82800: a9052fea stp x10, x11, [sp, #80]
82804: a90637ec stp x12, x13, [sp, #96]
82808: a9073fee stp x14, x15, [sp, #112]
8280c: a90847f0 stp x16, x17, [sp, #128]
82810: a9094ff2 stp x18, x19, [sp, #144]
82814: a90a57f4 stp x20, x21, [sp, #160]
82818: a90b5ff6 stp x22, x23, [sp, #176]
8281c: a90c67f8 stp x24, x25, [sp, #192]
82820: a90d6ffa stp x26, x27, [sp, #208]
82824: a90e77fc stp x28, x29, [sp, #224]
82828: d5384036 mrs x22, elr_el1
8282c: d5384017 mrs x23, spsr_el1
82830: a90f5bfe stp x30, x22, [sp, #240]
82834: f90083f7 str x23, [sp, #256]
82838: d2800020 mov x0, #0x1 // #1
8283c: d5385201 mrs x1, esr_el1
82840: d5384022 mrs x2, elr_el1
82844: 97fff851 bl 80988 <show_invalid_entry_message>
82848: 14000173 b 82e14 <err_hang>
000000000008284c <fiq_invalid_el1t>:
fiq_invalid_el1t:
handle_invalid_entry FIQ_INVALID_EL1t
8284c: d10443ff sub sp, sp, #0x110
82850: a90007e0 stp x0, x1, [sp]
82854: a9010fe2 stp x2, x3, [sp, #16]
82858: a90217e4 stp x4, x5, [sp, #32]
8285c: a9031fe6 stp x6, x7, [sp, #48]
82860: a90427e8 stp x8, x9, [sp, #64]
82864: a9052fea stp x10, x11, [sp, #80]
82868: a90637ec stp x12, x13, [sp, #96]
8286c: a9073fee stp x14, x15, [sp, #112]
82870: a90847f0 stp x16, x17, [sp, #128]
82874: a9094ff2 stp x18, x19, [sp, #144]
82878: a90a57f4 stp x20, x21, [sp, #160]
8287c: a90b5ff6 stp x22, x23, [sp, #176]
82880: a90c67f8 stp x24, x25, [sp, #192]
82884: a90d6ffa stp x26, x27, [sp, #208]
82888: a90e77fc stp x28, x29, [sp, #224]
8288c: d5384036 mrs x22, elr_el1
82890: d5384017 mrs x23, spsr_el1
82894: a90f5bfe stp x30, x22, [sp, #240]
82898: f90083f7 str x23, [sp, #256]
8289c: d2800040 mov x0, #0x2 // #2
828a0: d5385201 mrs x1, esr_el1
828a4: d5384022 mrs x2, elr_el1
828a8: 97fff838 bl 80988 <show_invalid_entry_message>
828ac: 1400015a b 82e14 <err_hang>
00000000000828b0 <error_invalid_el1t>:
error_invalid_el1t:
handle_invalid_entry ERROR_INVALID_EL1t
828b0: d10443ff sub sp, sp, #0x110
828b4: a90007e0 stp x0, x1, [sp]
828b8: a9010fe2 stp x2, x3, [sp, #16]
828bc: a90217e4 stp x4, x5, [sp, #32]
828c0: a9031fe6 stp x6, x7, [sp, #48]
828c4: a90427e8 stp x8, x9, [sp, #64]
828c8: a9052fea stp x10, x11, [sp, #80]
828cc: a90637ec stp x12, x13, [sp, #96]
828d0: a9073fee stp x14, x15, [sp, #112]
828d4: a90847f0 stp x16, x17, [sp, #128]
828d8: a9094ff2 stp x18, x19, [sp, #144]
828dc: a90a57f4 stp x20, x21, [sp, #160]
828e0: a90b5ff6 stp x22, x23, [sp, #176]
828e4: a90c67f8 stp x24, x25, [sp, #192]
828e8: a90d6ffa stp x26, x27, [sp, #208]
828ec: a90e77fc stp x28, x29, [sp, #224]
828f0: d5384036 mrs x22, elr_el1
828f4: d5384017 mrs x23, spsr_el1
828f8: a90f5bfe stp x30, x22, [sp, #240]
828fc: f90083f7 str x23, [sp, #256]
82900: d2800060 mov x0, #0x3 // #3
82904: d5385201 mrs x1, esr_el1
82908: d5384022 mrs x2, elr_el1
8290c: 97fff81f bl 80988 <show_invalid_entry_message>
82910: 14000141 b 82e14 <err_hang>
0000000000082914 <sync_invalid_el1h>:
sync_invalid_el1h:
handle_invalid_entry SYNC_INVALID_EL1h
82914: d10443ff sub sp, sp, #0x110
82918: a90007e0 stp x0, x1, [sp]
8291c: a9010fe2 stp x2, x3, [sp, #16]
82920: a90217e4 stp x4, x5, [sp, #32]
82924: a9031fe6 stp x6, x7, [sp, #48]
82928: a90427e8 stp x8, x9, [sp, #64]
8292c: a9052fea stp x10, x11, [sp, #80]
82930: a90637ec stp x12, x13, [sp, #96]
82934: a9073fee stp x14, x15, [sp, #112]
82938: a90847f0 stp x16, x17, [sp, #128]
8293c: a9094ff2 stp x18, x19, [sp, #144]
82940: a90a57f4 stp x20, x21, [sp, #160]
82944: a90b5ff6 stp x22, x23, [sp, #176]
82948: a90c67f8 stp x24, x25, [sp, #192]
8294c: a90d6ffa stp x26, x27, [sp, #208]
82950: a90e77fc stp x28, x29, [sp, #224]
82954: d5384036 mrs x22, elr_el1
82958: d5384017 mrs x23, spsr_el1
8295c: a90f5bfe stp x30, x22, [sp, #240]
82960: f90083f7 str x23, [sp, #256]
82964: d2800080 mov x0, #0x4 // #4
82968: d5385201 mrs x1, esr_el1
8296c: d5384022 mrs x2, elr_el1
82970: 97fff806 bl 80988 <show_invalid_entry_message>
82974: 14000128 b 82e14 <err_hang>
0000000000082978 <fiq_invalid_el1h>:
fiq_invalid_el1h:
handle_invalid_entry FIQ_INVALID_EL1h
82978: d10443ff sub sp, sp, #0x110
8297c: a90007e0 stp x0, x1, [sp]
82980: a9010fe2 stp x2, x3, [sp, #16]
82984: a90217e4 stp x4, x5, [sp, #32]
82988: a9031fe6 stp x6, x7, [sp, #48]
8298c: a90427e8 stp x8, x9, [sp, #64]
82990: a9052fea stp x10, x11, [sp, #80]
82994: a90637ec stp x12, x13, [sp, #96]
82998: a9073fee stp x14, x15, [sp, #112]
8299c: a90847f0 stp x16, x17, [sp, #128]
829a0: a9094ff2 stp x18, x19, [sp, #144]
829a4: a90a57f4 stp x20, x21, [sp, #160]
829a8: a90b5ff6 stp x22, x23, [sp, #176]
829ac: a90c67f8 stp x24, x25, [sp, #192]
829b0: a90d6ffa stp x26, x27, [sp, #208]
829b4: a90e77fc stp x28, x29, [sp, #224]
829b8: d5384036 mrs x22, elr_el1
829bc: d5384017 mrs x23, spsr_el1
829c0: a90f5bfe stp x30, x22, [sp, #240]
829c4: f90083f7 str x23, [sp, #256]
829c8: d28000c0 mov x0, #0x6 // #6
829cc: d5385201 mrs x1, esr_el1
829d0: d5384022 mrs x2, elr_el1
829d4: 97fff7ed bl 80988 <show_invalid_entry_message>
829d8: 1400010f b 82e14 <err_hang>
00000000000829dc <error_invalid_el1h>:
error_invalid_el1h:
handle_invalid_entry ERROR_INVALID_EL1h
829dc: d10443ff sub sp, sp, #0x110
829e0: a90007e0 stp x0, x1, [sp]
829e4: a9010fe2 stp x2, x3, [sp, #16]
829e8: a90217e4 stp x4, x5, [sp, #32]
829ec: a9031fe6 stp x6, x7, [sp, #48]
829f0: a90427e8 stp x8, x9, [sp, #64]
829f4: a9052fea stp x10, x11, [sp, #80]
829f8: a90637ec stp x12, x13, [sp, #96]
829fc: a9073fee stp x14, x15, [sp, #112]
82a00: a90847f0 stp x16, x17, [sp, #128]
82a04: a9094ff2 stp x18, x19, [sp, #144]
82a08: a90a57f4 stp x20, x21, [sp, #160]
82a0c: a90b5ff6 stp x22, x23, [sp, #176]
82a10: a90c67f8 stp x24, x25, [sp, #192]
82a14: a90d6ffa stp x26, x27, [sp, #208]
82a18: a90e77fc stp x28, x29, [sp, #224]
82a1c: d5384036 mrs x22, elr_el1
82a20: d5384017 mrs x23, spsr_el1
82a24: a90f5bfe stp x30, x22, [sp, #240]
82a28: f90083f7 str x23, [sp, #256]
82a2c: d28000e0 mov x0, #0x7 // #7
82a30: d5385201 mrs x1, esr_el1
82a34: d5384022 mrs x2, elr_el1
82a38: 97fff7d4 bl 80988 <show_invalid_entry_message>
82a3c: 140000f6 b 82e14 <err_hang>
0000000000082a40 <sync_invalid_el0_64>:
sync_invalid_el0_64:
handle_invalid_entry SYNC_INVALID_EL0_64
82a40: d10443ff sub sp, sp, #0x110
82a44: a90007e0 stp x0, x1, [sp]
82a48: a9010fe2 stp x2, x3, [sp, #16]
82a4c: a90217e4 stp x4, x5, [sp, #32]
82a50: a9031fe6 stp x6, x7, [sp, #48]
82a54: a90427e8 stp x8, x9, [sp, #64]
82a58: a9052fea stp x10, x11, [sp, #80]
82a5c: a90637ec stp x12, x13, [sp, #96]
82a60: a9073fee stp x14, x15, [sp, #112]
82a64: a90847f0 stp x16, x17, [sp, #128]
82a68: a9094ff2 stp x18, x19, [sp, #144]
82a6c: a90a57f4 stp x20, x21, [sp, #160]
82a70: a90b5ff6 stp x22, x23, [sp, #176]
82a74: a90c67f8 stp x24, x25, [sp, #192]
82a78: a90d6ffa stp x26, x27, [sp, #208]
82a7c: a90e77fc stp x28, x29, [sp, #224]
82a80: d5384036 mrs x22, elr_el1
82a84: d5384017 mrs x23, spsr_el1
82a88: a90f5bfe stp x30, x22, [sp, #240]
82a8c: f90083f7 str x23, [sp, #256]
82a90: d2800100 mov x0, #0x8 // #8
82a94: d5385201 mrs x1, esr_el1
82a98: d5384022 mrs x2, elr_el1
82a9c: 97fff7bb bl 80988 <show_invalid_entry_message>
82aa0: 140000dd b 82e14 <err_hang>
0000000000082aa4 <irq_invalid_el0_64>:
irq_invalid_el0_64:
handle_invalid_entry IRQ_INVALID_EL0_64
82aa4: d10443ff sub sp, sp, #0x110
82aa8: a90007e0 stp x0, x1, [sp]
82aac: a9010fe2 stp x2, x3, [sp, #16]
82ab0: a90217e4 stp x4, x5, [sp, #32]
82ab4: a9031fe6 stp x6, x7, [sp, #48]
82ab8: a90427e8 stp x8, x9, [sp, #64]
82abc: a9052fea stp x10, x11, [sp, #80]
82ac0: a90637ec stp x12, x13, [sp, #96]
82ac4: a9073fee stp x14, x15, [sp, #112]
82ac8: a90847f0 stp x16, x17, [sp, #128]
82acc: a9094ff2 stp x18, x19, [sp, #144]
82ad0: a90a57f4 stp x20, x21, [sp, #160]
82ad4: a90b5ff6 stp x22, x23, [sp, #176]
82ad8: a90c67f8 stp x24, x25, [sp, #192]
82adc: a90d6ffa stp x26, x27, [sp, #208]
82ae0: a90e77fc stp x28, x29, [sp, #224]
82ae4: d5384036 mrs x22, elr_el1
82ae8: d5384017 mrs x23, spsr_el1
82aec: a90f5bfe stp x30, x22, [sp, #240]
82af0: f90083f7 str x23, [sp, #256]
82af4: d2800120 mov x0, #0x9 // #9
82af8: d5385201 mrs x1, esr_el1
82afc: d5384022 mrs x2, elr_el1
82b00: 97fff7a2 bl 80988 <show_invalid_entry_message>
82b04: 140000c4 b 82e14 <err_hang>
0000000000082b08 <fiq_invalid_el0_64>:
fiq_invalid_el0_64:
handle_invalid_entry FIQ_INVALID_EL0_64
82b08: d10443ff sub sp, sp, #0x110
82b0c: a90007e0 stp x0, x1, [sp]
82b10: a9010fe2 stp x2, x3, [sp, #16]
82b14: a90217e4 stp x4, x5, [sp, #32]
82b18: a9031fe6 stp x6, x7, [sp, #48]
82b1c: a90427e8 stp x8, x9, [sp, #64]
82b20: a9052fea stp x10, x11, [sp, #80]
82b24: a90637ec stp x12, x13, [sp, #96]
82b28: a9073fee stp x14, x15, [sp, #112]
82b2c: a90847f0 stp x16, x17, [sp, #128]
82b30: a9094ff2 stp x18, x19, [sp, #144]
82b34: a90a57f4 stp x20, x21, [sp, #160]
82b38: a90b5ff6 stp x22, x23, [sp, #176]
82b3c: a90c67f8 stp x24, x25, [sp, #192]
82b40: a90d6ffa stp x26, x27, [sp, #208]
82b44: a90e77fc stp x28, x29, [sp, #224]
82b48: d5384036 mrs x22, elr_el1
82b4c: d5384017 mrs x23, spsr_el1
82b50: a90f5bfe stp x30, x22, [sp, #240]
82b54: f90083f7 str x23, [sp, #256]
82b58: d2800140 mov x0, #0xa // #10
82b5c: d5385201 mrs x1, esr_el1
82b60: d5384022 mrs x2, elr_el1
82b64: 97fff789 bl 80988 <show_invalid_entry_message>
82b68: 140000ab b 82e14 <err_hang>
0000000000082b6c <error_invalid_el0_64>:
error_invalid_el0_64:
handle_invalid_entry ERROR_INVALID_EL0_64
82b6c: d10443ff sub sp, sp, #0x110
82b70: a90007e0 stp x0, x1, [sp]
82b74: a9010fe2 stp x2, x3, [sp, #16]
82b78: a90217e4 stp x4, x5, [sp, #32]
82b7c: a9031fe6 stp x6, x7, [sp, #48]
82b80: a90427e8 stp x8, x9, [sp, #64]
82b84: a9052fea stp x10, x11, [sp, #80]
82b88: a90637ec stp x12, x13, [sp, #96]
82b8c: a9073fee stp x14, x15, [sp, #112]
82b90: a90847f0 stp x16, x17, [sp, #128]
82b94: a9094ff2 stp x18, x19, [sp, #144]
82b98: a90a57f4 stp x20, x21, [sp, #160]
82b9c: a90b5ff6 stp x22, x23, [sp, #176]
82ba0: a90c67f8 stp x24, x25, [sp, #192]
82ba4: a90d6ffa stp x26, x27, [sp, #208]
82ba8: a90e77fc stp x28, x29, [sp, #224]
82bac: d5384036 mrs x22, elr_el1
82bb0: d5384017 mrs x23, spsr_el1
82bb4: a90f5bfe stp x30, x22, [sp, #240]
82bb8: f90083f7 str x23, [sp, #256]
82bbc: d2800160 mov x0, #0xb // #11
82bc0: d5385201 mrs x1, esr_el1
82bc4: d5384022 mrs x2, elr_el1
82bc8: 97fff770 bl 80988 <show_invalid_entry_message>
82bcc: 14000092 b 82e14 <err_hang>
0000000000082bd0 <sync_invalid_el0_32>:
sync_invalid_el0_32:
handle_invalid_entry SYNC_INVALID_EL0_32
82bd0: d10443ff sub sp, sp, #0x110
82bd4: a90007e0 stp x0, x1, [sp]
82bd8: a9010fe2 stp x2, x3, [sp, #16]
82bdc: a90217e4 stp x4, x5, [sp, #32]
82be0: a9031fe6 stp x6, x7, [sp, #48]
82be4: a90427e8 stp x8, x9, [sp, #64]
82be8: a9052fea stp x10, x11, [sp, #80]
82bec: a90637ec stp x12, x13, [sp, #96]
82bf0: a9073fee stp x14, x15, [sp, #112]
82bf4: a90847f0 stp x16, x17, [sp, #128]
82bf8: a9094ff2 stp x18, x19, [sp, #144]
82bfc: a90a57f4 stp x20, x21, [sp, #160]
82c00: a90b5ff6 stp x22, x23, [sp, #176]
82c04: a90c67f8 stp x24, x25, [sp, #192]
82c08: a90d6ffa stp x26, x27, [sp, #208]
82c0c: a90e77fc stp x28, x29, [sp, #224]
82c10: d5384036 mrs x22, elr_el1
82c14: d5384017 mrs x23, spsr_el1
82c18: a90f5bfe stp x30, x22, [sp, #240]
82c1c: f90083f7 str x23, [sp, #256]
82c20: d2800180 mov x0, #0xc // #12
82c24: d5385201 mrs x1, esr_el1
82c28: d5384022 mrs x2, elr_el1
82c2c: 97fff757 bl 80988 <show_invalid_entry_message>
82c30: 14000079 b 82e14 <err_hang>
0000000000082c34 <irq_invalid_el0_32>:
irq_invalid_el0_32:
handle_invalid_entry IRQ_INVALID_EL0_32
82c34: d10443ff sub sp, sp, #0x110
82c38: a90007e0 stp x0, x1, [sp]
82c3c: a9010fe2 stp x2, x3, [sp, #16]
82c40: a90217e4 stp x4, x5, [sp, #32]
82c44: a9031fe6 stp x6, x7, [sp, #48]
82c48: a90427e8 stp x8, x9, [sp, #64]
82c4c: a9052fea stp x10, x11, [sp, #80]
82c50: a90637ec stp x12, x13, [sp, #96]
82c54: a9073fee stp x14, x15, [sp, #112]
82c58: a90847f0 stp x16, x17, [sp, #128]
82c5c: a9094ff2 stp x18, x19, [sp, #144]
82c60: a90a57f4 stp x20, x21, [sp, #160]
82c64: a90b5ff6 stp x22, x23, [sp, #176]
82c68: a90c67f8 stp x24, x25, [sp, #192]
82c6c: a90d6ffa stp x26, x27, [sp, #208]
82c70: a90e77fc stp x28, x29, [sp, #224]
82c74: d5384036 mrs x22, elr_el1
82c78: d5384017 mrs x23, spsr_el1
82c7c: a90f5bfe stp x30, x22, [sp, #240]
82c80: f90083f7 str x23, [sp, #256]
82c84: d28001a0 mov x0, #0xd // #13
82c88: d5385201 mrs x1, esr_el1
82c8c: d5384022 mrs x2, elr_el1
82c90: 97fff73e bl 80988 <show_invalid_entry_message>
82c94: 14000060 b 82e14 <err_hang>
0000000000082c98 <fiq_invalid_el0_32>:
fiq_invalid_el0_32:
handle_invalid_entry FIQ_INVALID_EL0_32
82c98: d10443ff sub sp, sp, #0x110
82c9c: a90007e0 stp x0, x1, [sp]
82ca0: a9010fe2 stp x2, x3, [sp, #16]
82ca4: a90217e4 stp x4, x5, [sp, #32]
82ca8: a9031fe6 stp x6, x7, [sp, #48]
82cac: a90427e8 stp x8, x9, [sp, #64]
82cb0: a9052fea stp x10, x11, [sp, #80]
82cb4: a90637ec stp x12, x13, [sp, #96]
82cb8: a9073fee stp x14, x15, [sp, #112]
82cbc: a90847f0 stp x16, x17, [sp, #128]
82cc0: a9094ff2 stp x18, x19, [sp, #144]
82cc4: a90a57f4 stp x20, x21, [sp, #160]
82cc8: a90b5ff6 stp x22, x23, [sp, #176]
82ccc: a90c67f8 stp x24, x25, [sp, #192]
82cd0: a90d6ffa stp x26, x27, [sp, #208]
82cd4: a90e77fc stp x28, x29, [sp, #224]
82cd8: d5384036 mrs x22, elr_el1
82cdc: d5384017 mrs x23, spsr_el1
82ce0: a90f5bfe stp x30, x22, [sp, #240]
82ce4: f90083f7 str x23, [sp, #256]
82ce8: d28001c0 mov x0, #0xe // #14
82cec: d5385201 mrs x1, esr_el1
82cf0: d5384022 mrs x2, elr_el1
82cf4: 97fff725 bl 80988 <show_invalid_entry_message>
82cf8: 14000047 b 82e14 <err_hang>
0000000000082cfc <error_invalid_el0_32>:
error_invalid_el0_32:
handle_invalid_entry ERROR_INVALID_EL0_32
82cfc: d10443ff sub sp, sp, #0x110
82d00: a90007e0 stp x0, x1, [sp]
82d04: a9010fe2 stp x2, x3, [sp, #16]
82d08: a90217e4 stp x4, x5, [sp, #32]
82d0c: a9031fe6 stp x6, x7, [sp, #48]
82d10: a90427e8 stp x8, x9, [sp, #64]
82d14: a9052fea stp x10, x11, [sp, #80]
82d18: a90637ec stp x12, x13, [sp, #96]
82d1c: a9073fee stp x14, x15, [sp, #112]
82d20: a90847f0 stp x16, x17, [sp, #128]
82d24: a9094ff2 stp x18, x19, [sp, #144]
82d28: a90a57f4 stp x20, x21, [sp, #160]
82d2c: a90b5ff6 stp x22, x23, [sp, #176]
82d30: a90c67f8 stp x24, x25, [sp, #192]
82d34: a90d6ffa stp x26, x27, [sp, #208]
82d38: a90e77fc stp x28, x29, [sp, #224]
82d3c: d5384036 mrs x22, elr_el1
82d40: d5384017 mrs x23, spsr_el1
82d44: a90f5bfe stp x30, x22, [sp, #240]
82d48: f90083f7 str x23, [sp, #256]
82d4c: d28001e0 mov x0, #0xf // #15
82d50: d5385201 mrs x1, esr_el1
82d54: d5384022 mrs x2, elr_el1
82d58: 97fff70c bl 80988 <show_invalid_entry_message>
82d5c: 1400002e b 82e14 <err_hang>
0000000000082d60 <el1_irq>:
el1_irq:
kernel_entry
82d60: d10443ff sub sp, sp, #0x110
82d64: a90007e0 stp x0, x1, [sp]
82d68: a9010fe2 stp x2, x3, [sp, #16]
82d6c: a90217e4 stp x4, x5, [sp, #32]
82d70: a9031fe6 stp x6, x7, [sp, #48]
82d74: a90427e8 stp x8, x9, [sp, #64]
82d78: a9052fea stp x10, x11, [sp, #80]
82d7c: a90637ec stp x12, x13, [sp, #96]
82d80: a9073fee stp x14, x15, [sp, #112]
82d84: a90847f0 stp x16, x17, [sp, #128]
82d88: a9094ff2 stp x18, x19, [sp, #144]
82d8c: a90a57f4 stp x20, x21, [sp, #160]
82d90: a90b5ff6 stp x22, x23, [sp, #176]
82d94: a90c67f8 stp x24, x25, [sp, #192]
82d98: a90d6ffa stp x26, x27, [sp, #208]
82d9c: a90e77fc stp x28, x29, [sp, #224]
82da0: d5384036 mrs x22, elr_el1
82da4: d5384017 mrs x23, spsr_el1
82da8: a90f5bfe stp x30, x22, [sp, #240]
82dac: f90083f7 str x23, [sp, #256]
bl handle_irq
82db0: 97fff707 bl 809cc <handle_irq>
kernel_exit
82db4: f94083f7 ldr x23, [sp, #256]
82db8: a94f5bfe ldp x30, x22, [sp, #240]
82dbc: d5184036 msr elr_el1, x22
82dc0: d5184017 msr spsr_el1, x23
82dc4: a94007e0 ldp x0, x1, [sp]
82dc8: a9410fe2 ldp x2, x3, [sp, #16]
82dcc: a94217e4 ldp x4, x5, [sp, #32]
82dd0: a9431fe6 ldp x6, x7, [sp, #48]
82dd4: a94427e8 ldp x8, x9, [sp, #64]
82dd8: a9452fea ldp x10, x11, [sp, #80]
82ddc: a94637ec ldp x12, x13, [sp, #96]
82de0: a9473fee ldp x14, x15, [sp, #112]
82de4: a94847f0 ldp x16, x17, [sp, #128]
82de8: a9494ff2 ldp x18, x19, [sp, #144]
82dec: a94a57f4 ldp x20, x21, [sp, #160]
82df0: a94b5ff6 ldp x22, x23, [sp, #176]
82df4: a94c67f8 ldp x24, x25, [sp, #192]
82df8: a94d6ffa ldp x26, x27, [sp, #208]
82dfc: a94e77fc ldp x28, x29, [sp, #224]
82e00: 910443ff add sp, sp, #0x110
82e04: d69f03e0 eret
0000000000082e08 <ret_from_fork>:
.globl ret_from_fork
ret_from_fork:
bl schedule_tail
82e08: 97fff82f bl 80ec4 <schedule_tail>
mov x0, x20
82e0c: aa1403e0 mov x0, x20
blr x19 //should never return
82e10: d63f0260 blr x19
0000000000082e14 <err_hang>:
.globl err_hang
err_hang: b err_hang
82e14: 14000000 b 82e14 <err_hang>
0000000000082e18 <memzero>:
.globl memzero
memzero:
str xzr, [x0], #8
82e18: f800841f str xzr, [x0], #8
subs x1, x1, #8
82e1c: f1002021 subs x1, x1, #0x8
b.gt memzero
82e20: 54ffffcc b.gt 82e18 <memzero>
ret
82e24: d65f03c0 ret
0000000000082e28 <cpu_switch_to>:
#include "sched.h"
.globl cpu_switch_to
cpu_switch_to:
mov x10, #THREAD_CPU_CONTEXT
82e28: d280000a mov x10, #0x0 // #0
add x8, x0, x10
82e2c: 8b0a0008 add x8, x0, x10
mov x9, sp
82e30: 910003e9 mov x9, sp
stp x19, x20, [x8], #16 // store callee-saved registers
82e34: a8815113 stp x19, x20, [x8], #16
stp x21, x22, [x8], #16
82e38: a8815915 stp x21, x22, [x8], #16
stp x23, x24, [x8], #16
82e3c: a8816117 stp x23, x24, [x8], #16
stp x25, x26, [x8], #16
82e40: a8816919 stp x25, x26, [x8], #16
stp x27, x28, [x8], #16
82e44: a881711b stp x27, x28, [x8], #16
stp x29, x9, [x8], #16
82e48: a881251d stp x29, x9, [x8], #16
str x30, [x8]
82e4c: f900011e str x30, [x8]
add x8, x1, x10
82e50: 8b0a0028 add x8, x1, x10
ldp x19, x20, [x8], #16 // restore callee-saved registers
82e54: a8c15113 ldp x19, x20, [x8], #16
ldp x21, x22, [x8], #16
82e58: a8c15915 ldp x21, x22, [x8], #16
ldp x23, x24, [x8], #16
82e5c: a8c16117 ldp x23, x24, [x8], #16
ldp x25, x26, [x8], #16
82e60: a8c16919 ldp x25, x26, [x8], #16
ldp x27, x28, [x8], #16
82e64: a8c1711b ldp x27, x28, [x8], #16
ldp x29, x9, [x8], #16
82e68: a8c1251d ldp x29, x9, [x8], #16
ldr x30, [x8]
82e6c: f940011e ldr x30, [x8]
mov sp, x9
82e70: 9100013f mov sp, x9
ret
82e74: d65f03c0 ret
| 32.795864 | 118 | 0.628201 |
7c5d4c993d25a39b1072b02d0a14bace2ed35cff | 2,583 | asm | Assembly | unittests/ASM/FEX_bugs/Test_CmpSelect_Merge_branch.asm | cobalt2727/FEX | 13087f8425aeaad28dc81bed46a83e1d72ff0db8 | [
"MIT"
] | null | null | null | unittests/ASM/FEX_bugs/Test_CmpSelect_Merge_branch.asm | cobalt2727/FEX | 13087f8425aeaad28dc81bed46a83e1d72ff0db8 | [
"MIT"
] | null | null | null | unittests/ASM/FEX_bugs/Test_CmpSelect_Merge_branch.asm | cobalt2727/FEX | 13087f8425aeaad28dc81bed46a83e1d72ff0db8 | [
"MIT"
] | null | null | null | %ifdef CONFIG
{
"RegData": {
"RAX": "0x0000000aaaaafaaa"
}
}
%endif
%macro intcompare 3
; instruction, value1, value2
mov rcx, %2
mov rdx, %3
shl rax, 1
cmp rcx, rdx
; Conditional branch
%1 %%true
%%fallthrough:
; False fallthrough path
mov rbx, 0
jmp %%combine
%%true:
; True path
mov rbx, 1
%%combine:
; Combine
or rax, rbx
%endmacro
; This test specifically tests the Select and compare merging that occurs in OpcodeDispatcher
; The easiest way to test this is to do the comparison op and then SETcc with the flags that we want to ensure is working
; RAX will be our result
mov rax, 0
; RBX will be our temp for setcc
mov rbx, 0
; Test integer ops
; RCX and RDX for comparison values
mov rcx, 0
mov rdx, 0
; Test EQ - true
intcompare je, 0, 0
; Test EQ - false
intcompare je, 0, 1
; Test NEQ - true
intcompare jne, 0, 1
; Test NEQ - false
intcompare jne, 0, 0
; Test SGE - true
intcompare jge, 0, 0
; Test SGE - false
intcompare jge, 0, 1
; Test SGE with sign difference - true
intcompare jge, 1, -1
; Test SGE with sign difference - false
intcompare jge, -1, 1
; Test SLT - true
intcompare jl, 0, 1
; Test SLT - false
intcompare jl, 0, 0
; Test SLT with sign difference - true
intcompare jl, -1, 1
; Test SLT with sign difference - false
intcompare jl, 1, -1
; Test SGT - true
intcompare jg, 1, 0
; Test SGT - false
intcompare jg, 0, 0
; Test SGT with sign difference - true
intcompare jg, 1, -1
; Test SGT with sign difference - false
intcompare jg, -1, 1
; Test SLE - true
intcompare jle, 0, 0
; Test SLE - false
intcompare jle, 1, 0
; Test SLE with sign difference - true
intcompare jle, -1, 1
; Test SLE with sign difference - false
intcompare jle, 1, -1
; Test UGE - true
intcompare jae, 0, 0
; Test UGE - false
intcompare jae, 1, 0
; Test UGE with *sign* difference - true
intcompare jae, -1, 1
; Test UGE with *sign* difference - false
intcompare jb, 1, -1
; Test ULT - true
intcompare jb, 0, 1
; Test ULT - false
intcompare jb, 1, 0
; Test ULT with *sign* difference - true
intcompare jb, 1, -1
; Test ULT with *sign* difference - false
intcompare jb, -1, 1
; Test UGT - true
intcompare ja, 1, 0
; Test UGT - false
intcompare ja, 0, 1
; Test UGT with *sign* difference - true
intcompare ja, -1, 1
; Test UGT with *sign* difference - false
intcompare ja, 1, -1
; Test ULE - true
intcompare jbe, 0, 0
; Test ULE - false
intcompare jbe, 1, 0
; Test ULE with *sign* difference - true
intcompare jbe, 1, -1
; Test ULE with *sign* difference - false
intcompare jbe, -1, 1
hlt
| 16.664516 | 121 | 0.67441 |
9320f135f9fe9d3bd1aac22e56d1f0afa4ba1cba | 30,039 | asm | Assembly | x86/windows64.asm | lantonov/asm | b9ddd4ed9a8c73cbd3600608847769f4690c293c | [
"BSD-3-Clause"
] | 150 | 2016-11-26T05:41:31.000Z | 2022-02-09T20:54:53.000Z | x86/windows64.asm | lantonov/asm | b9ddd4ed9a8c73cbd3600608847769f4690c293c | [
"BSD-3-Clause"
] | 199 | 2016-12-07T22:13:00.000Z | 2022-03-22T15:42:18.000Z | x86/windows64.asm | lantonov/asm | b9ddd4ed9a8c73cbd3600608847769f4690c293c | [
"BSD-3-Clause"
] | 95 | 2016-11-24T22:57:13.000Z | 2022-01-24T19:42:10.000Z | macro library? definitions&
PE.Imports:
iterate <name,string>, definitions
if ~ name.redundant
dd RVA name.lookup,0,0,RVA name.str,RVA name.address
end if
name.referred = 1
end iterate
dd 0,0,0,0,0
iterate <name,string>, definitions
if ~ name.redundant
name.str db string,0
align 2
end if
end iterate
end macro
macro import? name,definitions&
align 8
if defined name.referred
name.lookup:
iterate <label,string>, definitions
if used label
if string eqtype ''
dq RVA name.label
else
dq 8000000000000000h + string
end if
end if
end iterate
if $ > name.lookup
name.redundant = 0
dq 0
else
name.redundant = 1
end if
name.address:
iterate <label,string>, definitions
if used label
if string eqtype ''
label dq RVA name.label
else
label dq 8000000000000000h + string
end if
end if
end iterate
if ~ name.redundant
dq 0
end if
iterate <label,string>, definitions
if used label & string eqtype ''
name.label dw 0
db string,0
align 2
end if
end iterate
end if
end macro
; General constants
NULL = 0
TRUE = 1
FALSE = 0
; Maximum path length in characters
MAX_PATH = 260
TOKEN_ADJUST_PRIVILEGES = 0x0020
TOKEN_QUERY = 0x0008
SE_PRIVILEGE_ENABLED = 0x00000002
; Access rights
DELETE_RIGHT = 00010000h
READ_CONTROL = 00020000h
WRITE_DAC = 00040000h
WRITE_OWNER = 00080000h
SYNCHRONIZE = 00100000h
STANDARD_RIGHTS_READ = READ_CONTROL
STANDARD_RIGHTS_WRITE = READ_CONTROL
STANDARD_RIGHTS_EXECUTE = READ_CONTROL
STANDARD_RIGHTS_REQUIRED = 000F0000h
STANDARD_RIGHTS_ALL = 001F0000h
SPECIFIC_RIGHTS_ALL = 0000FFFFh
ACCESS_SYSTEM_SECURITY = 01000000h
MAXIMUM_ALLOWED = 02000000h
GENERIC_READ = 80000000h
GENERIC_WRITE = 40000000h
GENERIC_EXECUTE = 20000000h
GENERIC_ALL = 10000000h
PROCESS_TERMINATE = 00000001h
PROCESS_CREATE_THREAD = 00000002h
PROCESS_VM_OPERATION = 00000008h
PROCESS_VM_READ = 00000010h
PROCESS_VM_WRITE = 00000020h
PROCESS_DUP_HANDLE = 00000040h
PROCESS_CREATE_PROCESS = 00000080h
PROCESS_SET_QUOTA = 00000100h
PROCESS_SET_INFORMATION = 00000200h
PROCESS_QUERY_INFORMATION = 00000400h
PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 0FFFh
FILE_SHARE_READ = 00000001h
FILE_SHARE_WRITE = 00000002h
FILE_SHARE_DELETE = 00000004h
; CreateFile actions
CREATE_NEW = 1
CREATE_ALWAYS = 2
OPEN_EXISTING = 3
OPEN_ALWAYS = 4
TRUNCATE_EXISTING = 5
; OpenFile modes
OF_READ = 0000h
OF_WRITE = 0001h
OF_READWRITE = 0002h
OF_SHARE_COMPAT = 0000h
OF_SHARE_EXCLUSIVE = 0010h
OF_SHARE_DENY_WRITE = 0020h
OF_SHARE_DENY_READ = 0030h
OF_SHARE_DENY_NONE = 0040h
OF_PARSE = 0100h
OF_DELETE = 0200h
OF_VERIFY = 0400h
OF_CANCEL = 0800h
OF_CREATE = 1000h
OF_PROMPT = 2000h
OF_EXIST = 4000h
OF_REOPEN = 8000h
; SetFilePointer methods
FILE_BEGIN = 0
FILE_CURRENT = 1
FILE_END = 2
; File attributes
FILE_ATTRIBUTE_READONLY = 001h
FILE_ATTRIBUTE_HIDDEN = 002h
FILE_ATTRIBUTE_SYSTEM = 004h
FILE_ATTRIBUTE_DIRECTORY = 010h
FILE_ATTRIBUTE_ARCHIVE = 020h
FILE_ATTRIBUTE_NORMAL = 080h
FILE_ATTRIBUTE_TEMPORARY = 100h
FILE_ATTRIBUTE_COMPRESSED = 800h
; File flags
FILE_FLAG_WRITE_THROUGH = 80000000h
FILE_FLAG_OVERLAPPED = 40000000h
FILE_FLAG_NO_BUFFERING = 20000000h
FILE_FLAG_RANDOM_ACCESS = 10000000h
FILE_FLAG_SEQUENTIAL_SCAN = 08000000h
FILE_FLAG_DELETE_ON_CLOSE = 04000000h
FILE_FLAG_BACKUP_SEMANTICS = 02000000h
FILE_FLAG_POSIX_SEMANTICS = 01000000h
; Notify filters
FILE_NOTIFY_CHANGE_FILE_NAME = 001h
FILE_NOTIFY_CHANGE_DIR_NAME = 002h
FILE_NOTIFY_CHANGE_ATTRIBUTES = 004h
FILE_NOTIFY_CHANGE_SIZE = 008h
FILE_NOTIFY_CHANGE_LAST_WRITE = 010h
FILE_NOTIFY_CHANGE_SECURITY = 100h
; File types
FILE_TYPE_UNKNOWN = 0
FILE_TYPE_DISK = 1
FILE_TYPE_CHAR = 2
FILE_TYPE_PIPE = 3
FILE_TYPE_REMOTE = 8000h
; LockFileEx flags
LOCKFILE_FAIL_IMMEDIATELY = 1
LOCKFILE_EXCLUSIVE_LOCK = 2
; MoveFileEx flags
MOVEFILE_REPLACE_EXISTING = 1
MOVEFILE_COPY_ALLOWED = 2
MOVEFILE_DELAY_UNTIL_REBOOT = 4
MOVEFILE_WRITE_THROUGH = 8
; FindFirstFileEx flags
FIND_FIRST_EX_CASE_SENSITIVE = 1
; Device handles
INVALID_HANDLE_VALUE = -1
STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE = -11
STD_ERROR_HANDLE = -12
; DuplicateHandle options
DUPLICATE_CLOSE_SOURCE = 1
DUPLICATE_SAME_ACCESS = 2
; File mapping acccess rights
SECTION_QUERY = 01h
SECTION_MAP_WRITE = 02h
SECTION_MAP_READ = 04h
SECTION_MAP_EXECUTE = 08h
SECTION_EXTEND_SIZE = 10h
SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or SECTION_EXTEND_SIZE
FILE_MAP_COPY = SECTION_QUERY
FILE_MAP_WRITE = SECTION_MAP_WRITE
FILE_MAP_READ = SECTION_MAP_READ
FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS
; File system flags
FILE_CASE_SENSITIVE_SEARCH = 0001h
FILE_CASE_PRESERVED_NAMES = 0002h
FILE_UNICODE_ON_DISK = 0004h
FILE_PERSISTENT_ACLS = 0008h
FILE_FILE_COMPRESSION = 0010h
FILE_VOLUME_IS_COMPRESSED = 8000h
FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES
FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH
FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK
FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS
; Drive types
DRIVE_UNKNOWN = 0
DRIVE_NO_ROOT_DIR = 1
DRIVE_REMOVABLE = 2
DRIVE_FIXED = 3
DRIVE_REMOTE = 4
DRIVE_CDROM = 5
DRIVE_RAMDISK = 6
; Pipe modes
PIPE_ACCESS_INBOUND = 1
PIPE_ACCESS_OUTBOUND = 2
PIPE_ACCESS_DUPLEX = 3
PIPE_CLIENT_END = 0
PIPE_SERVER_END = 1
PIPE_WAIT = 0
PIPE_NOWAIT = 1
PIPE_READMODE_BYTE = 0
PIPE_READMODE_MESSAGE = 2
PIPE_TYPE_BYTE = 0
PIPE_TYPE_MESSAGE = 4
PIPE_UNLIMITED_INSTANCES = 255
; Global memory flags
GMEM_FIXED = 0000h
GMEM_MOVEABLE = 0002h
GMEM_NOCOMPACT = 0010h
GMEM_NODISCARD = 0020h
GMEM_ZEROINIT = 0040h
GMEM_MODIFY = 0080h
GMEM_DISCARDABLE = 0100h
GMEM_NOT_BANKED = 1000h
GMEM_SHARE = 2000h
GMEM_DDESHARE = 2000h
GMEM_NOTIFY = 4000h
GMEM_LOWER = GMEM_NOT_BANKED
GMEM_VALID_FLAGS = 7F72h
GMEM_INVALID_HANDLE = 8000h
GMEM_DISCARDED = 4000h
GMEM_LOCKCOUNT = 0FFh
GHND = GMEM_MOVEABLE + GMEM_ZEROINIT
GPTR = GMEM_FIXED + GMEM_ZEROINIT
; Local memory flags
LMEM_FIXED = 0000h
LMEM_MOVEABLE = 0002h
LMEM_NOCOMPACT = 0010h
LMEM_NODISCARD = 0020h
LMEM_ZEROINIT = 0040h
LMEM_MODIFY = 0080h
LMEM_DISCARDABLE = 0F00h
LMEM_VALID_FLAGS = 0F72h
LMEM_INVALID_HANDLE = 8000h
LHND = LMEM_MOVEABLE + LMEM_ZEROINIT
LPTR = LMEM_FIXED + LMEM_ZEROINIT
LMEM_DISCARDED = 4000h
LMEM_LOCKCOUNT = 00FFh
; Page access flags
PAGE_NOACCESS = 001h
PAGE_READONLY = 002h
PAGE_READWRITE = 004h
PAGE_WRITECOPY = 008h
PAGE_EXECUTE = 010h
PAGE_EXECUTE_READ = 020h
PAGE_EXECUTE_READWRITE = 040h
PAGE_EXECUTE_WRITECOPY = 080h
PAGE_GUARD = 100h
PAGE_NOCACHE = 200h
; Memory allocation flags
MEM_LARGE_PAGES = 0x20000000
MEM_COMMIT = 001000h
MEM_RESERVE = 002000h
MEM_DECOMMIT = 004000h
MEM_RELEASE = 008000h
MEM_FREE = 010000h
MEM_PRIVATE = 020000h
MEM_MAPPED = 040000h
MEM_RESET = 080000h
MEM_TOP_DOWN = 100000h
; Heap allocation flags
HEAP_NO_SERIALIZE = 1
HEAP_GENERATE_EXCEPTIONS = 4
HEAP_ZERO_MEMORY = 8
; Platform identifiers
VER_PLATFORM_WIN32s = 0
VER_PLATFORM_WIN32_WINDOWS = 1
VER_PLATFORM_WIN32_NT = 2
; GetBinaryType return values
SCS_32BIT_BINARY = 0
SCS_DOS_BINARY = 1
SCS_WOW_BINARY = 2
SCS_PIF_BINARY = 3
SCS_POSIX_BINARY = 4
SCS_OS216_BINARY = 5
; CreateProcess flags
DEBUG_PROCESS = 001h
DEBUG_ONLY_THIS_PROCESS = 002h
CREATE_SUSPENDED = 004h
DETACHED_PROCESS = 008h
CREATE_NEW_CONSOLE = 010h
BELOW_NORMAL_PRIORITY_CLASS = 0x00004000
NORMAL_PRIORITY_CLASS = 020h
IDLE_PRIORITY_CLASS = 040h
HIGH_PRIORITY_CLASS = 080h
REALTIME_PRIORITY_CLASS = 100h
CREATE_NEW_PROCESS_GROUP = 200h
CREATE_SEPARATE_WOW_VDM = 800h
; Thread priority values
THREAD_BASE_PRIORITY_MIN = -2
THREAD_BASE_PRIORITY_MAX = 2
THREAD_BASE_PRIORITY_LOWRT = 15
THREAD_BASE_PRIORITY_IDLE = -15
THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST + 1
THREAD_PRIORITY_NORMAL = 0
THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST - 1
THREAD_PRIORITY_ERROR_RETURN = 7FFFFFFFh
THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
; Startup flags
STARTF_USESHOWWINDOW = 001h
STARTF_USESIZE = 002h
STARTF_USEPOSITION = 004h
STARTF_USECOUNTCHARS = 008h
STARTF_USEFILLATTRIBUTE = 010h
STARTF_RUNFULLSCREEN = 020h
STARTF_FORCEONFEEDBACK = 040h
STARTF_FORCEOFFFEEDBACK = 080h
STARTF_USESTDHANDLES = 100h
; Shutdown flags
SHUTDOWN_NORETRY = 1h
; LoadLibraryEx flags
DONT_RESOLVE_DLL_REFERENCES = 1
LOAD_LIBRARY_AS_DATAFILE = 2
LOAD_WITH_ALTERED_SEARCH_PATH = 8
; DLL entry-point calls
DLL_PROCESS_DETACH = 0
DLL_PROCESS_ATTACH = 1
DLL_THREAD_ATTACH = 2
DLL_THREAD_DETACH = 3
; Status codes
STATUS_WAIT_0 = 000000000h
STATUS_ABANDONED_WAIT_0 = 000000080h
STATUS_USER_APC = 0000000C0h
STATUS_TIMEOUT = 000000102h
STATUS_PENDING = 000000103h
STATUS_DATATYPE_MISALIGNMENT = 080000002h
STATUS_BREAKPOINT = 080000003h
STATUS_SINGLE_STEP = 080000004h
STATUS_ACCESS_VIOLATION = 0C0000005h
STATUS_IN_PAGE_ERROR = 0C0000006h
STATUS_NO_MEMORY = 0C0000017h
STATUS_ILLEGAL_INSTRUCTION = 0C000001Dh
STATUS_NONCONTINUABLE_EXCEPTION = 0C0000025h
STATUS_INVALID_DISPOSITION = 0C0000026h
STATUS_ARRAY_BOUNDS_EXCEEDED = 0C000008Ch
STATUS_FLOAT_DENORMAL_OPERAND = 0C000008Dh
STATUS_FLOAT_DIVIDE_BY_ZERO = 0C000008Eh
STATUS_FLOAT_INEXACT_RESULT = 0C000008Fh
STATUS_FLOAT_INVALID_OPERATION = 0C0000090h
STATUS_FLOAT_OVERFLOW = 0C0000091h
STATUS_FLOAT_STACK_CHECK = 0C0000092h
STATUS_FLOAT_UNDERFLOW = 0C0000093h
STATUS_INTEGER_DIVIDE_BY_ZERO = 0C0000094h
STATUS_INTEGER_OVERFLOW = 0C0000095h
STATUS_PRIVILEGED_INSTRUCTION = 0C0000096h
STATUS_STACK_OVERFLOW = 0C00000FDh
STATUS_CONTROL_C_EXIT = 0C000013Ah
WAIT_FAILED = -1
WAIT_OBJECT_0 = STATUS_WAIT_0
WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0
WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0
WAIT_TIMEOUT = STATUS_TIMEOUT
WAIT_IO_COMPLETION = STATUS_USER_APC
STILL_ACTIVE = STATUS_PENDING
; Exception codes
EXCEPTION_CONTINUABLE = 0
EXCEPTION_NONCONTINUABLE = 1
EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION
EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT
EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT
EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP
EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED
EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND
EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO
EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT
EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION
EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW
EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK
EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW
EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO
EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW
EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION
EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION
EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR
; Registry options
REG_OPTION_RESERVED = 0
REG_OPTION_NON_VOLATILE = 0
REG_OPTION_VOLATILE = 1
REG_OPTION_CREATE_LINK = 2
REG_OPTION_BACKUP_RESTORE = 4
REG_CREATED_NEW_KEY = 1
REG_OPENED_EXISTING_KEY = 2
REG_WHOLE_HIVE_VOLATILE = 1
REG_REFRESH_HIVE = 2
REG_NOTIFY_CHANGE_NAME = 1
REG_NOTIFY_CHANGE_ATTRIBUTES = 2
REG_NOTIFY_CHANGE_LAST_SET = 4
REG_NOTIFY_CHANGE_SECURITY = 8
REG_LEGAL_CHANGE_FILTER = REG_NOTIFY_CHANGE_NAME or REG_NOTIFY_CHANGE_ATTRIBUTES or REG_NOTIFY_CHANGE_LAST_SET or REG_NOTIFY_CHANGE_SECURITY
REG_LEGAL_OPTION = REG_OPTION_RESERVED or REG_OPTION_NON_VOLATILE or REG_OPTION_VOLATILE or REG_OPTION_CREATE_LINK or REG_OPTION_BACKUP_RESTORE
REG_NONE = 0
REG_SZ = 1
REG_EXPAND_SZ = 2
REG_BINARY = 3
REG_DWORD = 4
REG_DWORD_LITTLE_ENDIAN = 4
REG_DWORD_BIG_ENDIAN = 5
REG_LINK = 6
REG_MULTI_SZ = 7
REG_RESOURCE_LIST = 8
REG_FULL_RESOURCE_DESCRIPTOR = 9
REG_RESOURCE_REQUIREMENTS_LIST = 10
; Registry access modes
KEY_QUERY_VALUE = 1
KEY_SET_VALUE = 2
KEY_CREATE_SUB_KEY = 4
KEY_ENUMERATE_SUB_KEYS = 8
KEY_NOTIFY = 10h
KEY_CREATE_LINK = 20h
KEY_READ = STANDARD_RIGHTS_READ or KEY_QUERY_VALUE or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY and not SYNCHRONIZE
KEY_WRITE = STANDARD_RIGHTS_WRITE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY and not SYNCHRONIZE
KEY_EXECUTE = KEY_READ
KEY_ALL_ACCESS = STANDARD_RIGHTS_ALL or KEY_QUERY_VALUE or KEY_SET_VALUE or KEY_CREATE_SUB_KEY or KEY_ENUMERATE_SUB_KEYS or KEY_NOTIFY or KEY_CREATE_LINK and not SYNCHRONIZE
; Predefined registry keys
HKEY_CLASSES_ROOT = 80000000h
HKEY_CURRENT_USER = 80000001h
HKEY_LOCAL_MACHINE = 80000002h
HKEY_USERS = 80000003h
HKEY_PERFORMANCE_DATA = 80000004h
HKEY_CURRENT_CONFIG = 80000005h
HKEY_DYN_DATA = 80000006h
; FormatMessage flags
FORMAT_MESSAGE_ALLOCATE_BUFFER = 0100h
FORMAT_MESSAGE_IGNORE_INSERTS = 0200h
FORMAT_MESSAGE_FROM_STRING = 0400h
FORMAT_MESSAGE_FROM_HMODULE = 0800h
FORMAT_MESSAGE_FROM_SYSTEM = 1000h
FORMAT_MESSAGE_ARGUMENT_ARRAY = 2000h
FORMAT_MESSAGE_MAX_WIDTH_MASK = 00FFh
; Language identifiers
LANG_NEUTRAL = 00h
LANG_BULGARIAN = 02h
LANG_CHINESE = 04h
LANG_CROATIAN = 1Ah
LANG_CZECH = 05h
LANG_DANISH = 06h
LANG_DUTCH = 13h
LANG_ENGLISH = 09h
LANG_FINNISH = 0Bh
LANG_FRENCH = 0Ch
LANG_GERMAN = 07h
LANG_GREEK = 08h
LANG_HUNGARIAN = 0Eh
LANG_ICELANDIC = 0Fh
LANG_ITALIAN = 10h
LANG_JAPANESE = 11h
LANG_KOREAN = 12h
LANG_NORWEGIAN = 14h
LANG_POLISH = 15h
LANG_PORTUGUESE = 16h
LANG_ROMANIAN = 18h
LANG_RUSSIAN = 19h
LANG_SLOVAK = 1Bh
LANG_SLOVENIAN = 24h
LANG_SPANISH = 0Ah
LANG_SWEDISH = 1Dh
LANG_THAI = 1Eh
LANG_TURKISH = 1Fh
; Sublanguage identifiers
SUBLANG_NEUTRAL = 00h shl 10
SUBLANG_DEFAULT = 01h shl 10
SUBLANG_SYS_DEFAULT = 02h shl 10
SUBLANG_CHINESE_TRADITIONAL = 01h shl 10
SUBLANG_CHINESE_SIMPLIFIED = 02h shl 10
SUBLANG_CHINESE_HONGKONG = 03h shl 10
SUBLANG_CHINESE_SINGAPORE = 04h shl 10
SUBLANG_DUTCH = 01h shl 10
SUBLANG_DUTCH_BELGIAN = 02h shl 10
SUBLANG_ENGLISH_US = 01h shl 10
SUBLANG_ENGLISH_UK = 02h shl 10
SUBLANG_ENGLISH_AUS = 03h shl 10
SUBLANG_ENGLISH_CAN = 04h shl 10
SUBLANG_ENGLISH_NZ = 05h shl 10
SUBLANG_ENGLISH_EIRE = 06h shl 10
SUBLANG_FRENCH = 01h shl 10
SUBLANG_FRENCH_BELGIAN = 02h shl 10
SUBLANG_FRENCH_CANADIAN = 03h shl 10
SUBLANG_FRENCH_SWISS = 04h shl 10
SUBLANG_GERMAN = 01h shl 10
SUBLANG_GERMAN_SWISS = 02h shl 10
SUBLANG_GERMAN_AUSTRIAN = 03h shl 10
SUBLANG_ITALIAN = 01h shl 10
SUBLANG_ITALIAN_SWISS = 02h shl 10
SUBLANG_NORWEGIAN_BOKMAL = 01h shl 10
SUBLANG_NORWEGIAN_NYNORSK = 02h shl 10
SUBLANG_PORTUGUESE = 02h shl 10
SUBLANG_PORTUGUESE_BRAZILIAN = 01h shl 10
SUBLANG_SPANISH = 01h shl 10
SUBLANG_SPANISH_MEXICAN = 02h shl 10
SUBLANG_SPANISH_MODERN = 03h shl 10
; Sorting identifiers
SORT_DEFAULT = 0 shl 16
SORT_JAPANESE_XJIS = 0 shl 16
SORT_JAPANESE_UNICODE = 1 shl 16
SORT_CHINESE_BIG5 = 0 shl 16
SORT_CHINESE_PRCP = 0 shl 16
SORT_CHINESE_UNICODE = 1 shl 16
SORT_CHINESE_PRC = 2 shl 16
SORT_CHINESE_BOPOMOFO = 3 shl 16
SORT_KOREAN_KSC = 0 shl 16
SORT_KOREAN_UNICODE = 1 shl 16
SORT_GERMAN_PHONE_BOOK = 1 shl 16
SORT_HUNGARIAN_DEFAULT = 0 shl 16
SORT_HUNGARIAN_TECHNICAL = 1 shl 16
; Code pages
CP_ACP = 0 ; default to ANSI code page
CP_OEMCP = 1 ; default to OEM code page
CP_MACCP = 2 ; default to MAC code page
CP_THREAD_ACP = 3 ; current thread's ANSI code page
CP_SYMBOL = 42 ; SYMBOL translations
CP_UTF7 = 65000 ; UTF-7 translation
CP_UTF8 = 65001 ; UTF-8 translation
; Resource types
RT_CURSOR = 1
RT_BITMAP = 2
RT_ICON = 3
RT_MENU = 4
RT_DIALOG = 5
RT_STRING = 6
RT_FONTDIR = 7
RT_FONT = 8
RT_ACCELERATOR = 9
RT_RCDATA = 10
RT_MESSAGETABLE = 11
RT_GROUP_CURSOR = 12
RT_GROUP_ICON = 14
RT_VERSION = 16
RT_DLGINCLUDE = 17
RT_PLUGPLAY = 19
RT_VXD = 20
RT_ANICURSOR = 21
RT_ANIICON = 22
RT_HTML = 23
RT_MANIFEST = 24
; Clipboard formats
CF_TEXT = 001h
CF_BITMAP = 002h
CF_METAFILEPICT = 003h
CF_SYLK = 004h
CF_DIF = 005h
CF_TIFF = 006h
CF_OEMTEXT = 007h
CF_DIB = 008h
CF_PALETTE = 009h
CF_PENDATA = 00Ah
CF_RIFF = 00Bh
CF_WAVE = 00Ch
CF_UNICODETEXT = 00Dh
CF_ENHMETAFILE = 00Eh
CF_HDROP = 00Fh
CF_LOCALE = 010h
CF_OWNERDISPLAY = 080h
CF_DSPTEXT = 081h
CF_DSPBITMAP = 082h
CF_DSPMETAFILEPICT = 083h
CF_DSPENHMETAFILE = 08Eh
CF_PRIVATEFIRST = 200h
CF_PRIVATELAST = 2FFh
CF_GDIOBJFIRST = 300h
CF_GDIOBJLAST = 3FFh
; OS types for version info
VOS_UNKNOWN = 00000000h
VOS_DOS = 00010000h
VOS_OS216 = 00020000h
VOS_OS232 = 00030000h
VOS_NT = 00040000h
VOS__BASE = 00000000h
VOS__WINDOWS16 = 00000001h
VOS__PM16 = 00000002h
VOS__PM32 = 00000003h
VOS__WINDOWS32 = 00000004h
VOS_DOS_WINDOWS16 = 00010001h
VOS_DOS_WINDOWS32 = 00010004h
VOS_OS216_PM16 = 00020002h
VOS_OS232_PM32 = 00030003h
VOS_NT_WINDOWS32 = 00040004h
; File types for version info
VFT_UNKNOWN = 00000000h
VFT_APP = 00000001h
VFT_DLL = 00000002h
VFT_DRV = 00000003h
VFT_FONT = 00000004h
VFT_VXD = 00000005h
VFT_STATIC_LIB = 00000007h
; File subtypes for version info
VFT2_UNKNOWN = 00000000h
VFT2_DRV_PRINTER = 00000001h
VFT2_DRV_KEYBOARD = 00000002h
VFT2_DRV_LANGUAGE = 00000003h
VFT2_DRV_DISPLAY = 00000004h
VFT2_DRV_MOUSE = 00000005h
VFT2_DRV_NETWORK = 00000006h
VFT2_DRV_SYSTEM = 00000007h
VFT2_DRV_INSTALLABLE = 00000008h
VFT2_DRV_SOUND = 00000009h
VFT2_DRV_COMM = 0000000Ah
VFT2_DRV_INPUTMETHOD = 0000000Bh
VFT2_DRV_VERSIONED_PRINTER = 0000000Ch
VFT2_FONT_RASTER = 00000001h
VFT2_FONT_VECTOR = 00000002h
VFT2_FONT_TRUETYPE = 00000003h
; Console control signals
CTRL_C_EVENT = 0
CTRL_BREAK_EVENT = 1
CTRL_CLOSE_EVENT = 2
CTRL_LOGOFF_EVENT = 5
CTRL_SHUTDOWN_EVENT = 6
; Maximum path length in characters
MAX_PATH = 260
; Access rights
DELETE_RIGHT = 00010000h
READ_CONTROL = 00020000h
WRITE_DAC = 00040000h
WRITE_OWNER = 00080000h
SYNCHRONIZE = 00100000h
STANDARD_RIGHTS_READ = READ_CONTROL
STANDARD_RIGHTS_WRITE = READ_CONTROL
STANDARD_RIGHTS_EXECUTE = READ_CONTROL
STANDARD_RIGHTS_REQUIRED = 000F0000h
STANDARD_RIGHTS_ALL = 001F0000h
SPECIFIC_RIGHTS_ALL = 0000FFFFh
ACCESS_SYSTEM_SECURITY = 01000000h
MAXIMUM_ALLOWED = 02000000h
GENERIC_READ = 80000000h
GENERIC_WRITE = 40000000h
GENERIC_EXECUTE = 20000000h
GENERIC_ALL = 10000000h
PROCESS_TERMINATE = 00000001h
PROCESS_CREATE_THREAD = 00000002h
PROCESS_VM_OPERATION = 00000008h
PROCESS_VM_READ = 00000010h
PROCESS_VM_WRITE = 00000020h
PROCESS_DUP_HANDLE = 00000040h
PROCESS_CREATE_PROCESS = 00000080h
PROCESS_SET_QUOTA = 00000100h
PROCESS_SET_INFORMATION = 00000200h
PROCESS_QUERY_INFORMATION = 00000400h
PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE or 0FFFh
FILE_SHARE_READ = 00000001h
FILE_SHARE_WRITE = 00000002h
FILE_SHARE_DELETE = 00000004h
; CreateFile actions
CREATE_NEW = 1
CREATE_ALWAYS = 2
OPEN_EXISTING = 3
OPEN_ALWAYS = 4
TRUNCATE_EXISTING = 5
; OpenFile modes
OF_READ = 0000h
OF_WRITE = 0001h
OF_READWRITE = 0002h
OF_SHARE_COMPAT = 0000h
OF_SHARE_EXCLUSIVE = 0010h
OF_SHARE_DENY_WRITE = 0020h
OF_SHARE_DENY_READ = 0030h
OF_SHARE_DENY_NONE = 0040h
OF_PARSE = 0100h
OF_DELETE = 0200h
OF_VERIFY = 0400h
OF_CANCEL = 0800h
OF_CREATE = 1000h
OF_PROMPT = 2000h
OF_EXIST = 4000h
OF_REOPEN = 8000h
; SetFilePointer methods
FILE_BEGIN = 0
FILE_CURRENT = 1
FILE_END = 2
; File attributes
FILE_ATTRIBUTE_READONLY = 001h
FILE_ATTRIBUTE_HIDDEN = 002h
FILE_ATTRIBUTE_SYSTEM = 004h
FILE_ATTRIBUTE_DIRECTORY = 010h
FILE_ATTRIBUTE_ARCHIVE = 020h
FILE_ATTRIBUTE_NORMAL = 080h
FILE_ATTRIBUTE_TEMPORARY = 100h
FILE_ATTRIBUTE_COMPRESSED = 800h
; File flags
FILE_FLAG_WRITE_THROUGH = 80000000h
FILE_FLAG_OVERLAPPED = 40000000h
FILE_FLAG_NO_BUFFERING = 20000000h
FILE_FLAG_RANDOM_ACCESS = 10000000h
FILE_FLAG_SEQUENTIAL_SCAN = 08000000h
FILE_FLAG_DELETE_ON_CLOSE = 04000000h
FILE_FLAG_BACKUP_SEMANTICS = 02000000h
FILE_FLAG_POSIX_SEMANTICS = 01000000h
; Notify filters
FILE_NOTIFY_CHANGE_FILE_NAME = 001h
FILE_NOTIFY_CHANGE_DIR_NAME = 002h
FILE_NOTIFY_CHANGE_ATTRIBUTES = 004h
FILE_NOTIFY_CHANGE_SIZE = 008h
FILE_NOTIFY_CHANGE_LAST_WRITE = 010h
FILE_NOTIFY_CHANGE_SECURITY = 100h
; File types
FILE_TYPE_UNKNOWN = 0
FILE_TYPE_DISK = 1
FILE_TYPE_CHAR = 2
FILE_TYPE_PIPE = 3
FILE_TYPE_REMOTE = 8000h
; LockFileEx flags
LOCKFILE_FAIL_IMMEDIATELY = 1
LOCKFILE_EXCLUSIVE_LOCK = 2
; MoveFileEx flags
MOVEFILE_REPLACE_EXISTING = 1
MOVEFILE_COPY_ALLOWED = 2
MOVEFILE_DELAY_UNTIL_REBOOT = 4
MOVEFILE_WRITE_THROUGH = 8
; FindFirstFileEx flags
FIND_FIRST_EX_CASE_SENSITIVE = 1
; Device handles
INVALID_HANDLE_VALUE = -1
STD_INPUT_HANDLE = -10
STD_OUTPUT_HANDLE = -11
STD_ERROR_HANDLE = -12
; DuplicateHandle options
DUPLICATE_CLOSE_SOURCE = 1
DUPLICATE_SAME_ACCESS = 2
; File mapping acccess rights
SECTION_QUERY = 01h
SECTION_MAP_WRITE = 02h
SECTION_MAP_READ = 04h
SECTION_MAP_EXECUTE = 08h
SECTION_EXTEND_SIZE = 10h
SECTION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED or SECTION_QUERY or SECTION_MAP_WRITE or SECTION_MAP_READ or SECTION_MAP_EXECUTE or SECTION_EXTEND_SIZE
FILE_MAP_COPY = SECTION_QUERY
FILE_MAP_WRITE = SECTION_MAP_WRITE
FILE_MAP_READ = SECTION_MAP_READ
FILE_MAP_ALL_ACCESS = SECTION_ALL_ACCESS
; File system flags
FILE_CASE_SENSITIVE_SEARCH = 0001h
FILE_CASE_PRESERVED_NAMES = 0002h
FILE_UNICODE_ON_DISK = 0004h
FILE_PERSISTENT_ACLS = 0008h
FILE_FILE_COMPRESSION = 0010h
FILE_VOLUME_IS_COMPRESSED = 8000h
FS_CASE_IS_PRESERVED = FILE_CASE_PRESERVED_NAMES
FS_CASE_SENSITIVE = FILE_CASE_SENSITIVE_SEARCH
FS_UNICODE_STORED_ON_DISK = FILE_UNICODE_ON_DISK
FS_PERSISTENT_ACLS = FILE_PERSISTENT_ACLS
; Drive types
DRIVE_UNKNOWN = 0
DRIVE_NO_ROOT_DIR = 1
DRIVE_REMOVABLE = 2
DRIVE_FIXED = 3
DRIVE_REMOTE = 4
DRIVE_CDROM = 5
DRIVE_RAMDISK = 6
; Pipe modes
PIPE_ACCESS_INBOUND = 1
PIPE_ACCESS_OUTBOUND = 2
PIPE_ACCESS_DUPLEX = 3
PIPE_CLIENT_END = 0
PIPE_SERVER_END = 1
PIPE_WAIT = 0
PIPE_NOWAIT = 1
PIPE_READMODE_BYTE = 0
PIPE_READMODE_MESSAGE = 2
PIPE_TYPE_BYTE = 0
PIPE_TYPE_MESSAGE = 4
PIPE_UNLIMITED_INSTANCES = 255
; Global memory flags
GMEM_FIXED = 0000h
GMEM_MOVEABLE = 0002h
GMEM_NOCOMPACT = 0010h
GMEM_NODISCARD = 0020h
GMEM_ZEROINIT = 0040h
GMEM_MODIFY = 0080h
GMEM_DISCARDABLE = 0100h
GMEM_NOT_BANKED = 1000h
GMEM_SHARE = 2000h
GMEM_DDESHARE = 2000h
GMEM_NOTIFY = 4000h
GMEM_LOWER = GMEM_NOT_BANKED
GMEM_VALID_FLAGS = 7F72h
GMEM_INVALID_HANDLE = 8000h
GMEM_DISCARDED = 4000h
GMEM_LOCKCOUNT = 0FFh
GHND = GMEM_MOVEABLE + GMEM_ZEROINIT
GPTR = GMEM_FIXED + GMEM_ZEROINIT
; Local memory flags
LMEM_FIXED = 0000h
LMEM_MOVEABLE = 0002h
LMEM_NOCOMPACT = 0010h
LMEM_NODISCARD = 0020h
LMEM_ZEROINIT = 0040h
LMEM_MODIFY = 0080h
LMEM_DISCARDABLE = 0F00h
LMEM_VALID_FLAGS = 0F72h
LMEM_INVALID_HANDLE = 8000h
LHND = LMEM_MOVEABLE + LMEM_ZEROINIT
LPTR = LMEM_FIXED + LMEM_ZEROINIT
LMEM_DISCARDED = 4000h
LMEM_LOCKCOUNT = 00FFh
; Page access flags
PAGE_NOACCESS = 001h
PAGE_READONLY = 002h
PAGE_READWRITE = 004h
PAGE_WRITECOPY = 008h
PAGE_EXECUTE = 010h
PAGE_EXECUTE_READ = 020h
PAGE_EXECUTE_READWRITE = 040h
PAGE_EXECUTE_WRITECOPY = 080h
PAGE_GUARD = 100h
PAGE_NOCACHE = 200h
; Memory allocation flags
MEM_COMMIT = 001000h
MEM_RESERVE = 002000h
MEM_DECOMMIT = 004000h
MEM_RELEASE = 008000h
MEM_FREE = 010000h
MEM_PRIVATE = 020000h
MEM_MAPPED = 040000h
MEM_RESET = 080000h
MEM_TOP_DOWN = 100000h
; Heap allocation flags
HEAP_NO_SERIALIZE = 1
HEAP_GENERATE_EXCEPTIONS = 4
HEAP_ZERO_MEMORY = 8
; Platform identifiers
VER_PLATFORM_WIN32s = 0
VER_PLATFORM_WIN32_WINDOWS = 1
VER_PLATFORM_WIN32_NT = 2
; GetBinaryType return values
SCS_32BIT_BINARY = 0
SCS_DOS_BINARY = 1
SCS_WOW_BINARY = 2
SCS_PIF_BINARY = 3
SCS_POSIX_BINARY = 4
SCS_OS216_BINARY = 5
; CreateProcess flags
DEBUG_PROCESS = 001h
DEBUG_ONLY_THIS_PROCESS = 002h
CREATE_SUSPENDED = 004h
DETACHED_PROCESS = 008h
CREATE_NEW_CONSOLE = 010h
NORMAL_PRIORITY_CLASS = 020h
IDLE_PRIORITY_CLASS = 040h
HIGH_PRIORITY_CLASS = 080h
REALTIME_PRIORITY_CLASS = 100h
CREATE_NEW_PROCESS_GROUP = 200h
CREATE_SEPARATE_WOW_VDM = 800h
; Thread priority values
THREAD_BASE_PRIORITY_MIN = -2
THREAD_BASE_PRIORITY_MAX = 2
THREAD_BASE_PRIORITY_LOWRT = 15
THREAD_BASE_PRIORITY_IDLE = -15
THREAD_PRIORITY_LOWEST = THREAD_BASE_PRIORITY_MIN
THREAD_PRIORITY_BELOW_NORMAL = THREAD_PRIORITY_LOWEST + 1
THREAD_PRIORITY_NORMAL = 0
THREAD_PRIORITY_HIGHEST = THREAD_BASE_PRIORITY_MAX
THREAD_PRIORITY_ABOVE_NORMAL = THREAD_PRIORITY_HIGHEST - 1
THREAD_PRIORITY_ERROR_RETURN = 7FFFFFFFh
THREAD_PRIORITY_TIME_CRITICAL = THREAD_BASE_PRIORITY_LOWRT
THREAD_PRIORITY_IDLE = THREAD_BASE_PRIORITY_IDLE
; Startup flags
STARTF_USESHOWWINDOW = 001h
STARTF_USESIZE = 002h
STARTF_USEPOSITION = 004h
STARTF_USECOUNTCHARS = 008h
STARTF_USEFILLATTRIBUTE = 010h
STARTF_RUNFULLSCREEN = 020h
STARTF_FORCEONFEEDBACK = 040h
STARTF_FORCEOFFFEEDBACK = 080h
STARTF_USESTDHANDLES = 100h
; Shutdown flags
SHUTDOWN_NORETRY = 1h
; LoadLibraryEx flags
DONT_RESOLVE_DLL_REFERENCES = 1
LOAD_LIBRARY_AS_DATAFILE = 2
LOAD_WITH_ALTERED_SEARCH_PATH = 8
; DLL entry-point calls
DLL_PROCESS_DETACH = 0
DLL_PROCESS_ATTACH = 1
DLL_THREAD_ATTACH = 2
DLL_THREAD_DETACH = 3
; Status codes
STATUS_WAIT_0 = 000000000h
STATUS_ABANDONED_WAIT_0 = 000000080h
STATUS_USER_APC = 0000000C0h
STATUS_TIMEOUT = 000000102h
STATUS_PENDING = 000000103h
STATUS_DATATYPE_MISALIGNMENT = 080000002h
STATUS_BREAKPOINT = 080000003h
STATUS_SINGLE_STEP = 080000004h
STATUS_ACCESS_VIOLATION = 0C0000005h
STATUS_IN_PAGE_ERROR = 0C0000006h
STATUS_NO_MEMORY = 0C0000017h
STATUS_ILLEGAL_INSTRUCTION = 0C000001Dh
STATUS_NONCONTINUABLE_EXCEPTION = 0C0000025h
STATUS_INVALID_DISPOSITION = 0C0000026h
STATUS_ARRAY_BOUNDS_EXCEEDED = 0C000008Ch
STATUS_FLOAT_DENORMAL_OPERAND = 0C000008Dh
STATUS_FLOAT_DIVIDE_BY_ZERO = 0C000008Eh
STATUS_FLOAT_INEXACT_RESULT = 0C000008Fh
STATUS_FLOAT_INVALID_OPERATION = 0C0000090h
STATUS_FLOAT_OVERFLOW = 0C0000091h
STATUS_FLOAT_STACK_CHECK = 0C0000092h
STATUS_FLOAT_UNDERFLOW = 0C0000093h
STATUS_INTEGER_DIVIDE_BY_ZERO = 0C0000094h
STATUS_INTEGER_OVERFLOW = 0C0000095h
STATUS_PRIVILEGED_INSTRUCTION = 0C0000096h
STATUS_STACK_OVERFLOW = 0C00000FDh
STATUS_CONTROL_C_EXIT = 0C000013Ah
WAIT_FAILED = -1
WAIT_OBJECT_0 = STATUS_WAIT_0
WAIT_ABANDONED = STATUS_ABANDONED_WAIT_0
WAIT_ABANDONED_0 = STATUS_ABANDONED_WAIT_0
WAIT_TIMEOUT = STATUS_TIMEOUT
WAIT_IO_COMPLETION = STATUS_USER_APC
STILL_ACTIVE = STATUS_PENDING
; Exception codes
EXCEPTION_CONTINUABLE = 0
EXCEPTION_NONCONTINUABLE = 1
EXCEPTION_ACCESS_VIOLATION = STATUS_ACCESS_VIOLATION
EXCEPTION_DATATYPE_MISALIGNMENT = STATUS_DATATYPE_MISALIGNMENT
EXCEPTION_BREAKPOINT = STATUS_BREAKPOINT
EXCEPTION_SINGLE_STEP = STATUS_SINGLE_STEP
EXCEPTION_ARRAY_BOUNDS_EXCEEDED = STATUS_ARRAY_BOUNDS_EXCEEDED
EXCEPTION_FLT_DENORMAL_OPERAND = STATUS_FLOAT_DENORMAL_OPERAND
EXCEPTION_FLT_DIVIDE_BY_ZERO = STATUS_FLOAT_DIVIDE_BY_ZERO
EXCEPTION_FLT_INEXACT_RESULT = STATUS_FLOAT_INEXACT_RESULT
EXCEPTION_FLT_INVALID_OPERATION = STATUS_FLOAT_INVALID_OPERATION
EXCEPTION_FLT_OVERFLOW = STATUS_FLOAT_OVERFLOW
EXCEPTION_FLT_STACK_CHECK = STATUS_FLOAT_STACK_CHECK
EXCEPTION_FLT_UNDERFLOW = STATUS_FLOAT_UNDERFLOW
EXCEPTION_INT_DIVIDE_BY_ZERO = STATUS_INTEGER_DIVIDE_BY_ZERO
EXCEPTION_INT_OVERFLOW = STATUS_INTEGER_OVERFLOW
EXCEPTION_ILLEGAL_INSTRUCTION = STATUS_ILLEGAL_INSTRUCTION
EXCEPTION_PRIV_INSTRUCTION = STATUS_PRIVILEGED_INSTRUCTION
EXCEPTION_IN_PAGE_ERROR = STATUS_IN_PAGE_ERROR
; MessageBox type flags
MB_OK = 000000h
MB_OKCANCEL = 000001h
MB_ABORTRETRYIGNORE = 000002h
MB_YESNOCANCEL = 000003h
MB_YESNO = 000004h
MB_RETRYCANCEL = 000005h
MB_ICONHAND = 000010h
MB_ICONQUESTION = 000020h
MB_ICONEXCLAMATION = 000030h
MB_ICONASTERISK = 000040h
MB_USERICON = 000080h
MB_ICONWARNING = MB_ICONEXCLAMATION
MB_ICONERROR = MB_ICONHAND
MB_ICONINFORMATION = MB_ICONASTERISK
MB_ICONSTOP = MB_ICONHAND
MB_DEFBUTTON1 = 000000h
MB_DEFBUTTON2 = 000100h
MB_DEFBUTTON3 = 000200h
MB_DEFBUTTON4 = 000300h
MB_APPLMODAL = 000000h
MB_SYSTEMMODAL = 001000h
MB_TASKMODAL = 002000h
MB_HELP = 004000h
MB_NOFOCUS = 008000h
MB_SETFOREGROUND = 010000h
MB_DEFAULT_DESKTOP_ONLY = 020000h
MB_TOPMOST = 040000h
MB_RIGHT = 080000h
MB_RTLREADING = 100000h
MB_SERVICE_NOTIFICATION = 200000h
| 25.89569 | 181 | 0.768068 |
e7d6121aa5952e5922954f65be996cae6f813cff | 1,640 | asm | Assembly | programs/oeis/024/A024032.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/024/A024032.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/024/A024032.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A024032: a(n) = 3^n - n^9.
; 1,2,-503,-19656,-262063,-1952882,-10076967,-40351420,-134211167,-387400806,-999940951,-2357770544,-5159248911,-10602905050,-20656263815,-38429010468,-68676430015,-118458736334,-197971869879,-321525436312,-508513215599,-783819693378,-1175888158183,-1707009482636,-2359378003743,-2967408656182,-2887637850647,0,12298336501553,54123231389014,186208132094649,591233774123276,1817835816763009,5512649082153570,16616464706900105,49952729460327832,149993075340330705,450153944151202286,1350686501571729241,4052346424657817508,12157403315056928801,36472668995236392442,109418582460128509737,328256464801925140784,984770284061771723377,2954311949870191120518,8862937197462338426873,26588813239827030185020,79766441724267049268673,239299327602203931679634,717897985738727588770249,2153693960741392593220296,6461081886446767415296529,19383245664380256304994590,58149736999135753778076825,174449211004514812487186132,523347633021944367765366625,1570042899075730149685150506,4710128697238817176181958761,14130386091730071508946156128,42391158275206125818294433201,127173474825636916396790465462,381520424476932294542103635257,1144561273430821861071792842604,3433683820292494470259339607297,10301051460877516742060709377218,30903154382632588599240628003593,92709463147897809879227529115640,278128389443693480170185479802193,834385168331080498319769493119054,2503155504993241560961964986085849,7509466514979724758098215239808516,22528399544939174359841450060543649,67585198634817523176648856916050010,202755595904452569640020920097874345,608266787713357709044599306339564432
mov $1,3
pow $1,$0
pow $0,9
sub $1,$0
mov $0,$1
| 182.222222 | 1,561 | 0.912805 |
b8255e2d799e712f27c6eac3a61b5ced9dfc4bcc | 620 | asm | Assembly | oeis/275/A275779.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/275/A275779.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/275/A275779.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A275779: a(n) = (2^(n^2) - 1)/(1 - 1/2^n).
; 2,20,584,69904,34636832,69810262080,567382630219904,18519084246547628288,2422583247133816584929792,1268889750375080065623288448000,2659754699919401766201267083003561984,22306191045953951743035482794815064402563072,748380193317489370459454048174977015562807531282432,100439758122517612290482157270179485135978506112041742254080,53921538889076947220779976828605564007308691576147311567174480461824,115793856111341331857467735920185713421406907988821545813533107889564276555776
add $0,1
mov $2,$0
lpb $0
sub $0,1
mov $3,2
pow $3,$2
add $4,1
mul $4,$3
lpe
mov $0,$4
| 44.285714 | 476 | 0.843548 |
31e4c4b1a76548a5639861c07aed9f19b4e15e8b | 642 | asm | Assembly | oeis/310/A310439.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/310/A310439.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/310/A310439.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A310439: Coordination sequence Gal.6.321.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; Submitted by Jon Maiga
; 1,4,10,15,19,24,29,33,38,44,48,52,58,63,67,72,77,81,86,92,96,100,106,111,115,120,125,129,134,140,144,148,154,159,163,168,173,177,182,188,192,196,202,207,211,216,221,225,230,236
mov $1,$0
seq $1,315275 ; Coordination sequence Gal.6.329.3 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
mov $2,$0
mul $0,7
sub $0,1
mod $0,$1
mul $2,3
add $0,$2
add $0,1
| 45.857143 | 182 | 0.73053 |
61f6d55032ca2a1808e1f383b996340245ca2091 | 206 | asm | Assembly | testdata/unit/branch_backwards_test.asm | tehmaze/mos65xx | 60dbe6b949efcf197106eeae4382e084493a27b0 | [
"MIT"
] | 3 | 2019-10-24T09:41:14.000Z | 2021-12-12T08:11:52.000Z | testdata/unit/branch_backwards_test.asm | tehmaze/mos65xx | 60dbe6b949efcf197106eeae4382e084493a27b0 | [
"MIT"
] | null | null | null | testdata/unit/branch_backwards_test.asm | tehmaze/mos65xx | 60dbe6b949efcf197106eeae4382e084493a27b0 | [
"MIT"
] | 1 | 2020-11-11T17:11:54.000Z | 2020-11-11T17:11:54.000Z |
; Simple test checking if we correctly reach branch targets with negative
; offsets. We had that bug, and the other branch tests don't cover it
;
; Expected Results: X = $FF
LDX #$05
loop:
DEX
BPL loop
| 15.846154 | 73 | 0.728155 |
780b1c91149d57160e9f276d57a18457874983a3 | 230 | asm | Assembly | libsrc/_DEVELOPMENT/adt/bv_priority_queue/c/sccz80/bv_priority_queue_destroy.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/bv_priority_queue/c/sccz80/bv_priority_queue_destroy.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null | libsrc/_DEVELOPMENT/adt/bv_priority_queue/c/sccz80/bv_priority_queue_destroy.asm | meesokim/z88dk | 5763c7778f19a71d936b3200374059d267066bb2 | [
"ClArtistic"
] | null | null | null |
; void bv_priority_queue_destroy(bv_priority_queue_t *q)
SECTION code_adt_bv_priority_queue
PUBLIC bv_priority_queue_destroy
bv_priority_queue_destroy:
INCLUDE "adt/bv_priority_queue/z80/asm_bv_priority_queue_destroy.asm"
| 20.909091 | 72 | 0.869565 |
bc44362d48d810b79d66c68707edcf2e3b97d24e | 6,439 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2623.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2623.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_21829_2623.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0xf929, %rsi
lea addresses_A_ht+0x1daa9, %rdi
nop
nop
nop
nop
nop
sub %rbp, %rbp
mov $104, %rcx
rep movsw
nop
and %r15, %r15
lea addresses_normal_ht+0xaab5, %rsi
lea addresses_normal_ht+0x10ad1, %rdi
nop
nop
nop
nop
nop
dec %r15
mov $25, %rcx
rep movsq
and $22418, %rcx
lea addresses_A_ht+0x116b9, %rax
cmp %r12, %r12
mov (%rax), %rdi
nop
and %r12, %r12
lea addresses_A_ht+0x230d, %rsi
lea addresses_A_ht+0x10e39, %rdi
nop
nop
nop
nop
nop
xor %rbx, %rbx
mov $81, %rcx
rep movsq
nop
nop
nop
inc %rdi
lea addresses_D_ht+0x4a29, %rdi
nop
nop
sub $46600, %rax
movb $0x61, (%rdi)
nop
nop
nop
cmp %rax, %rax
lea addresses_UC_ht+0x1d74a, %rsi
lea addresses_WT_ht+0x15ca9, %rdi
nop
nop
nop
nop
cmp $30498, %rbp
mov $118, %rcx
rep movsq
nop
nop
nop
nop
nop
add $432, %rbp
lea addresses_WC_ht+0xf910, %rsi
lea addresses_WT_ht+0x1929, %rdi
nop
cmp $20014, %r12
mov $67, %rcx
rep movsq
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0x39e9, %rcx
sub %rdi, %rdi
mov (%rcx), %esi
nop
nop
nop
nop
sub %r15, %r15
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r8
push %r9
push %rbp
push %rcx
push %rdx
// Load
lea addresses_UC+0x62a9, %r14
and $45656, %rcx
movb (%r14), %r8b
nop
nop
nop
nop
cmp %rcx, %rcx
// Load
lea addresses_D+0x14e21, %r13
add $9777, %r14
mov (%r13), %r9d
nop
nop
add %r14, %r14
// Faulty Load
lea addresses_UC+0x62a9, %r14
nop
nop
nop
nop
and %rbp, %rbp
mov (%r14), %ecx
lea oracles, %r9
and $0xff, %rcx
shlq $12, %rcx
mov (%r9,%rcx,1), %rcx
pop %rdx
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC', 'same': True, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D', 'same': False, 'size': 4, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'same': False, 'size': 8, 'congruent': 4, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 1, 'congruent': 2, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 4, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
| 37.219653 | 2,999 | 0.656934 |
faeb193443dd1fdcdba16d1a9dde93ee9087c9e1 | 485 | asm | Assembly | src/guess.asm | rprouse/8088 | 7cba221d5dd515144afa0d7bdd875f914e0e8c9a | [
"MIT"
] | null | null | null | src/guess.asm | rprouse/8088 | 7cba221d5dd515144afa0d7bdd875f914e0e8c9a | [
"MIT"
] | null | null | null | src/guess.asm | rprouse/8088 | 7cba221d5dd515144afa0d7bdd875f914e0e8c9a | [
"MIT"
] | null | null | null | ; Guess a number between 0 and 7
cpu 8086
bits 16
org 0x0100
jmp start
%include 'library.inc'
start:
in al,(0x40) ; Read the timer counter chip
and al,0x07 ; Mask bits to get 0 to 7
add al,0x30 ; Convert to ASCII
mov cl,al ; Move AL into CL
.game_loop:
mov al,'?'
call chout
call chin
cmp al,cl ; Did you guess right?
jne .game_loop
mov al,':'
call chout
mov al,')'
call chout
jmp exit | 17.962963 | 49 | 0.569072 |
a744b2c75f5e22c959514968696eb026436fdd44 | 595 | asm | Assembly | lib/math/multiply.asm | msiemens/rust-tinyasm | 1549d75260b9d523d4ecebd2033b098ef5e5f156 | [
"MIT",
"Unlicense"
] | 14 | 2015-02-24T01:39:42.000Z | 2022-03-30T10:55:55.000Z | lib/math/multiply.asm | msiemens/rust-tinyasm | 1549d75260b9d523d4ecebd2033b098ef5e5f156 | [
"MIT",
"Unlicense"
] | null | null | null | lib/math/multiply.asm | msiemens/rust-tinyasm | 1549d75260b9d523d4ecebd2033b098ef5e5f156 | [
"MIT",
"Unlicense"
] | 2 | 2021-01-19T20:52:32.000Z | 2022-03-30T10:55:56.000Z | ; Define constants
$math_mul_counter = [_]
; SUBROUTINE: Multiply two integers
; ---------------------------------
; Input: $arg1 & $arg2 as two integers
; Output: $return's the multiplication of the two
; Algorithm: Sum arg1 arg0' times
@start(multiply, 2)
math_mul_loop:
; counter == arg1 → break
JEQ :math_mul_done $arg1 $math_mul_counter
ADD $math_mul_counter 1
ADD $return $arg0
JMP :math_mul_loop ; Loop iteration
math_mul_done:
@end() | 29.75 | 66 | 0.515966 |
23c9dc0b650991be446542ebf1a2272911424c74 | 675 | asm | Assembly | oeis/277/A277509.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/277/A277509.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/277/A277509.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A277509: E.g.f.: 1/((1+LambertW(-x))*(1+x)).
; Submitted by Christian Krause
; 1,0,4,15,196,2145,33786,587041,12080888,278692497,7213075030,205967845281,6444486304884,219096784628761,8044651840755362,317224112769528945,13371158269397088496,599930571306586259745,28547657791777984900014,1436014157616531876023713,76137316847669362479525740,4243703364584925909311083881,248066403343351187391802878202,15174940722950834724343566711921,969537199499464091064835871757672,64579411982525920957269636653323825,4477054868661483365907663735413784326
mov $3,2
lpb $0
sub $0,1
add $1,1
mov $2,$1
pow $2,$1
mul $2,2
mul $3,-1
mul $3,$1
add $3,$2
lpe
mov $0,$3
div $0,2
| 37.5 | 462 | 0.807407 |
0f1bda237f7dd3a431a20b07055ab6dc268fd585 | 108 | asm | Assembly | error_addresses.asm | jwestfall69/ddragon-sound-diag | 4c022db7191815e546a8490150fb8b7ea26a4f5b | [
"Unlicense"
] | null | null | null | error_addresses.asm | jwestfall69/ddragon-sound-diag | 4c022db7191815e546a8490150fb8b7ea26a4f5b | [
"Unlicense"
] | null | null | null | error_addresses.asm | jwestfall69/ddragon-sound-diag | 4c022db7191815e546a8490150fb8b7ea26a4f5b | [
"Unlicense"
] | null | null | null | section errors,"rodata"
; fills the errors section with bra to self instructions
blkw (0x5ff2/2),0x20fe
| 21.6 | 57 | 0.759259 |
10725c33fee1eae880c2d84696fbbe6cfaf2017a | 264 | nasm | Assembly | Project-Einstein/src/E-Assembly/src/labs/lcd1.nasm | FelixLuciano/Elements-of-Computing-Systems | bf36e4f4bbaa75aebefd1b864514a146b371495d | [
"MIT"
] | null | null | null | Project-Einstein/src/E-Assembly/src/labs/lcd1.nasm | FelixLuciano/Elements-of-Computing-Systems | bf36e4f4bbaa75aebefd1b864514a146b371495d | [
"MIT"
] | null | null | null | Project-Einstein/src/E-Assembly/src/labs/lcd1.nasm | FelixLuciano/Elements-of-Computing-Systems | bf36e4f4bbaa75aebefd1b864514a146b371495d | [
"MIT"
] | 1 | 2022-02-20T21:45:28.000Z | 2022-02-20T21:45:28.000Z | ; Arquivo: sw1.nasm
; Curso: Elementos de Sistemas
; Criado por: Rafael Corsi
; Data: 4/2020
leaw $16384, %A
movw %A, %D
leaw $0, %A
movw %D, (%A)
LOOP:
leaw $0, %A
movw (%A), %D
addw $1, %D, (%A)
movw %D, %A
movw $-1, (%A)
leaw $LOOP, %A
jmp
nop | 13.894737 | 30 | 0.549242 |
600819e06d7a39b37ed73136933508f20f00e2eb | 367 | asm | Assembly | src/vwf.asm | ISSOtm/gb-open-world | b0b5b838e2a98e536e440632c95472ea057111c5 | [
"MIT"
] | 8 | 2021-03-14T21:48:19.000Z | 2021-11-16T11:05:16.000Z | src/vwf.asm | ISSOtm/gb-open-world | b0b5b838e2a98e536e440632c95472ea057111c5 | [
"MIT"
] | null | null | null | src/vwf.asm | ISSOtm/gb-open-world | b0b5b838e2a98e536e440632c95472ea057111c5 | [
"MIT"
] | null | null | null |
INCLUDE "hardware.inc/hardware.inc"
SKIP_HELD_KEYS equ PADF_B
SKIP_PRESSED_KEYS equ PADF_A
NB_CHARSETS equ 1
CHARSET_0 equs "res/optix.vwf"
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, ((\2) << 8) | (\3)
ENDM
INCLUDE "gb-vwf/vwf.asm"
| 21.588235 | 77 | 0.640327 |
60c6b5c020704e90463e84286daee7f1c060f50d | 683 | asm | Assembly | oeis/189/A189052.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/189/A189052.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/189/A189052.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A189052: a(n) is the number of inversions in all compositions of n.
; 0,0,0,1,4,14,42,118,314,806,2010,4902,11738,27686,64474,148518,338906,767014,1723354,3847206,8539098,18854950,41438170,90682406,197675994,429372454,929582042,2006430758,4318579674,9270965286,19854281690,42422744102,90452806618,192478164006,408817257434,866788029478,1834746399706,3877560103974,8182708063194,17243498329126,36288974048218,76273528845350,160121471126490,335758273000486,703280215247834,1471553784493094,3076026307988442,6423754155996198,13402639516060634,27938997688316966
lpb $0
mov $2,$0
sub $0,2
trn $2,2
seq $2,49611 ; a(n) = T(n,2), array T as in A049600.
add $1,$2
lpe
mov $0,$1
| 56.916667 | 489 | 0.809663 |
6096eb0d09a68c1171f276fa64858c973aa57cb1 | 319 | asm | Assembly | oeis/021/A021978.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/021/A021978.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/021/A021978.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A021978: Decimal expansion of 1/974.
; Submitted by Jon Maiga
; 0,0,1,0,2,6,6,9,4,0,4,5,1,7,4,5,3,7,9,8,7,6,7,9,6,7,1,4,5,7,9,0,5,5,4,4,1,4,7,8,4,3,9,4,2,5,0,5,1,3,3,4,7,0,2,2,5,8,7,2,6,8,9,9,3,8,3,9,8,3,5,7,2,8,9,5,2,7,7,2,0,7,3,9,2,1,9,7,1,2,5,2,5,6,6,7,3,5,1
seq $0,199685 ; a(n) = 5*10^n+1.
div $0,487
mod $0,10
| 39.875 | 199 | 0.554859 |
a3fbd0e6cbc085439ab0ca70026aadc881f91737 | 319 | asm | Assembly | MPI/Lab-4/Avg_n_numbers.asm | vishwas1101/Misc | cf660dfbacc674cd262eb4abd0e9dd07479a90ae | [
"MIT"
] | null | null | null | MPI/Lab-4/Avg_n_numbers.asm | vishwas1101/Misc | cf660dfbacc674cd262eb4abd0e9dd07479a90ae | [
"MIT"
] | null | null | null | MPI/Lab-4/Avg_n_numbers.asm | vishwas1101/Misc | cf660dfbacc674cd262eb4abd0e9dd07479a90ae | [
"MIT"
] | null | null | null |
org 100h
; average of N numbers
MOV AX, 0000H
MOV SI, 1100H
MOV CX, 0005H
MOV BX, 0000H
MOV [SI], 0123H
MOV [SI+ 2H], 1234H
MOV [SI+ 4H], 1023H
MOV [SI+ 6H], 1456H
MOV [SI+ 8H], 2045H
lop: ADD AX, [SI]
INC SI
INC SI
INC BX
CMP CX, BX
JNZ lop
DIV CX
MOV [1200H], AX
HLT
ret
| 9.114286 | 23 | 0.567398 |
1330c178523fc6c1d88ae725121b6884b0b02229 | 1,493 | asm | Assembly | src/util/strg/insst.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | src/util/strg/insst.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | src/util/strg/insst.asm | olifink/qspread | d6403d210bdad9966af5d2a0358d4eed3f1e1c02 | [
"MIT"
] | null | null | null | ; insert one string in another 06/01-92 O.Fink
section string
include win1_keys_err
xdef st_insst ; insert a string
;+++
; insert a string in another one
; abcdef -> insert 123 after 2 -> ab123def
;
; Entry Exit
; a0 ptr to string preserved
; a1 ptr to string inserted preserved
; a2 ptr to result string preserved
; d1.w position to insert after preserved
;
; error codes: err.orng position out of range
; condition codes set
;---
r_insst reg d1-d3/a0-a2
st_insst
movem.l r_insst,-(sp)
moveq #err.orng,d0
move.w (a0)+,d2
move.w d2,d3
sub.w d1,d3
bmi.s ins_exit
add.w (a1),d2
move.w d2,(a2)+ ; new string length
move.w (a1)+,d2 ; length of insert string
bra.s ins_end ; copy the first part
ins_lp
move.b (a0)+,(a2)+
ins_end
dbra d1,ins_lp
bra.s ins_end2 ; insert the string
ins_lp2
move.b (a1)+,(a2)+
ins_end2
dbra d2,ins_lp2
bra.s ins_end3 ; copy the rest
ins_lp3
move.b (a0)+,(a2)+
ins_end3
dbra d3,ins_lp3
moveq #0,d0
ins_exit
movem.l (sp)+,r_insst
tst.l d0
rts
end
| 24.47541 | 69 | 0.470864 |
8dcaa28409dc68311f5941e77bf6f2650a107d94 | 877 | asm | Assembly | Compilation/TP5/utils.asm | FlorentSimonnot/S6 | 42b149625b8bbea772dd4e21fc962e0a5ebbf0d9 | [
"MIT"
] | null | null | null | Compilation/TP5/utils.asm | FlorentSimonnot/S6 | 42b149625b8bbea772dd4e21fc962e0a5ebbf0d9 | [
"MIT"
] | null | null | null | Compilation/TP5/utils.asm | FlorentSimonnot/S6 | 42b149625b8bbea772dd4e21fc962e0a5ebbf0d9 | [
"MIT"
] | null | null | null | extern printf
section .data
format_registers db "rax:%x rbx:%x rcx:%ld rdx:%ld", 10, 0
format_stacks db "haut de la pile (rsp): 0x%x, bas de la pile (rbp): 0x%x", 10, 0
section .text
global print_stacks ; declaration de la fonction
global print_registers ; declatation de la fonction
print_registers:
push rbp
mov rbp, rsp
push rax
push rcx
push rdx
push rdi
push rsi
push r8
mov r8, rdx
mov rcx, rcx
mov rdx, rbx
mov rsi, rax
mov rdi, format_registers
mov rax, 0
call printf WRT ..plt
pop r8
pop rsi
pop rdi
pop rdx
pop rcx
pop rax
pop rbp
ret
print_stacks:
push rbp
mov rbp, rsp
push rax
push rdx
push rdi
push rsi
mov rdx, [rsp+32]
mov rax, rsp
add rax, 48
mov rsi, rax
mov rdi, format_stacks
mov rax, 0
call printf WRT ..plt
pop rsi
pop rdi
pop rdx
pop rax
pop rbp
ret
| 13.089552 | 82 | 0.655644 |
dda5795e9ac8a8dc1f99d95923b4162b9af0e56e | 459 | asm | Assembly | oeis/065/A065363.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/065/A065363.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/065/A065363.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A065363: Sum of balanced ternary digits in n. Replace 3^k with 1 in balanced ternary expansion of n.
; Submitted by Jamie Morken(s3)
; 0,1,0,1,2,-1,0,1,0,1,2,1,2,3,-2,-1,0,-1,0,1,0,1,2,-1,0,1,0,1,2,1,2,3,0,1,2,1,2,3,2,3,4,-3,-2,-1,-2,-1,0,-1,0,1,-2,-1,0,-1,0,1,0,1,2,-1,0,1,0,1,2,1,2,3,-2,-1,0,-1,0,1,0,1,2,-1,0,1,0,1,2,1,2,3,0,1,2,1,2,3,2,3,4,-1,0,1,0,1
lpb $0
add $0,1
mov $2,$0
div $0,3
sub $1,1
add $2,$0
mod $2,4
add $1,$2
lpe
mov $0,$1
| 30.6 | 221 | 0.544662 |
349677916c5a09d284e679a79b3aaff8e209c6d5 | 560 | asm | Assembly | programs/oeis/329/A329822.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/329/A329822.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/329/A329822.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A329822: The minimum weight of a Boolean function of algebraic degree at most n-3 whose support contains n linearly independent elements.
; 8,8,12,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204
trn $0,1
mov $1,1
cmp $1,$0
add $1,$0
mul $1,2
add $1,8
mov $0,$1
| 50.909091 | 352 | 0.714286 |
071c27d23f20cc2f992defb708377846766259d8 | 1,325 | asm | Assembly | tests/z80/op_IY_BIT_FDCB.asm | cizo2000/sjasmplus | 615d7c0e09a44aa2a923095fc9ed6dca6ecae4a4 | [
"BSD-3-Clause"
] | 220 | 2016-10-22T19:44:39.000Z | 2022-03-29T20:57:04.000Z | tests/z80/op_IY_BIT_FDCB.asm | ped7g/sjasmplus | 487635c8057cd5594c372d9b70bc00a3f3a1ecc4 | [
"BSD-3-Clause"
] | 153 | 2018-05-07T10:31:23.000Z | 2022-03-30T04:35:59.000Z | tests/z80/op_IY_BIT_FDCB.asm | ped7g/sjasmplus | 487635c8057cd5594c372d9b70bc00a3f3a1ecc4 | [
"BSD-3-Clause"
] | 51 | 2016-05-12T21:27:36.000Z | 2022-03-27T15:16:16.000Z | OUTPUT "op_IY_BIT_FDCB.bin"
;;; generate shift instructions: #FDCBFF00 .. #FDCBFF3F ("iy-1" = FF index byte)
LUA ALLPASS
instructions = { 'rlc', 'rrc', 'rl', 'rr', 'sla', 'sra', 'sli', 'srl' }
registers = { '(iy-1),b', '(iy-1),c', '(iy-1),d', '(iy-1),e', '(iy-1),h', '(iy-1),l', '(iy-1)', '(iy-1),a' }
for ii = 1, #instructions do
for rr = 1, #registers do
instruction = instructions[ii]..' '..registers[rr]
_pc(instruction)
end
end
ENDLUA
;;; generate `bit` instructions: #FDCBFF46 .. #FDCBFF7E (two: {#x6, #xE})
LUA ALLPASS
for bb = 0, 7 do
instruction = 'bit '..bb..',(iy-1)'
_pc(instruction)
end
ENDLUA
;;; generate `res` + `set` instructions: #FDCB1180 .. #FDCB11FF ("iy+17" = 11 index byte)
LUA ALLPASS
instructions = { 'res', 'set' }
registers = { '(iy+17),b', '(iy+17),c', '(iy+17),d', '(iy+17),e', '(iy+17),h', '(iy+17),l', '(iy+17)', '(iy+17),a' }
for ii = 1, #instructions do
for bb = 0, 7 do
for rr = 1, #registers do
instruction = instructions[ii]..' '..bb..','..registers[rr]
_pc(instruction)
end
end
end
ENDLUA
| 36.805556 | 124 | 0.463396 |
f633febddde7200210cf12b618b4a3295e48a40e | 144 | asm | Assembly | src/third_party/nasm/test/_file_.asm | Mr-Sheep/naiveproxy | 9f6e9768295f6d1d41517a15a621d4756bd7d6be | [
"BSD-3-Clause"
] | 2,219 | 2018-03-26T02:57:34.000Z | 2022-03-31T00:27:59.000Z | src/third_party/nasm/test/_file_.asm | Mr-Sheep/naiveproxy | 9f6e9768295f6d1d41517a15a621d4756bd7d6be | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | src/third_party/nasm/test/_file_.asm | Mr-Sheep/naiveproxy | 9f6e9768295f6d1d41517a15a621d4756bd7d6be | [
"BSD-3-Clause"
] | 473 | 2019-03-24T16:34:23.000Z | 2022-03-31T02:01:05.000Z | ;Testname=bin; Arguments=-fbin -o_file_.bin; Files=stdout stderr _file_.bin
db __FILE__, `\r\n`
db __FILE__, `\r\n`
dw __LINE__
dw __LINE__
| 24 | 75 | 0.722222 |
dc3f8e436b324c73bd1ad8eb2482eebd3f4da12f | 687 | asm | Assembly | Recursion/checking_evens.asm | JaredsOSToolbox/AssemblerPrograms | a9158c5b135689ec39c71944c121d65a61d8a6b4 | [
"MIT"
] | null | null | null | Recursion/checking_evens.asm | JaredsOSToolbox/AssemblerPrograms | a9158c5b135689ec39c71944c121d65a61d8a6b4 | [
"MIT"
] | null | null | null | Recursion/checking_evens.asm | JaredsOSToolbox/AssemblerPrograms | a9158c5b135689ec39c71944c121d65a61d8a6b4 | [
"MIT"
] | null | null | null | ; This program will test my NASM knowledge
global _start
section .text
; Takes in al as input
isEven:
; C-Code Equivalent
; return (number%2==0) ? 1 : 0;
push r8
; divide the number by 2
; check if the remainder is 0?
; preparing for integer division
mov al, r8b
xor ah, ah ; clear the remainder
mov bl, 3
div bl
cmp ah, 0
jz return_zero
return_one:
; since we do not need to have al stay in contact, we can discard it by having it hold the TRUE or FALSE variable
mov r8, 1
jmp exit
return_zero:
xor r8, r8
exit:
ret
_start:
mov al, 2
call isEven
cmp r8, 1
inc r9
mov rax, 60
mov rdi, 0
syscall
section .data
array: dq ""
| 18.567568 | 117 | 0.659389 |
420b6e510d42fa04e3119bd821df06e34386fa85 | 948 | asm | Assembly | libsrc/graphics/gray/g_drawr.asm | andydansby/z88dk-mk2 | 51c15f1387293809c496f5eaf7b196f8a0e9b66b | [
"ClArtistic"
] | 1 | 2020-09-15T08:35:49.000Z | 2020-09-15T08:35:49.000Z | libsrc/graphics/gray/g_drawr.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | libsrc/graphics/gray/g_drawr.asm | dex4er/deb-z88dk | 9ee4f23444fa6f6043462332a1bff7ae20a8504b | [
"ClArtistic"
] | null | null | null | ;
; TI Gray Library Functions
;
; Written by Stefano Bodrato - Mar 2001
;
;
; $Id: g_drawr.asm,v 1.3 2001/04/18 13:21:38 stefano Exp $
;
;Usage: g_drawr(int px, int py, int GrayLevel)
XLIB g_drawr
XREF COORDS
LIB line_r
LIB plotpixel
LIB respixel
LIB graypage
.g_drawr
ld ix,0
add ix,sp
ld a,(ix+2) ;GrayLevel
ld e,(ix+4) ;py
ld d,(ix+5)
ld l,(ix+6) ;px
ld h,(ix+7)
ld bc,(COORDS)
push bc
push af
xor a
call graypage
pop af
ld ix,plotpixel
rra
jr nc,set1
ld ix,respixel
.set1
push af
push hl
push de
call line_r
pop de
pop hl
pop af
pop bc
ld (COORDS),bc
push af
ld a,1
call graypage
pop af
ld ix,plotpixel
rra
jr nc,set2
ld ix,respixel
.set2
jp line_r
| 14.8125 | 58 | 0.492616 |
8d5c59e062fd8be6683e5e5423b2bab124267584 | 3,766 | asm | Assembly | source/features/icons.asm | shoaib-jamal/MichalOS | beb0ed824ae7c2eef63c5a1659b576332e732cda | [
"BSD-3-Clause"
] | 14 | 2021-04-23T15:31:04.000Z | 2022-03-16T01:18:22.000Z | source/features/icons.asm | shoaib-jamal/MichalOS | beb0ed824ae7c2eef63c5a1659b576332e732cda | [
"BSD-3-Clause"
] | 4 | 2021-03-30T15:51:42.000Z | 2021-12-31T22:55:22.000Z | source/features/icons.asm | shoaib-jamal/MichalOS | beb0ed824ae7c2eef63c5a1659b576332e732cda | [
"BSD-3-Clause"
] | 3 | 2021-03-30T13:47:02.000Z | 2021-11-07T02:53:02.000Z | ; ==================================================================
; MichalOS Icons
; ==================================================================
bomblogo db 9, 16
db 00000000b, 00000000b, 00000000b, 00000000b, 00000000b, 00100000b, 00000000b, 01100000b, 00000000b
db 00000000b, 00000000b, 00000000b, 00000000b, 00000100b, 00000010b, 00000001b, 10000000b, 00000000b
db 00000000b, 00000000b, 00000000b, 00000000b, 00000000b, 10000100b, 10000000b, 00000000b, 00000000b
db 00000000b, 00000000b, 00000000b, 01101010b, 10100101b, 00000001b, 01010000b, 10001000b, 10000000b
db 00000000b, 00000000b, 00000011b, 00000000b, 00000000b, 10101000b, 00000000b, 01000000b, 00000000b
db 00000000b, 00000000b, 01010111b, 01010100b, 00000000b, 00011000b, 00100000b, 00100100b, 00000000b
db 00000000b, 00000000b, 11111111b, 11111100b, 00000000b, 10000000b, 00100000b, 00000010b, 00000000b
db 00000000b, 01011111b, 11111111b, 11111111b, 11010100b, 00000000b, 00100000b, 00000000b, 00000000b
db 00000001b, 11111111b, 11111111b, 11111111b, 11111101b, 00000000b, 00000000b, 00000000b, 00000000b
db 00000111b, 11111111b, 11111111b, 11111111b, 11111111b, 01000000b, 00000000b, 00000000b, 00000000b
db 00001111b, 11111111b, 11111111b, 11111111b, 11111111b, 11000000b, 00000000b, 00000000b, 00000000b
db 00001111b, 11111111b, 11111111b, 11111111b, 11111111b, 11000000b, 00000000b, 00000000b, 00000000b
db 00001111b, 11111111b, 11111111b, 11111111b, 11111111b, 11000000b, 00000000b, 00000000b, 00000000b
db 00000011b, 11111111b, 11111111b, 11111111b, 11111111b, 00000000b, 00000000b, 00000000b, 00000000b
db 00000000b, 11111111b, 11111111b, 11111111b, 11111100b, 00000000b, 00000000b, 00000000b, 00000000b
db 00000000b, 00001010b, 11111111b, 11111110b, 10000000b, 00000000b, 00000000b, 00000000b, 00000000b
filelogo db 4, 8
db 00001110b, 10101010b, 11010000b, 00000000b
db 00001100b, 00000000b, 11001001b, 00000000b
db 00001100b, 00000000b, 10101010b, 11000000b
db 00001100b, 00000000b, 00000000b, 11000000b
db 00001100b, 00000000b, 00000000b, 11000000b
db 00001100b, 00000000b, 00000000b, 11000000b
db 00001100b, 00000000b, 00000000b, 11000000b
db 00001101b, 01010101b, 01010101b, 11000000b
logo db 18, 7
db 00000000b, 00000000b, 00001110b, 11101010b, 10101010b, 10101100b, 01000000b, 00000100b, 00000000b, 00000000b, 01000000b, 00000000b, 00000000b, 00010011b, 11101010b, 10111111b, 10101010b, 10110000b
db 00000000b, 00000000b, 00001100b, 11101010b, 10101010b, 11101100b, 11100100b, 01101100b, 00000000b, 00000000b, 11000000b, 00000000b, 00000000b, 00110011b, 00111111b, 11001100b, 11111111b, 11110000b
db 00000000b, 00000000b, 00001100b, 11000000b, 00000000b, 11001100b, 11000010b, 00001100b, 10000000b, 00000000b, 11000000b, 00000000b, 00000000b, 00110011b, 00111111b, 11001100b, 11111111b, 11110000b
db 00000000b, 00000000b, 00001100b, 11000000b, 00000000b, 11001100b, 11000000b, 00001100b, 11000110b, 10101000b, 11011010b, 10010010b, 10101001b, 00110011b, 00111111b, 11001111b, 01010101b, 10110000b
db 00000000b, 00000000b, 00001100b, 11000000b, 00000000b, 11001100b, 11000000b, 00001100b, 11001100b, 00000000b, 11000000b, 00110001b, 10101011b, 00110011b, 00111111b, 11001111b, 11111111b, 00110000b
db 00000000b, 00000000b, 00001110b, 10101010b, 10101010b, 11001100b, 11000000b, 00001100b, 11001001b, 01010100b, 11000000b, 00110010b, 01010110b, 00110011b, 01101010b, 10011110b, 10101010b, 01110000b
db 00000000b, 00000000b, 00001010b, 10101010b, 10101010b, 10101000b, 00000000b, 00000000b, 00000000b, 00000000b, 00000000b, 00000000b, 00000000b, 00000010b, 10101010b, 10101010b, 10101010b, 10100000b
| 89.666667 | 205 | 0.750664 |
cf254ac3670cb66c98cda76df90d46a0832ec1bc | 1,078 | asm | Assembly | programs/oeis/321/A321003.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/321/A321003.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/321/A321003.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A321003: a(n) = 2^n*(4*3^n-1).
; 3,22,140,856,5168,31072,186560,1119616,6718208,40310272,241863680,1451186176,8707125248,52242767872,313456640000,1880739905536,11284439564288,67706637647872,406239826411520,2437438959517696,14624633759203328,87747802559414272,526486815364874240,3158920892206022656,18953525353269690368,113721152119685251072,682326912718245724160,4093961476309742780416,24563768857858993553408,147382613147155035062272,884295678882932357857280,5305774073297598442110976,31834644439785599242600448,191007866638713612635471872,1146047199832281710172569600,6876283198993690329754894336,41257699193962142115968319488,247546195163772852970687823872,1485277170982637118373882757120,8911663025895822711342808170496,53469978155374936270255872278528,320819868932249617625933280182272,1924919213593497705764395774115840,11549515281560986234603966830739456,69297091689365917407658985356525568,415782550136195504446024280883331072
add $0,1
mov $1,2
pow $1,$0
mov $2,6
pow $2,$0
sub $2,$1
mul $2,4
add $1,$2
sub $1,6
div $1,6
mul $1,2
sub $1,4
div $1,2
add $1,3
mov $0,$1
| 56.736842 | 903 | 0.877551 |
10b92a6211531a5e6cd3a3c468190d2d219f1df3 | 696 | asm | Assembly | oeis/006/A006041.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/006/A006041.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/006/A006041.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A006041: a(n+1) = (n^2 - 1)*a(n) + n + 1.
; Submitted by Christian Krause
; 0,2,9,76,1145,27486,962017,46176824,2909139921,232731193690,23040388175321,2764846581038532,395373061088510089,66422674262869694966,12952421481259590518385,2901342411802148276118256,739842315009547810410155297,213074586722749769398124725554,68823091511448175515594286353961,24776312944121343185613943087425980,9885748864704415931059963291882966041,4349729500469943009666383848428505058062,2100919348726982473668863398790967943043969,1109285416127846746097159874561631073927215656
mov $2,1
lpb $0
sub $0,1
sub $1,4
mul $1,$2
add $2,1
mul $1,$2
sub $4,1
lpe
bin $3,$1
add $4,$3
div $1,$4
mov $0,$1
div $0,4
| 36.631579 | 481 | 0.813218 |
98062c7103489fcc2f80fe334eb7cb95495c75c6 | 1,096 | asm | Assembly | programs/oeis/033/A033686.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/033/A033686.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | programs/oeis/033/A033686.asm | karttu/loda | 9c3b0fc57b810302220c044a9d17db733c76a598 | [
"Apache-2.0"
] | null | null | null | ; A033686: One-ninth of theta series of A2[hole]^2.
; 1,2,5,4,8,6,14,8,14,10,21,16,20,14,28,16,31,18,40,20,32,28,42,24,38,32,62,28,44,30,56,40,57,34,70,36,72,38,70,48,62,52,85,44,68,46,112,56,74,50,100,64,80,64,98,56,108,58,124,60,112,76,112,64,98,66,155,80,104,80,126,88,110,84,168,76,144,78,140,80,133,114,160,84,128,86,196,88,160,90,186,124,140,94,168,112,180,98,190,112,152,124,224,104,158,106,254,120,164,128,196,136,183,128,220,116,248,118,210,120,182,148,248,144,216,140,280,128,194,130,285,160,200,134,238,152,252,160,294,140,212,186,252,144,256,160,360,148,224,150,266,224,230,154,310,156,288,176,336,160,242,196,310,164,280,192,364,168,288,170,341,208,304,174,308,192,324,196,340,228,272,220,322,200,278,186,496,188,284,190,392,248,307,224,370,196,360,198,350,200,352,266,420,224,308,206,448,240,314,228,400,256,360,214,448,216,434,218,434,220,332,320,392,248,338,226,540,228,400,252,406,280,350,234,508,272,432,256,420,240,381,310,560,264,368,272,532,248,374,288
mul $0,3
add $0,1
cal $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
mov $1,$0
div $1,3
| 121.777778 | 921 | 0.713504 |
77b59282518043363fc1cc7d7424b9f7b28cb6b3 | 1,847 | asm | Assembly | unicode_extended/UnicodeTest_Console/UnicodeTest_Console.asm | AlexRogalskiy/Masm | d39498878f140696b299c76436f209156961429e | [
"MIT"
] | null | null | null | unicode_extended/UnicodeTest_Console/UnicodeTest_Console.asm | AlexRogalskiy/Masm | d39498878f140696b299c76436f209156961429e | [
"MIT"
] | null | null | null | unicode_extended/UnicodeTest_Console/UnicodeTest_Console.asm | AlexRogalskiy/Masm | d39498878f140696b299c76436f209156961429e | [
"MIT"
] | null | null | null | ;-----------------------------------------------------------------;
; This example shows how to to use the Unicode macros. ;
; A short overview: ;
; UCSTR / UC - unicode string ;
; UCCSTR / UCC - unicode string with escape sequences ;
; uc$() - returns offset to zero. term. unicode string ;
; ucc$() - returns offset to zero. term. unicode c-string ;
;-----------------------------------------------------------------;
__UNICODE__ EQU 1
include \masm32\include\masm32rt.inc
; usage: printw pwsz1,pwsz2,...
printw macro args:VARARG
prw_args TEXTEQU repargs(&args)
prw_frmt TEXTEQU <">
prw_cntr = 0
WHILE prw_cntr LT repargs_cntr
prw_frmt CATSTR prw_frmt,<!\ps>
prw_cntr = prw_cntr + 1
ENDM
prw_frmt CATSTR prw_frmt,<">
prw_call TEXTEQU <fnx crt_wprintf,>,ucc$(%prw_frmt),prw_args
prw_call
endm
.data
; create zero terminated unicode string
UCSTR wstr1, "Hello World",21h,13,10,"This is a test for MASM32's unicode macros.",13,10,0
; create zero terminated unicode string with escape sequences
UCCSTR wstr2, 'This is a C-String\x : \a\b\l\r\\\n',0
; create a string over several lines. The term. zero is added in the last line.
UCSTR wstr3, 9,"This Text",13,10
UCSTR , 9,"needs",13,10
UCSTR , 9,"four",13,10
UCSTR , 9,"lines",13,10,0
; UC = UCSTR
; UCC = UCCSTR
UC wstr4,"123456789",13,10
UCC wstr5,"abcdef\n",0
.code
main proc
; print the strings (&=ADDR)
printw &wstr1,&wstr2,&wstr3
; print a string with escape sequences
printw ucc$("\t\x\x\x\n")
; print some other string
printw uc$("abcdefg...",13,10)
; the fnx-macro produces unicode strings, if __UNICODE__ = 1
fnx crt_wprintf,"%s%s","ABCDEFG...",uc$(13,10)
inkey
exit
main endp
end main | 29.31746 | 91 | 0.590146 |
27ccd0ec3bf932ecda3380d7fbaa00b1f6dfdea1 | 1,032 | asm | Assembly | cpuinfo.asm | lgromanowski/fasm-other-stuff | 7f311aab6454dcdda6a6806e1e56ba2b8e47b782 | [
"BSD-3-Clause"
] | null | null | null | cpuinfo.asm | lgromanowski/fasm-other-stuff | 7f311aab6454dcdda6a6806e1e56ba2b8e47b782 | [
"BSD-3-Clause"
] | null | null | null | cpuinfo.asm | lgromanowski/fasm-other-stuff | 7f311aab6454dcdda6a6806e1e56ba2b8e47b782 | [
"BSD-3-Clause"
] | null | null | null | format ELF executable 3
entry _
segment readable writeable executable
_:
mov eax, 80000000h
cpuid
cmp eax, 80000004h
jb exit
mov edi, cpuname
mov eax, 80000002h
call get_cpu_name_part
mov eax, 80000003h
call get_cpu_name_part
mov eax, 80000004h
call get_cpu_name_part
mov ecx, cpuname
mov edx, cpuname_size
call print
mov eax, 1
cpuid
shl ecx, 1
jnc exit
vm:
mov eax, 40000000h
cpuid
mov edi, hypervisor
call save_cpuid_string2
mov ecx, hypervisor
mov edx, hypervisor_size
call print
jmp exit
get_cpu_name_part:
cpuid
call save_cpuid_string
ret
print:
mov ebx, 1
mov eax, 4
int 80h
ret
exit:
mov eax, 1
int 80h
save_cpuid_string:
stosd
save_cpuid_string2:
mov eax, ebx
stosd
mov eax, ecx
stosd
mov eax, edx
stosd
ret
cpuname rb 48
db 0x0A
cpuname_size = $ - cpuname
hypervisor rb 12
db 0x0A
hypervisor_size = $ - hypervisor | 13.578947 | 37 | 0.638566 |
8537edfe79cc60e178317808d8e11ca9cc9e3080 | 677 | asm | Assembly | oeis/021/A021724.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/021/A021724.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/021/A021724.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A021724: Expansion of 1/((1-x)(1-3x)(1-10x)(1-12x)).
; Submitted by Jon Maiga
; 1,26,465,7150,101621,1378026,18123145,233349350,2958918141,37094306626,461004657425,5690785933950,69876732453061,854393804284826,10411455807073305,126524771262956950,1534170271000826381,18568773410657056626,224412582514937210785,2708824006051515234350,32664618231346100038101,393562720363448063246026,4738625660234372458429865,57022238081542567710702150,685854158565812218268168221,8246122918662761947548357026,99112205182683300466682410545,1190933763779501187999606416350
add $0,2
lpb $0
sub $0,1
add $2,2
mul $2,12
mul $3,10
add $3,$1
mul $1,3
add $1,$2
lpe
mov $0,$3
div $0,24
| 39.823529 | 474 | 0.82127 |
2eb3330b2a4172d1660ac4c296b1ded6411f9f5f | 1,259 | nasm | Assembly | Library/OcPeimEntryPoint/X64/GS.nasm | lyrl/OpenCorePkg | d246944bb09f0189455f8174ca14e38909cfbe8d | [
"BSD-3-Clause"
] | 10,125 | 2019-04-05T07:28:52.000Z | 2022-03-31T14:46:53.000Z | Library/OcPeimEntryPoint/X64/GS.nasm | lyrl/OpenCorePkg | d246944bb09f0189455f8174ca14e38909cfbe8d | [
"BSD-3-Clause"
] | 169 | 2019-04-15T17:22:54.000Z | 2022-03-31T11:50:23.000Z | Library/OcPeimEntryPoint/X64/GS.nasm | lyrl/OpenCorePkg | d246944bb09f0189455f8174ca14e38909cfbe8d | [
"BSD-3-Clause"
] | 2,383 | 2019-04-03T21:05:59.000Z | 2022-03-30T18:28:40.000Z | ; @file
; Copyright (C) 2021, ISP RAS. All rights reserved.
;*
;* Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
;* SPDX-License-Identifier: BSD-2-Clause-Patent
;*
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
;
BITS 64
extern ASM_PFX(__stack_chk_fail)
section .text
; #######################################################################
; VOID __GSHandlerCheck (VOID)
; #######################################################################
align 8
global ASM_PFX(__GSHandlerCheck)
ASM_PFX(__GSHandlerCheck):
jmp ASM_PFX(__stack_chk_fail)
; #######################################################################
; VOID __report_rangecheckfailure (VOID)
; #######################################################################
align 8
global ASM_PFX(__report_rangecheckfailure)
ASM_PFX(__report_rangecheckfailure):
jmp ASM_PFX(__stack_chk_fail)
| 34.972222 | 84 | 0.598094 |
55bb08e2893b95505bfd67232d818fc01fbeb59b | 351 | asm | Assembly | programs/oeis/127/A127329.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/127/A127329.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/127/A127329.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A127329: Semiprimes equal to the sum of three primes in arithmetic progression.
; 15,21,33,39,51,57,69,87,93,111,123,129,141,159,177,183,201,213,219,237,249,267,291,303,309,321,327,339,381,393,411,417,447,453,471,489,501,519,537,543,573,579,591,597,633,669,681,687,699,717,723,753,771,789
add $0,2
cal $0,40 ; The prime numbers.
mov $1,$0
mul $1,3
| 43.875 | 208 | 0.726496 |
060a4441fb0ecbe61b9c1248706422850b691cc9 | 9,135 | asm | Assembly | src/play/clubs.asm | 1888games/golf | 5078fc0699e5f91a53761cc30526b510d49e955c | [
"BSD-2-Clause"
] | 1 | 2022-02-13T16:09:18.000Z | 2022-02-13T16:09:18.000Z | src/play/clubs.asm | 1888games/golf | 5078fc0699e5f91a53761cc30526b510d49e955c | [
"BSD-2-Clause"
] | null | null | null | src/play/clubs.asm | 1888games/golf | 5078fc0699e5f91a53761cc30526b510d49e955c | [
"BSD-2-Clause"
] | null | null | null | ; Top-hole Golf
; Copyright 2020-2021 Matthew Clarke
clubs_c_BEGIN = *
; *****************
; *** CONSTANTS ***
; *****************
; NOTE: this excludes the putter:
CLUBS_N = 12
CLUBS_PUTTER_I = CLUBS_N
clubs_c_OFFSET_TO_PUNCH_VELOCITIES = 4*13
; Power levels for each club.
;clubs_l_VZ_LO !byte <8686, <7887 ,<7079, <5925, <5553, <4922, <4572, <4096, <3904
; !byte <3629, <2933, <2271, <1480 ;<1504
;clubs_l_VZ_HI !byte >8686, >7887 ,>7079, >5925, >5553, >4922, >4572, >4096, >3904
; !byte >3629, >2933, >2271, >1480 ;>1504
;clubs_l_VY_LO !byte <1375, <1391 ,<1376, <1477, <1487, <1411, <1398, <1331, <1343
; !byte <1307, <1368, <1419, 0
;clubs_l_VY_HI !byte >1375, >1391 ,>1376, >1477, >1487, >1411, >1398, >1331, >1343
; !byte >1307, >1368, >1419, 0
!source "trajectories.asm"
!source "../../tools/clubs/punch_club_velocities.asm"
CLUBS_STR !scr "DR3W5W3I4I5I6I7I8I9IPWSWPT"
clubs_l_DISTANCE_STR !scr "240230215205195175165150145135120100"
!scr "2 6 14 24 37 52 "
clubs_l_DISTANCE_STR_OFFSETS !byte 0,3,6,9,12,15,18,21,24,27,30,33
!byte 36,39,42,45,48,51
clubs_l_DISTANCE_PIXELS_LO
!byte <(240*hole_c_PIXELS_PER_YARD )
!byte <(230*hole_c_PIXELS_PER_YARD )
!byte <(215*hole_c_PIXELS_PER_YARD )
!byte <(205*hole_c_PIXELS_PER_YARD )
!byte <(195*hole_c_PIXELS_PER_YARD )
!byte <(175*hole_c_PIXELS_PER_YARD )
!byte <(165*hole_c_PIXELS_PER_YARD )
!byte <(150*hole_c_PIXELS_PER_YARD )
!byte <(145*hole_c_PIXELS_PER_YARD )
!byte <(135*hole_c_PIXELS_PER_YARD )
!byte <(120*hole_c_PIXELS_PER_YARD )
!byte <(100*hole_c_PIXELS_PER_YARD )
clubs_l_DISTANCE_PIXELS_HI
!byte >(240*hole_c_PIXELS_PER_YARD )
!byte >(230*hole_c_PIXELS_PER_YARD )
!byte >(215*hole_c_PIXELS_PER_YARD )
!byte >(205*hole_c_PIXELS_PER_YARD )
!byte >(195*hole_c_PIXELS_PER_YARD )
!byte >(175*hole_c_PIXELS_PER_YARD )
!byte >(165*hole_c_PIXELS_PER_YARD )
!byte >(150*hole_c_PIXELS_PER_YARD )
!byte >(145*hole_c_PIXELS_PER_YARD )
!byte >(135*hole_c_PIXELS_PER_YARD )
!byte >(120*hole_c_PIXELS_PER_YARD )
!byte >(100*hole_c_PIXELS_PER_YARD )
; NOTE: these three chars are placeholders for actual distance.
clubs_l_DISTANCE_BUFF !raw "000"
clubs_c_BUFF_LEN = 3
clubs_c_DR = 0
clubs_c_3W = 1
clubs_c_5I = 5
clubs_c_8I = 8
clubs_c_PW = 10
clubs_c_SW = 11
; NOTE: except when on the green!
clubs_c_MAX_ALLOWED = clubs_c_SW
; Index this with the current player's terrain.
clubs_l_MIN_CLUBS !byte clubs_c_3W,clubs_c_8I,clubs_c_3W,clubs_c_5I
; *****************
; *** VARIABLES ***
; *****************
clubs_v_current_selection !byte 0
clubs_v_min_allowed !byte 0
; *******************
; ****** MACROS *****
; *******************
; *******************
; *** SUBROUTINES ***
; *******************
!zone {
clubs_reset
lda #0
sta clubs_v_current_selection
rts
; end sub clubs_reset
} ; !zone
; **************************************************
; NOTE: implement wraparound.
!zone {
clubs_s_next
ldx clubs_v_current_selection
inx
cpx #clubs_c_MAX_ALLOWED+1
bcc .ok
; Wraparound.
ldx clubs_v_min_allowed
.ok
stx clubs_v_current_selection
ldy #sfx_c_BROWSE
jsr snd_s_init_sfx
rts
; end sub clubs_s_next
} ; !zone
; **************************************************
; NOTE: implement wraparound.
!zone {
clubs_s_prev
ldx clubs_v_current_selection
dex
bmi .wraparound
cpx clubs_v_min_allowed
bcc .wraparound
+skip_2_bytes
.wraparound
ldx #clubs_c_MAX_ALLOWED
stx clubs_v_current_selection
ldy #sfx_c_BROWSE
jsr snd_s_init_sfx
rts
; end sub clubs_s_prev
} ; !zone
; **************************************************
; Puts address of club 'strings' into P0-P1 and sets Y to the correct
; offset for the current club selection.
;!zone {
;clubs_get_str
; lda #<CLUBS_STR
; sta P0
; lda #>CLUBS_STR
; sta P1
; lda clubs_current_selection
; asl
; tay
; rts
;; end sub clubs_get_str
;} ; !zone
; **************************************************
;!zone {
;clubs_s_draw
; ldx clubs_current_selection
; lda CLUBS_STR_OFFSETS,x
; sta P0 ; from
; lda CLUBS_STR_OFFSETS+1,x
; sta P1 ; to
;
; ; X indexes source, Y the destination.
; ldx P0
; ldy #0
;
;-
; lda CLUBS_STR2,x
; sta utils_str_buf,y
; inx
; iny
; cpx P1
; bne -
;
; ldx #0
;-
; lda CLUBS_STR_SUFFIX,x
; beq +
; sta utils_str_buf,y
; inx
; iny
; jmp -
;
;+
; ; Y now holds string length.
; sty P6
; lda #<utils_str_buf
; sta P0
; lda #>utils_str_buf
; sta P1
; lda #24*8
; sta P2
; lda #4
; sta P3
; jsr dp_draw_string
;
; lda clubs_current_selection
; ; Multiply by 2 to get index into CLUBS_STR2.
; asl
; tax
; ; Second char 'code' first and push onto stack.
; lda CLUBS_STR2+1,x
; pha
; lda CLUBS_STR2,x
; ; Multiply code by 8 to get index into char data (i.e. CLUBS_CHARS).
; asl
; asl
; asl
; tax
;
; ; Use Y to count writes.
; ldy #0
;
;-
; lda CLUBS_CHARS,x
; sta CLUBS_STR_DEST,y
; sta CLUBS_STR_DEST2,y
; iny
; inx
; cpy #8
; bne -
;
; ; Now second char - pull code off stack.
; pla
; asl
; asl
; asl
; tax
;-
; lda CLUBS_CHARS,x
; sta CLUBS_STR_DEST,y
; sta CLUBS_STR_DEST2,y
; iny
; inx
; cpy #16
; bne -
;
; rts
;; end sub clubs_s_draw
;} ; !zone
; **************************************************
!zone {
clubs_s_draw2
; Address of text into P0-P1.
lda clubs_v_current_selection
asl
clc
adc #<CLUBS_STR
sta P0
lda #>CLUBS_STR
adc #0
sta P1
; (Off-screen) destination into BITMAP_LO/HI.
; lda #<CLUBS_STR_DEST2
; sta BITMAP_LO
; lda #>CLUBS_STR_DEST2
; sta BITMAP_HI
lda #2
sta P4
; jsr font_s_draw_text_direct
lda #20*8
sta P2
lda #1*4
sta P3
jsr font_s_shift_text_right
jsr font_s_draw_text
jsr clubs_s_draw_distance
jsr font_s_reset_shift
rts
; end sub clubs_s_draw2
} ; !zone
; **************************************************
; Draw average maximum distance for this club in the lhs panel.
!zone {
.DEST_ROW = 21*8
.DEST_COL = 1*4
clubs_s_draw_distance
ldx clubs_v_current_selection
cpx #CLUBS_PUTTER_I
bne .swing
lda powarc_v_putt_assist_index
; Skip over the first 12 bytes to get to the putting distances!
clc
adc #CLUBS_N
tax
.swing
lda clubs_l_DISTANCE_STR_OFFSETS,x
tax
; Now we have offset for the distance string. Copy 3 bytes to the buffer.
ldy #0
-
lda clubs_l_DISTANCE_STR,x
sta clubs_l_DISTANCE_BUFF,y
inx
iny
cpy #clubs_c_BUFF_LEN
bne -
; Prepare call to msg_s_display.
lda #<clubs_l_DISTANCE_BUFF
sta P0
lda #>clubs_l_DISTANCE_BUFF
sta P1
lda #clubs_c_BUFF_LEN
sta P4
lda #.DEST_ROW
sta P2
lda #.DEST_COL
sta P3
jsr font_s_draw_text
rts
; end sub clubs_s_draw_distance
} ; !zone
; **************************************************
!zone {
.LAST_VALID_INDEX = MATHS0
clubs_s_select_best_club
ldy round_v_current_player
ldx #clubs_c_MAX_ALLOWED
-
lda clubs_l_DISTANCE_PIXELS_LO,x
cmp players_v_distance_lo,y
lda clubs_l_DISTANCE_PIXELS_HI,x
sbc players_v_distance_hi,y
bcs .found
dex
cpx clubs_v_min_allowed
bne -
.found
stx clubs_v_current_selection
rts
; end sub clubs_s_select_best_club
} ; !zone
; **************************************************
; NOTE: minimum in terms of its index - actually it's the biggest club you're
; allowed to play!
; INPUTS: MATHS0 = terrain
!zone {
clubs_s_set_min_allowed
lda round_v_teeing_off
+branch_if_false +
lda #clubs_c_DR
beq ++
+
ldy MATHS0
lda clubs_l_MIN_CLUBS,y
++
sta clubs_v_min_allowed
rts
; end sub clubs_s_set_min_allowed
} ; !zone
; **************************************************
; INPUTS: X = index into ghosting color table.
!zone {
.COLORS !byte GREY2,GREY1
.DEST = gfxs_c_DISPLAY_BASE+21*40+1
clubs_s_ghost_carry
lda .COLORS,x
; Three chars will be affected, starting at the rightmost edge. Stop
; when index becomes negative.
ldx #2
-
sta .DEST,x
dex
bpl -
rts
; end sub clubs_s_ghost_carry
} ; !zone
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
; **************************************************
clubs_c_SIZE = *-clubs_c_BEGIN
| 22.226277 | 84 | 0.565627 |
17fa3b808ecc6755fbb71a1906baba063b5a30b1 | 299 | asm | Assembly | micro_lab/8086/strrev.asm | prodicus/dabble | 1c9f422343060fd1cccf08de4498382f3d2762cf | [
"MIT"
] | null | null | null | micro_lab/8086/strrev.asm | prodicus/dabble | 1c9f422343060fd1cccf08de4498382f3d2762cf | [
"MIT"
] | null | null | null | micro_lab/8086/strrev.asm | prodicus/dabble | 1c9f422343060fd1cccf08de4498382f3d2762cf | [
"MIT"
] | 2 | 2017-10-07T23:16:38.000Z | 2018-03-27T05:13:38.000Z | DATA SEGMENT
str1 db 'HI!$'
LENGTH EQU $-str1-1
DATA ENDS
ASSUME CS:CODE, DS:DATA
CODE SEGMENT
START:
MOV AX,SEG str1
MOV DS,AX
MOV SI, OFFSET str1
MOV CX, LENGTH
ADD SI, CX
DEC SI
AA:
MOV DL,[SI]
MOV AH, 02H
INT 21H
DEC SI
LOOP AA
MOV AX,4C00h
INT 21H
CODE ENDS
END START | 11.96 | 24 | 0.662207 |
1eff7b8815e88322189c7beb724315f7dd1c9a82 | 6,525 | asm | Assembly | engine/overworld/overworld.asm | AtmaBuster/pokeplat-gen2 | fa83b2e75575949b8f72cb2c48f7a1042e97f70f | [
"blessing"
] | 6 | 2021-06-19T06:41:19.000Z | 2022-02-15T17:12:33.000Z | engine/overworld/overworld.asm | AtmaBuster/pokeplat-gen2-old | 01e42c55db5408d72d89133dc84a46c699d849ad | [
"blessing"
] | null | null | null | engine/overworld/overworld.asm | AtmaBuster/pokeplat-gen2-old | 01e42c55db5408d72d89133dc84a46c699d849ad | [
"blessing"
] | 2 | 2021-08-11T19:47:07.000Z | 2022-01-01T07:07:56.000Z | GetEmote2bpp:
ld a, $1
ldh [rVBK], a
call Get2bpp
xor a
ldh [rVBK], a
ret
_ReplaceKrisSprite::
call GetPlayerSprite
ld a, [wUsedSprites]
ldh [hUsedSpriteIndex], a
ld a, [wUsedSprites + 1]
ldh [hUsedSpriteTile], a
call GetUsedSprite
ret
Function14146: ; mobile
Function14157: ; mobile
ret
GetPlayerSprite:
; Get Chris or Kris's sprite.
ld hl, ChrisStateSprites
ld a, [wPlayerSpriteSetupFlags]
bit PLAYERSPRITESETUP_FEMALE_TO_MALE_F, a
jr nz, .go
ld a, [wPlayerGender]
bit PLAYERGENDER_FEMALE_F, a
jr z, .go
ld hl, KrisStateSprites
.go
ld a, [wPlayerState]
ld c, a
.loop
ld a, [hli]
cp c
jr z, .good
inc hl
cp -1
jr nz, .loop
; Any player state not in the array defaults to Chris's sprite.
xor a ; ld a, PLAYER_NORMAL
ld [wPlayerState], a
ld a, SPRITE_LUCAS
jr .finish
.good
ld a, [hl]
.finish
ld [wUsedSprites + 0], a
ld [wPlayerSprite], a
ld [wPlayerObjectSprite], a
ret
INCLUDE "data/sprites/player_sprites.asm"
ReloadVisibleSprites::
call LoadUsedSpritesGFX
push hl
push de
push bc
call GetPlayerSprite
xor a
ldh [hUsedSpriteIndex], a
call ReloadSpriteIndex
pop bc
pop de
pop hl
ret
ReloadSpriteIndex::
; Reloads sprites using hUsedSpriteIndex.
; Used to reload variable sprites
ld hl, wObjectStructs
ld de, OBJECT_STRUCT_LENGTH
push bc
ldh a, [hUsedSpriteIndex]
ld b, a
xor a
.loop
ldh [hObjectStructIndexBuffer], a
ld a, [hl]
and a
jr z, .done
bit 7, b
jr z, .continue
cp b
jr nz, .done
.continue
push hl
call GetSpriteVTile
pop hl
push hl
inc hl
inc hl
ld [hl], a
pop hl
.done
add hl, de
ldh a, [hObjectStructIndexBuffer]
inc a
cp NUM_OBJECT_STRUCTS
jr nz, .loop
pop bc
ret
LoadUsedSpritesGFX:
ld a, MAPCALLBACK_SPRITES
call RunMapCallback
call GetUsedSprites
call .LoadMiscTiles
ret
.LoadMiscTiles:
ld a, [wSpriteFlags]
bit 6, a
ret nz
ld c, EMOTE_SHADOW
farcall LoadEmote
call GetMapEnvironment
call CheckOutdoorMap
ld c, EMOTE_GRASS_RUSTLE
jr z, .outdoor
ld c, EMOTE_BOULDER_DUST
.outdoor
farcall LoadEmote
ret
SafeGetSprite:
push hl
call GetSprite
pop hl
ret
GetSprite::
call GetMonSprite
ret c
ld hl, OverworldSprites + SPRITEDATA_ADDR
dec a
ld c, a
ld b, 0
ld a, NUM_SPRITEDATA_FIELDS
call AddNTimes
; load the address into de
ld a, [hli]
ld e, a
ld a, [hli]
ld d, a
; load the length into c
ld a, [hli]
swap a
ld c, a
; load the sprite bank into both b and h
ld b, [hl]
ld a, [hli]
; load the sprite type into l
ld l, [hl]
ld h, a
ret
GetMonSprite:
; Return carry if a monster sprite was loaded.
cp SPRITE_POKEMON
jr c, .Normal
cp SPRITE_DAY_CARE_MON_1
jr z, .BreedMon1
cp SPRITE_DAY_CARE_MON_2
jr z, .BreedMon2
cp SPRITE_VARS
jr nc, .Variable
jr .Icon
.Normal:
and a
ret
.Icon:
sub SPRITE_POKEMON
ld e, a
ld d, 0
ld hl, SpriteMons
add hl, de
add hl, de
ld a, [hli]
ld h, [hl]
ld l, a
call GetPokemonIDFromIndex
jr .Mon
.BreedMon1
ld a, [wBreedMon1Species]
jr .Mon
.BreedMon2
ld a, [wBreedMon2Species]
.Mon:
ld e, a
and a
jr z, .NoBreedmon
farcall LoadOverworldMonIcon
ld l, 1
ld h, 0
scf
ret
.Variable:
sub SPRITE_VARS
ld e, a
ld d, 0
ld hl, wVariableSprites
add hl, de
ld a, [hl]
and a
jp nz, GetMonSprite
.NoBreedmon:
ld a, 1
ld l, 1
ld h, 0
and a
ret
_DoesSpriteHaveFacings::
; Checks to see whether we can apply a facing to a sprite.
; Returns carry unless the sprite is a Pokemon or a Still Sprite.
cp SPRITE_POKEMON
jr nc, .only_down
push hl
push bc
ld hl, OverworldSprites + SPRITEDATA_TYPE
dec a
ld c, a
ld b, 0
ld a, NUM_SPRITEDATA_FIELDS
call AddNTimes
ld a, [hl]
pop bc
pop hl
cp STILL_SPRITE
jr nz, .only_down
scf
ret
.only_down
and a
ret
_GetSpritePalette::
ld a, c
call GetMonSprite
jr c, .is_pokemon
ld hl, OverworldSprites + SPRITEDATA_PALETTE
dec a
ld c, a
ld b, 0
ld a, NUM_SPRITEDATA_FIELDS
call AddNTimes
ld c, [hl]
ret
.is_pokemon
xor a
ld c, a
ret
AddSpriteGFX:
; Add any new sprite ids to a list of graphics to be loaded.
; Return carry if the list is full.
push hl
push bc
ld b, a
ld hl, wUsedSprites + 2
ld c, SPRITE_GFX_LIST_CAPACITY - 1
.loop
ld a, [hl]
cp b
jr z, .exists
and a
jr z, .new
inc hl
inc hl
dec c
jr nz, .loop
pop bc
pop hl
scf
ret
.exists
pop bc
pop hl
and a
ret
.new
ld [hl], b
pop bc
pop hl
and a
ret
GetSpriteLength:
; Return the length of sprite type a in tiles.
cp WALKING_SPRITE
jr z, .AnyDirection
cp STANDING_SPRITE
jr z, .AnyDirection
cp STILL_SPRITE
jr z, .OneDirection
ld a, 12
ret
.AnyDirection:
ld a, 12
ret
.OneDirection:
ld a, 4
ret
GetUsedSprites:
ld hl, wUsedSprites
ld c, SPRITE_GFX_LIST_CAPACITY
.loop
ld a, [wSpriteFlags]
res 5, a
ld [wSpriteFlags], a
ld a, [hli]
and a
jr z, .done
ldh [hUsedSpriteIndex], a
ld a, [hli]
ldh [hUsedSpriteTile], a
bit 7, a
jr z, .dont_set
ld a, [wSpriteFlags]
set 5, a ; load VBank0
ld [wSpriteFlags], a
.dont_set
push bc
push hl
call GetUsedSprite
pop hl
pop bc
dec c
jr nz, .loop
.done
ret
GetUsedSprite::
ldh a, [hUsedSpriteIndex]
call SafeGetSprite
ldh a, [hUsedSpriteTile]
call .GetTileAddr
push hl
push de
push bc
ld a, [wSpriteFlags]
bit 7, a
jr nz, .skip
call .CopyToVram
.skip
pop bc
ld l, c
ld h, $0
rept 4
add hl, hl
endr
pop de
add hl, de
ld d, h
ld e, l
pop hl
ld a, [wSpriteFlags]
bit 5, a
jr nz, .done
bit 6, a
jr nz, .done
ldh a, [hUsedSpriteIndex]
call _DoesSpriteHaveFacings
jr c, .done
ld a, h
add HIGH(vTiles1 - vTiles0)
ld h, a
call .CopyToVram
.done
ret
.GetTileAddr:
; Return the address of tile (a) in (hl).
and $7f
ld l, a
ld h, 0
rept 4
add hl, hl
endr
ld a, l
add LOW(vTiles0)
ld l, a
ld a, h
adc HIGH(vTiles0)
ld h, a
ret
.CopyToVram:
ldh a, [rVBK]
push af
ld a, [wSpriteFlags]
bit 5, a
ld a, $1
jr z, .bankswitch
xor a
.bankswitch
ldh [rVBK], a
call Get2bpp
pop af
ldh [rVBK], a
ret
LoadEmote::
; Get the address of the pointer to emote c.
ld a, c
ld bc, 6 ; sizeof(emote)
ld hl, Emotes
call AddNTimes
; Load the emote address into de
ld e, [hl]
inc hl
ld d, [hl]
; load the length of the emote (in tiles) into c
inc hl
ld c, [hl]
swap c
; load the emote pointer bank into b
inc hl
ld b, [hl]
; load the VRAM destination into hl
inc hl
ld a, [hli]
ld h, [hl]
ld l, a
; if the emote has a length of 0, do not proceed (error handling)
ld a, c
and a
ret z
call GetEmote2bpp
ret
INCLUDE "data/sprites/emotes.asm"
INCLUDE "data/sprites/sprite_mons.asm"
INCLUDE "data/sprites/sprites.asm"
| 13.509317 | 65 | 0.691341 |
7a163506b004588473b71650d56c4dcba8eab483 | 710 | asm | Assembly | oeis/019/A019958.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/019/A019958.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/019/A019958.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A019958: Expansion of 1/((1-5*x)*(1-7*x)*(1-10*x)).
; Submitted by Jon Maiga
; 1,22,329,4178,48621,537222,5744929,60136378,620564021,6341995022,64384199529,650640568578,6554239839421,65878458172822,661143103694129,6627971208280778,66395645870074821,664768758151070622,6653377492360228729,66573623373035272978,666015268243815270221,6662106400869548688422,66634742421901049803329,666443185032378393545178,6665102235622003979425621,66655715351330803979026222,666590005969199508468417929,6666130034333815962355097378,66662910203083808751866541021,666640371235322146339970084022
add $0,2
lpb $0
sub $0,1
div $1,2
max $2,26
mul $2,7
mul $3,10
add $3,$1
mul $1,10
add $1,$2
lpe
mov $0,$3
div $0,91
| 39.444444 | 496 | 0.815493 |
29f9647b522ecc1a63f6c508880fd2bccd2825a5 | 563 | asm | Assembly | oeis/195/A195463.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/195/A195463.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/195/A195463.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A195463: a(n) = 4^(n+1) + 7.
; 11,23,71,263,1031,4103,16391,65543,262151,1048583,4194311,16777223,67108871,268435463,1073741831,4294967303,17179869191,68719476743,274877906951,1099511627783,4398046511111,17592186044423,70368744177671,281474976710663,1125899906842631,4503599627370503,18014398509481991,72057594037927943,288230376151711751,1152921504606846983,4611686018427387911,18446744073709551623,73786976294838206471,295147905179352825863,1180591620717411303431,4722366482869645213703,18889465931478580854791
add $0,1
mov $1,4
pow $1,$0
add $1,7
mov $0,$1
| 62.555556 | 483 | 0.857904 |
4b0f8c13e3ef954b8b3d66673b5ebe1445a8f77d | 683 | asm | Assembly | oeis/048/A048585.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/048/A048585.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/048/A048585.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A048585: Pisot sequence L(6,7).
; Submitted by Christian Krause
; 6,7,9,12,16,22,31,44,63,91,132,192,280,409,598,875,1281,1876,2748,4026,5899,8644,12667,18563,27204,39868,58428,85629,125494,183919,269545,395036,578952,848494,1243527,1822476,2670967,3914491,5736964,8407928,12322416,18059377,26467302,38789715,56849089,83316388,122106100,178955186,262271571,384377668,563332851,825604419,1209982084,1773314932,2598919348,3808901429,5582216358,8181135703,11990037129,17572253484,25753389184,37743426310,55315679791,81069068972,118812495279,174128175067,255197244036
add $0,4
seq $0,930 ; Narayana's cows sequence: a(0) = a(1) = a(2) = 1; thereafter a(n) = a(n-1) + a(n-3).
add $0,3
| 85.375 | 499 | 0.795022 |
f97fc120368813a6fadb3b7e3938cd3e04eed324 | 148 | asm | Assembly | other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_endt3.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_endt3.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | other.7z/SFC.7z/SFC/ソースデータ/ゼルダの伝説神々のトライフォース/日本_Ver3/asm/zel_endt3.asm | prismotizm/gigaleak | d082854866186a05fec4e2fdf1def0199e7f3098 | [
"MIT"
] | null | null | null | Name: zel_endt3.asm
Type: file
Size: 130398
Last-Modified: '2016-05-13T04:36:32Z'
SHA-1: A25954CE556BA457A34708B9172D7A2DE8D45E4E
Description: null
| 21.142857 | 47 | 0.817568 |
fcd73c23a370bc910549a7fa43abc36328322b8f | 188 | asm | Assembly | WEEK-8/3.asm | ShruKin/Microprocessor-and-Microcontroller-Lab | 279c1432f0dee01fae37dc8fcb1dcb798e5725d8 | [
"MIT"
] | null | null | null | WEEK-8/3.asm | ShruKin/Microprocessor-and-Microcontroller-Lab | 279c1432f0dee01fae37dc8fcb1dcb798e5725d8 | [
"MIT"
] | null | null | null | WEEK-8/3.asm | ShruKin/Microprocessor-and-Microcontroller-Lab | 279c1432f0dee01fae37dc8fcb1dcb798e5725d8 | [
"MIT"
] | null | null | null | LXI H,8000
MOV B,M
MVI A,99
INX H
SUB M
ADI 01
ADD B
DAA
MOV L,A
JC SKP2
MVI H,FF
JMP STORE
SKP2: MVI H,00
STORE: SHLD 8050
HLT
| 10.444444 | 19 | 0.478723 |
4d268e81f7deb6bad63c151d3d629d0b07e39ef2 | 6,735 | asm | Assembly | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2283.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 9 | 2020-08-13T19:41:58.000Z | 2022-03-30T12:22:51.000Z | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2283.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 1 | 2021-04-29T06:29:35.000Z | 2021-05-13T21:02:30.000Z | Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_2283.asm | ljhsiun2/medusa | 67d769b8a2fb42c538f10287abaf0e6dbb463f0c | [
"MIT"
] | 3 | 2020-07-14T17:07:07.000Z | 2022-03-21T01:12:22.000Z | .global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x15d6, %rsi
lea addresses_A_ht+0x9a56, %rdi
nop
nop
sub $46527, %r15
mov $91, %rcx
rep movsq
nop
dec %r12
lea addresses_normal_ht+0x1bbd7, %r9
nop
nop
nop
nop
nop
cmp $36482, %r12
vmovups (%r9), %ymm1
vextracti128 $0, %ymm1, %xmm1
vpextrq $0, %xmm1, %r15
nop
nop
nop
add %r15, %r15
lea addresses_normal_ht+0x173d6, %rcx
nop
nop
nop
nop
xor $57688, %rbp
mov $0x6162636465666768, %r9
movq %r9, (%rcx)
nop
nop
nop
nop
and $64511, %r12
lea addresses_D_ht+0xc9c6, %rsi
nop
nop
cmp $58546, %rcx
mov $0x6162636465666768, %r9
movq %r9, %xmm4
and $0xffffffffffffffc0, %rsi
vmovntdq %ymm4, (%rsi)
add $19019, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %rbp
push %rbx
push %rdx
push %rsi
// Load
lea addresses_WT+0x1d13e, %rdx
nop
cmp $54060, %r13
mov (%rdx), %esi
cmp $5105, %r11
// Load
lea addresses_WC+0xa396, %rdx
nop
dec %rsi
mov (%rdx), %r11w
nop
nop
xor %r13, %r13
// Store
lea addresses_WT+0xf156, %r13
nop
nop
nop
nop
nop
cmp %rbp, %rbp
mov $0x5152535455565758, %rbx
movq %rbx, %xmm1
vmovups %ymm1, (%r13)
nop
nop
nop
nop
and $58875, %r13
// Store
lea addresses_normal+0x7686, %r11
nop
nop
nop
dec %rsi
movw $0x5152, (%r11)
nop
nop
nop
nop
dec %rbx
// Load
lea addresses_D+0x2a61, %rsi
nop
nop
nop
and %r10, %r10
mov (%rsi), %rbx
nop
nop
inc %rbx
// Store
lea addresses_US+0x52d6, %rbx
nop
cmp $5508, %rdx
mov $0x5152535455565758, %r10
movq %r10, %xmm7
vmovups %ymm7, (%rbx)
nop
sub %rbp, %rbp
// Store
lea addresses_US+0x181d6, %rbx
nop
nop
nop
nop
sub $62225, %r10
mov $0x5152535455565758, %rdx
movq %rdx, %xmm6
movups %xmm6, (%rbx)
nop
nop
dec %rbp
// Faulty Load
lea addresses_D+0x1cbd6, %r11
nop
inc %rsi
mov (%r11), %r13d
lea oracles, %r10
and $0xff, %r13
shlq $12, %r13
mov (%r10,%r13,1), %r13
pop %rsi
pop %rdx
pop %rbx
pop %rbp
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': True, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 2, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': False, 'NT': True}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 1, 'size': 2, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 2, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_US', 'AVXalign': False, 'congruent': 7, 'size': 16, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 0, 'size': 4, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 10, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 4, 'size': 32, 'same': False, 'NT': True}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
| 34.716495 | 2,999 | 0.655828 |
15dfa9106a3f51b452a194c75ba0e230448cc00d | 703 | asm | Assembly | oeis/293/A293640.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/293/A293640.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/293/A293640.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A293640: a(n) is the least integer k such that k/Fibonacci(n) > 2/5.
; Submitted by Jamie Morken(m1)
; 0,1,1,1,2,2,4,6,9,14,22,36,58,94,151,244,395,639,1034,1673,2706,4379,7085,11463,18548,30010,48558,78568,127125,205692,332816,538508,871324,1409832,2281155,3690986,5972141,9663127,15635268,25298395,40933662,66232057,107165719,173397775,280563494,453961268,734524762,1188486030,1923010791,3111496820,5034507610,8146004430,13180512040,21326516470,34507028509,55833544978,90340573487,146174118465,236514691952,382688810417,619203502368,1001892312785,1621095815153,2622988127937,4244083943090
seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
mul $0,2
add $0,4
div $0,5
| 78.111111 | 489 | 0.786629 |
e96c03943ce974e1babd49d4a1895802c8ffdfd1 | 1,073 | asm | Assembly | programs/oeis/075/A075841.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/075/A075841.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/075/A075841.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A075841: Numbers k such that 2*k^2 - 9 is a square.
; 3,15,87,507,2955,17223,100383,585075,3410067,19875327,115841895,675176043,3935214363,22936110135,133681446447,779152568547,4541233964835,26468251220463,154268273357943,899141388927195,5240580060205227,30544338972304167,178025453773619775,1037608383669414483,6047624848242867123,35248140705787788255,205441219386483862407,1197399175613115386187,6978953834292208454715,40676323830140135342103,237078989146548603597903,1381797611049151486245315,8053706677148360313873987,46940442451841010396998607,273588948033897702068117655,1594593245751545202011707323,9293970526475373510002126283,54169229913100695858001050375,315721408952128801638004175967,1840159223799672113970024005427,10725233933845903882182139856595,62511244379275751179122815134143,364342232341808603192554750948263,2123542149671575867976205690555435,12376910665687646604664679392384347,72137921844454303760011870663750647,420450620401038175955406544590119535
mul $0,2
mov $1,3
lpb $0
sub $0,1
add $2,$1
mov $3,$1
add $1,$2
mov $2,$3
lpe
mov $0,$1
| 76.642857 | 919 | 0.889096 |
188ae369eb5d15a45ebe4dd93c7ef4dba001f311 | 5,574 | asm | Assembly | lib/i386/wipe.asm | xumia/SymCrypt | b15ec2c87d54704474ee8d26c95e90762c746ba2 | [
"MIT"
] | 170 | 2019-05-07T01:45:42.000Z | 2022-03-28T19:02:38.000Z | lib/i386/wipe.asm | xumia/SymCrypt | b15ec2c87d54704474ee8d26c95e90762c746ba2 | [
"MIT"
] | 15 | 2019-05-07T01:25:48.000Z | 2022-03-22T13:51:49.000Z | lib/i386/wipe.asm | xumia/SymCrypt | b15ec2c87d54704474ee8d26c95e90762c746ba2 | [
"MIT"
] | 31 | 2019-05-07T07:49:21.000Z | 2022-03-27T03:15:43.000Z | ;
; Wipe.asm
;
; Copyright (c) Microsoft Corporation. Licensed under the MIT license.
;
TITLE wipe.asm
.686
.xmm
_TEXT SEGMENT PARA PUBLIC USE32 'CODE'
ASSUME CS:_TEXT, DS:FLAT, SS:FLAT
PUBLIC @SymCryptWipeAsm@8
;VOID
;SYMCRYPT_CALL
;SymCryptWipe( _Out_writes_bytes_( cbData ) PVOID pbData,
; SIZE_T cbData )
@SymCryptWipeAsm@8 PROC
;
; The .FPO provides debugging information for stack frames that do not use
; ebp as a base pointer.
; This stuff not well documented,
; but here is the information I've gathered about the arguments to .FPO
;
; In order:
; cdwLocals: Size of local variables, in DWords
; cdwParams: Size of parameters, in DWords. Given that this is all about
; stack stuff, I'm assuming this is only about parameters passed
; on the stack.
; cbProlog : Number of bytes in the prolog code. We sometimes interleaved the
; prolog code with work for better performance. Most uses of
; .FPO seem to set this value to 0.
; The debugger seems to work if the prolog defined by this value
; contains all the stack adjustments.
; cbRegs : # registers saved in the prolog. 4 in our case
; fUseBP : 0 if EBP is not used as base pointer, 1 if EBP is used as base pointer
; cbFrame : Type of frame.
; 0 = FPO frame (no frame pointer)
; 1 = Trap frame (result of a CPU trap event)
; 2 = TSS frame
;
; Having looked at various occurrences of .FPO in the Windows code it
; seems to be used fairly sloppy, with lots of arguments left 0 even when
; they probably shouldn't be according to the spec.
;
.FPO(0,0,0,0,0,0) ; 3 byte prolog (covers esp ajustment only)
; ecx = pbData
; edx = cbData
;
; This function will handle any alginment of pbData and any size, but it is optimized for
; the case where pbData is 4-aligned, and cbData is a multiple of 4.
;
xor eax,eax
cmp edx,8
jb SymCryptWipeAsmSmall ; if cbData < 8, this is a rare case
test ecx,7
jnz SymCryptWipeAsmUnAligned; if data pointer is unaligned, we jump to the code that aligns the pointer
; For well-optimized code the aligned case is the common one, and that is
; the fall-through.
SymCryptWipeAsmAligned:
;
; Here ecx is aligned, and edx contains the # bytes left to wipe, and edx >= 8
;
; Our loop wipes in 8-byte increments;
;
sub edx,8
align 16
SymCryptWipeAsmLoop:
mov [ecx],eax
mov [ecx+4],eax ; Wipe 8 bytes
add ecx,8
sub edx,8
ja SymCryptWipeAsmLoop ; Loop if we have >8 byte to wipe. <= 8 bytes is handled by the code below
;
; The end of the buffer to wipe is at ecx + edx + 8 as
; the number of bytes we wiped is 8 less than the number we subtracted from edx.
;
; We know we had 8 or more bytes to wipe, so we just wipe the last 8 bytes.
; This avoids a lot of conditional jumping etc.
;
mov [ecx+edx+8-8],eax
mov [ecx+edx+8-4],eax
SymCryptWipeAsmDone:
ret
SymCryptWipeAsmUnaligned:
;
; At this point we know that cbData(rdx) >= 8 and pbData(rcx) is unaligned.
; We wipe 4 bytes and set our pointer & length to the remaining aligned buffer
;
mov [ecx],eax
mov [ecx+4],eax
sub eax,ecx
and eax,7
add ecx,eax
sub edx,eax
xor eax,eax
;
; edx = cbData could be less than 4 now. If it is, go directly to the
; tail wiping.
;
cmp edx,8
jae SymCryptWipeAsmAligned ; if cbData >= 8, do aligned wipes
SymCryptWipeAsmSmall:
jmp dword ptr [SymCryptWipeAsmSmallTable + 4*edx]
SymCryptWipeAsmT4:
mov [ecx],eax
SymCryptWipeAsmT0:
ret
SymCryptWipeAsmT1:
mov [ecx],al
ret
SymCryptWipeAsmT3:
mov [ecx+2],al
SymCryptWipeAsmT2:
mov [ecx],ax
ret
SymCryptWipeAsmT5:
mov [ecx],eax
mov [ecx+1],eax
ret
SymCryptWipeAsmT6:
mov [ecx],eax
mov [ecx+2],eax
ret
SymCryptWipeAsmT7:
mov [ecx],eax
mov [ecx+3],eax
ret
align 4
SymCryptWipeAsmSmallTable label dword
dd SymCryptWipeAsmT0
dd SymCryptWipeAsmT1
dd SymCryptWipeAsmT2
dd SymCryptWipeAsmT3
dd SymCryptWipeAsmT4
dd SymCryptWipeAsmT5
dd SymCryptWipeAsmT6
dd SymCryptWipeAsmT7
@SymCryptWipeAsm@8 ENDP
_TEXT ENDS
END
| 32.219653 | 116 | 0.514891 |
173159facd31df293e985b5ccd54128dbccb6896 | 1,012 | asm | Assembly | examples/font.asm | crgimenes/assembly | 0e0abbf68a44ae7e7c2e2c2a495c8a68ac072da5 | [
"MIT"
] | 1 | 2020-06-29T05:27:38.000Z | 2020-06-29T05:27:38.000Z | examples/font.asm | crgimenes/assembly | 0e0abbf68a44ae7e7c2e2c2a495c8a68ac072da5 | [
"MIT"
] | null | null | null | examples/font.asm | crgimenes/assembly | 0e0abbf68a44ae7e7c2e2c2a495c8a68ac072da5 | [
"MIT"
] | 3 | 2019-08-13T10:09:50.000Z | 2022-02-24T16:43:22.000Z | ;nasm -f bin -o font.com font.asm
org 100h
section .text
start:
;mov ax,0003h ; set screen mode to normal
;int 10h ; (80x25) text
;push ds ;
;pop es ; make sure ES = DS
mov bp,font ;
mov cx,1 ; change 1 bitmap
mov dx,0041h ; A 41h = 65
mov bx,1000h ; bh 16 bl 00 -> 16 bytes per char RAM block 00
mov ax,1100h ; change font to our font
int 10h ; video interrupt
mov ax,4C00h ; exit to DOS
int 21h ;
section .data
font:
db 00000000b ; 1
db 01111100b ; 2
db 11111110b ; 3
db 11000010b ; 4
db 11000010b ; 5
db 11000010b ; 6
db 11000010b ; 7
db 11111110b ; 8
db 11000010b ; 9
db 11000010b ; 10
db 11000010b ; 11
db 11000010b ; 12
db 11000010b ; 13
db 11000010b ; 14
db 00000000b ; 15
db 00000000b ; 16
.end
| 24.095238 | 66 | 0.486166 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.