How to start programming with assembly?
How to start programming with assembly?
Hi!
I used Adder assembler, but I can't launch program. When I am typing exec_w win1_asm in Qemulator, I got a message "bad or changed medium". How to launch binary programs?
Qemulator manual describes:
OFFSET LENGTH(bytes) CONTENT
0 18 “]!QDOSSFileeHeader“
18 1 00(reserved)
19 1 totalllength_of_header,,inn166bittwords
20 length_of_header*2-20 QDOS INFO
where to find info about "QDOS INFO"?
I used Adder assembler, but I can't launch program. When I am typing exec_w win1_asm in Qemulator, I got a message "bad or changed medium". How to launch binary programs?
Qemulator manual describes:
OFFSET LENGTH(bytes) CONTENT
0 18 “]!QDOSSFileeHeader“
18 1 00(reserved)
19 1 totalllength_of_header,,inn166bittwords
20 length_of_header*2-20 QDOS INFO
where to find info about "QDOS INFO"?
Re: How to start programming with assembly?
I'm not sure I got the question right, but will try an answer anyways:
Actually, you shouldn't normally need to care for (or even be able to access from within QDOS) the Q-EMulator header information. As long as you do your copying from within Q-Emulator from emulated QDOS that should be completely transparent.
In case you can "see" the Q-EMulator header from within QDOS, that means it is corrupted and Q-Emulator is not able to cut it off before handing over the contents to QDOS. It would then need to be cut off manually and re-created (see next).
If the header is lost for some reason, the easiest would be to re-create it within QEmu by
<data space size> you should normally be fine with like 4-8kBytes, i.e 4096 or 8192 would do fine for most programs. The above should then re-create the header.
Should you really want to care about the header information directly, it's as such:
Bytes 0-3 - file length
Byte 4 - should be 0
Byte 5 - should be 1 for executable files
Byte 6-$0d - "file type dependent information" - For executable jobs, bytes 6 - 9 hold the size of the data space as a longword
Byte $0e onwards hold a word for file name length and then the ASCII characters of the file name
the three long words at the ends are reserved for file dates, but unused if you don't have TK2 (and should be irrelevant in your case)
Note as of the Q-Emulator manual, Q-Emulator will normally only store byte 4-13 of the above information
as "QDOS INFO" (or 14 bytes more, if the "long header" option is chosen and a mdv sector header extract is added - But that should be seen from the length information at offset 19)
Tobias
Actually, you shouldn't normally need to care for (or even be able to access from within QDOS) the Q-EMulator header information. As long as you do your copying from within Q-Emulator from emulated QDOS that should be completely transparent.
In case you can "see" the Q-EMulator header from within QDOS, that means it is corrupted and Q-Emulator is not able to cut it off before handing over the contents to QDOS. It would then need to be cut off manually and re-created (see next).
If the header is lost for some reason, the easiest would be to re-create it within QEmu by
Code: Select all
a=respr (<filesize of program>)
lbytes <program>,a
sexec <program>,a, <filesize of program>, <data space size>
Should you really want to care about the header information directly, it's as such:
Bytes 0-3 - file length
Byte 4 - should be 0
Byte 5 - should be 1 for executable files
Byte 6-$0d - "file type dependent information" - For executable jobs, bytes 6 - 9 hold the size of the data space as a longword
Byte $0e onwards hold a word for file name length and then the ASCII characters of the file name
the three long words at the ends are reserved for file dates, but unused if you don't have TK2 (and should be irrelevant in your case)
Note as of the Q-Emulator manual, Q-Emulator will normally only store byte 4-13 of the above information
as "QDOS INFO" (or 14 bytes more, if the "long header" option is chosen and a mdv sector header extract is added - But that should be seen from the length information at offset 19)
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: How to start programming with assembly?
I'm looking at amiga_exe:

Bytes 0-3 - file length
bytes doesn't look as file length. Seems header differs drom provided information.

Bytes 0-3 - file length
bytes doesn't look as file length. Seems header differs drom provided information.
Re: How to start programming with assembly?
and about how to restore header:
for Q-emulator I placed "asm" into folder "QL Software\QL Demo"
here is result:

for Q-emulator I placed "asm" into folder "QL Software\QL Demo"
here is result:

Re: How to start programming with assembly?
That's why you don't see the file length here. You see "00 01 ...." which aligns totofro wrote: Note as of the Q-Emulator manual, Q-Emulator will normally only store byte 4-13 of the above information
as "QDOS INFO"
Tobias
With regards to the next message:Byte 4 - should be 0
Byte 5 - should be 1 for executable files
The "Bad or changed medium" occuring at an "LBYTES" looks suspicious to me. I'm pretty sure Q-Emulator shouldn't store a file header here (It's basically only needed for executable jobs). Can you cut that Q-Emulator header completely from there and try again?
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: How to start programming with assembly?
So,
00.0F-bytes 19&20
00.01
00.01 - bytes 4&5 what you described?
00.0F-bytes 19&20
00.01
00.01 - bytes 4&5 what you described?
Re: How to start programming with assembly?
Right. Remember, what you're looking at is a partial QDOS file header (defined as in my above post, but only starting from byte 4) embedded in a Q-Emulator file header (described in the Q-EMulator manual).
Tobias
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: How to start programming with assembly?
Just seen:
The SEXEC in your above post is wrong.
Instead of
it should read
You have definitively saved something, but most probably not the code you have loaded to address a 
Tobias
The SEXEC in your above post is wrong.
Instead of
Code: Select all
30 SEXEC win1_asm2,55856,4096
Code: Select all
30 SEXEC win1_asm2,a,55856,4096

Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
-
- RWAP Master
- Posts: 2890
- Joined: Sun Nov 28, 2010 4:51 pm
- Location: Stone, United Kingdom
- Contact:
Re: How to start programming with assembly?
I could be wrong - but does q-emulator suport win1_ as a device name?
I don't think it does unless you are running SMSQ/e on it.
That would explain the bad or changed medium in line 20
I don't think it does unless you are running SMSQ/e on it.
That would explain the bad or changed medium in line 20
Rich Mellor
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm
Re: How to start programming with assembly?
It does, Rich. Actually, it doesn't care about device names at all, only drive numbers. win1_, mdv1_, flp1_ is all the same, just depends on what you have mounted there.RWAP wrote:I could be wrong - but does q-emulator suport win1_ as a device name?
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO