15 February 2015, 21:41 | #21 |
Zone Friend
Join Date: May 2006
Location: France
Posts: 1,801
|
Maybe an assembler like kick assembler could help too.
http://theweb.dk/KickAssembler/Main.php Kamelito |
15 February 2015, 21:52 | #22 |
Moderator
Join Date: Jan 2003
Location: ...
Age: 52
Posts: 1,838
|
DevPac(genam)+SAS/C linker all the way
Obviously, these days it would be completely different - I am not crazy enough anymore to make RPGs in assembly or even pure C... |
16 February 2015, 18:10 | #23 | |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
Quote:
|
|
17 February 2015, 20:36 | #24 |
Glastonbridge Software
Join Date: Jan 2012
Location: Edinburgh/Scotland
Posts: 2,243
|
btw if anyone has good code for loading IFF images i'd be very grateful... currently i am still having to use AMOS to do all my file conversion work
|
17 February 2015, 21:33 | #25 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
|
Have you checked coppershade...? Must be tons out there, though. #IFF.S Won't load anims but won't choke on stencils, IIRC. Made it a long time ago.
|
11 March 2016, 11:26 | #26 |
Registered User
Join Date: Oct 2015
Location: France
Posts: 82
|
Great topic!
Where can I find information about the syntax of the labels used in these macros ? I didn't find in VASM documentation. I would want to know if it is possible to create other ASM macros to define : do-while, while, switch... structures. Last edited by majikeyric; 11 March 2016 at 11:39. |
11 March 2016, 15:47 | #27 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Those are special Leffmann additions.
I remember that he suggested them for implementation into vasm, but they were obviously never documented. All are variants of \@ (replaced by a unique id for this macro call). They make it possible to refer to unique ids of a previous macro call. \@! means: push the current unique id onto a global stack, then insert it. \@? means: push the current unique id below the top element on this global stack, then insert it. \@@ means: pull the top element from the global id stack and insert it (but do not replace the current unique id for further usage). |
11 March 2016, 15:56 | #28 |
Registered User
Join Date: May 2001
Location: ?
Posts: 19,645
|
Yes please comment all the things and be as verbose as possible, especially if you intend too SHARE the code with other people. I am a learner and many times I have a hard time following code because of lack of comments, or very tiny comments that assume things/prior knowledge.
|
12 March 2016, 11:21 | #29 | |
Registered User
Join Date: Oct 2015
Location: France
Posts: 82
|
Quote:
wow great additions! Thanks for that phx ! All kind of control structures should be doable then! (why not document them ?) |
|
12 March 2016, 12:30 | #30 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
|
03 June 2016, 19:04 | #31 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Use macros for the math libraries because they're an enormous pain to use:
Code:
selectMathBase set 0 setMathBase macro ifle selectMathBase selectMathBase set 1 move.l mathBase,a6 endc endm setMathtransBase macro ifge selectMathBase selectMathBase set -1 move.l mathtransBase,a6 endc endm spflt macro setMathBase move.l \1,d0 jsr _LVOSPFlt(a6) move.l d0,\2 endm spdiv macro setMathBase move.l \1,d0 move.l \2,d1 jsr _LVOSPDiv(a6) move.l d0,\3 endm sppow macro setMathtransBase move.l \1,d0 move.l \2,d1 jsr _LVOSPPow(a6) move.l d0,\3 endm Code:
spfix #123,d2 ; set d2 to 123 spdiv d2,d3,d2 ; divide d2 by d3, store result in d2 sppow d2,d3,d2 ; raise d2 to d3, store result in d2 |
15 July 2016, 14:10 | #32 |
Posts: n/a
|
Does anyone have any thoughts on a good way to deal with calling conventions and locals? I've been trying to follow the convention used by the ROM libraries (d0-d1/a0-a1 are temporary, everything else is callee-preserved) and I'm finding I'm spending a lot of code on pushing/popping things from the stack or shuffling data in and out of the callee-preserved registers.
|
16 July 2016, 16:21 | #33 | ||
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
|
Quote:
If size and performance doesn't matter, or if you're writing machine language just because you prefer it, then one compromise would be to keep all local variables on the stack as you work with them, since most arithmetic and logic operations can be done on memory operands. Using macros to emulate high-level language function calls and hiding the pushing/popping of variables could be useful as well. Quote:
When the main target builds without errors, it will automatically do a commit with a blank message, and when I'm happy with the changes I'll amend a proper commit message, and finally I go back and squash the blank commits before and if I push to a remote repo. |
||
16 July 2016, 17:02 | #34 | |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
Quote:
As for locals, keep them in registers when writing speed critical routines whenever possible, otherwise use what's most convenient and yields the cleanest code. |
|
16 July 2016, 22:25 | #35 |
Registered User
Join Date: May 2013
Location: Grimstad / Norway
Posts: 839
|
ISTR some _real_ old BIX thread printed in BYTE with Jez San discussing calling conventions and him having landed on the side of all saves being done callee side?
Bah, this wasn't worth much without an exact quote, but if someone can find and look through old BYTEs with their "Best of BIX"(?) I think you should find it. |
16 July 2016, 22:30 | #36 |
Registered User
Join Date: Nov 2006
Location: Stockholm, Sweden
Posts: 237
|
Practically all compilers' calling conventions are a combination of caller-saved and caller-saved. This in itself is a good indication that a mixed approach gives the best performance/code size tradeoff.
Sent from my D5503 using Tapatalk |
17 July 2016, 03:16 | #37 |
Banned
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
|
Maybe we can guess at the history from the beginning.
1) stack args were caller deallocated 2) instructions like 68k RTD (Return and Deallocate) and x86 RET with immediate made callee deallocate faster 3) inefficient but convenient variable args became more popular making RTD type instructions unusable for those functions 4) high end processors received enough registers to pass args in registers and ABIs changed to suite (reg args have no deallocation although the caller may need to store data in scratch regs before calling and the callee needs to save any preserved regs) The 68k of course still uses the ancient AT&T ABI which is the least efficient possible despite having enough registers to use for reg args (the AmigaOS uses reg args for libraries but compilers still pass args on the stack by default). The ColdFire didn't update the ABI but they added the MOV3Q instruction which is very useful for moving small immediates to the stack (MOV3Q would not have been worth adding if they changed to a reg arg ABI). Most assembler programmers would probably have not noticed and didn't seem to care about the ugly MOV3Q instruction and the kludge for a kludge. Add it to the list of 68k CPU design screw ups. 1) 68040 removed the FINT/FINTRZ instruction which is common for C fp conversions 2) 68060 removed the MULS.L/MULU.L (64 bit result) instructions which was used by GCC for DivMagic with a large cycle savings 3) ColdFire removed 68k encoding compatibility and added many ugly bolt-on instructions which didn't match with the 68k naming conventions but kept the inefficient ABI and even added instructions to support it 4) Apollo core's naming conventions are just as ugly with BSEL (B=Byte where 68k first B=Bit) and MOVEX (X=cross rev? where 68k end X=X CCR bit) I guess assembler programmers don't care about ugly and poorly designed APIs/ABIs though. I guess they don't plan on using or supporting enhancements. I seem to be the only one who used to care. I just hope nobody expects me to add support in a compiler for this crap (I wanted to make it easier for compilers to generate good code). Maybe it is time to let the 68k rest in peace. That seems to be what most of the 68k retro "real" hardware guys want anyway. Let the 68k CPU die with them while the younger kids will never know a CPU was so easy to program. |
17 July 2016, 07:26 | #38 | ||||||||||||
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Removing them from 060 was a really poor move. Quote:
Quote:
Quote:
But good programming starts with a good architecture. Quote:
Quote:
Perhaps the 68k needs some kind of worthy successor, which unfortunately isn't gonna happen either. |
||||||||||||
17 July 2016, 09:54 | #39 |
old bearded fool
Join Date: Jan 2010
Location: Bangkok
Age: 56
Posts: 775
|
Lots of interesting tips here for a slowly progressing 68k apprentice like me, thanks.
matthey, Please drop the doom and gloom attitude, cheer up, take a good look at this: https://www.google.com/trends/explore#q=Amiga Sure, the "Amiga" trend is somewhat affected by the Spanish use of the word, but that's part of the charm, and one of the reasons it was chosen. I guess as long as girlfriends are trending, there is hope for our beloved computer platform. |
17 July 2016, 11:38 | #40 |
Computer Nerd
Join Date: Sep 2007
Location: Rotterdam/Netherlands
Age: 47
Posts: 3,751
|
That's certainly not what I want. I want REAL 68k with REAL Amiga chipset, not an FPGA computer with Amiga stickers on it.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Neat idea - borderless WinUAE and Amiga wallpaper | Bloodwych | Amiga scene | 8 | 12 January 2011 23:58 |
2000 - black screen... Chips good... PSU good... | chiark | support.Hardware | 45 | 09 January 2009 05:41 |
Mitser Org'oeil, good platformer in old style | s2325 | Retrogaming General Discussion | 2 | 23 November 2008 21:58 |
good retro racer in Lotus/Outrun style | s2325 | Retrogaming General Discussion | 4 | 27 May 2007 20:57 |
very good new racing PC game in old style | s2325 | Retrogaming General Discussion | 1 | 20 February 2007 22:34 |
|
|