English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 13 June 2010, 01:16   #81
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
Thanks for your help guys
AlfaRomeo is offline  
Old 14 June 2010, 12:43   #82
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
Tried to open my own screen with the following code in DevPac318 but the A1200 crash and I don´t know why.
Any Ideas?

Code:
MoveScr		=-162
OpenScr		=-198
CloseScr	=-66
CloseLib	=-414
OpenLib		=-552
ExecBase	=4
IntuitRev	EQU	31


	bsr	OpenInt
	bsr	ScrOpen
	move.l	#10000,d0
	
Wait:	sub.w	#1,d0
	cmp.w	#1,d0
	bgt	Wait
	bsr	ScrClose
	bsr	CloseInt
	rts
OpenInt:
	moveq	#IntuitRev,d0
	move.l	ExecBase,a6
	lea	IntName,a1
	jsr	OpenLib(a6)
	move.l	d0,IntBase
	rts
CloseInt:
	move.l	ExecBase,a6
	move.l	IntBase,a1
	jsr	CloseLib(a6)
	rts
ScrOpen:
	move.l	IntBase,a6
	lea	ScrDefs,a0
	jsr	OpenScr
	move.l	d0,ScrHandle
	rts
ScrClose:
	move.l	IntBase,a6
	move.l	ScrHandle,a0
	jsr	CloseScr(a6)
	rts
	
align
	
ScrDefs:
x_pos:		dc.w	0
y_pos:		dc.w	0
width:		dc.w	320
height:		dc.w	200
deph:		dc.w	2
detail_pen:	dc.b	1
block_pen:	dc.b	3
view_modes:	dc.w	2
screen_type:	dc.w	15
font:		dc.l	0
title:		dc.l	sname
gadgets:	dc.l	0
bitmap:		dc.l	0
IntBase:	dc.l	0
ScrHandle:	dc.l	0
IntName:	dc.b	'intuition.library',0
sname:		dc.b	'Our Screen',0
AlfaRomeo is offline  
Old 14 June 2010, 12:59   #83
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
It's just because you forgot to add (A6) after jsr OpenScr

Also the delay loop will finish almost instantly. Even on an old Amiga 500 that loop will be done in a fraction of a second. You can check for the left mouse button like this:

Code:
waitmouse  btst  #6, $bfe001
           bne   waitmouse
Leffmann is offline  
Old 14 June 2010, 13:42   #84
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
This my error was so rookie that I´m still amazed

Thanks for the help Leffmann
Also, one of my next items in the learning list was: how to make a routine for waiting a mouse click. Thanks to you, now I already know
AlfaRomeo is offline  
Old 14 June 2010, 16:29   #85
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
If we have some FastRam installed how we can force some code to run in ChipRam?
Do have any option in DevPac to force the code to be in ChipRam or it can be done directly in the code?
AlfaRomeo is offline  
Old 14 June 2010, 17:01   #86
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by AlfaRomeo View Post
If we have some FastRam installed how we can force some code to run in ChipRam?
Do have any option in DevPac to force the code to be in ChipRam or it can be done directly in the code?
just add this line to your source:

SECTION CODE, CODE_c
StingRay is offline  
Old 14 June 2010, 22:19   #87
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
@StingRay
Thanks for the help.
Tried your tip but DevPac gives an error in ´CODE_c´ maybe it doesn´t support that op-code.
There is other way to force data into ChipMem?
AlfaRomeo is offline  
Old 14 June 2010, 23:10   #88
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
He was thinking about ASM-One in Devpac it's just "section code_c".

The section types you can use are code, data and bss, and the postfixes are c, f and p.

bss is a section of zeroed space that will be allocated for you when the program starts, so you don't have to add to size your executable.

I'm not sure if AmigaOS itself makes any distinction between between code and data type sections, since it seems it will start program execution in the first section regardless of its type, so you should always put your program code first.

The postfixes are c for chipmem, f for fastmem or slowmem, and p for public. Public memory is fastmem or slowmem if available, and chipmem if not. Public is to prefer for all code and things like constants since it could potentially end up in fastmem and run faster. Only use chipmem for the stuff that must go there, like audio and graphics data to be accessed directly by the hardware.
Leffmann is offline  
Old 15 June 2010, 01:52   #89
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
You are right Leffmann, with 'section code_c' DevPac assembles with no errors. Already downloaded DevPac´s manual too and read the 'Output file directives' chapter so I could understand this stuff
AlfaRomeo is offline  
Old 15 June 2010, 09:05   #90
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by Leffmann
in Devpac it's just "section code_c".
That's actually inaccurate - you can name sections in Devpac.

StingRay was (almost ) correct in what he posted - that's the first time I've ever said "almost" in relation to an assetion by Stinger and, to be fair, the guy doesn't even use Devpac!

The error with this:

Quote:
Originally Posted by StingRay
SECTION CODE, CODE_c
is the space character between the , and CODE_c.

Code:
 
SECTION CODE,CODE_c
Works just fine in Devpac.
pmc is offline  
Old 15 June 2010, 09:33   #91
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by pmc View Post
That's actually inaccurate - you can name sections in Devpac.

StingRay was (almost ) correct in what he posted - that's the first time I've ever said "almost" in relation to an assetion by Stinger and, to be fair, the guy doesn't even use Devpac!

The error with this:



is the space character between the , and CODE_c.
Dunno where the space came from, guess I shouldn't post in a hurry when I'm at work. Anyway, I was pretty sure that Devpac handles "normal" section statements.
StingRay is offline  
Old 15 June 2010, 11:54   #92
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
Yeah you're right, I should've spotted that since I've never been a fan of Devpac's strict syntax.

In any case per the current topic of Bippy's hijacked thread and it being in the tutorial forum, the reason for using anonymous or identical sections is to have the assembler coalesce them to f.ex benefit from PC-relative addressing.

Splitting things up in several sections with different names might give your program a better chance of starting when you're low on memory or if it's fragmented.

F.ex if you have a demo with 4 large songs of 100 kB each and stick them in the same section, your program won't start if there's no contiguous block of 400 kB. But if you put them in separate sections it might because there's a bigger chance you'd find 4 separate blocks of 100 kB each.
Leffmann is offline  
Old 16 June 2010, 11:44   #93
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,525
As this is a tutorial thread (and I'm currently bored at the office ) some more information on sections, names and linkers:

The general syntax, which should be supported by all assemblers is:
Code:
        SECTION <name>,<type>
Where <type> is either code, data or bss. Most assemblers also support specifying memory attributes. Either by a special section type name (like code_f, data_c, etc.) or, preferably, by a third argument:
Code:
        SECTION <name>,<type>,<memattr>
Where <memattr> may be chip or fast.

Devpac and others (like vasm) also support omitting the <name> field. In this case it will automatically use <type> as section name.

Special section names:

Unnamed sections have a special meaning to the linker. The linker will never coalesce unnamed sections! The same effect is achieved by naming a section _NOMERGE.

Another very useful section name is __MERGED. All data and bss sections with this name will be automatically coalesced, building a so-called data-bss section. This is a Data hunk which defines a larger size than it contains initialized data. The unitialized data is automatically cleared by LoadSeg() (Warning: only since OS2.0, otherwise you have to clear it yourself). A perfect construct for small data segments.
phx is offline  
Old 16 June 2010, 17:06   #94
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
I´m trying to make something visible on screen but with no luck until now.
Assembled the code below with DevPac in UAE 68040 so I could see screen change color but when run it in CLI from RamDisk: I couldn´t see nothing appear on screen until I click the mouse and program stops.
Why?..Do I need to setup my own screen?

Code:
  
CODE_c

       moveq   #-1,d0
Loop:    
       move.w  $dff006,$dff180        
       subq.w  #1,d0       
       bne.b   Loop        
       moveq   #0,d0 
WaitMouse:  
       btst  #6, $bfe001
       bne   WaitMouse      
       rts

Last edited by AlfaRomeo; 16 June 2010 at 17:20.
AlfaRomeo is offline  
Old 16 June 2010, 17:54   #95
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,546
Quote:
Originally Posted by AlfaRomeo View Post
I´m trying to make something visible on screen but with no luck until now.
Assembled the code below with DevPac in UAE 68040 so I could see screen change color but when run it in CLI from RamDisk: I couldn´t see nothing appear on screen until I click the mouse and program stops.
Why?..Do I need to setup my own screen?
Do not use display card (RTG) modes?
Toni Wilen is offline  
Old 16 June 2010, 19:41   #96
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
Quote:
Originally Posted by Toni Wilen View Post
Do not use display card (RTG) modes?
Yes, Tony I´m using RTG.
What I have to do so I can view the colors from the code above?

Last edited by AlfaRomeo; 16 June 2010 at 19:47.
AlfaRomeo is offline  
Old 16 June 2010, 22:24   #97
BippyM
Global Moderator
 
BippyM's Avatar
 
Join Date: Nov 2001
Location: Derby, UK
Age: 48
Posts: 9,355
Boot into a non RTG screen.

I.e use a native amiga screenmode!
BippyM is offline  
Old 16 June 2010, 22:49   #98
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
Understood.. that happens because UAE doesn´t emulate Amiga custom chips.
But some demos could start directly from UAE like the one I uploaded now to the zone: VectorBalls
Means that demos like that one are OS friendly?
Sorry for my "so basic" questions

Last edited by AlfaRomeo; 16 June 2010 at 23:04.
AlfaRomeo is offline  
Old 16 June 2010, 23:04   #99
TCD
HOL/FTP busy bee
 
TCD's Avatar
 
Join Date: Sep 2006
Location: Germany
Age: 46
Posts: 31,867
Quote:
Originally Posted by AlfaRomeo View Post
Understood.. that happens because UAE doesn´t emulate Amiga custom chips.
Huh? Of course it does.
TCD is offline  
Old 16 June 2010, 23:09   #100
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 829
Quote:
Originally Posted by AlfaRomeo View Post
What I have to do so I can view the colors from the code above?
Join to the dark force and kill the os

Its mean you should first add to source two routines. First kill the os and second one restore os. But much easier is to use prefs and switch to the PAL screen then you will see colors.
Asman is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Downfall - diary of a game... Graham Humphrey Amiga scene 505 15 March 2015 19:26
Uridium 2 : Diary of a Game silkworm Amiga scene 15 09 August 2011 09:00
19 Part One - Boot Camp Retro-Nerd project.aGTW 2 19 February 2008 22:11
Help....what is this part 2? Dizzy Retrogaming General Discussion 7 05 June 2007 15:27

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:08.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10388 seconds with 14 queries