3 ms·
If you're referring to the code that's loaded into memory location $00 and run when the simulator starts up: it doesn't look like it's anything particularly int
by NobodyNada 7y ago
If you're referring to the code that's loaded into memory location $00 and run when the simulator starts up: it doesn't look like it's anything particularly interesting, just a simple loop to exercise the simulator:
LDA #$00 ; A=0
loop:
JSR sub ; call subroutine
JMP loop ; infinite loop
sub:
INX ; increment X register
DEY ; decrement Y register
INC $0F ; increment memory location $0F
SEC ; set carry flag
ADC #$02 ; A += 3 (add 2, with carry)
RTS ; return from subroutine
- saagarjha 7y agoYeah, it didn't look like it was doing anything useful so I was curious if it was a reference to something…
- NobodyNada 7y agoI very much doubt it's a reference to anything. It doesn't appear to have a useful purpose besides demonstrating/exercising a few of the important components of the processor: it performs operations using the registers, the stack (JSR/RTS), memory (INC), and the ALU (ADC). A quick search through GitHub shows that this code is unchanged since the initial commit of the original Visual6502: https://github.com/trebonian/visual6502/blob/4d8da5b680216dcbe5705ecb831821cd6b81e479/macros.js#L2 https://github.com/trebonian/visual6502/blob/4d8da5b680216dc...
- flohofwoe 7y agoI just took the original testing code from http://visual6502.org/JSSim/index.html http://visual6502.org/JSSim/index.html, also to confirm whether the simulation and visualization works. I don't think it has any significance except testing a few things like memory read/write access, whether the stack works etc...