Weird AI

Talk about anything not remotely related to retrocomputing here!
Post Reply
SolarSurfer
Posts: 29
Joined: Sun Nov 26, 2023 2:18 am

Weird AI

Post by SolarSurfer »

I decided to ask "Bing Co-Pilot" for some advice on memory management for the 6502 and it recommended that I can free up unused memory by de-allocating it. Intrigued, I asked how to de-allocate memory on a 6502. It gave me this:

you can use the LDY instruction to load the size of the memory block into the Y register, and then subtract it from the stack pointer using the TSY instruction. Here’s an example:

Code: Select all

LDY #1024 ; Load the size of the memory block
TSY       ; Subtract it from the stack pointer
... at least we don't need to worry about AI taking over any time soon.
Edmond D
Posts: 458
Joined: Thu Aug 19, 2021 1:42 am

Re: Weird AI

Post by Edmond D »

SolarSurfer wrote: Sat Dec 09, 2023 8:35 pm ... at least we don't need to worry about AI taking over any time soon.
The Commander 16 will be AI proof! :lol:
Ed Minchau
Posts: 483
Joined: Sat Jul 11, 2020 3:30 pm

Re: Weird AI

Post by Ed Minchau »

Edmond D wrote: Sat Dec 09, 2023 9:21 pm
SolarSurfer wrote: Sat Dec 09, 2023 8:35 pm ... at least we don't need to worry about AI taking over any time soon.
The Commander 16 will be AI proof! :lol:
Nope, that's coming after I finish the game engine I'm working on.
DragWx
Posts: 306
Joined: Tue Mar 07, 2023 9:07 pm

Re: Weird AI

Post by DragWx »

We've had a few people in the NES/SNES homebrew community try using AI to help them generate assembly code to make a game, and it almost always generates nonsense code.

Like, it knows what 65-family assembly looks like, but it has no idea what a NES or a SNES actually is, so it just assumes there are random features from random 65-family systems (usually c64) at random memory addresses, and assumes that there's always a character set in VRAM ready to go. :P

AI might be a helpful tool for someone who already knows what they're doing and just needs a second pair of eyes, but it won't be capable of helping someone with zero knowledge create a working game from scratch, which is something that people new to and excited for AI don't like hearing after being promised the world.
mortarm
Posts: 228
Joined: Tue May 16, 2023 6:21 pm

Re: Weird AI

Post by mortarm »

Just for fun, I asked ChatGPT the same question, except I used the 65C02:
-------------------------------------------------------------------------------------------
Managing memory efficiently on the 65C02, or any microprocessor for that matter, is crucial for optimal performance. Here are some pointers:

1. **Memory Map Design**: Understand the memory map of the 65C02. This includes the ROM, RAM, I/O devices, and any other memory-mapped peripherals. Design your memory layout intelligently to minimize conflicts and optimize access.

2. **Memory Banking**: If your system requires more memory than the CPU can directly address, consider memory banking techniques. This involves switching different memory banks in and out of the CPU's addressable space to access more memory.

3. **Memory Access Patterns**: Optimize your code to access memory efficiently. Minimize unnecessary reads and writes, and try to access memory in sequential patterns whenever possible to benefit from caching and reduce wait states.

4. **Stack Management**: Properly manage the stack, which is crucial for subroutine calls and managing local variables. Make sure to allocate enough space for the stack and avoid stack overflows.

5. **Memory-Optimized Code**: Write code that's memory efficient. This includes using smaller data types when possible, reusing variables, and optimizing algorithms to minimize memory usage.

6. **Interrupt Handling**: Understand how interrupts work and manage them effectively. Ensure your interrupt service routines are concise and fast, as they can affect the overall performance of your system.

7. **Debugging Tools**: Use tools and emulators that help in debugging memory-related issues. Track memory usage, detect memory leaks, and profile your code to identify areas where memory optimization is needed.

8. **Documentation and Comments**: Document your memory management scheme thoroughly. Clearly document memory layouts, reserved memory regions, and any memory management techniques used in your code. This will help in maintaining and debugging the code in the future.

Remember, memory management for the 65C02, or any processor, is a balance between optimization and readability. Striking a balance between efficient memory usage and code maintainability is key.
-------------------------------------------------------------------------------------------
As you can see the "advice" is much more generalized, but still useful to a degree.
DragWx
Posts: 306
Joined: Tue Mar 07, 2023 9:07 pm

Re: Weird AI

Post by DragWx »

The advice is general because the prompt is general. :P

If you asked about something specific to 65-series processors, like how to decide whether you should put a variable in zeropage or in regular ram, or how an IRQ differs from an NMI, it might provide more detailed advice.

Edit: Or, "is it ok to put program variables in the same page where the 6502 keeps its stack" might be a good one.
SolarSurfer
Posts: 29
Joined: Sun Nov 26, 2023 2:18 am

Re: Weird AI

Post by SolarSurfer »

Just in case AI does progress to Skynet levels, I'm learning 6502 assembly well enough to hack a T800 like John Connor did in T2.

https://www.pagetable.com/?p=64

EDIT: I Just noticed who wrote that article :D
SolarSurfer
Posts: 29
Joined: Sun Nov 26, 2023 2:18 am

Re: Weird AI

Post by SolarSurfer »

I've been struggling with the math library, so I asked Bing AI "How do I use the AYINT subroutine on Commodore C128"

and got this answer:

"The AYINT subroutine is a part of the Commodore 128 Subroutine Library. The AYINT subroutine is used to calculate the interest rate for a loan or an investment, given the principal amount, the number of payments, and the payment amount."

and this one: "The AYINT subroutine is used to initialize the AY-3-8910 sound chip on the Commodore C128 computer."

It makes me wonder, how does AI work? What kills me is how "confidently" it states these things.
Edmond D
Posts: 458
Joined: Thu Aug 19, 2021 1:42 am

Re: Weird AI

Post by Edmond D »

SolarSurfer wrote: Sun Jan 14, 2024 2:11 am It makes me wonder, how does AI work? What kills me is how "confidently" it states these things.
The A for Artificial should say it all. If a human were to lie, they have to be convincing otherwise it doesn't fly. AI doesn't know that it is presenting "alternate" facts, so it tries to be authoritative :-)
User avatar
Daedalus
Posts: 222
Joined: Fri Nov 11, 2022 3:03 am

Re: Weird AI

Post by Daedalus »

I rather expect that the inferred "confidence" of an AI is from the viewer, not the AI. The AI is just reading a script written for it by a collection of info processing algos. It certainly has no more idea what it's talking about than a radio when it converts to sound what is transmitted over the air.
Post Reply