Using Commodore 64 BASIC SYS Parameters in Machine Language

  Рет қаралды 12,618

8-Bit Show And Tell

8-Bit Show And Tell

Күн бұрын

Пікірлер: 60
@RetroGameCoders
@RetroGameCoders 3 жыл бұрын
Always a good day when Robin breaks out the assembler :D
@AnnatarTheMaia
@AnnatarTheMaia 3 жыл бұрын
Always.
@cybermodo
@cybermodo Жыл бұрын
I keep in mind this SYS parameters thing for decades, it was actually published in some computer magazine article back in the 80's. And I keep returning to it when I roll some C64 ideas in my head. However, I always think about the next step - and that would be easing these things for existing basic v2 COMPILERS! But unfortunately I believe this elegant trick won't cut it for a compiled code. So it might be better to stick to some workarounds, poking parameters to some dedicated set of memory locations (doing so before SYS command), and have machine routines pick them from there, or write back into them. Basic V2 really miss PTR function - providing working with pointers to variables. That thing is powerful, and even more so if compiler supports it properly. Providing access to variables from machine code, both in interpreting or compiled code.
@mikeloewen612
@mikeloewen612 3 ай бұрын
You know what? I know how to do just about everything you can, Robin, yet I find myself constantly watching your content. Must be a very reasonable explanation for this.
@G.B...
@G.B... 3 жыл бұрын
Very educative. I never thought of using SYS for that purpose. Normally I used to extend Basic with my own commands (the easiest and fastest way is by adding a special character in the beginning of all new commands, like "!"), then each new command had its own code to read command parameter, if any. In the end, I could type, e.g., !PLOT X,Y,C. This video actually shows a faster way to extend Basic , and without even making it harder to read, e.g. PLOT=828, then SYS PLOT,X,Y,C.
@talideon
@talideon 3 жыл бұрын
Oh, this explains a lot! I spent years (actually technically decades) thinking SYS only took a single 8-bit number. I can't recall it being used with anything else that I pulled apart when I was tearing apart type-ins.
@alexandermaasland3494
@alexandermaasland3494 3 жыл бұрын
Thanks for the explanation Robin!, I am feeling an itch to do something with my breadbin once more :)
@sammy61187
@sammy61187 3 жыл бұрын
Watched your podcast so glad to put a face to the voice not what i was expecting honestly thought you were a middle aged dude but your a beastly bearded legend!!!
@BitcoinmeetupsOrg123
@BitcoinmeetupsOrg123 3 жыл бұрын
The initial shock when anyone sees the face behind the voice for the first time : )
@MS-ho9wq
@MS-ho9wq 3 жыл бұрын
Hey Robin, you're my favorite C64 KZbinr, I love you, man, keep it up always
@StevenWalter
@StevenWalter 3 жыл бұрын
You can shave off a few cycles if you replace "dec len+1" with "dex" after "decrement length remaining." You already loaded len+1 into X before the loop. I believe that will save 4 cycles per page of memory.
@TheXJ12
@TheXJ12 2 жыл бұрын
and the "ldy #0" could be done after the "beq remain" test
@GrowlyBear917
@GrowlyBear917 3 жыл бұрын
I think the C128 had a native routine that allowed SYS to have parameters. Could you explain the 128's routine, and is it similar to what is happening in this example of code?
@wayneandrews1738
@wayneandrews1738 11 ай бұрын
This opens up new possibilities Robin. Great use of the sys command. Copying ram to a different location is one possibility. Now, if I could do a bsave on the C64 like the 128 has, to save memory to disk would be great. Something like: sys 828,"screen dump",8,1024,2023 to disk would be useful.
@theannoyedmrfloyd3998
@theannoyedmrfloyd3998 3 жыл бұрын
Atari BASIC also has a way to call machine language from inside a BASIC program. The address of the string can be inside the call itself or stored somewhere in RAM like Page 6. It looks like this: X=USR(1536, 100, 20, 3000, PLR1, MEMTOP-10) Well, it can look like that when passing parameters. There can be up to 255! And generally the value returned doesn't matter, but I used it in my Push It! conversion of Sokoban when it counted the number of boxes in the final position. USR is very handy.
@8_Bit
@8_Bit 3 жыл бұрын
Looks very useful. Commodore BASIC has USR() as well, but only accepts one parameter (though maybe it can be extended in the same way as SYS) and annoyingly needs a couple POKEs to point the USR function to the 16-bit address of the machine language routine. If you want to call a different machine language routine with USR, you need to POKE a new address again. So USR() usually gets ignored in favour of SYS on Commodore machines.
@christiancarassai9540
@christiancarassai9540 3 жыл бұрын
Today, 99% of people with 12gb ram and i9, do a lot less things than you with a C64!!! Always amazing
@klif_n
@klif_n Жыл бұрын
This is just awesome. I recently installed the VICE emulator and started playing around with C64 programming. Back in my college days I had an Apple II+ and of course was looking for all that graphics stuff in the C64. It's a might more complicated, but it's all just for fun so that's ok. I was a bit of an Apple snob at the time (since I had one), but I'm realizing that I sort of missed out on a whole world of fun with the C64. Keep an open mind :). Anyway, I was messing with the bit mapped mode and was thinking about writing a screen clear function... and wouldn't you know.. there it is all nicely written up for me to learn from. Thank you so much for all the wonderful C64 videos. You are making me a believer.
@merman1974
@merman1974 3 жыл бұрын
Enjoyed that, geeky but well explained. It made sense of a few things I have used other the years, including Mr. Mouse from Loadstar (which relied on SYS calls from BASIC).
@Shmbler
@Shmbler 3 жыл бұрын
Thats a very neat way to do it. Looks like Sid Meier didn't know about it, too ;-) The memcpy/memset routines in Pirates! 64ksupport.prg get their args from POKEs to cassette/serial bus registers at $A3+. That also applies to all machine language routines for the "window handling" in this game. It is basically always a combo of POKEs with a bare SYS... there.
@FadkinsDiet
@FadkinsDiet 10 ай бұрын
SYS does load some memory locations into the a, x, and y registers-- is that what's happening?
@quantass
@quantass 3 жыл бұрын
ASK ROBIN ~ I recommend an episode on a C64 "cracking group"-like Intro coding session. When growing up I would see your typical ☠ Cracktro ☠: x smooth scrolling text -- usually running along a wave-like path x text gradually fading in and out x an animating shiny glimmer at random spots on the text during the scrolling ?? Could you show us how this is coded in Assembly, and as a challenge, how close you can get using only C= BASIC ??
@BitcoinmeetupsOrg123
@BitcoinmeetupsOrg123 3 жыл бұрын
I second this. This is what I would have wanted to know when I was 10 years old.
@thadoctorreturns2999
@thadoctorreturns2999 10 ай бұрын
Alot of BBS software uses parameter-passing to the ML components. That was one thing I always struggled with while modding.
@DenizTurkmen
@DenizTurkmen 3 жыл бұрын
I had 2 tape turbos that can be called by SYS708
@radman999
@radman999 3 жыл бұрын
Didn't know you had a podcast! I subscribed. 😀
@Barldon
@Barldon 3 жыл бұрын
On the topic of assemblers, I would love to see a video on how to go about, and the logic behind, loading an assembly program from basic (to allow the user to run it without knowing the memory address). I assume you have used this technique in your previous games? If not, what would the alternative be?
@8_Bit
@8_Bit 3 жыл бұрын
Hi! Do you mean you'd like to determine the correct address to SYS when loading a program? In most (but not all) programs that's the same as the load address, which I show how to figure out a few different ways in this video: kzbin.info/www/bejne/mGTNZp5np9Gbpdk (if you don't want to watch the whole thing, look at the index for the sections starting with "Finding...". For BASIC code that calculates the load address, check out the "LOAD ADDRESS" program on the Model 1541 Test/Demo Diskette which I mention (but don't examine) at 23:31 in that video.
@Centar1964
@Centar1964 3 жыл бұрын
You should try this in Abacus Fortran...it is what BASIC was based on...you can add your own intrinsic or external functions and libraries to it easy (in Fortran) and it compiles to M/L code...it has the EXEC function (same as SYS but passes register values with it) and commands for PEEK and POKE (MEM)...I'd like to get or write libraries for graphics, sound, and disk functions. Oh and gives 50k space for programs. Have sorta started on such...
@AndyHewco
@AndyHewco 3 жыл бұрын
Great video Robin.
@poorman-trending
@poorman-trending 3 жыл бұрын
Can you do a deep dive into using the SS Pro v5?
@huntabadday2663
@huntabadday2663 3 жыл бұрын
You should make a video on opening files and accessing devices in assembly
@superx9619
@superx9619 3 жыл бұрын
I'd like too see more Growing up 80s material of reviewing and playing games.
@VulpisFoxfire
@VulpisFoxfire 3 жыл бұрын
So the next step from this is to instead of wedging this into the routine that processes the SYS command, create your own custom tokens so you can have things like a 'FILL' command?
@GeoffSeeley
@GeoffSeeley 3 жыл бұрын
Quack quack!
@chromosundrift
@chromosundrift 3 жыл бұрын
So skipcomma etc. read and update a pointer to the current token of the basic execution?
@diegochazan1125
@diegochazan1125 3 жыл бұрын
Hi, a while ago you made a video about IRQ-Driver SID Playback using Machine Language ... I have been experimenting with this but I haven't been able to fade out the sid volumen, even though it has a volume control that theoretically goes from 0 to 15. But I have seen in many demos that they fade out the sound and I was wondering how they did it. cheers
@8_Bit
@8_Bit 3 жыл бұрын
Yes, it should be possible by gradually going from 15 to 0 in the volume register ($D418). It's possible the music player updates $D418 every time it's called, which would likely prevent the fading from working. I'd suggest right after you make the call to the music player, then update the volume register right afterwards.
@AnnatarTheMaia
@AnnatarTheMaia 3 жыл бұрын
Still no version of Turbo Macro Pro running from ROM, then? Is that even being worked on by Style?
@dannyepstein
@dannyepstein Жыл бұрын
I think you could use "BIT len+1" rather than "LDX len+1" since you're only trying to set the Z status bit. This wouldn't make it any faster, but it'd be a bit clearer.
@standupmackan
@standupmackan 3 жыл бұрын
Really cool! Thank you!
@BitcoinmeetupsOrg123
@BitcoinmeetupsOrg123 3 жыл бұрын
Front end programmers: -He's a wizard.
@JohnDoe-tn3tx
@JohnDoe-tn3tx 3 жыл бұрын
I wish i had KZbin back in 1990 lol...
@D3cker1
@D3cker1 3 жыл бұрын
Drones .. .DEACTIVATED.
@PaulHockerOnEarth
@PaulHockerOnEarth 3 жыл бұрын
Great vid.
@michaelbarry8005
@michaelbarry8005 3 жыл бұрын
I apologize to Robin (and anyone else who might have briefly seen it) for a comment I just deleted that addressed a non-existent "bug". It's way past my bedtime ...
@rev.davemoorman3883
@rev.davemoorman3883 3 жыл бұрын
Now add a Jump table, and you have a real tool box!
@BojarskyLeGrand
@BojarskyLeGrand 3 жыл бұрын
Is it possible to use only zeros and ones to code something? Did someone try to write a code using only zeros and ones?
@8_Bit
@8_Bit 3 жыл бұрын
It's not really possible on the C64 to only use zeros and ones unless someone deliberately wrote a program (maybe on a cartridge) to deliberately "downgrade" the C64 that much. But on earlier computers, like the Altair 8800, those were literally programmed with zeros and ones unless you paid a lot of money for upgrades like a keyboard!
@ColinLeyUK
@ColinLeyUK 3 жыл бұрын
Sys64738 always remember this
RAM Scan 64 - Early 1980s Glitch Art Code?
28:52
8-Bit Show And Tell
Рет қаралды 20 М.
Machine Language 10 PRINT Size-Optimized for Commodore 64
27:41
8-Bit Show And Tell
Рет қаралды 32 М.
The Singing Challenge #joker #Harriet Quinn
00:35
佐助与鸣人
Рет қаралды 42 МЛН
What type of pedestrian are you?😄 #tiktok #elsarca
00:28
Elsa Arca
Рет қаралды 31 МЛН
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 11 МЛН
Running MSBASIC on my breadboard 6502 computer
36:53
Ben Eater
Рет қаралды 227 М.
C64 Joystick-Controlled Sprites in Assembly and BASIC
33:46
8-Bit Show And Tell
Рет қаралды 44 М.
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 403 М.
8-Bit Book Club: Mapping the Commodore 64
45:34
8-Bit Show And Tell
Рет қаралды 22 М.
WAITing for BASIC on the Commodore 64
31:42
8-Bit Show And Tell
Рет қаралды 23 М.
Maybe the BEST C64 Demo I have yet seen !
16:44
gazzaka
Рет қаралды 105 М.
The Rise of Unix. The Seeds of its Fall.
16:51
Asianometry
Рет қаралды 500 М.
Printing Binary in BASIC and Assembly on Commodore 64
39:08
8-Bit Show And Tell
Рет қаралды 22 М.
The Singing Challenge #joker #Harriet Quinn
00:35
佐助与鸣人
Рет қаралды 42 МЛН