Updates to calling C

This commit is contained in:
alpine9000
2016-03-16 20:25:15 +11:00
parent 68c54c01d2
commit 9e2888bc84
4 changed files with 15 additions and 10 deletions
+2 -1
View File
@@ -14,7 +14,8 @@ PokeBitplanePointers(unsigned short* copper, unsigned char* bitplanes, unsigned
static unsigned short _copperData;
static unsigned char _bitplaneData;
static void
void
TestCall()
{
PokeBitplanePointers(&_copperData, &_bitplaneData, 3, 4, 5);
+3 -1
View File
@@ -28,7 +28,9 @@ Entry:
;===========================================================
if 0
PokeBitplanePointers: ; d0 = frame offset in bytes, a0 = BPLP copper list address
PokeBitplanePointers:
; d0 = frame offset in bytes;
; a0 = BPLP copper list address
movem.l d0-a6,-(sp)
move.l bitplanes,a1
add.l d0,a1 ; Offset for odd/even frames
+9 -8
View File
@@ -19,14 +19,15 @@ Init:
jsr PokeBitplanePointers
endif
;; void PokeBitplanePointers(unsigned short* copper, unsigned char* bitplanes, unsigned offset, unsigned numBitplanes, unsigned screenWidthBytes)
move.l #SCREEN_WIDTH_BYTES,-(sp)
move.l #SCREEN_BIT_DEPTH,-(sp)
move.l #0,-(sp)
pea bitplanes
pea copperList
jsr _PokeBitplanePointers
add.l #20,sp
;; Make a call to a C function with the following prototype:
;; void PokeBitplanePointers(unsigned short* copper, unsigned char* bitplanes, unsigned offset, unsigned numBitplanes, unsigned screenWidthBytes)
move.l #SCREEN_WIDTH_BYTES,-(sp) ; arguments are pushed onto the stack...
move.l #SCREEN_BIT_DEPTH,-(sp) ; in reverse order
move.l #0,-(sp) ; offset == 0
pea bitplanes ; make sure you push the address...
pea copperList ; of variables, not the value
jsr _PokeBitplanePointers ; C adds an _ to all global symbols
add.l #20,sp ; Need to pop the arguments from the stack
;; set up playfield
move.w #(RASTER_Y_START<<8)|RASTER_X_START,DIWSTRT(a6)
+1
View File
@@ -93,6 +93,7 @@ out/%.o: %.s
out/%.o: %.c
vc -O3 -c $< -o $@
-@vc -O3 -S $< -o out/$*.s > /dev/null 2> /dev/null
-@vc -O0 -S $< -o out/$*-noopt.s > /dev/null 2> /dev/null
out/main.bin: out/main.o $(OBJS)
@#-T ../link.script