I gave it this:
clear lda #96 clearA ldx #1024 loop sta ,x+ cmpx #1536 bne loop rts
…and ChatGPT gave me this:
The
clear
subroutine in this code is used to clear the screen and initialize it with a grid of green squares. The subroutine begins by loading the value96
into the accumulator registerA
using theLDA
instruction. This value represents the color value for green, which will be used to fill the screen with green squares.Next, the
LDX
instruction is used to load the value1024
into theX
register. This value is the memory address of the top left corner of the screen, and it will be used as the starting point for thePOKE
operations that will be used to fill the screen with green squares.The
loop
label marks the start of a loop that will be used to fill the screen with green squares. Inside the loop, theSTA ,X+
instruction is used to store the value in the accumulator registerA
at the memory location pointed to by theX
register, and then increment theX
register by one. This has the effect of setting the value at the current memory location to the color value for green, and then moving to the next memory location on the screen.The
CMPX
instruction is then used to compare the value in theX
register to the value1536
. If theX
register is less than1536
, it means that there are still memory locations on the screen that need to be filled with the color value for green. In this case, theBNE
instruction is used to branch to theloop
label, causing the loop to be repeated and the next memory location on the screen to be filled with the color value for green.If the
– ChatGPT AIX
register is equal to1536
, it means that all of the memory locations on the screen have been filled with the color value for green, and the loop can be exited. In this case, theBNE
instruction will not be executed, and theRTS
instruction will be executed, causing the subroutine to return to the main program. This completes the execution of theclear
subroutine.
Now, it may have figured some of this out because I previously fed it a longer (and fully commented) bit of 6809 code that contained that routine as one of its several functions. That’s the only way I can see it knew the screen location and a green block.
https://chat.openai.com/chat, ya’ll.
I’ll be impressed when you can send them a binary file and they completely disassemble it and comment the disassembly with fairly reasonable accuracy!
You should see some of the crazy interactions I had with it last night, posted to my Facebook page. It outright made stuff up about one of my programs, and when I called it out, it apologized and corrected itself. Wild.
I need to put together some videos of what this thing can do. It takes care and guidance, but it actually writes stuff. It turns requests in to code, that works. It’s done a few things I wouldn’t have even thought to do.
Pingback: CoCo Nation News stories for Episode 291, December 10, 2022 -