diff --git a/.gitignore b/.gitignore index d5e95b5..901547e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ graphics1 ham1 intuition1 openwin -ostest \ No newline at end of file +ostest +main diff --git a/scrolling_tricks/Makefile b/scrolling_tricks/Makefile index 2c7ffad..35205ad 100644 --- a/scrolling_tricks/Makefile +++ b/scrolling_tricks/Makefile @@ -2,7 +2,7 @@ ASM=vasmm68k_mot ASM_FLAGS = -Fhunk -devpac .SUFFIXES = .o .asm .c -CC=vc +kick13 +CC=vc +aos68k CFLAGS=-c99 -I$(NDK_INC) -DDEBUG all: main diff --git a/scrolling_tricks/README.md b/scrolling_tricks/README.md index b9e23e9..c86a1e7 100644 --- a/scrolling_tricks/README.md +++ b/scrolling_tricks/README.md @@ -1,9 +1,13 @@ # Scrolling Tricks This is a project to rework the Aminet Scrolling Tricks by Georg Steger into a -version that works on all Amiga OS releases from 1.3 and has -higher reuse. The ScrollingTricks tutorial has tremendous learning -value, but requires at least AmigaOS3.0 to run +version that has higher internal reuse, is smaller and compiles with +VBCC. The purpose is mainly to better understand the algorithms + +# System Requirements + +This software requires V39 libraries and therefore only runs on the +3.x releases or greater of AmigaOS ## Original source diff --git a/scrolling_tricks/main.c b/scrolling_tricks/main.c index f0022ff..fab41f8 100644 --- a/scrolling_tricks/main.c +++ b/scrolling_tricks/main.c @@ -107,35 +107,12 @@ struct FetchInfo /********************* COMPATIBILITY ***********************/ -/* - * AllocBitMap() is V39, provide a version here, that works on all AmigaOS versions - * Older releases, unfortunately have to do the initialization in a more lengthy way - */ -struct BitMap *alloc_bitmap(ULONG sizex, ULONG sizey, ULONG depth, ULONG flags, - struct BitMap *friend_bitmap) -{ - return AllocBitMap(sizex, sizey, depth, flags, friend_bitmap); -} - -/* FreeBitMap() is V39, provide a version here that works on all AmigaOS versions */ -void free_bitmap(struct BitMap *bitmap) -{ - FreeBitMap(bitmap); -} - -/* - GetBitMapAttr() is V39, provide a version here that works on all AmigaOS versions - On older revisions, we simply read the bitmap structure -*/ ULONG is_bitmap_interleaved(struct BitMap *bitmap) { return (GetBitMapAttr(bitmap, BMA_FLAGS) & BMF_INTERLEAVED) == BMF_INTERLEAVED; } -/* Encapsulation of the FindDisplayInfo()/GetDisplayInfo() functions which - don't exist in 1.x OS releases, in that case, we can simply return INVALID_ID - */ -static ULONG get_mode_id_os3() +static ULONG get_mode_id_os3(void) { ULONG modeid = INVALID_ID; struct DimensionInfo diminfo; @@ -149,7 +126,7 @@ static ULONG get_mode_id_os3() return modeid; } -ULONG get_mode_id() +ULONG get_mode_id(void) { ULONG modeid; @@ -182,12 +159,12 @@ static void Cleanup(char *msg) if (ScreenBitmap) { WaitBlit(); - free_bitmap(ScreenBitmap); + FreeBitMap(ScreenBitmap); } if (BlocksBitmap) { WaitBlit(); - free_bitmap(BlocksBitmap); + FreeBitMap(BlocksBitmap); } if (Map) free(Map); @@ -254,11 +231,11 @@ static void OpenBlocks(void) { LONG l; - if (!(BlocksBitmap = alloc_bitmap(BLOCKSWIDTH, - BLOCKSHEIGHT, - BLOCKSDEPTH, - BMF_STANDARD | BMF_INTERLEAVED, - 0))) { + if (!(BlocksBitmap = AllocBitMap(BLOCKSWIDTH, + BLOCKSHEIGHT, + BLOCKSDEPTH, + BMF_STANDARD | BMF_INTERLEAVED, + 0))) { Cleanup("Can't alloc blocks bitmap!"); } @@ -282,14 +259,13 @@ static void OpenBlocks(void) blocksbuffer = BlocksBitmap->Planes[0]; } -// V36: OpenScreenTags() static void OpenDisplay(void) { ULONG modeid; LONG bmflags; - if (!(ScreenBitmap = alloc_bitmap(BITMAPWIDTH,BITMAPHEIGHT + 3,BLOCKSDEPTH, - BMF_STANDARD | BMF_INTERLEAVED | BMF_CLEAR,0))) { + if (!(ScreenBitmap = AllocBitMap(BITMAPWIDTH,BITMAPHEIGHT + 3,BLOCKSDEPTH, + BMF_STANDARD | BMF_INTERLEAVED | BMF_CLEAR,0))) { Cleanup("Can't alloc screen bitmap!"); } frontbuffer = ScreenBitmap->Planes[0]; @@ -379,7 +355,7 @@ static void InitCopperlist(void) /******************* SCROLLING **********************/ -static void DrawBlock(LONG x,LONG y,LONG mapx,LONG mapy) +static void DrawBlock(LONG x, LONG y, LONG mapx, LONG mapy) { UBYTE block;