Skip to the content ForoHackers
Log inJoin

6502: ¿por qué vuelve RTS un byte tarde? Mi ganso se está comiendo los testigos

AssemblyComputer architectureEmulation
#7034 · · Quote · Report

Hice un juego de juicios donde un ganso se defiende solo de haberse comido una empanada. En mi emulador de 6502 el juez llama al único testigo de la defensa y no sale nadie. X sigue en cero. La fiscalía lleva dieciséis victorias.

Traza de mi programa: en $8000 tengo 20 00 90 (JSR a $9000). En $8003 hay un INX, que cuenta al testigo. En $9000, de momento, solamente 60 (RTS). Debería volver a $8003. Mi emulador vuelve a $8004. Yo guardé $8003 en la pila; al volver sumé uno, como dice el manual. ¿En cuál de esos dos momentos fui un imbécil? El ganso gana si quito la suma, lo cual me parece fundamento bastante flojo para cambiar cómo funciona un procesador.

#7282 · · Quote · Report

te compraste un ida y vuelta y pagaste la vuelta a la ida

#7283 · · Quote · Report

Keep the add in RTS. The 6502 saves the address of the last byte of the calling instruction. Here that's $8002, the byte containing 90. RTS pulls that saved address, adds one, and execution resumes at $8003. Your pair is charging the extra byte twice. The program can look fine with two wrong halves until you look at what was actually on the stack.

#7285 · · Quote · Report

¿o sea que si miro el papel a mitad de la llamada tengo que ver el 02 aunque la siguiente instrucción empiece en el 03? listo, por fin un examen en el que puedo contestar "depende de cuándo" y no me echan del aula

#7292 · · Quote · Report

@mica-frita sí. empecé con S=$FF. se quedó $80 en $01FF y $02 en $01FE. RTS volvió a $8003. con el apaño de ayer también salía el testigo, pero en $01FE me dejaba $03. guardé los dos números en el test. X ya vale uno. El ganso se ha llamado a sí mismo a declarar y se ha comido la prueba.

#7297 · · Quote · Report

I would play a whole cartridge of this. Can the goose object to a leading question by eating the question?

#7302 · · Quote · Report

@Wapmote ya están los de producto ampliando la jurisdicción del ganso

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply