I am not sure what I am doing wrong here. Below is my timer.s code. It just increments a 32bit unsigned little endian int while waiting for a key press. My c code: extern unsigned long count; extern unsigned char key; I can read "key", but I always get 0 for count. If I change long count to char count[4], then I can read each byte. I need to be able to say count = 0 and have all four bytes set to 0, and when reading count get a number from 0 to 2^32-1. Thanks. timer.s: .export _timer .export _count .export _key KBDCR = $D011 KBDDATA = $D010 _count: .byte 0,0,0,0 _key: .byte 0 _timer: LDA KBDCR ; cycles 4 got key? BMI DONE ; cycles 2 if neg, got key goto DONE CLC ; cycles 2 clear carry LDA #1 ; cycles 2 A = 1 ADC _count ; cycles 4 LSB += A STA _count ; cycles 4 LDA #0 ; cycles 2 A = 0 ROL A ; cycles 2 A = carry, carry = 0 ADC _count+1 ; cycles 4 STA _count+1 ; cycles 4 LDA #0 ; cycles 2 A = 0 ROL A ; cycles 2 A = carry, carry = 0 ADC _count+2 ; cycles 4 STA _count+2 ; cycles 4 LDA #0 ; cycles 2 A = 0 ROL A ; cycles 2 A = carry, carry = 0 ADC _count+3 ; cycles 4 STA _count+3 ; cycles 4 CLC ; cycles 2 clear carry BCC _timer ; cycles 2 + 1 back to checking for key ; total = 59 DONE: LDA KBDDATA ; get key value STA _key ; store in _key RTS ---------------------------------------------------------------------- To unsubscribe from the list send mail to majordomo@musoftware.de with the string "unsubscribe cc65" in the body(!) of the mail.Received on Wed Nov 23 01:57:21 2011
This archive was generated by hypermail 2.1.8 : 2011-11-23 01:57:24 CET