Jump to content

twh/f2's Photo

twh/f2

Member Since 28 Sep 2002
OFFLINE Last Active Nov 19 2017 12:10 PM

Topics I've Started

Atarisation by XLent

Mon Oct 16, 2017 1:55 PM

can please somebody tell me where these "Atarisations by XLent" can be found for download?

 

 

 

 

 


CC65 and "incbin"

Thu Mar 16, 2017 3:11 PM

Hi everbody,

 

is somebody having an example how gfx/sound data can be included into a CC65 project?

For instance I would have an  RMT file and some DAT files for PMG gfx data. In Assembler I would use ".incbin" and the "org" directive. Both directives are for good reason not available in the C-source file.

 

I think I would have to define some CC65 linker-configurations. But I can't find a good example for this. I'm not even sure if I still could use CL65?

 

any hint welcome,

thanks


wait <n> seconds in ASM

Mon Mar 13, 2017 2:51 PM

Hi *,

 

what's a decent way to program a "wait <n> seconds" routine in assembler?

I guess it would be to count frames (like in the pattern 1/50 per frame. ($12,$13,$14) which the OS is doing during VBI)

 

But let's say I have a PAL system or a NTSC system. How would I really know what e.g. "1 second" is?

    lda #0
    sta $14	
r1
    lda $14
    cmp #60
    bne r1


help me bug fix 32bit multiplication

Thu Feb 2, 2017 9:38 AM

Hi !

 

I have here a 32bit multiplication routine which is simply adapted from this code from the Codebase64.

 

http://codebase64.or..._32-bit_product

 

The following code was adapted by FJC. 

Num1	.ds 4
Num2	.ds 4
Num3	.ds 8

​.proc MulLong ; 32 bit multiplication: Num1 by Num2, result in Num3
	lda #0
	sta Num3+4
	sta Num3+5
	sta Num3+6
	sta Num3+7
	ldx #32 ; loop for each bit
multloop
	lsr Num1+3 ; divide multiplier by 2
	lsr Num1+2
	lsr Num1+1
	ror Num1
	bcc rotate
	lda Num3+4 ; get upper half of product and add multiplicand
	clc
	adc Num2
	sta Num3+4
	lda Num3+5
	adc Num2+1
	sta Num3+5
	lda Num3+6
	adc Num2+2
	sta Num3+6
	lda Num3+7
	adc Num2+3
rotate
	ror ; rotate partial product 
	sta Num3+7
	ror Num3+6
	ror Num3+5
	ror Num3+4
	ror Num3+3
	ror Num3+2
	ror Num3+1
	ror Num3
	dex
	bne multloop
	lda Num3
	ldx Num3+1
	rts
.endp

 
But I'm afraid it has a bug which I can't really fix. The following shows the dilemma:  $4 * $16b62 = $5ad88
	mda #$16b62 Num1
	mda #$4 Num2
	jsr MulLong
	mda Num3 Temp	; save result

	jmp *

It's producing: "$1AD88" rather than "$5AD88".

 

However this one works:  $16b62 * $4  = $5ad88

	mda #$4 Num1
	mda #$16b62 Num2
	jsr MulLong
	mda Num3 Temp	; save result

FJC: It seems that some upper bits of multiplier/multiplicand aren't handled properly (so result is different depending on which has set or cleared upper bits).

 

Any ideas?! Any help is appreciated!!

 

greetings,

\thomas


help with mads macro

Wed Jan 18, 2017 1:51 PM

Hi *,

 

I could need some help with a MADS macro.

 

Similar to macros like "mva" and "mwa" I would like to have a macro for "double words" (32bit). For instance 

 $org 2000

.macro mdwa src,dst
 lda <:src
 sta :dst
 lda >:src
 sta :dst+1
 lda <(:src/65355)
 sta :dst+2
 lda >(:src/65535)
 sta :dst+3
.endm

.struct values
 longvalue .dword
.ends

m values

 mdwa #$12345678,m.longvalue

Unfortunately my attempt does not "compile" . MADS tells me something like "Extra character on line".

It's probably pretty obvious but I'm giving up for now :)