a shadow :D
parent
94e293ab0f
commit
20e2e1a88c
Binary file not shown.
@ -1,34 +1,74 @@
|
||||
[org 0x1000]
|
||||
|
||||
start:
|
||||
mov ah, 01h ;make cursor invisible
|
||||
mov cx, 2607h
|
||||
int 10h
|
||||
|
||||
mov ah, 06h ; Scroll up function
|
||||
xor al, al ; Clear entire screen
|
||||
xor cx, cx ; Upper left corner CH=row, CL=column
|
||||
mov dx, 184FH ; lower right corner DH=row, DL=column
|
||||
mov bh, 1Eh ; YellowOnBlue
|
||||
int 10H ; execute interrupt
|
||||
|
||||
mov ah, 06h ;draw rect on background
|
||||
mov cx, 0101h
|
||||
mov dx, 164Dh
|
||||
mov bh, 3Eh
|
||||
int 10h
|
||||
|
||||
mov ah, 06h ;draw shadow
|
||||
mov cx, 1702h
|
||||
mov dx, 174Eh
|
||||
mov bh, 0Eh
|
||||
int 10h
|
||||
mov ah, 06h ;draw shadow
|
||||
mov cx, 024Eh
|
||||
mov dx, 174Eh
|
||||
mov bh, 0Eh
|
||||
int 10h
|
||||
|
||||
|
||||
mov ah, 02h ;sets cursor to top to write
|
||||
mov bh, 0h
|
||||
mov dh, 1h
|
||||
mov dl, 1h
|
||||
int 10h
|
||||
|
||||
mov al, 0xC9 ;draw border
|
||||
mov bl, 0x03
|
||||
mov ah,0x0e
|
||||
int 10h
|
||||
mov al, 0xCD
|
||||
mov bl, 0x03
|
||||
mov ah,0x0e
|
||||
int 10h
|
||||
|
||||
mov ah, 02h ;sets cursor to top to write
|
||||
mov bh, 0h
|
||||
mov dh, 4h
|
||||
mov dl, 4h
|
||||
int 10h
|
||||
|
||||
mov si, msg1
|
||||
call print
|
||||
mov si, msg2
|
||||
|
||||
jmp start
|
||||
data:
|
||||
msg db ' POETIC SOFTWARE',0
|
||||
|
||||
start:
|
||||
mov dl,7h
|
||||
mov ah,2
|
||||
int 21h
|
||||
|
||||
MOV AH, 06h ; Scroll up function
|
||||
XOR AL, AL ; Clear entire screen
|
||||
XOR CX, CX ; Upper left corner CH=row, CL=column
|
||||
MOV DX, 184FH ; lower right corner DH=row, DL=column
|
||||
MOV BH, 1Eh ; YellowOnBlue
|
||||
INT 10H
|
||||
|
||||
mov si, msg
|
||||
call print ; print is a function, use CALL instead of JMP
|
||||
|
||||
cli
|
||||
hlt
|
||||
print:
|
||||
lodsb
|
||||
or al,al
|
||||
jz exit
|
||||
mov bl, 0x03
|
||||
mov ah,0x0e
|
||||
int 10h
|
||||
jmp print
|
||||
exit:
|
||||
ret
|
||||
|
||||
|
||||
|
||||
msg1 db " X P U B",0x0A,0
|
||||
msg2 db " NOT MY DEFAULT",0x0D,0x0A,0
|
||||
|
||||
|
Binary file not shown.
@ -0,0 +1,37 @@
|
||||
[org 0x1000]
|
||||
|
||||
mov ah, 0x00
|
||||
mov al, 0x13
|
||||
int 0x10
|
||||
|
||||
|
||||
jmp start
|
||||
|
||||
data:
|
||||
msg db ' POETIC SOFTWARE',0
|
||||
|
||||
start:
|
||||
MOV AH, 06h ; Scroll up function
|
||||
XOR AL, AL ; Clear entire screen
|
||||
XOR CX, CX ; Upper left corner CH=row, CL=column
|
||||
MOV DX, 184FH ; lower right corner DH=row, DL=column
|
||||
MOV BH, 1Eh ; YellowOnBlue
|
||||
INT 10H
|
||||
|
||||
mov si, msg
|
||||
call print ; print is a function, use CALL instead of JMP
|
||||
|
||||
cli
|
||||
hlt
|
||||
print:
|
||||
lodsb
|
||||
or al, al
|
||||
jz exit
|
||||
mov ah,0x0e
|
||||
mov bh, 0x00
|
||||
mov bl, 0x07
|
||||
int 10h
|
||||
jmp print
|
||||
exit:
|
||||
ret
|
||||
|
@ -0,0 +1,190 @@
|
||||
[org 0x1000]
|
||||
|
||||
push 0a000h ;Video memory graphics segment
|
||||
pop es
|
||||
|
||||
mov ax, 0012h ;320x200@8bpp
|
||||
int 10h
|
||||
|
||||
|
||||
push 0Eh ;Blue
|
||||
push 10 ;cX
|
||||
push 10 ;cY
|
||||
push 10 ;Radius
|
||||
call drawFilledCircle
|
||||
|
||||
push 02h ;Blue
|
||||
push 40 ;cX
|
||||
push 40 ;cY
|
||||
push 30 ;Radius
|
||||
call drawFilledCircle
|
||||
|
||||
push 06h ;Blue
|
||||
push 140 ;cX
|
||||
push 100 ;cY
|
||||
push 70 ;Radius
|
||||
call drawFilledCircle
|
||||
|
||||
main: ; Label for the start of the main program
|
||||
|
||||
mov ax,0x0000 ; Setup the Data Segment register
|
||||
; Location of data is DS:Offset
|
||||
mov ds,ax ; This can not be loaded directly it has to be in two steps.
|
||||
; 'mov ds, 0x0000' will NOT work due to limitations on the CPU
|
||||
|
||||
mov si, HelloWorld ; Load the string into position for the procedure.
|
||||
call PutStr ; Call/start the procedure
|
||||
|
||||
mov dx, 0C14h ;DH=12 row, DL=20 column
|
||||
mov bh, 0 ;BH=0 display page
|
||||
mov ah, 02h ;AH=02h set cursor position function
|
||||
int 10h ;video BIOS interrupt
|
||||
|
||||
mov bx, 000Ch ;BH=0 display page, BL=12 red
|
||||
mov ax, 0E42h ;AH=0Eh teletype function, AL=66 capital B
|
||||
int 10h ;video BIOS interrupt
|
||||
|
||||
|
||||
|
||||
; Procedures
|
||||
PutStr: ; Procedure label/start
|
||||
; Set up the registers for the interrupt call
|
||||
mov ah,0x0E ; The function to display a chacter (teletype)
|
||||
mov bh,0x00 ; Page number
|
||||
mov bl,0x0C ; Normal text attribute
|
||||
|
||||
.nextchar ; Internal label (needed to loop round for the next character)
|
||||
lodsb ; I think of this as LOaD String Block
|
||||
; (Not sure if thats the real meaning though)
|
||||
; Loads [SI] into AL and increases SI by one
|
||||
; Check for end of string '0'
|
||||
or al,al ; Sets the zero flag if al = 0
|
||||
; (OR outputs 0's where there is a zero bit in the register)
|
||||
jz .return ; If the zero flag has been set go to the end of the procedure.
|
||||
; Zero flag gets set when an instruction returns 0 as the answer.
|
||||
int 0x10 ; Run the BIOS video interrupt
|
||||
jmp .nextchar ; Loop back round tothe top
|
||||
.return ; Label at the end to jump to when complete
|
||||
ret ; Return to main program
|
||||
|
||||
|
||||
;Color
|
||||
;cX
|
||||
;cY
|
||||
;R
|
||||
drawFilledCircle:
|
||||
push bp
|
||||
mov bp, sp
|
||||
|
||||
sub sp, 02h
|
||||
|
||||
mov cx, WORD [bp+04h] ;R
|
||||
|
||||
mov ax, cx
|
||||
mul ax ;AX = R^2
|
||||
mov WORD [bp-02h], ax ;[bp-02h] = R^2
|
||||
|
||||
|
||||
|
||||
mov ax, WORD [bp+06h]
|
||||
sub ax, cx ;i = cY-R
|
||||
mov bx, WORD [bp+08h]
|
||||
sub bx, cx ;j = cX-R
|
||||
|
||||
shl cx, 1
|
||||
mov dx, cx ;DX = Copy of 2R
|
||||
|
||||
.advance_v:
|
||||
push cx
|
||||
push bx
|
||||
|
||||
mov cx, dx
|
||||
|
||||
.advance_h:
|
||||
;Save values
|
||||
push bx
|
||||
push ax
|
||||
push dx
|
||||
|
||||
;Compute (i-y) and (j-x)
|
||||
sub ax, WORD [bp+06h]
|
||||
sub bx, WORD [bp+08h]
|
||||
|
||||
mul ax ;Compute (i-y)^2
|
||||
|
||||
push ax
|
||||
mov ax, bx
|
||||
mul ax
|
||||
pop bx ;Compute (j-x)^2 in ax, (i-y)^2 is in bx now
|
||||
|
||||
add ax, bx ;(j-x)^2 + (i-y)^2
|
||||
cmp ax, WORD [bp-02h] ;;(j-x)^2 + (i-y)^2 <= R^2
|
||||
|
||||
;Restore values before jump
|
||||
pop dx
|
||||
pop ax
|
||||
pop bx
|
||||
|
||||
ja .continue ;Skip pixel if (j-x)^2 + (i-y)^2 > R^2
|
||||
|
||||
;Write pixel
|
||||
push WORD [bp+0ah]
|
||||
push bx
|
||||
push ax
|
||||
call writePx
|
||||
|
||||
|
||||
.continue:
|
||||
|
||||
;Advance j
|
||||
inc bx
|
||||
loop .advance_h
|
||||
|
||||
;Advance i
|
||||
inc ax
|
||||
|
||||
|
||||
pop bx ;Restore j
|
||||
pop cx ;Restore counter
|
||||
|
||||
loop .advance_v
|
||||
|
||||
add sp, 02h
|
||||
|
||||
|
||||
pop bp
|
||||
ret 08h
|
||||
|
||||
|
||||
|
||||
;Color
|
||||
;X
|
||||
;Y
|
||||
writePx:
|
||||
push bp
|
||||
mov bp, sp
|
||||
|
||||
push ax
|
||||
push bx
|
||||
|
||||
mov bx, WORD [bp+04h]
|
||||
mov ax, bx
|
||||
shl bx, 6
|
||||
shl ax, 8
|
||||
add bx, ax ;320 = 256 + 64
|
||||
|
||||
add bx, WORD [bp+06h]
|
||||
mov ax, WORD [bp+08h]
|
||||
|
||||
;TODO: Clip
|
||||
|
||||
mov BYTE [es:bx], al
|
||||
|
||||
pop bx
|
||||
pop ax
|
||||
|
||||
pop bp
|
||||
ret 06h
|
||||
|
||||
|
||||
HelloWorld db ' Not My Default Bootloader',0x0D,0x0A,0
|
Loading…
Reference in New Issue