Software > Coding
ChatGPT schreibt ein GEM-Programm
goetz @ 3rz:
--- Zitat von: czietz am Di 10.01.2023, 19:08:37 ---Ein Problem mit ChatGPT ist, dass es sehr selten sagt "tut mir leid, weiß ich nicht".
--- Ende Zitat ---
Richtig:
mfro:
--- Zitat von: Thorsten Otto am Di 10.01.2023, 19:38:04 ---Vermutlich weiss es überhaupt nichts über GFA, und hat nur "Basic" gelesen. Zeilen-Nummern gibt es in GFA ja auch nicht.
--- Ende Zitat ---
Douglas Adams hat schon gewusst, dass man die richtige Frage (und die Frage richtig) stellen muss:
--- Zitat ---write a gfa basic program for the atari st that displays a gem alert box
--- Ende Zitat ---
--- Zitat ---Here is an example program in GFA Basic for the Atari ST that displays a "GEM alert box":
--- Code: ---' GFA Basic program for Atari ST
' Displays a GEM alert box
' Declare variables
DIM message$
' Set message to be displayed in the alert box
message$ = "This is a GEM alert box!"
' Display the alert box
ALERT message$
--- Ende Code ---
This program uses the built-in ALERT function to display a message in a GEM window. The message to be displayed is stored in the string variable message$, which is passed as a parameter to the ALERT function.
This code is an example of how GFA basic can be used to display an alert box on the Atari ST, however it depends on specific version of GFA basic and specific system setup.
It is good to have access to the documentation of the version of GFA basic that you are using to be sure of compatibility and to be able to troubleshoot.
--- Ende Zitat ---
Ich hab' mit GFA Basic nichts am Hut, aber das müsste so richtig sein, oder?
mfro:
Mit dem Rwabs() Bios-Aufruf ist es ähnlich: die AI braucht mehr Kontext.
--- Zitat ---write a program for the atari st that reads sector number 5 from the bios device 2 using the Rwabs() Bios system call
--- Ende Zitat ---
--- Zitat ---The Atari ST operating system uses the BIOS (Basic Input/Output System) to interact with devices such as disk drives. To read sector number 5 from the BIOS device 2 using the Rwabs() BIOS system call, you can use the following program in assembly language:
--- Code: --- section code
start:
move.l #2, d0 ; BIOS device number (2 = floppy drive)
move.l #5, d1 ; Sector number to read
move.l #1, d2 ; Number of sectors to read
move.l buffer, a1 ; Address of buffer to store data
move.w #512, d3 ; Number of bytes to read
move.w #0, d4 ; Read operation
trap #14 ; Rwabs() BIOS system call
tst.w d0 ; Check for errors
bmi.s error ; Branch to error handler if negative status
jmp.s done
error:
; Handle error
done:
; Continue execution
section data
buffer:
rmb 512 ; Reserve 512 bytes for the buffer
--- Ende Code ---
This program uses the Atari ST's Motorola 68000 assembly language and the BIOS system calls to access the BIOS.
It starts by loading the necessary parameters into registers. The device number is loaded into d0 (2=floppy drive), sector number is loaded into d1, number of sectors to read is loaded into d2 , address of buffer to store data is loaded into a1, number of bytes to read is loaded into d3, and the operation code is loaded into d4 (0 = read)
The trap #14 instruction is used to call the Rwabs() BIOS system call with these parameters, which will read the specified sector from the device and store it in the buffer. The contents of d0 will be updated with the status of the operation: if it's negative, it means an error has occurred. So the program check for errors using the tst.w d0 instruction and jumps to the error handl
--- Ende Zitat ---
Das ist immer noch nicht richtig (die Parameter sind verdreht, werden in Registern übergeben und die Stackkorrektur am Ende fehlt), aber schon deutlich näher dran. Ich habe auch vergessen, ein C-Programm zu verlangen und die AI hat von sich aus beschlossen, es mal in Assembler zu versuchen.
Offensichtlich muss man die richtige Antwort kennen, um die richtige Frage zu stellen.
czietz:
--- Zitat von: mfro am Mi 11.01.2023, 08:00:13 ---Ich hab' mit GFA Basic nichts am Hut, aber das müsste so richtig sein, oder?
--- Ende Zitat ---
Nö. DIM braucht man für Arrays. ALERT hat noch weitere Parameter.
MJaap:
Bei mir kam folgendes Programm bei der GEM message box in GFA Basic on the Atari ST:
--- Code: ---' Import the GEM library
BLOAD "GEM.LIB",R
' Declare the variables
DIM id$(3), wtitle$(20), wtext$(60)
' Define the message box text and title
wtitle$ = "My Message Box"
wtext$ = "Hello, World!"
' Open the message box
id$ = " "
FORM_CENTER(id$, 0, 0, wtitle$, wtext$)
--- Ende Code ---
Vielleicht Omikron? ;)
Manche Abfragen lehnt ChatGPT auch einfach ab:
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln