gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

ASM > using Linkcable in Goldroad ASM

#5615 - f00l - Sat May 03, 2003 12:46 pm

Hi ,

I'm just a newbie trying to use the linkcable in goldroad ASM,
this is what I have so far :




This is what I want to do :

Recommended Communication Procedure for MASTER unit (internal clock)
- Initialize data which is to be sent to slave (placed in REG_SCCNT_H for 8-bit mode or REG_SCD0 for 32-bit mode)
- Wait for SI to become LOW (slave ready). (Check timeout here!)
- Set Start flag.
- Wait for IRQ (or for Start bit to become zero).
- Process received data (received in REG_SCCNT_H for 8-bit mode or REG_SCD0 for 32-bit mode)



And this is my code, can somebody tell me if it works and if not, how I can get it to work...




ldr r2,=0x40012A ; REG_SCCNT_H
ldr r1,=0xFF

strb r1,[r2]

ldr r3,=0x4000128 ; REG_SCCNT_L
ldr r0,=0x00

SUBS r3,r0 ; Wait until r3 is 0
ldrbZ r3,[r2] ; and then read it...




Thanks
_________________
woei!

#6964 - Ampersand - Thu Jun 05, 2003 12:49 pm

Hi,

I think this might be what you've ment to do... no guarantee's I'm right...

Ampersand

----------------------------------------------------------------------------X
ldr r2,=0x40012A ; REG_SCCNT_H

;prepare
mov r0,#3 ; set coutdown number

loop:
subS r0,r0,#1 ; sub r0 with 1 store in r0 and set flag
bne loop ; while r3 is not zero repeat countdown

;Continue to do something
ldrb rX,[rX] ; Do what ever u want... to do.

infinity
b infinity
_________________
www.iome.nl

#7000 - MrMr[iCE] - Thu Jun 05, 2003 10:57 pm

I think you left out a zero in the REG_SCCNT line:

ldr r2,=0x40012A ; REG_SCCNT_H

should be

ldr r2, =0x400012A ;REG_SCCNT_H
_________________
Does the corpse have a familiar face?

#7856 - f00l - Thu Jun 26, 2003 6:55 pm

hehe.. here's the new asm source.. at the moment I can't test it, but does anybody know if it's okay ? :

ldr r2,=0x400012A ; REG_SCCNT_H
ldr r1,=0xFF ; data to be send (255,test number)

strb r1,[r2] ; write r1 to r2


ldr r3,=0x4000128 ; REG_SCCNT_L
mov r0,#3 ; set coutdown number


loop: ; start loop

subS r0,r0,#1 ; sub r0 with 1 store in r0 and set flag
bne loop ; while r3 is not zero repeat countdown

ldrbZ r3,[r2] ; and then read it...

infinity ; main loop
b infinity ; end main loop
_________________
woei!