I'm exploring making a size limited intro. I'm currently using RASM's built in option to generate the AMSDOS header but I'd like to explore abusing the header to squeeze more bytes out of the space (at 128 bytes with lots of unused space it seems ripe for some hacking?).
The checksum is a 16-bit unsigned sum of all the bytes up to the checksum. Is it possible to generate this in RASM itself (I see a single byte unsigned sum function) or is it simpler to post process the binary?
I think I might have misunderstood how this works so I need to do some more research. I can't delete the post so please ignore.
Hi
SUMMEM directive is only 8 bits checksum (i could add an option for any checksum, just... ask for it and i will release it quickly :) )
anyway, you can use a variable and add each byte then output it with a DEFW
boring, ok, i get it :P
Ok, I've had a play with a hex editor and there is some scope for hacking about with the header (although it is a bit hacky and I'm not sure about compatibility).
Sorry, I can't follow how to use a variable to add each byte using the assembler - I have tried using SUMMEM but I getting errors when I try to assign the result to a variable. I couldn't see any other directive that would allow me to get the bytes from the assembled output.
Could you add the 16-bit unsigned summem directive please?
Ideally I'd like to be able to write something like...
begin
... ; first chunk of AMSDOS header stuff
dw SUMMEM16 begin, $-begin
... ; more AMSDOS header stuff
end
SAVE "file.bin",begin,end
I think I have the rest of the tools I need to build the AMSDOS header in the assembly file. (e.g. dw end - entrypoint ; file length)
please note that SUMMEM is a directive, not a function, it does itself the byte/word write at the directive place
ok, so i added (if you cannot compile yourself, will push a new release today)
SUM16 <start>,<end>
A header generation will be like
myHeader
defb file_user
defb 'FILENAME'
defb 'EXT'
defs 6
defb filetype ; 0:basic 1:protected basic 2:binary
defw filesize
defw loading_address
nop ; filler
defw filesize
defw execution_address
defs 36
defw filesize
nop
SUM16 myHeader,$-myHeader
defs 59
Amazing, thanks! I'll get the code and compile it later on today.
cannot edit so i must fix
it's <start>,<end> for parameters so the last parameter is not $-start but simply $
Tested and all working great. Thanks again!
Thx for this post.
I will retrieve your directive for basm ! What I was using for 4dekades is far less nice
At the checksum location:
.CHECKSUM = 0
.ADR = 0
while .ADR < 0x43
.CHECKSUM = (.CHECKSUM + peek(.ADR)) AND 0xffff
.ADR += 1
wend