06 December 2018, 20:41 | #81 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
|
|
06 December 2018, 21:50 | #82 | |
Registered User
Join Date: Mar 2016
Location: Ozherele
Posts: 229
|
Quote:
Maybe. I have just done some coding in the plain Xlib, Fltk, OpenGL. IMHO AmigaOS gives more i/o-paradigms than the mention libraries. I really begin to like AmigaOS and it is sad that I can afford to study it more carefully now. I have failed to find a way to use console and graphic output in the same window. However using SetDrMd, SetAPen ... allows to customize RasterPort output. BTW. I'm a bit disappointed that 68000 doesn't have a command to swap bytes in a word. Even ancient PDP-11 has a SWAB instruction for this. 8088 gives you a go like XCHG BL,BH for 4 cycles. For 68000 I have to use ROL #8,D0 for 20 cycles. EDIT. I have also discovered that shifts and rotates can be applied only to words in memory, this makes a code for such operations for bytes too big and slow. So IMHO for byte operations 8086 maybe has performance close to 68000. |
|
06 December 2018, 22:20 | #83 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Quote:
|
||
06 December 2018, 22:52 | #84 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
|
There are faster ways to do that (for 68000).
|
06 December 2018, 22:52 | #85 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Quote:
So an instruction like lsr <ea> can shift one bit only and the operand size is restricted to word (so you can think of it as lsr.w #1,<ea>). But can be very useful: consider a sequence of roxl -(a0) or roxr (a0)+ and the result on a video bitplane If you want a multi shift/rotate byte operation you can load to some data register, operate, then write to memory, not a big problem Last edited by ross; 06 December 2018 at 23:03. |
|
07 December 2018, 10:14 | #86 | |
Registered User
Join Date: Dec 2014
Location: germany
Posts: 439
|
Quote:
There's a lot of routines for byte swapping that are faster than ROL, if you want to work directly in memory: http://atari-forum.com/viewtopic.php?f=68&t=11779 Fastest is AFAICS 24 clock cycles to read from mem, byte-swap and write back a word using movep (actually 96 cycles for four words): Code:
movep.l 0(a0),d0 movep.l 1(a0),d1 movep.l d0,1(a1) movep.l d1,0(a1) |
|
07 December 2018, 10:18 | #87 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,322
|
On 68020+ there is a barrel shifter so ROL/ROR timing is no longer a problem. Having added an extra instruction for byte swapping in words would have led to duplicates.
|
07 December 2018, 10:29 | #88 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
|
07 December 2018, 10:42 | #89 | |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
Quote:
If you want more esoteric window attributes, you will need to create the window yourself (you already did that), and then, using console.device, create and attach a console to your window. That way you can use char control sequences, etc. |
|
07 December 2018, 10:48 | #90 | ||
Registered User
Join Date: Dec 2014
Location: germany
Posts: 439
|
Quote:
But there's a slightly mysterious sentence in the Programmer's Reference Manual: Quote:
|
||
07 December 2018, 17:34 | #91 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
|
07 December 2018, 21:10 | #92 | |
Registered User
Join Date: Mar 2016
Location: Ozherele
Posts: 229
|
Quote:
Code:
bsr printstr dc.b "Hello World!",0 even printstr: movea.l (sp)+,a2 lea stringbuf(a3),a4 ;A3 is a base for data section moveq #0,d0 .l1: addq.w #1,d0 move.b (a2)+,d1 move.b d1,(a4)+ bne .l1 move.l a2,d1 addq.l #1,d1 ;is it necessary? andi.b #$fe,d1 move.l d1,-(sp) ;movea.l GRAPHICS_BASE(a3),a6 ;movea.l RASTER_PORT(a3),a1 lea stringbuf(a3),a0 subq.w #1,d0 jmp Text(a6) I am sure this is a mistake in the book. |
|
07 December 2018, 22:36 | #93 | |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
Yes.
Quote:
Even understanding what you want to do in such a simple routine is complicated by how you write it! You can use a simple straightforward call: Code:
move.w #(endstr-string-1),d0 lea string(pc),a0 ; movea.l RASTER_PORT(a3),a1 ; movea.l GRAPHICS_BASE(a3),a6 jsr _LVOText(a6) ; code continue.. string dc.b 'Hello World!',0 endstr even Code:
bsr printstr dc.b 'Hello World!',0 even ; code continue.. printstr: moveq #-1,d0 movea.l (sp),a0 .l addq.l #1,d0 tst.b (a0,d0.l) bne.b .l move.l d0,d1 addq.l #2,d1 lsr.l #1,d1 add.l d1,d1 add.l d1,(sp) ; movea.l GRAPHICS_BASE(a3),a6 ; movea.l RASTER_PORT(a3),a1 jmp Text(a6) |
|
07 December 2018, 23:43 | #94 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
I like doing strlen() with dbeq. It also takes advantage of the 68010 DBcc-cache.
Code:
moveq #-1,d0 .1: tst.b (a0)+ dbeq d0,.1 not.l d0 Last edited by phx; 07 December 2018 at 23:45. Reason: a0 |
08 December 2018, 00:02 | #95 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
|
08 December 2018, 00:37 | #96 |
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Code:
moveq #-1, d0 .1 tst.b (a0)+ dbeq d0, .1 add.l d0, a0 not.l d0 Code:
move.l a0, d0 .1 tst.b (a0)+ bne .1 sub.l d0, a0 exg a0, d0 subq.l #1, d0 Last edited by Leffmann; 08 December 2018 at 00:42. |
08 December 2018, 01:18 | #97 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
|
08 December 2018, 10:13 | #98 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
@Leffmann, phx
If my calculations are right than bcc version is 2 cycles slower (on 68000 of course) Lets see Code:
moveq #-1, d0 ;4c .1 tst.b (a0)+ ;8c*x dbeq d0, .1 ;10c*(x-1) + 12c add.l d0, a0 ;8c not.l d0 ;4c ;total 4c+ 8c*x + 10c*(x-1) + 12c + 8c + 4c = 28c + 18c * x 0 - 10c = ; = 18c + 18c*x Code:
move.l a0, d0 ;4c .1 tst.b (a0)+ ;8c*x bne .1 ;10c*(x-1) + 8c sub.l d0, a0 ;8c exg a0, d0 ;6c subq.l #1, d0 ;4c ;toal 4c + 8c*x + 10c*x - 10c + 8c + 8c + 6c + 4c = ; = 20c + 18c*x Code:
move.l a0,a1 ;4c moveq #-1,d0 ;4c .loop tst.b (a1)+ ;8c*x dbeq.b .loop ;10c*(x-1) + 12c not.l d0 ;4c ;total 8c + 18c*x - 10c +12c + 4c = ; = 16c + 18c*x |
08 December 2018, 10:25 | #99 |
Registered User
Join Date: Mar 2016
Location: Ozherele
Posts: 229
|
This approach has a disadvantage - you have to give a name for a string which is used only once. Possibly we need a macro which will be generate unique names.
Thank you. Your code is much better than mine. Why did I those increment and decrement?! Last edited by litwr; 08 December 2018 at 12:01. |
08 December 2018, 11:09 | #100 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
You can use local labels. Though, the approach to use the stack to obtain the (string) addresses can indeed be quite useful. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Misc Amiga Assembler Source Code | copse | Coders. General | 14 | 20 October 2019 02:05 |
The 6502 assembler code in "The Terminator" (1984) | Shoonay | Nostalgia & memories | 2 | 15 May 2009 13:52 |
Assembler System Friendly code | redblade | Coders. General | 3 | 29 July 2008 12:15 |
Amiga Cross Assembler to code intros! - Help! | W4r3DeV1L | Amiga scene | 6 | 30 May 2008 16:53 |
3D code and/or internet code for Blitz Basic 2.1 | EdzUp | Retrogaming General Discussion | 0 | 10 February 2002 11:40 |
|
|