How to start programming with assembly?
Re: How to start programming with assembly?
Still wondering why Adder doesn't work on unregustered version.
Why not to transfer files to MDV?
Why not to transfer files to MDV?
Re: How to start programming with assembly?
Try the attached asm.zip file. Unzip into a new directory, attach it as a folder to the first slot on your unregistered Qemulator. It should work. I tested it on my mac after de-registering my version. Not sure what the difference is with the zip on Dylwin's site, but apparently the qdos header info is intact on this one.
Wim
Wim
- Attachments
-
- asm.zip
- adder assembler
- (29.29 KiB) Downloaded 253 times
Re: How to start programming with assembly?
well...
I attached assembler(asm20) and editor(QED). Here is text:
compilation:
how to launch binary?
I use BASIC:
after I type exec win2_hl I got a trash message on screen and computer doesn't respond at pressing keys.
Any clue?
I attached assembler(asm20) and editor(QED). Here is text:
Code: Select all
UT_MTEXT equ $d0
clr.l d0
lea M9,a1
move.l d2,(a1)
lea M8,a1
sub.l a0,a0
move.w UT_MTEXT,a2
jsr (a2)
rts
M8
dc.w M2-M1
M1 dc.b 'QDOS Version - '
M9 ds.l 1
M2
ds.l 1
M2
Code: Select all
10 EXEC win2_asm20;'win2_a_s win2_hl'
I use BASIC:
Code: Select all
10 a=ALCHP(50)
20 LBYTES win2_hl,a
30 SEXEC win2_hl,a,50,4096
Any clue?
-
- RWAP Master
- Posts: 2890
- Joined: Sun Nov 28, 2010 4:51 pm
- Location: Stone, United Kingdom
- Contact:
Re: How to start programming with assembly?
Refer to the QDOS/SMSQ Reference Manual - section 3.1
http://www.dilwyn.me.uk/docs/manuals/QD ... 20v4.3.pdf
This explains that an executable job has to have a standard header at the start:
Then you can add your code
What are you trying to do with
d2 could contain anything at this point...
http://www.dilwyn.me.uk/docs/manuals/QD ... 20v4.3.pdf
This explains that an executable job has to have a standard header at the start:
Code: Select all
JMP.L JOB_START
DC.W $4AFB
DC.W JOB_NAME_LENGTH
DC.B 'Name of job' (word-aligned)
Code: Select all
JOB_START
clr.l d0
lea M9,a1
move.l d2,(a1)
lea M8,a1
sub.l a0,a0
move.w UT_MTEXT,a2
jsr (a2)
rts
M8
dc.w M2-M1
M1 dc.b 'QDOS Version - '
M9 ds.l 1
M2 ds.l 1
Code: Select all
move.l d2,(a1)
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
- janbredenbeek
- Super Gold Card
- Posts: 664
- Joined: Wed Jan 21, 2015 4:54 pm
- Location: Hilversum, The Netherlands
- Contact:
Re: How to start programming with assembly?
The standard header is not really required - but recommended if you want your program to be identified by job control utilities such as in TK2.
He has forgotten the trap #1 (mt.inf) after the first clr.l d0. But that should not cause a crash - only garbage as QDOS version.
The real problem is that it ends with a RTS instruction, and because the stack will contain a zero longword the CPU will wander off to address 0 - on Minerva this will certainly cause a crash as Lau has deliberately put in an illegal opcode there, and on QDOS or SMSQ it won't be much better. The code should end with a MT.FRJOB trap like all executable jobs.
Also, M9 might not word aligned so doing a move.l d2,(a1) where a1 is odd will cause an address error. Putting a DS.L 1 at the end will not always get this right (the GST assembler has a bug in that). A DC.L 0 will do because this does a word alignment before assigning the address to the label.
Jan.
He has forgotten the trap #1 (mt.inf) after the first clr.l d0. But that should not cause a crash - only garbage as QDOS version.
The real problem is that it ends with a RTS instruction, and because the stack will contain a zero longword the CPU will wander off to address 0 - on Minerva this will certainly cause a crash as Lau has deliberately put in an illegal opcode there, and on QDOS or SMSQ it won't be much better. The code should end with a MT.FRJOB trap like all executable jobs.
Also, M9 might not word aligned so doing a move.l d2,(a1) where a1 is odd will cause an address error. Putting a DS.L 1 at the end will not always get this right (the GST assembler has a bug in that). A DC.L 0 will do because this does a word alignment before assigning the address to the label.
Jan.
Re: How to start programming with assembly?
win2_a_s;3: Bad size or wrong operand(s)
Code: Select all
UT_MTEXT equ $d0
BRA.S js
DC.W $4AFB
DC.W 4
DC.B ' hlw'
js
clr.l d0
Re: How to start programming with assembly?
found one:
http://theqlforum.com/viewtopic.php?t=1449
program starts, no message (
http://theqlforum.com/viewtopic.php?t=1449
program starts, no message (
Code: Select all
JMP J_S
dc.w 0
DC.W $4AFB
DC.W 6
DC.B 'C_PROG'
J_S
move.l #0,a0
lea mess,a1
* sub.l a0,a0
move.w $d0,a2
jsr (a2)
rts
mess
dc.w 12
M1 dc.b 'Hello World!',10
Re: How to start programming with assembly?
Lets not forget the simple solution: CALL. The code you need for this is:g0blinish wrote:<>
how to launch binary?
I use BASIC:after I type exec win2_hl I got a trash message on screen and computer doesn't respond at pressing keys.Code: Select all
10 a=ALCHP(50) 20 LBYTES win2_hl,a 30 SEXEC win2_hl,a,50,4096
Any clue?
Code: Select all
100 fnm$ = 'win2_hl_bin'
110 fl = FLEN(\ fnm$)
120 adr = ALCHP(fl)
130 LBYTES fnm$, adr
140 CALL adr
150 RECHP adr
160 :
It also presupposes a corrected version of your code (here packaged for assembly with QMAC):
Code: Select all
filetype 0
section code
UT_MTEXT equ $d0
clr.l d0 sms.info
trap #1 you forgot this!
lea M9,a1
move.l d2,(a1) version
lea M8,a1
sub.l a0,a0
move.w UT_MTEXT,a2
jsr (a2)
rts
M8
dc.w M2-M1
M1 dc.b 'QDOS Version - '
M9 ds.l 1
M2
*
end
Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen