-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootsector.dasm
More file actions
66 lines (58 loc) · 1.01 KB
/
bootsector.dasm
File metadata and controls
66 lines (58 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
; Minimal boot sector
; You can just slap it at the beginning of you program and change the corresponding values
;
; A contains the floppy ID
; B contains the device list ID
; in sectors, not including the bootsector (TO CHANGE)
:PROGRAM_SIZE .dat 0
#define COPY_LOCATION 0xF000
#define FLOPPY_STATE_BUSY 3
#define SECTOR_SIZE 0x200
set I, copy
set J, COPY_LOCATION
set C, memcpy - copy
set PUSH, COPY_LOCATION
set PC, memcpy
:copy
set PUSH, B
set PUSH, A
set Y, 0
set Z, [PROGRAM_SIZE]
add Z, 1
set X, 1
set A, 2
hwi PEEK
set A, 0
hwi PEEK
ife B, FLOPPY_STATE_BUSY
sub PC, 3
add X, 1
add Y, SECTOR_SIZE
ifg X, Z
add PC, 1
sub PC, 10
set A, POP
set B, POP
set C, 0
set X, 0
set Y, 0
set Z, 0
set EX, 0
set SP, 0
set PC, 0
; I -> from
; J -> to
; C -> size
:memcpy
ife C, 0
set PC, POP
sti [J], [I]
sub C, 1
sub PC, 5
.org 0x1F2, 0
; reserved for future use
.dat 0 0 0
; name, needs to reserve 10 u16 in total (TO CHANGE)
.dat "cFrOSt" 0 0 0
; magic word to be found as a bootsector by the bootloader
.dat 0x55AA