Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jart
Last active June 25, 2021 00:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jart/9754441 to your computer and use it in GitHub Desktop.
Save jart/9754441 to your computer and use it in GitHub Desktop.
AcidOS
;
; ACID OPERATING SYSTEM
; Only 324 Bytes!
; Never Crashes!
; Loads in less than a second off a floppy!
; Runs on any IBM computer (even the 8086!)
;
; Copyright (c) 2003 Justine Tunney
; Licensed Apache 2.0
;
; Tabs: 8
; CPU: Intel 8086
; Assembler: Emu8086/MicroASM, NASM
;
; To use: Compile to bin format at write to the very
; firstest sector of the floppy. You will have
; to use a raw disk writer of some sort. Be
; that if you are compiling to be booted that
; you change the ORG to 7C00h
;
; --- NOTES ---
; To use in NASM I believe all you have to do is
; change the `B.[x]' deferences to `byte [x]'. In
; most other assemblers you would have to do
; `byte ptr [x]' I assume if you program assembly
; you are smart enough to make the small tweaks needed.
;
;ORG 7C00h ; address at which boot code is loaded
ORG 100h ; Use to build a .com file (testing)
JMP start
x DW 0
; width 29 chars (0..28)
logo DB "\. .! ^ ,--. $ ^ .---,"
DB " `\ /. ! | ! / + |._ "
DB " ^\ .` # <==. | + `,"
DB " `` I > \ .__, .__)"
DB " _ ___ ___ ___ _ _ ____ __ "
DB " YOUR COMPUTER IS DEAD "
start: MOV AX, 07C0h ; set this up so we can access memory
MOV SS, AX
MOV SP, 03FEh
PUSH CS
POP DS
AND AH, 0 ; set vid mode 80x25
MOV AL, 2 ; 6 is monochrome, 5 is messed up
INT 10h
AND BX, 0 ; first page, first color
MOV CX, 1 ; one at a time
AND DX, 0 ; dh = y, dl = x
MOV AH, 06h ; write char interrupt
go: MOV AL, 2
ADD AL, B.[x]
ADD AL, B.[x+1]
ADD B.[x], 7
CALL setch ; face character
INT 10h
ADD BL, B.[x] ; change color - 13 works good
ADD BL, B.[x+1]
MOV AH, 02h ; move cursor
INC DL
CMP DL, 79
JL skip
AND DL, 0
INC DH
CMP DH, 24
JL skip
AND DH, 0
skip: INT 10h
MOV AH, 09h
JMP go
setch: CMP DH, 7 ; is cursor in logo area?
JL face
CMP DH, 12
JG face
CMP DL, 10
JL face
CMP DL, 38
JG face
LEA SI, logo ; `si' stores pointer to char
MOV DI, DX ; save `dx' `di' stores dx
SUB DH, 7
loopy: CMP DH, 0
JE dox
ADD SI, 29 ; increase pointer a line
DEC DH
JMP loopy
dox: SUB DL, 10
AND DX, 00FFh ; cut off hi bits so we can add using dx
ADD SI, DX
MOV DX, DI ; restore `dx'
MOV AL, [SI] ; grab the char
CMP AL, ' '
JE fin
MOV BL, 0Eh ; yellow text on black
fin: RET
face: RET ; don't change the char
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment