r/Assembly_language

▲ 13 r/Assembly_language+1 crossposts

OWL FLY III is now in development

The third generation of our 8086 combat flight sim has left the runway - forked from the finished OWL FLY II. We went through the feedback you sent us after the OWL FLY II release, and the request that came up most was support for the different displays of the era — so that is exactly where development began, and it is already flying: the game opens with a SELECT VIDEO SYSTEM menu, quizzes the actual hardware, and offers only what the machine really owns:

Hercules - 720×348 monochrome, the 6845 programmed by hand

CGA - 320×200, the classic cyan/magenta palette

EGA - 320×200 and 640×350, sixteen colours

MCGA - 320×200, 256 colours (colors? :) )

VGA - 320×200 in 256 colours, or 640×480 in 16 colours.

On every retro card the cockpit isn't a downscaled conversion - it is its own drawn artwork, redrawn the way 1988 drew instrument panels. Playable in the browser right now:

- COLOR (CGA EGA VGA): https://kirindenis.github.io/wire-city-2/owlfly3.html

- HERCULES (monochrome): https://kirindenis.github.io/wire-city-2/owlfly3h.html

THE SOURCE CODE:

https://github.com/KirinDenis/wire-city-2/tree/main/GAMES/OWLFLY3

u/Extension_Emu_9825 — 12 hours ago
▲ 17 r/Assembly_language+1 crossposts

Novium OS — A from-scratch 32-bit x86 hobby Operating System (Custom assembly bootloader)

Hey everyone,

I wanted to share a milestone on a hobby operating system I’m building from scratch called Novium OS featuring a custom bootloader.

I just got my multi-stage boot chain (boot.S -> setup.S -> bootstrap.S) completely stable. It successfully handles the raw hardware initialization, sets up a temporary GDT, and handles the cr0 register transition cleanly into 32-bit protected mode before jumping into the kernel entry point. I also wrapped up a basic VGA text driver with hardware cursor syncing so I can verify output, and got "Hello World" printing to the screen.

The layout is inspired by a super stripped-down Linux (arch/, drivers/, kernel/).

Next up is tackling irq.c and interrupt.c and writing the low-level assembly ISR stubs. I need to build the macro wrappers to handle interrupts with and without error codes, save the CPU state with pusha, remap the 8259 PIC master/slave vectors, and execute the final iret. I'm fully braced for plenty of debugging via QEMU logs to catch silent triple faults.

The codebase uses AT&T syntax for the GNU Assembler (gas). If anyone wants to take a look at the boot sequence, folder layout, or offer any early feedback on how I structured the assembly stages, the repository is right here:
https://github.com/alexdev8930/NoviumOS

u/devcurrent0x — 1 day ago
▲ 19 r/Assembly_language+2 crossposts

I wrote an AArch64 quine as part of my AArch64/x86-64/RV64 learning journey

I'm learning assembly so I can eventually create my own IR/compiler/language.

The code is frankly ugly. I hope you find it (or my incompetence) funny:

```AArch64

.global \_start

.section .text

_start:

stp x29, x30, \[sp, #-32\]!

mov x29, sp

str x20, \[sp, #16\]

mov x13, sp

ldr x9, =0x75206e6576617265

ldr x10, =0x0a726f776f207577

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20333c20656e6975

ldr x10, =0x687465696e6e6977

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x72657a2e203a6666

ldr x10, =0x712f2f0a3538206f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x37206e67696c612e

ldr x10, =0x757473657065720a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6f69746365732e09

ldr x10, =0x090a7373622e206e

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c70735b202c30

ldr x10, =0x0a22215d36312d23

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7473745c6e5c3032

ldr x10, =0x3178202c39782070

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3032303230327830

ldr x10, =0x3032303230323032

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x646c745c6e5c3032

ldr x10, =0x3d202c3031782072

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3032303230327830

ldr x10, =0x3032303230323032

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6c745c6e5c222069

ldr x10, =0x3d202c3978207264

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d6574657065720a

ldr x10, =0x696373612e203a70

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6e6f69746365732e

ldr x10, =0x617461646f722e20

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x36783023202c3931

ldr x10, =0x090a746572090a36

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x65747962660a7465

ldr x10, =0x7720766f6d090a3a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c39317720766f

ldr x10, =0x72090a3536783023

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x650a746572090a34

ldr x10, =0x6d090a3a65747962

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7720766f6d090a3a

ldr x10, =0x36783023202c3931

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x72090a3336783023

ldr x10, =0x65747962640a7465

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d090a3a65747962

ldr x10, =0x202c39317720766f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x36783023202c3931

ldr x10, =0x630a746572090a32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x65747962620a7465

ldr x10, =0x7720766f6d090a3a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c39317720766f

ldr x10, =0x72090a3136783023

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x610a746572090a39

ldr x10, =0x6d090a3a65747962

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7720766f6d090a3a

ldr x10, =0x33783023202c3931

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a746572090a3833

ldr x10, =0x65747962656e696e

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20766f6d090a3a65

ldr x10, =0x783023202c393177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a746572090a3733

ldr x10, =0x7479626874676965

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20766f6d090a3a65

ldr x10, =0x783023202c393177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a746572090a3633

ldr x10, =0x7479626e65766573

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20766f6d090a3a65

ldr x10, =0x783023202c393177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6572090a35337830

ldr x10, =0x7479627869730a74

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6f6d090a3a657479

ldr x10, =0x23202c3931772076

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x72090a3433783023

ldr x10, =0x62657669660a7465

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d090a3a65747962

ldr x10, =0x202c39317720766f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a333378302320

ldr x10, =0x72756f660a746572

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a3a6574796265

ldr x10, =0x2c39317720766f6d

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a323378302320

ldr x10, =0x657268740a746572

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a3a657479626f

ldr x10, =0x2c39317720766f6d

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3133783023202c39

ldr x10, =0x77740a746572090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3a65747962656e6f

ldr x10, =0x317720766f6d090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x783023202c393177

ldr x10, =0x0a746572090a3033

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7479626f72657a0a

ldr x10, =0x20766f6d090a3a65

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2e62090a66307830

ldr x10, =0x6574796266207165

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d63090a65747962

ldr x10, =0x23202c3831772070

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6530783023202c38

ldr x10, =0x652071652e62090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6574796264207165

ldr x10, =0x317720706d63090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x23202c3831772070

ldr x10, =0x2e62090a64307830

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x632071652e62090a

ldr x10, =0x6d63090a65747962

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x317720706d63090a

ldr x10, =0x6330783023202c38

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2e62090a62307830

ldr x10, =0x6574796262207165

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d63090a65747962

ldr x10, =0x23202c3831772070

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6130783023202c38

ldr x10, =0x612071652e62090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x65747962656e696e

ldr x10, =0x317720706d63090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x30783023202c3831

ldr x10, =0x2071652e62090a39

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7479626874676965

ldr x10, =0x7720706d63090a65

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x30783023202c3831

ldr x10, =0x2071652e62090a38

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7479626e65766573

ldr x10, =0x7720706d63090a65

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x30783023202c3831

ldr x10, =0x2071652e62090a37

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7479627869732071

ldr x10, =0x7720706d63090a65

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3023202c38317720

ldr x10, =0x652e62090a363078

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6265766966207165

ldr x10, =0x706d63090a657479

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x23202c3831772070

ldr x10, =0x2e62090a35307830

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x72756f662071652e

ldr x10, =0x6d63090a65747962

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c38317720706d

ldr x10, =0x62090a3430783023

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x657268742071652e

ldr x10, =0x63090a6574796265

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c38317720706d

ldr x10, =0x62090a3330783023

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x77742071652e6209

ldr x10, =0x63090a657479626f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x38317720706d6309

ldr x10, =0x0a3230783023202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2071652e62090a31

ldr x10, =0x0a65747962656e6f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7720706d63090a65

ldr x10, =0x30783023202c3831

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x71652e62090a3030

ldr x10, =0x7479626f72657a20

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20706d63090a3a65

ldr x10, =0x783023202c383177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x62696e0a30232063

ldr x10, =0x7479626f74656c62

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c387820766f6d09

ldr x10, =0x7673090a33392320

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x766f6d090a323323

ldr x10, =0x0a3023202c307820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x303378202c393278

ldr x10, =0x202c5d70735b202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3123202c70735b20

ldr x10, =0x2070646c090a5d36

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a3a6666757473

ldr x10, =0x2c3032782072646c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x637673090a323131

ldr x10, =0x746978650a302320

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7820627573090a31

ldr x10, =0x23202c3278202c32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x782072736c090a32

ldr x10, =0x23202c3278202c32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c32782062757309

ldr x10, =0x3278202c31327820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x78202c3178206464

ldr x10, =0x0a33313123202c31

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x317820766f6d090a

ldr x10, =0x61090a323278202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6f6d090a34362320

ldr x10, =0x3123202c30782076

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a3a7473616c746e

ldr x10, =0x2c387820766f6d09

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x77646e6173207467

ldr x10, =0x6972700a31686369

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c37317820706d63

ldr x10, =0x2e62090a30327820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a353823202c32

ldr x10, =0x090a302320637673

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6675747365706572

ldr x10, =0x7820766f6d090a66

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6c090a3123202c30

ldr x10, =0x3d202c3178207264

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3623202c38782076

ldr x10, =0x7820766f6d090a34

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x35317820766f6d09

ldr x10, =0x6f6d090a3023202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x78202c3231782064

ldr x10, =0x0a333423202c3231

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c323178202c3231

ldr x10, =0x6461090a39322320

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x676e69746e697270

ldr x10, =0x7820627573090a3a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x68636977646e6173

ldr x10, =0x656d757365720a32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3123202c35317820

ldr x10, =0x20746c2e62090a36

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c353178202c3531

ldr x10, =0x706d63090a312320

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c5d3231785b20

ldr x10, =0x7820646461090a31

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x73090a657479626f

ldr x10, =0x2c39317720627274

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6c62090a66307830

ldr x10, =0x74656c6262696e20

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x38317720646e6109

ldr x10, =0x23202c363177202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x785b202c39317720

ldr x10, =0x0a3123202c5d3231

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x79626f74656c6262

ldr x10, =0x62727473090a6574

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x23202c3831772c20

ldr x10, =0x696e206c62090a34

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a3066783023202c

ldr x10, =0x3831772072736c09

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20646e61090a312d

ldr x10, =0x363177202c383177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c363177206272

ldr x10, =0x23202c5d3731785b

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x313278202c313278

ldr x10, =0x646c090a3123202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x68636977646e6173

ldr x10, =0x20646461090a3a32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x78202c3231782062

ldr x10, =0x0a363423202c3231

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x77646e617320746c

ldr x10, =0x7573090a31686369

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x35317820706d6309

ldr x10, =0x2e62090a3823202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c353178206464

ldr x10, =0x0a3123202c353178

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3231785b202c3931

ldr x10, =0x61090a3123202c5d

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x657479626f74656c

ldr x10, =0x772062727473090a

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a6630783023202c

ldr x10, =0x6262696e206c6209

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20646e61090a3123

ldr x10, =0x363177202c383177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c39317720627274

ldr x10, =0x202c5d3231785b20

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x74656c6262696e20

ldr x10, =0x73090a657479626f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3831772c20383177

ldr x10, =0x6c62090a3423202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x66783023202c3631

ldr x10, =0x2072736c090a2030

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6e61090a312d2320

ldr x10, =0x77202c3831772064

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x363177206272646c

ldr x10, =0x2c5d3731785b202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x78202c3132782064

ldr x10, =0x090a3123202c3132

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6977646e61730a30

ldr x10, =0x6461090a3a316863

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x313123202c327820

ldr x10, =0x2320637673090a32

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c317820766f6d

ldr x10, =0x766f6d090a343178

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20766f6d090a3436

ldr x10, =0x090a3123202c3078

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d090a3a74737269

ldr x10, =0x23202c387820766f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x23202c343178202c

ldr x10, =0x66746e6972700a31

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a3123202c333178

ldr x10, =0x3032782062757309

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x73090a3123202c34

ldr x10, =0x202c373178206275

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x627573090a312320

ldr x10, =0x3178202c32327820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7820627573090a30

ldr x10, =0x2c333178202c3132

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6f6d090a33342320

ldr x10, =0x23202c3531782076

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7820646461090a35

ldr x10, =0x2c323178202c3231

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c32317820627573

ldr x10, =0x3823202c32317820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7264617465736572

ldr x10, =0x090a3a7365737365

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x657264616f6c2074

ldr x10, =0x0a66667574736570

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x202c35317820706d

ldr x10, =0x6c2e62090a353823

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3178202c35317820

ldr x10, =0x63090a3123202c35

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c5d3231785b202c

ldr x10, =0x646461090a312320

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x090a3123202c5d31

ldr x10, =0x3631772062727473

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x206272646c090a3a

ldr x10, =0x31785b202c363177

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x7264616f6c0a3023

ldr x10, =0x6666757473657065

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6d090a6666757473

ldr x10, =0x202c35317820766f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6c3a202c32317820

ldr x10, =0x657065723a32316f

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x61090a6666757473

ldr x10, =0x2c32317820206464

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x782070726461090a

ldr x10, =0x65706572202c3231

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3a32316f6c3a202c

ldr x10, =0x706d657465706572

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2020646461090a70

ldr x10, =0x313178202c313178

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x2c31317820707264

ldr x10, =0x6d65746570657220

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x317820766f6d090a

ldr x10, =0x61090a7073202c34

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x766f6d090a5d3631

ldr x10, =0x7073202c33317820

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x3032782072747309

ldr x10, =0x23202c70735b202c

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x20766f6d090a215d

ldr x10, =0x0a7073202c393278

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x5b202c303378202c

ldr x10, =0x32332d23202c7073

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x0a3a74726174735f

ldr x10, =0x3932782070747309

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6f69746365732e09

ldr x10, =0x0a747865742e206e

stp x9, x10, \[sp, #-16\]!

ldr x9, =0x6c61626f6c672e09

ldr x10, =0x0a74726174735f20

stp x9, x10, \[sp, #-16\]!

mov x14, sp

adrp x11, repetemp

add  x11, x11, :lo12:repetemp

adrp x12, repestuff

add  x12, x12, :lo12:repestuff

mov x15, #0

loadrepestuff:

ldrb w16, \[x11\], #1

strb w16, \[x12\], #1

add x15, x15, #1

cmp x15, #85

b.lt loadrepestuff

resetadresses:

sub x12, x12, #85

add x12, x12, #43

mov x15, #0

sub x21, x13, #1

sub x22, x14, #1

sub x17, x13, #1

sub x20, x14, #1

printfirst:

mov x8, #64

mov x0, #1

mov x1, x14

mov x2, #112

svc #0

sandwich1:

add x21, x21, #1

ldrb w16, \[x17\], #-1

and w18, w16, #0xf0 

lsr w18 ,w18, #4

bl nibbletobyte

strb w19, \[x12\], #1

and w18, w16, #0x0f

bl nibbletobyte

strb w19, \[x12\], #1

add x15, x15, #1

cmp x15, #8

b.lt sandwich1

sub x12, x12, #46

sandwich2:

add x21, x21, #1

ldrb w16, \[x17\], #-1

and w18, w16, #0xf0

lsr w18 ,w18, #4

bl nibbletobyte

strb w19, \[x12\], #1

and w18, w16, #0x0f

bl nibbletobyte

strb w19, \[x12\], 1

add x15, x15, #1

cmp x15, #16

b.lt sandwich2

resumeprinting:

sub x12, x12, #29

add x12, x12, #43

mov x15, #0

mov x8, #64

mov x0, #1

ldr x1, =repestuff

mov x2, #85

svc #0

cmp x17, x20

b.gt sandwich1

printlast:

mov x8, #64

mov x0, #1

mov x1, x22

add x1, x1, #113

sub x2, x21, x22

lsr x2, x2, #1

sub x2, x2, #112

svc #0

exitstuff:

ldr x20, \[sp, #16\]

ldp x29, x30, \[sp\], #32

mov x0, #0

mov x8, #93

svc #0

nibbletobyte:

cmp w18, #0x00

b.eq zerobyte

cmp w18, #0x01

b.eq onebyte

cmp w18, #0x02

b.eq twobyte

cmp w18, #0x03

b.eq threebyte

cmp w18, #0x04

b.eq fourbyte

cmp w18, #0x05

b.eq fivebyte

cmp w18, #0x06

b.eq sixbyte

cmp w18, #0x07

b.eq sevenbyte

cmp w18, #0x08

b.eq eigthbyte

cmp w18, #0x09

b.eq ninebyte

cmp w18, #0x0a

b.eq abyte

cmp w18, #0x0b

b.eq bbyte

cmp w18, #0x0c

b.eq cbyte

cmp w18, #0x0d

b.eq dbyte

cmp w18, #0x0e

b.eq ebyte

cmp w18, #0x0f

b.eq fbyte

zerobyte:

mov w19, #0x30

ret

onebyte:

mov w19, #0x31

ret

twobyte:

mov w19, #0x32

ret

threebyte:

mov w19, #0x33

ret

fourbyte:

mov w19, #0x34

ret

fivebyte:

mov w19, #0x35

ret

sixbyte:

mov w19, #0x36

ret

sevenbyte:

mov w19, #0x37

ret

eigthbyte:

mov w19, #0x38

ret

ninebyte:

mov w19, #0x39

ret

abyte:

mov w19, #0x61

ret

bbyte:

mov w19, #0x62

ret

cbyte:

mov w19, #0x63

ret

dbyte:

mov w19, #0x64

ret

ebyte:

mov w19, #0x65

ret

fbyte:

mov w19, #0x66

ret

.section .rodata

repetemp: .ascii "\n\tldr x9, =0x2020202020202020\n\tldr x10, =0x2020202020202020\n\tstp x9, x10, [sp, #-16]!"

.section .bss

.align 7

repestuff: .zero 85

//quine <3 winnietheraven uwu owor```

▲ 150 r/Assembly_language+9 crossposts

asm.fm — a chiptune synthesizer in pure x86-64 assembly (no libc, no audio lib)

Learning project that became my favourite: a chiptune synth written entirely in x86-64 assembly (Linux, NASM). No libc, no audio library — just computing raw 16-bit samples and writing a WAV header by hand.

The premise is that sound is just a list of numbers (44100/second) describing where a speaker sits. So the whole synth is: generate the numbers, write them out.

It does four oscillators (square/saw/triangle + LFSR noise), polyphony by mixing voices into one buffer, ADSR envelopes, and FM synthesis with a hand-built sine table. Working on effects next (vibrato, delay, reverb).

github.com/whispem/asm.fm

Feedback on the low-level details welcome — especially the fixed-point math in the FM operator.

u/whispem — 3 days ago

Пишу свою операционную систему / I'm writing my own OS.

Всем привет, я создаю с нуля свою open-source операционную систему, это пока что просто хобби, кто может, посмотрите ОС по этой ссылке: https://github.com/OS-AC713/os-core713, может найдете баг или чего вам недостаточно, хотя это пока просто .s код на AT&T который принимает ваши символы и все. Но я скоро перенесу код на NASM / Hi everyone, I’m building my own open-source operating system from scratch. It’s just a hobby for now, but if you have a moment, please check out the OS at this link: https://github.com/OS-AC713/os-core713. You might spot a bug or notice something missing—though right now, it’s just AT&T syntax assembly code that accepts user input and nothing more. That said, I’ll be porting the code to NASM soon.

u/Arch_bembembem — 2 days ago

How to encode this instruction correctly?

Hi, I was developing my own assembler and decided to add {sae} in my AVX-encoder, so I consider to add sae for `vfoo [memory], vreg, imm`, and I tested my assembler with objdump and I saw exactly same result witch nasm generated and you can see it on a screenshot. Please help, because documentation is to week, intel sdm tells me nothing, idk if it's bug in nasm or objdump. I also tryed to ask AI, but did not yield results.

Nasm version – 3.02

Objdump version – 2.40

Sorry for English.

u/This-Assumption-5924 — 3 days ago
▲ 103 r/Assembly_language+13 crossposts

8 bit Workbench™ ED: explore number systems

I designed this device that teaches binary, decimal, hexadecimal and octal number systems. It uses a hands-on approach with Altair-like toggle switches. Can be used as a STEM-kit in classrooms, handy for programmers or for the retro hobbyist. It also has a built-in game. Check out the video for details, hope you like it.

youtu.be
u/8BitFlux-com — 4 days ago

Any tips on how to learn for my upcoming retake of my 8086 assembly exam?

I'm an EE and currently preparing for a retake exam as I failed the first one. This class is notoriously difficult because of the exam (which takes 85% of the entire grade and it isn't curved).

Here are the subjects we learned:

  • Registers and Memory
  • Memory Addressing and Instruction Codes
  • Arithmologic and Control
  • Stack and Routines
  • I/O, Interrupts, and Reset
  • Compilation, Linking, and Loading
  • External Devices

Most of the exam was about "Compilation, Linking, and Loading" which was the subject I understood the least of and was the most difficult for me.

I want to understand everything better, but I have exhausted my lecture notes and the past exams I practiced with.

Any advice for how to understand everything on a deep level for the exam? And also sources to practice from?

Just to give a sense of the problems, here's one question of writing code (the exam is pen and paper, and just to be clear, I'm not asking for a solution; this is just an example which will probably look trivial for you guys).

>Due to the busy exam period, Danny had to stay in his room and study, missing the World Cup games. His roommates came up with an idea that would allow him to study without leaving his room: they installed a dedicated device in the living room that sends the game results directly to Danny's room. In Danny's room, there is an 8086 processor that receives the data via I/O ports.

>Unfortunately, after connecting the system, it turned out that the data transmitted over the electrical wires between the living room and the room picks up noise and occasionally arrives corrupted. To address this issue, the roommates proposed implementing error protection and correction mechanisms as detailed below.

>Technical Specification:

>The I/O device interface from the 8086:

>port 3F8h: DATA (read only)
Returns the most recently received byte.

port 3FDh: STATUS (read only)
bit 0 - DR (Data Ready): 1 = a new byte is available at port 3F8h.
0 = no new data / value already read from 3F8h.
bit 1 - OE (Overrun Error): 1 = a new byte arrived before the previous byte was read; new data replaced old.
bits 2-7 - not used.

NOTES:
- The receiver can hold exactly one byte at a time. If port 3F8h is not
read before the next byte arrives, the old byte is lost and OE is set.
- Reading port 3F8h automatically clears DR (bit 0).
- This device does not check parity in hardware — any parity checking
described below must be done by your own code.

>Parity Check Mechanism:

>A possible score of a game consists of two numbers ranging from 0 to 7 (e.g., 0-0 or 3-2). The score of the first team is encoded in bits 0, 1, 2, and the score of the second team is in bits 3, 4, 5. Bit 6 is set to 1 when the game is over. Bit 7 is the parity bit: it is set or cleared such that the total number of '1' bits in the complete byte is always even. In other words, the specification of the byte sent by the device is:

>Score Structure:
bits 0-2: Score of team A
bits 3-5: Score of team B
bit 6: 1 if the game is over
bit 7: parity

>Task Requirements:

>Write a routine that performs the following operations:

>The routine receives no input parameters.

>The routine polls and reads a new score from the device.

>The routine checks whether the data is valid according to the parity bit.

>If the data is valid, the routine returns Team A's score in register AL and Team B's score in register BL.

>If the data is invalid, the routine triggers Interrupt 42 and returns with the result -1 (for both teams).

reddit.com
u/Marvellover13 — 4 days ago
▲ 100 r/Assembly_language+1 crossposts

OWL FLY II

OWL FLY II - a new flight simulator for DOS. Not a port and not a remaster -

written now, in 8086 assembly, for the machine you already have.

MIT, and it builds with the assembler that ships beside it. Nothing to buy,

nothing to install.

Fly it in your browser:

https://kirindenis.github.io/wire-city-2/owlfly2.html

And you are not alone up there. Multiplayer over IPX - in your browser, or on

your own DOS box, and everybody ends up in the same sky. You drop in over a

war that is already going on, and Enter puts you in a jet.

Source (MIT), assembler included:

https://github.com/.../wire-city-2/tree/main/GAMES/OWLFLY2

u/Extension_Emu_9825 — 6 days ago

Wow Assembly not dead?

Encountered this reddit on my feed, shocked to learn it's not dead. I programmed on Z80 back in the 1980s.

(I wonder if Perl is still alive)

reddit.com
u/NolanRoad — 7 days ago

Anyone interested in doing Assembly Language coding projects together?

Let me first say that I have no programming experience. I've been studying Assembly Language though my ultimate goal is to become an engineer.

I got very interested in computer programming when I came across a Wikipedia article about Assembly Language programming. The article was saying that learning to code in Assembly gives you an incredible amounts of control over your machine. The ability to tell the computer exactly what to do and knowing how the machine works is fascinating.

I am not sure what Assembly project to do together; I hope someone has an idea here. I think I'd do a project where we are continuing to discover what we can do with the PCs or any hardware we have. Perhaps build a calculator program would be the first start.

I'm currently working with MASM (Microsoft Macro Assembler) as my assembler and I have textbooks to go with it. We could go use a different assembler if you are uncomfortable with MASM. Just please have a good reason for it because I would really not want to leave MASM because of the education resources I have for it.

reddit.com
u/Electrolerengine — 6 days ago

AssemBlocks DEVLOG #1

block-based x86-64 assembly editor. i used google blockly for this project. there are many basic instructions and a small emulator on the right side of the screen. you can run the project directly in the emulator and compile it.

u/DryComment6387 — 7 days ago

How do i start learning assembly

I know basic C, java, python and I wanna learn assembly but what should i learn, windows or linux, intel or at&t and what are the sources to learn assembly

reddit.com
u/yj_20927 — 9 days ago

Is this good?

/////////////////////

// Instruction Set //

/////////////////////

//

// LOGIC

// AND R1 R2 R3

// OR R1 R2 R3

// XOR R1 R2 R3

// NOT R1 R2 R3

// ----------------

// ARITHMETIC

// ADD R1 R2 R3

// SUB R1 R2 R3

// ----------------

// STORAGE

// MOV R1 R2

// LOAD R1 R2

// STOR R1 R2

// ----------------

// FLOW

// JUMP R1

// JEQU R1

// CALL R1

// RET

//

// ECHO R1

// QUIT

//

/////////////////////

// //

/////////////////////

reddit.com
u/TOYALFm1117 — 7 days ago

Best way to go about writing an emulator?

So the next step in my journey of developing the RX-GP16 ISA is writing an x86 based emulator and assembler for it. I have a few ideas for how to do the CPU emulation with virtual registers in memory and having every opcode act as a function pointer to a routine for manipulating that data in ways the ISA describes.

But before I write garbage and burn myself out, I wish to ask some of you more experienced folk how you'd do it. Of course, I dont want to eliminate my critical thinking and innovation but wiser oversight could be of great assistance.

Thank you for all answers in advance!

u/Brutustheman — 7 days ago
▲ 66 r/Assembly_language+1 crossposts

AVX-512 support in my own Assembler

AVX-512 support in my own Assembler

About a year ago I started writing AmmAsm, a handwritten x86-64 assembler in C to better understand x86-64 instruction encoding, ELF, and linking.

It currently supports generating Linux x86-64 executables, PIE binaries, and ELF relocatable object files that can be linked with ld or gcc, basic part of SIMD such as sse, sse2, avx, avx2, avx512

I implemented everything from the lexer and parser to the instruction encoder, ELF writer, relocation handling, symbol resolution.

In last realize, I fully implemented VEX/EVEX, including vvvv, w, mmm, broadcast, k0/k1-k7 mask registers, z mask, tuple type, and other fields thats belong to vex and evex. The most hard part was a W and tuple time, as I spend hours for searching every avx512 instruction for type of tuple if broadcast exists and W field.

I'd love to hear feedback from people interested in assemblers, instruction encoding(especially VEX/EVEX), or x86-64 in general.

Thanks!

Repository: https://github.com/LinuxCoder13/AmmAsm

u/This-Assumption-5924 — 11 days ago
▲ 62 r/Assembly_language+3 crossposts

I Implemented the TIS-100 Architecture on my Atum A3 Nano

If you haven't heard of this game, you should definitely check it out. It is awesome.

I was playing it recently and it occurred to me that I could absolutely design the architecture in VHDL, so I took a swing at it. This is a short demo of some very simple functionality actually running on the board (this is very much still a WIP).

I realize this UI is disgustingly hideous. I just wanted to throw something together so I could actually test it out. I plan to eventually actually interpret the assembly commands, I just didn't feel like spending the time to do that before I actually got to run it.

Each outer core has a shallow input and output fifo. There is a UART controller that can parse messages to write instructions to each core, enable/disable execution, and write data to the input fifos. It also monitors the occupancy of each output fifo, and sends a message with the direction, index, and data of the values coming out of the cores. You can see, at the bottom of the UI, it is sending out incrementing values. ​

So, this UI is converting these instructions into UART messages and programming each core of the device. It is also reading from the UART and interpreting the messages as direction, index, and data (hence up[0]: x)

u/Beautiful_Stage5720 — 10 days ago