Jump to content

JimmyDansbo

Members
  • Posts

    286
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by JimmyDansbo

  1. Yes, that is also possible however it requires that you set the carry flag before calling it to get it to return the actual coordinates. Something like this one-liner should work Address 780-783 are the CPU registers and flags just as the Commodore 64, see https://www.c64-wiki.com/wiki/SYS $FFF0 is the kernal PLOT routine, see https://cx16.dk/c64-kernal-routines/plot.html You do not have to switch ROM as the BASIC ROM does indeed have stubs to forward calls to the Kernal ROM just as @Scott Robison mentioned. Above line will of course use more CPU cycles than a simple peek of a memory address, but you should be fairly certain that the addresses do not change.
  2. A lot have moved around in the X16 kernal, but you are on the right track. A quick search of tblx in the .sym files of R38 shows that $0383 should indeed be the location of tblx and when trying it out, it works just fine and returns the current line of the cursor.
  3. As the X16 kernal is based off of the C64 kernal, it might be an idea to look at the big-brother for how they handled banking. Instead of an FSYS command, maybe we should implement something similar to the BANK command from BASIC 7 https://www.c64-wiki.com/wiki/BANK According to the C128 programmers reference https://www.pagetable.com/docs/Commodore 128 Programmer's Reference Guide.pdf (page 28 / 38), SYS, PEEK, POKE and WAIT will then use the selected bank.
  4. As far as I know, there is no easy way of clearing a line on the screen. You could use PETSCII codes https://cx16.dk/cx16-petscii/ ($11,$1D,$91,$9D) to move the cursor to the correct line and then just print a line of spaces.
  5. 59903 = $E9FF Looking at https://www.pagetable.com/c64ref/c64disasm/ I found that address to be the start of a function called CLRLN (Clear Line). Then I looked through the X16 source code to find the CLRLN function, but it does not exist instead I found the screen_clear_line function and looking at the .sym files I found the entry address of $C88E Unfortunately BASIC lives in ROM bank 4 and the screen_clear_line function is in ROM bank 0 so it is not possible to call it directly without switching banks. I tried switching banks in BASIC by poking the VIA, but as soon as the bank is switched, BASIC is no longer able to run and the emulator hangs (of course). I have written a small program that actually calls the screen_clear_line functions and ensures that the ROM banks selection is correct, but it might be just as easy to just clear the line through ordinary BASIC code. Line 10 is actually a small machine language program that sets the ROM bank to 0, calls the screen_clear_line function and sets the ROM bank back to 4 before returning. Line 20 Writes the machine language program to RAM address $400 (golden RAM) Line 30 Sets the line that should be cleared and calls the machine language function. This is the disassembly of the machine language program in line 10: Note that when R39 of the ROM is released, this code will no longer work as the bank switching is moved down to zero-page.
  6. DB will definitely work for !BYTE, but ACME tries to ensure that things that are defined as !PET or !SCR gets put into memory in such a way that characters typed in the source is the same when assembled and run on the target computer. You can you use DB instead of !PET and !SCR, but then you will need to ensure that correct conversion of characters is done. Your assembler may have other ways of storing strings.
  7. !BYTE, !PET & !SCR looks to me like they are pseudo opcodes used by the ACME assembler. You would have to look up the equivalent codes for the assembler you are using for the Z80. There is no way of directly translating CPY and CPX to Z80 assembly, but the Z80 has its own compare instructions: http://z80-heaven.wikidot.com/instructions-set:cp disclaimer: I am by no means fluent in Z80 assembly and had to look up the CP instruction before I could write this reply.
  8. To switch bank, you just insert the bank number before the memory address, so to see address A000 in bank 4 you do Same thing works for the code view, which is helpful if you want to step through kernal calls
  9. A while back, my brother told me that he would like to create a program for the Commander X16 that would be able to convert a program/game written for the Commodore 64 to make it run on the Commander X16. Preferably, it would do the conversion on the fly, but a conversion from file to file was not out of the question. I told him that it would be close to impossible to create such a program as it would mean that he would need 100% understanding of the inner workings of the C64 and be able to figure every demo-scene programmers tricks out in his own program. Our conversation ended there, but I have been thinking about this ever since and now I have written a short guide (mostly to convince my self that it can not be done) on how one could go ahead and do it. Have a look at https://techblog.dansbo.dk/?p=366 What do you guys think, would it be possible to create a program that can convert almost any C64 program to Commander X16?
    Nice little game. I like the story and find my self wishing for more puzzles to get more of the story.
  10. https://cx16.dk/syms/ Let me know when you have them, I will take them down again.
  11. You can use PETSCII codes to set both background and foreground color. Something like this: You can find a table of the PETSCII codes here: https://cx16.dk/cx16-petscii/ If you are writing directly to VERA memory, you need to remember that in default text modes, each character on screen uses 2 bytes of VRAM. The first byte contains the screencode of the character and the second byte contains the bacground- and foreground color. So you write to VRAM like this: You can find a table of screencodes and VERA standard colors here: https://cx16.dk/veratext/verachars/ When you use VPOKE to write to VRAM, you have to calculate the addresses your self, but it is fairly easy. Your X coordinate should always be doubled as each character on screen takes up 2 bytes. This is why I have (10*2) on line 30 and 40 above to make the @ sign appear at X=10. Each line takes up 256 bytes of VRAM even though only 80 (or 40) characters are visible so in order to calculated your Y coordinate you simply multiply it by 256. The final calculation is: The color information is most easily given in hexadecimal as that means that the first digit (upper nibble) is the background color and the second digit (lower nibble) is the foreground color. For more information on VPOKE, have a look at the manual: https://github.com/commanderx16/x16-docs/blob/master/Commander X16 Programmer's Reference Guide.md#vpoke
  12. Seems to be straight forward (said the blind mand) Thanks. I will look into it.
  13. It is not something I had thought about, but since you ask, I might look into it. Would you be able to point me in a direction that explains what should be done to create a C API? I am guessing you are talking about cc65?
  14. ... also links to the PiModem page
  15. I would be very interested. Please be sure to advertise it ahead of time and record the live-stream for future reference.
  16. I actually had to copy the i686-w64-mingw32 directory to /opt/local/ Even when I provided a different path to WIN_SDL2, it still tried to find the files in /opt/local/i686-w64-mingw32 Thanks for your help
  17. Hi Nadia and welcome If the X16 is indeed going to be your first ever coding experience, I suggest that you start out with BASIC and work your way up. As the Commander X16 is using the same BASICv2 as the Commodore 64, there are plenty of resources online to help you get startet. I suggest starting here: https://www.c64-wiki.com/wiki/BASIC and specifically the list of commands https://www.c64-wiki.com/wiki/BASIC#Overview_of_BASIC_Version_2.0_.28second_release.29_Commands When you want to go X16 specific, the Commander X16 Programmers Reference Guide is an excellent resource and of course the VERA Programmers Reference when you want to get very graphics specific. @DusanStrakl has some very nice tutorials on both BASIC and assembler programming for the Commander X16 here: https://www.8bitcoding.com/p/commander-x16.html If/when you want to start doing assembler, @SlithyMatt is creating great content on Youtube: https://www.youtube.com/user/slithymatt/playlists There are probably other good resources that I have forgotten or have not yet found, but generally I find this forum to be very friendly and helpful so go ahead and ask away if you have any questions. Happy coding
  18. I see no reason why we could not use #2. If we have to use something different, I was thinking that we might as well choose something that is recognizable from other platforms such as the PC, like $3F8. Only after I submitted my answer, I realized that we probably only have a single byte for the ID.
  19. I am mostly using 2.7.2.255 that can be found here: https://sourceforge.net/projects/circuit/files/2.7.x/2.7.x Development/ So far I have had no issues with it.
  20. I have been using Logisim for a couple of years now. I have also tried Digital and other's, but still like Logisim best. Would love to see a modern (read no-java-based) port of Logisim that has the same functionality.
  21. It seems to me like you are mixing your variables? Your DATA statement includes numbers, but your READ statement reads them as strings. Code should be: 10 DATA $1000, $FF 20 READ A, D 30 POKE A, D 40 PRINT A,D
  22. Unfortunately not in the manual yet, but DATA$ and DA$ are definately built into the KERNAL as string representations of current date. https://github.com/commanderx16/x16-rom/commit/f01870d7cf11b34c8cc372d5d04b571bf2574d54 Just tested it in the emulator: As you can see, when the DA$ has been set, it will be updated by the kernal.
×
×
  • Create New...

Important Information

Please review our Terms of Use