u/FinancialShow7176

Bonjour tout le monde, je commence à utiliser un processeur W65C816S et je voudrais essayer de faire des petits programme pour commencer à comprendre la programmation en langage machine / assembleur.

Voici le programme que j'ai actuellement :

rom[0] = 0xD8 # CLD

rom[1] = 0x18 # CLC

rom[2] = 0xAD # LDA $83E8

rom[3] = 0xE8

rom[4] = 0x83

rom[5] = 0x69 # ADC #05

rom[6] = 0x05

rom[7] = 0x8D # STA $8400

rom[8] = 0x00

rom[9] = 0x84

rom[1000] = 0x2D

rom[0x7FFC] = 0x00

rom[0x7FFD] = 0x80

Le problème ici est que sur la partie STA, la CPU écris 0x22 vers la mémoire alors que le résultat devrait être 0x32.

Si je retire la partie avec ADC, la valeure écrite est bien 0x2D (valeur lue à l'adresse 83E8).

Je suppose qu'il ne manque pas grand chose mais je n'arrive pas a trouver ou est mon erreur

Voici ce que je lis sur les deux bus avec une clock à 1Hz à partir de l'initialisation avec en premier l'adresse du bus, en second Lecture ou écriture et en troisème position la valeur du bus de data :

fffc R 00

fffd R 80

8000 R d8

8001 R 18

8001 R 18

8002 R ad

8002 R ad

8003 R e8

8004 R 83

83e8 R 2d

8005 R 69

8006 R 05

8007 R 8d

8008 R 00

8009 R 84

8400 W 22

Je vous remercie d'avance pour le temps passé à lire ceci

reddit.com
u/FinancialShow7176 — 5 days ago

Problem using the ADC with a W65C816S CPU

Hello everyone, I’m just starting to use a W65C816S processor and I’d like to try writing some simple programs to begin understanding programming in machine language/assembly.

Here is the program I currently have:

rom[0] = 0xD8 # CLD

rom[1] = 0x18 # CLC

rom[2] = 0xAD # LDA $83E8

rom[3] = 0xE8

rom[4] = 0x83

rom[5] = 0x69 # ADC #05

rom[6] = 0x05

rom[7] = 0x8D # STA $8400

rom[8] = 0x00

rom[9] = 0x84

rom[1000] = 0x2D

rom[0x7FFC] = 0x00

rom[0x7FFD] = 0x80

The problem here is that in the STA section, the CPU writes 0x22 to memory when the result should be 0x32.

If I remove the section with the ADC, the value written is indeed 0x2D (value read at address 83E8).

I suppose I’m not far off, but I can’t seem to find where my mistake is.

Here is what I read on the two buses at a 1Hz clock rate from initialisation, with the bus address first, read or write second, and the data bus value third:

fffc R 00

fffd R 80

8000 R d8

8001 R 18

8001 R 18

8002 R ad

8002 R ad

8003 R e8

8004 R 83

83e8 R 2d

8005 R 69

8006 R 05

8007 R 8d

8008 R 00

8009 R 84

8400 W 22

Thank you in advance for taking the time to read this

reddit.com
u/FinancialShow7176 — 5 days ago