[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference 7.286::atarist

Title:Atari ST, TT, & Falcon
Notice:Please read note 1.0 and its replies before posting!
Moderator:FUNYET::ANDERSON
Created:Mon Apr 04 1988
Last Modified:Tue May 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1433
Total number of notes:10312

1020.0. "68000 Workshop!" by SIEVAX::JAMIE (Use me, Use me... Ooops! Excuse me!) Mon Nov 26 1990 15:32

    I'm suprised that there isn't a note on 68000 programming in this
    conference (at least I couldn't *see* one...). I'm just starting out in
    the machine code wilderness and could do with a bit of help. There may
    be more like me out there, so it could be an idea to dedicate this note
    to 68000 problems etc.
    
    I want to rotate a block of memory so that word2 contains the contents
    of what was in word1, word3 contains old contents of word2 etc and
    word1 contains the contents of the last word in the block of memory (ie
    it's wraparound).
    
    Now, I'm getting mixed up with the different addressing modes etc and
    can't get it to work... the code I've come up with follows :
    
\ Routine to rotate block of memory
\ bounded by start and end.
    
	movea   end, a0
	move.w	(a0), temp
loop	move.w	(a0-1), (a0)
	cmpa	(a0-1), start
	bne	loop
	move.w  temp, (a0-1)
	rts

Start	dc.b	$1
	dc.b	$2
	dc.b	$3
End	dc.b	$4
    
    
    Questions : O.K. This doesn't work! What should I do to get this going
    ? It seems it should be really simple. Also, is there an easier way of
    achieving this ? Finally, should I be using the LEA instruction in the
    first line instead of MOVEA ? What's the difference ?
    
    
    Cheers,
    
    
    				Jamie.
T.RTitleUserPersonal
Name
DateLines
1020.1#2!SIEVAX::JAMIEUse me, Use me... Ooops! Excuse me!Mon Nov 26 1990 16:2620
    I've had a rethink (and fixed the disgusting error of using DC.B
    instead of DC.W!)... This is what I've come up with... any comments ?
    
    
\ Routine to rotate block of memory
\ bounded by start and end.

	lea	end, a0
	movea	a0, a1
	deca	a1
	move.w	(a0), d0
loop	move.w  (a1)-, (a0)-
	cmpa	start, a1
	bne	loop
	move.w  d0, (a0)

Start	dc.w	$1
	dc.w	$2
	dc.w	$3
End	dc.w	$4
1020.2Addressing mdoe problems aboundPRNSYS::LOMICKAJJeffrey A. LomickaMon Nov 26 1990 16:4333
I may be a little rusty, so others can correct me when I mess up, but I
interpret the code as follows:
    
	movea   end, a0

		This moves a "4" into A0.  The LEA instruction would
		load the address "END".  An equivalent instruction would
		be to say "MOVEA #end, A0".  The difference is that LEA
		allows the use of addressing modes that you can't get
		with the immediate load of a constant, such
		as "LEA (42,A0,D0.l)".

	move.w	(a0), temp
loop	move.w	(a0-1), (a0)

		I think "A0-1" is actually "D7".  Also, you need to be
		incrementing A0.  Try "move.b (-1,A0), (a0)+".  Also, if
		youare moving bytes, not words, you use the ".b" form.

	cmpa	(a0-1), start

		This compares with "1".  You mean "CMPA A0, #start".

	bne	loop
	move.w  temp, (a0-1)

		MOVE.W temp, (-1, A0)

	rts

This should get you started.  Have fun figuring out the rest of the
68000 addressing modes.

1020.3SIEVAX::JAMIEUse me, Use me... Ooops! Excuse me!Mon Nov 26 1990 17:3110
    That's what I'm having problems with! Getting to grips with the
    addressing modes! Thanks for the comments.
    
    One thing I don't understand though; why is (A0-1) equivalent to (D7) ?
    
    
    Cheers,
    
    
    				Jamie.
1020.4PRNSYS::LOMICKAJJeffrey A. LomickaTue Nov 27 1990 13:204
In some assembelers, the register names are simply pre-defined symbols,
and you can do math on them.  Not true in all cases, of course, but I
was trying to figure out a reason why your assembler would accept (a0-1)
without a syntax error.
1020.5SIEVAX::JAMIEUse me, Use me... Ooops! Excuse me!Wed Dec 05 1990 08:2016
    Having progressed a bit from .0 - got rasters licked, got sprites
    fluttering around the screen etc. I've got another more "internals"
    related question...
    
    How do you get rid of the top, bottom, left and right borders ? I know
    it can definitely be done; I've seen programs do it. Unfortunately I've
    not been able to see the source for the code.
    
    Has anyone done this or can anyone suggest how it might be
    accomplished ?
    
    
    Cheers,
    
    
    				Jamie.
1020.6maybe a traceMGOI02::FALKENSTEINso many girls, so little time...Wed Dec 05 1990 13:1945
I can't give you details, but it works like described below:

In 50Hz-Mode one screen consists of 313 lines showing up 50 times per second.
There is no interlace so that the two halfpictures overlay exactly. The first
39 lines are displayed without pixel-graphics but just with the background
color (colorpalette 0). Then followed by 200 lines each beginning on the left 
side with the backgroundcolor, in the mid with the pixel-graphic (320 or 640,
depending on the mode) and on the right again terminate with the background-
color. The next 45 lines (displaying the lower border) are again only back-
ground color, no pixels. 
The last 29 of 313 lines are blanked out by the blankling signal of the GLUE
and are therefor not seen on the monitor.
The trick some programmers use to display the complete screen is a short
50/60Hz switch which confuses the 199 lines of the glue so that the ST
displays 39200 Bytes screen memory instead of 32000 Bytes (45 lines with
each 160 Bytes = 7200 Bytes more).
I read all this in a mag dated May '89. They said to get the left and right
borders also a complex routine of Interrupt- and Videoaddresscounter 
synchronization is neccessary. 
Another hint: the DE-signal (display enable in color mode) switches the
display of pixels or backgroundcolor. (High=Pixel, Low=Backgroundcolor).
So you have to modify this signal in a way that in each video-line the
DE is longer and earlier on HIGH. So the line displays more than the normal
320 or 640 pixels.
DE is generated by the GLUE (also Blank, Hsync, Vsync), runs to the MMU,
to the Shifter and then to the B-input of the MFP (counting of lines via
interrupt). The starting address of the next halfpicture is stored from
the location FF8201 and FF8203 into the MMU. Is DE high, so the Display-
Cycle-Clock signal is now generated in the MMU which transports the
videodisplay information from RAM to Shifter with 16bits and uses the Load
Input of the Shifter. The same time the counter in the MMU counts up, the
actual number is in the video address counter FF8205/07/09. Is the DE high
for a longer period of time the MMU addresses more memory as display memory
and gives it to the Shifter as pixel-display.
The software trick is that because of interrupt controlled switching of
50/60Hz in dedicated lines the GLUE-generated DE signal keeps high for
a longer period of time per line. Don't ask me how to do that with 
software, in the mag came a schematic (one BC555, 2 diodes, one capacitor,
two resistors and a switch) which does exactly that. It avoids the borders
and gives you a resolution of up to 840*568 pixels in monochrome.

Bernd


1020.7 ST world articles.UKCSSE::KEANEThu Dec 06 1990 06:4420
    
    
    Hi Jamie,
    
    IN the old ST WOrld before its unfortunate takeover by the ST USer
    magazine, last year, was a series of articles and code examples of all
    sorts of graphic programming techniques in assembler. 
    It was by one of the top graphic gurus in the UK. I cant remember his
    name.... but ..
    I have the complete set of articles and I also sent for and received the 
    compilation disk with all the Code segments used in the series.
    If you are interested I will loan you the articles and the code segment
    disk. I cannot remember wheter there was a segment on software
    overscan.
    I also know it can be done, I also have seen those amazing demos,
    with all four borders missing!
    
    regards
    
    Pat K.
1020.8SIEVAX::JAMIEUse me, Use me... Ooops! Excuse me!Thu Dec 06 1990 07:3617
    RE .6
    
    Thanks for the descriptions; I understand the 50hz/60hz switch - that
    shouldn't be too bad - but the left/right border bit blew me away!
    I'll have to try and find some example code for that!
    
    Which brings me to .7!
    
    I'd love to borrow the articles & disks Pat; if it's the series I
    think - by Jeff Lawson - I've got just one issue of the series which I
    found very interesting but wished I'd got the others...!
    
    
    Cheers,
    
    
    				Jamie.
1020.9jeff LAwson was right!UKCSSE::KEANEThu Dec 06 1990 12:0412
    
    
    Hi Jamie 
    
    Yes Jeff Lawson was the guy.
    
    I will bring the articles and disk in Monday and drop them in the mail
    
    
    Cheers
    
    Pat K.
1020.10Me too!GOLLY::JAMISONWed Dec 12 1990 17:2311
    I'd love to copy off the articles and look at the disk too.  Would this
    be possible?
    
    My mail stop is 
    
    Al Jamison
    ZK02-3/r56
    
    Thanks for any reply,
    
    Al...
1020.11What is MIT Assembler format?GOLLY::JAMISONWed Dec 12 1990 17:2710
    What is the difference between MIT style 68000 assembler and Motorola
    Assembler formats?  Anyone know where to get more information?  
    
    I have a nice 68000 programmers book '68000 Assembly Language' by Kratz
    and another (I think).  Prentice Hall.  If this is wrong, I'll make
    another reply.
    
    Thanks, 
    
    Al...
1020.12SIEVAX::JAMIEUse me, Use me... Ooops! Excuse me!Mon Jan 07 1991 07:3120
    I'm running into some strange problems when leaving supervisor mode...
    when I go into supervisor mode, I save the old stack address, then when
    I leave supervisor mode, I supply the saved address to the system
    routine... this then blows up...
    
    I assume that somehow the contents of the old stack are becoming
    corrupted in some way... but I don't see how... since I'm not
    addressing that area of memory directly myself and I was under the
    impression that when in supervisor mode an entirely different stack was
    used...
    
    Has anyone else had problems with this ? I suppose I could save the
    contents of the old stack then restore that before jumping out of
    supervisor mode but that doesn't sound too safe to me!!!
    
    
    Cheers,
    
    
    				Jamie.
1020.13SSP and USP might interfere...STKHLM::WEBJORNWed Jan 09 1991 07:355
    Going from user to super mode switches from usp to ssp. However,
    check if USP and SSP points to the same location......
    
    Gullik
    
1020.14SIEVAX::JAMIEUse me, Use me... Ooops! Excuse me!Wed Jan 09 1991 12:338
    That occured to me last night! I might have to point the stack pointer
    to another area once I've switched into super. Thanks... your
    suspicions confirm mine!
    
    Cheers,
    
    
    				Jamie.