Hi!
I was searching commented ROM/RAM disassemply/map for:
- value for A, X, Y register for SYS command - success - found
- value SP for SYS command - success - found
- SYS routine address - success found
- LO and HI byte for use with SYS command as address - never found
Like we know SYS command can be performed with preloaded register values and even preform in ML code using LO and HI byte.
So, Q is: Where are in RAM located LO and HI bytes for address on VIC20 computer?
For complete found info:
C128
-----
0005 SR value for SYS
0006 A reg. value for SYS
0007 X reg. value for SYS
0008 Y reg. value for SYS
0009 SP value for SYS
0002 Bank value for SYS
0003 LO-byte SYS address
0004 HI-byte SYS address
22661 / $5885 SYS
C64
----
780 $030C A value for SYS
781 $030D X value for SYS
782 $030E Y value for SYS
783 $030F SP value for SYS
20 $0014 LO-byte SYS address
21 $0015 HI-byte SYS address
57642 $E12A SYS
VIC20
-----
780 $030C A value for SYS
781 $030D X value for SYS
782 $030E Y value for SYS
783 $030F SR value for SYS
57639 $E127 SYS
C16+4
-----
2034 $07F2 A value for SYS
2035 $07F3 X value for SYS
2036 $07F4 Y value for SYS
2037 $07F5 SR value for SYS
Thank you for help.
Miro
Values for SYS command and use/call in ML code
Moderator: Moderators
-
- Vic 20 Newbie
- Posts: 12
- Joined: Fri Oct 28, 2016 8:21 pm
- Website: http://www.mirkosoft.sk
- Location: Slovakia
- Mike
- Herr VC
- Posts: 4841
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Values for SYS command and use/call in ML code
The C64 uses essentially the same BASIC V2 as the VIC-20, and thus the target address for SYS is also stored in $14/$15 before performing the jump into the pointed to machine code. You find that indirect JMP at address $E141, see here: "registers $030c-$030e".
I see you're coming from the C128, and there, with JSR JSRFAR a lot more setup is necessary to do inter-bank subroutine calls. The C64 and VIC-20 do not have different RAM banks, and the VIC-20 doesn't even have any layered memory structure (no RAM 'under' ROM), so a simple JSR is all that's needed in 99%+ of all cases.
This is a typo/wrong: 783 contains the status register SR (or P), not the stack pointer SP (or S) - again same for both VIC-20 and C64.MIRKOSOFT wrote:C64
----
[...]
783 $030F SP value for SYS
[...]
Why would you want to do this? All registers A, X, Y, S and P are already 'there' without any need to store them to memory and a simple JSR $xxxx suffices to call a subroutine at a fixed address within machine code and of course again return with RTS, with current register values.Like we know SYS command can be performed with preloaded register values and even preform in ML code using LO and HI byte.
I see you're coming from the C128, and there, with JSR JSRFAR a lot more setup is necessary to do inter-bank subroutine calls. The C64 and VIC-20 do not have different RAM banks, and the VIC-20 doesn't even have any layered memory structure (no RAM 'under' ROM), so a simple JSR is all that's needed in 99%+ of all cases.
-
- Vic 20 Newbie
- Posts: 12
- Joined: Fri Oct 28, 2016 8:21 pm
- Website: http://www.mirkosoft.sk
- Location: Slovakia
Re: Values for SYS command and use/call in ML code
Ok, thank you very much!
My last Q is to banks...
I'm not writing for C128 bankswitching.
C64 allows to use also space normally under ROM $A000-$BFFF and $E000-$FFFF turn off and use it like RAM.
Difference is to VIC20 that C64 has 6510 CPU.
VIC20 uses 6502 CPU and I don't know if it allows anything similar...
Simply - is possible the space under ROM by any way use like RAM?
If, how to do it?
Thank you very much!
Miro
My last Q is to banks...
I'm not writing for C128 bankswitching.
C64 allows to use also space normally under ROM $A000-$BFFF and $E000-$FFFF turn off and use it like RAM.
Difference is to VIC20 that C64 has 6510 CPU.
VIC20 uses 6502 CPU and I don't know if it allows anything similar...
Simply - is possible the space under ROM by any way use like RAM?
If, how to do it?
Thank you very much!
Miro
Re: Values for SYS command and use/call in ML code
No, there is no equivalent on the VIC-20, the memory blocks are fixed.
- Mike
- Herr VC
- Posts: 4841
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: Values for SYS command and use/call in ML code
I already answered this in my post before:MIRKOSOFT wrote:Simply - is possible the space under ROM by any way use like RAM?
Mike wrote:[...] the VIC-20 doesn't even have any layered memory structure (no RAM 'under' ROM), [...]
Simply put, you don't.If, how to do it?
BTW, on the C64 it is not the CPU responsible for the selection between RAM, ROM, I/O and character set in the given address ranges. The CPU port of the 6510 merely provides the /LORAM, /HIRAM and /CHAREN signals for the PLA, and it is the PLA which does the main workload of address decoding!