75 lines
1.0 KiB
Plaintext
75 lines
1.0 KiB
Plaintext
@include "arch.vc6asm"
|
|
@include "macros.vc6asm"
|
|
|
|
start:
|
|
mov bp, 0x1000
|
|
mov sp, bp
|
|
|
|
mov r1, .splash
|
|
mov r2, VCD_BEGIN + (0 * 40 + 0)
|
|
call println
|
|
|
|
mov r0, 512
|
|
mov r1, 1
|
|
jr .l0_cond
|
|
.l0_body:
|
|
store [DISK_BLOCK_ID], r1
|
|
store [DISK_ADDR], r0
|
|
mov r2, DISK_CTL_START
|
|
store [DISK_CTL], r2
|
|
add r0, 512
|
|
add r1, 1
|
|
.l0_cond:
|
|
lr r2, .l0_body
|
|
clf
|
|
cmp r1, BOOT_SIZE / 512 + 2
|
|
and fl, FL_LT
|
|
cmov ip, r2
|
|
|
|
.spin:
|
|
hlt
|
|
jr .spin
|
|
|
|
.splash:
|
|
dw "VC6 boot loader\0"
|
|
|
|
println:
|
|
push bp
|
|
mov bp, sp
|
|
sub sp, 2
|
|
|
|
store [sp], r1
|
|
stea r0, r2, sp, 1
|
|
|
|
mov r1, 0
|
|
jr .l0_cond
|
|
.l0_body:
|
|
ldea r3, sp, 1
|
|
add r3, r1
|
|
load r2, [sp]
|
|
add r2, r1
|
|
load r2, [r2]
|
|
store [r3], r2
|
|
|
|
add r1, 1
|
|
.l0_cond:
|
|
load r2, [sp]
|
|
add r2, r1
|
|
load r2, [r2]
|
|
clf
|
|
lr r3, .l0_body
|
|
cmp r2, '\0'
|
|
not fl
|
|
and fl, FL_EQ
|
|
cmov ip, r3
|
|
|
|
.leave:
|
|
mov sp, bp
|
|
pop bp
|
|
ret
|
|
|
|
|
|
@const BOOT_SIZE $
|
|
@static_assert 0x800 - BOOT_SIZE & 0x8000 ^ 0x8000 ; BOOT_SIZE <= 0x800
|
|
|