Not being an artist, I want to generate some shapes for a game programatically. Drawing them each time on a bitmap then displaying seems to work fine but slowly, so I thought I'd draw to a temporary BitMap, then GetAShape and blit that.
I thought I'd start off simple and draw a red circle on a standard double-buffered display.
Whenever I get to the bit about blitting my shape, WinUAE dies with HALT3. Which I think is memory related?
However I don't see what I'm doing wrong. Is it me?
Using WinUAE ver 3.6.1 64bit with standard A1200 config.
Code:
;; Play nicely with WB
WBStartup
;; Everything is a WORD unless otherwise stated
DEFTYPE .w
;; Set up a palette with 4 colours, black red green blue
InitPalette 0,4
PalRGB 0,0,0,0,0
PalRGB 0,1,15,00,00
PalRGB 0,2,00,15,00
PalRGB 0,3,00,00,15
;; Set up a CopList, low-res, 2 bitplane
InitCopList 0,$002
;; Temporary bitmap for creating shapes
#BM_DRAW = 9
BitMap #BM_DRAW,320,256,2
Use BitMap #BM_DRAW
;; Draw a 10x10 circle centred on 5,5
Circle 5, 5, 5, 5, 1
;; Get a shape
#SH_1 = 1
GetaShape #SH_1,0,0,10,10
;; GO BLITZ MODE
BLITZ
;; Not entirely sure what these do but needed to control the screen
CreateDisplay 0
DisplayPalette 0,0
;; Let's start doing double buffering
dp = 0
;; Allocate the two bitmaps
#BM_DISP1 = 0
#BM_DISP2 = 1
BitMap #BM_DISP1,320,256,2
BitMap #BM_DISP2,320,256,2
;; Start off with DISP1
dp = #BM_DISP1
;; Do until mouse press
While Joyb(0)=0
;; Select a BitMap to use
Use BitMap dp
;; Wipe out everything
Cls 0
;; Blit
Blit #SH_1, 0, 0, 0
;; Display it
VWait
DisplayBitMap 0,dp
;; Swap over the display BitMap
dp = 1 - dp
Wend
End