Skip to main content

Avalon Python Assembly (APasm) - a library for coding and supporting Assembly in Python

Project description

APasm

What is APasm?

  • APasm is a library for coding and supporting Assembly in Python and you can directly interact with pure binary. APasm stands for "Avalon Python Assembly", notice something weird in the word "Avalon"? Its the library main name. APasm lastest version is 1.0. APasm supports basic Assembly instructions such as:
  • Instruction | Notes
  1. ADD | Basic addition
  2. ADC | Add with carry
  3. CLI | Clear interrupt flag
  4. HLT | Halt CPU
  5. JMP | Jump
  6. MOV | Move data
  7. OR | Bitwise OR
  8. PUSH | Segment registers only
  9. POP | Segment registers only

Requirements

  • Python3
  • QEMU (or another emulator)
  • Hex Editor (optional)

Example Usage

from APasm import * # or the main loader file name

setah      = MOV_imm("ah", 0x0E)  # call BIOS print
setal      = MOV_imm("al", 0x64)  # print "d"
call       = BIOSCALL_10h()

total      = setah + setal + call
bootloader = total + cli() + hlt() + jmp(-2) + BootPad()

with open("Bootloader.bin", "wb") as f:
    f.write(bootloader)

APasm APIs

  • APasmEnv - Create an APasm Development Environment(class)
  • QEMU - Use Subproccess to test your bootloader in QEMU(class)

APasmEnv Usage

from APasm import * # or the main loader file name
env = APasmEnv(  # your code will be packaged automatically
  MOV_imm("ah", 0x0E),
  MOV_imm("al", 0x64),  # print d
  BIOSCALL_10h()  
)
env.Push()
# the Push function create a dir named APasmEnv Output and your file will be created right here
# you can edit the dir param to your dir you want
# NOTE: if you don't rename your file to something then the default file name will be Untitled APasm Output File No{rand.randint(0,1000000)} which is generic

# the ClearOutPutDir function will clear APasm output directory or D:/APasmEnv Output/<files>
# CAUTION: ALL FILE INSIDE D:/APasmEnv Output WILL BE UTTERLY DELETED!

QEMU Usage

from AnPasm import *
emulator = QEMU()
emulator.run("D:/myBootloader.bin")    # onPath: True. Default Type: qemu-system-x86_64. Default External CMD: -fda. `*aargs` exists purely for passing raw subprocess flags without breaking the API.
emulator.run("D:/myBootloader.bin", onPath=False, QEMUPath="C:/Users/MyUserName/QEMU/<your QEMU type choice>.exe")

License

  • License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apasm-1.0.16.1.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apasm-1.0.16.1-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file apasm-1.0.16.1.tar.gz.

File metadata

  • Download URL: apasm-1.0.16.1.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for apasm-1.0.16.1.tar.gz
Algorithm Hash digest
SHA256 d9ae08b271c1f50a548c73e69453aa004d885c8c940228c3da87a6ea2c45003c
MD5 0d3a1ecda43c183006bef27749d7d8e2
BLAKE2b-256 0ffce2d1f268c6141ece6238f49f3b7704635074273577b77a75f2602879c258

See more details on using hashes here.

File details

Details for the file apasm-1.0.16.1-py3-none-any.whl.

File metadata

  • Download URL: apasm-1.0.16.1-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for apasm-1.0.16.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2425afec8028f77960adbd9703696c81d1bebbce3ca01b4a2d47f01ca1b1966
MD5 44ddb80dafa45798eacb6894bd519362
BLAKE2b-256 50b738604f65d7b19ddd8659652e28a396b24a3e5976a91bdbcd082ebc65c5af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page