How to start programming with assembly?

Anything QL Software or Programming Related.
g0blinish
ROM Dongle
Posts: 30
Joined: Mon Jun 22, 2015 11:54 am

How to start programming with assembly?

Postby g0blinish » Sat Jun 27, 2015 2:08 pm

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"?


User avatar
tofro
QL Wafer Drive
Posts: 1414
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: How to start programming with assembly?

Postby tofro » Sat Jun 27, 2015 3:46 pm

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

Code: Select all

a=respr (<filesize of program>)
lbytes <program>,a
sexec <program>,a, <filesize of program>, <data space size>

<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


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
g0blinish
ROM Dongle
Posts: 30
Joined: Mon Jun 22, 2015 11:54 am

Re: How to start programming with assembly?

Postby g0blinish » Sat Jun 27, 2015 4:56 pm

I'm looking at amiga_exe:
Image

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


g0blinish
ROM Dongle
Posts: 30
Joined: Mon Jun 22, 2015 11:54 am

Re: How to start programming with assembly?

Postby g0blinish » Sat Jun 27, 2015 5:01 pm

and about how to restore header:
for Q-emulator I placed "asm" into folder "QL Software\QL Demo"
here is result:
Image


User avatar
tofro
QL Wafer Drive
Posts: 1414
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: How to start programming with assembly?

Postby tofro » Sat Jun 27, 2015 5:36 pm

tofro 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


That's why you don't see the file length here. You see "00 01 ...." which aligns to
Byte 4 - should be 0
Byte 5 - should be 1 for executable files


With regards to the next message:

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
g0blinish
ROM Dongle
Posts: 30
Joined: Mon Jun 22, 2015 11:54 am

Re: How to start programming with assembly?

Postby g0blinish » Sat Jun 27, 2015 5:56 pm

So,
00.0F-bytes 19&20
00.01
00.01 - bytes 4&5 what you described?


User avatar
tofro
QL Wafer Drive
Posts: 1414
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: How to start programming with assembly?

Postby tofro » Sat Jun 27, 2015 6:43 pm

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


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
tofro
QL Wafer Drive
Posts: 1414
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: How to start programming with assembly?

Postby tofro » Sat Jun 27, 2015 6:51 pm

Just seen:

The SEXEC in your above post is wrong.

Instead of

Code: Select all

30 SEXEC win1_asm2,55856,4096

it should read

Code: Select all

30 SEXEC win1_asm2,a,55856,4096


You have definitively saved something, but most probably not the code you have loaded to address a ;)

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
RWAP
RWAP Master
Posts: 2513
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: How to start programming with assembly?

Postby RWAP » Sat Jun 27, 2015 8:43 pm

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


User avatar
tofro
QL Wafer Drive
Posts: 1414
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: How to start programming with assembly?

Postby tofro » Sat Jun 27, 2015 8:49 pm

RWAP wrote:I could be wrong - but does q-emulator suport win1_ as a device name?

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.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO

Return to “Software & Programming”

Who is online

Users browsing this forum: No registered users and 3 guests