mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 16:29:21 +00:00
fix atari target syslib
This commit is contained in:
parent
8f864417c4
commit
24fc95ac81
@ -7,31 +7,6 @@ atari {
|
||||
&uword RESET_VEC = $FFFC ; 6502 reset vector, determined by the kernal if banked in
|
||||
&uword IRQ_VEC = $FFFE ; 6502 interrupt vector, determined by the kernal if banked in
|
||||
|
||||
; ---- kernal routines ----
|
||||
; TODO
|
||||
|
||||
|
||||
asmsub init_system() {
|
||||
; Initializes the machine to a sane starting state.
|
||||
; Called automatically by the loader program logic.
|
||||
; TODO
|
||||
%asm {{
|
||||
sei
|
||||
cld
|
||||
clc
|
||||
; TODO reset screen mode etc etc
|
||||
clv
|
||||
cli
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub init_system_phase2() {
|
||||
%asm {{
|
||||
rts ; no phase 2 steps on the Atari
|
||||
}}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -40,6 +15,26 @@ sys {
|
||||
|
||||
const ubyte target = 8 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16, 8 = atari800XL
|
||||
|
||||
asmsub init_system() {
|
||||
; Initializes the machine to a sane starting state.
|
||||
; Called automatically by the loader program logic.
|
||||
; TODO
|
||||
%asm {{
|
||||
sei
|
||||
cld
|
||||
clc
|
||||
; TODO reset screen mode etc etc
|
||||
clv
|
||||
cli
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub init_system_phase2() {
|
||||
%asm {{
|
||||
rts ; no phase 2 steps on the Atari
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub reset_system() {
|
||||
; Soft-reset the system back to initial power-on Basic prompt.
|
||||
|
@ -118,7 +118,6 @@ romsub $F2Fd = waitkey()
|
||||
asmsub chrout(ubyte char @ A) {
|
||||
%asm {{
|
||||
sta _tmp_outchar+1
|
||||
pha
|
||||
txa
|
||||
pha
|
||||
tya
|
||||
@ -130,7 +129,6 @@ _tmp_outchar
|
||||
tay
|
||||
pla
|
||||
tax
|
||||
pla
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
@ -255,28 +255,32 @@ Troubleshooting
|
||||
Compiler doesn't run, complains about "UnsupportedClassVersionError"
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
You need to install and use JDK version 11 or newer to run the prog8 compiler. Check this with "java -version".
|
||||
See :ref:`requirements`.
|
||||
|
||||
The computer resets unexpectedly (at the end of the program)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
If you are using the default 'zeropage' compiler option, and your program exits, it is not possible
|
||||
to return back to the BASIC prompt. The only reliable course of action is to reboot the system.
|
||||
(this is due to the fact that in the default mode, prog8 can overwrite important BASIC and Kernal
|
||||
variables in memory).
|
||||
To avoid a sudden system reset, use an empty ``repeat`` loop at the end of your program to keep it from exiting.
|
||||
The computer just resets (at the end of the program)
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
In the default compiler configuration, it is not safely possible to return back to the BASIC prompt when
|
||||
your program exits. The only reliable thing to do is to reboot the system.
|
||||
This is due to the fact that in this mode, prog8 will overwrite important BASIC and Kernal variables in zero page memory.
|
||||
To avoid the reset from happening, use an empty ``repeat`` loop at the end of your program to keep it from exiting.
|
||||
Alternatively, if you want your program to exit cleanly back to the BASIC prompt,
|
||||
you have to use ``%zeropage basicsafe``, see :ref:`directives`.
|
||||
The reason this is not the default is that it is very beneficial to have more zeropage space available to the program,
|
||||
and programs that have to reaturn cleanly to the BASIC prompt are considered to be the exception.
|
||||
|
||||
|
||||
Odd text and screen colors at start
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Prog8 will reset the screen mode and colors to a uniform well-known state. If you don't like the
|
||||
default text and screen colors, you can simply change them to whatever you want using the
|
||||
appropriate routines in the ``textio`` module.
|
||||
default text and screen colors, you can simply change them yourself to whatever you want at the
|
||||
start of your program. It depends on the computer system how you do this but there are some
|
||||
routines in the textio module to help you with this.
|
||||
Alternatively you can choose to disable this re-initialization altogether
|
||||
using ``%option no_sysinit``, see :ref:`directives`.
|
||||
|
||||
Floats error
|
||||
^^^^^^^^^^^^
|
||||
Getting an assembler error about undefined symbols such as ``not defined 'floats'``?
|
||||
Are you getting an assembler error about undefined symbols such as ``not defined 'floats'``?
|
||||
This happens when your program uses floating point values, and you forgot to import ``floats`` library.
|
||||
If you use floating points, the compiler needs routines from that library.
|
||||
Fix it by adding an ``%import floats``.
|
||||
|
@ -1,10 +1,6 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
- instead of resetting the computer at program exit, reinit screen and print message >PROGRAM EXIT CODE 123;RESET COMPUTER.< + sei + endless loop.
|
||||
change troubleshooting and other references in the docs.
|
||||
|
||||
|
||||
For 9.0 major changes
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
- DONE: added 'cbm' block in the syslib module that now contains all CBM compatible kernal routines and variables
|
||||
|
@ -1,15 +1,28 @@
|
||||
%import textio
|
||||
%zeropage basicsafe
|
||||
%option no_sysinit
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
str name1 = "name1"
|
||||
str name2 = "name2"
|
||||
uword[] @split names = [name1, name2, "name3"]
|
||||
uword[] names = [name1, name2, "name3"]
|
||||
cx16.r0++
|
||||
uword ww
|
||||
for ww in names {
|
||||
txt.print(ww)
|
||||
txt.spc()
|
||||
}
|
||||
txt.nl()
|
||||
|
||||
names = [1111,2222,3333]
|
||||
for ww in names {
|
||||
txt.print_uw(ww)
|
||||
txt.spc()
|
||||
}
|
||||
txt.nl()
|
||||
txt.print("end.")
|
||||
%asm {{
|
||||
lda #$3e
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user