-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakedb.g
51 lines (45 loc) · 1.36 KB
/
makedb.g
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
; Make data statements from file (don't use this).
if definite FILE
virtual at 0
DAT::
file FILE
BYTES := $
end virtual
db '; ',FILE,13,10
repeat 1,D:BYTES
db 'label dat:',`D,13,10
end repeat
db 'db \',13,10
data_dump BYTES,,db
calminstruction hex_nibble digit*, command: display
compute digit, 0FFh and '0123456789ABCDEF' shr (digit*8)
arrange command, command digit
assemble command
end calminstruction
define _db
calminstruction data_dump bytes*, i:0, cmd:display
local awk, digit
jj: arrange awk, =load =_db:1 =from =DAT:i
assemble awk
arrange awk, cmd '0x'
assemble awk
compute digit, (_db shr 4) and 0Fh
call hex_nibble, digit, cmd
compute digit, _db and 0Fh
call hex_nibble, digit, cmd
compute i, i + 1
check i = bytes
jyes done
arrange awk, cmd ','
assemble awk
check i and 0Fh
jyes jj
arrange awk, cmd '\',13,10
assemble awk
jump jj
done: arrange awk, cmd 13,10
assemble awk
end calminstruction
else
display 'usage: fasmg -i "define FILE ''<filename>''" ',__FILE__,' <outfile>'
end if