mirror of https://github.com/irmen/prog8.git
Compare commits
2 Commits
6ed9899dc7
...
19ebc6d6b3
Author | SHA1 | Date |
---|---|---|
Irmen de Jong | 19ebc6d6b3 | |
Irmen de Jong | f88c29e083 |
|
@ -1,5 +1,5 @@
|
|||
; Emulator debug interface.
|
||||
; Docs: https://github.com/X16Community/x16-emulator#emulator-io-registers
|
||||
; Docs: https://github.com/X16Community/x16-emulator/tree/d52f118ce893fa24c4ca021a0b8de46cb80e5ccf#emulator-io-registers
|
||||
|
||||
emudbg {
|
||||
%option ignore_unused
|
||||
|
|
|
@ -48,7 +48,7 @@ psg {
|
|||
sub freq(ubyte voice_num, uword vera_freq) {
|
||||
; -- Changes the frequency of the voice's sound.
|
||||
; voice_num = 0-15, vera_freq = 0-65535 calculate this via the formula given in the Vera's PSG documentation.
|
||||
; (https://github.com/x16community/x16-docs/blob/master/VERA%20Programmer's%20Reference.md)
|
||||
; (https://github.com/X16Community/x16-docs/blob/101759f3bfa5e6cce4e8c5a0b67cb0f2f1c6341e/X16%20Reference%20-%2009%20-%20VERA%20Programmer's%20Reference.md)
|
||||
; Write freq MSB first and then LSB to reduce the chance on clicks
|
||||
sys.irqsafe_set_irqd()
|
||||
cx16.r0 = $f9c1 + voice_num * 4
|
||||
|
|
|
@ -998,7 +998,7 @@ asmsub restore_vera_context() clobbers(A) {
|
|||
|
||||
asmsub set_chrin_keyhandler(ubyte handlerbank @A, uword handler @XY) clobbers(A) {
|
||||
; Install a custom CHRIN (BASIN) key handler in a safe manner. Call this before each line you want to read.
|
||||
; See https://github.com/X16Community/x16-docs/blob/master/X16%20Reference%20-%2002%20-%20Editor.md#custom-basin-petscii-code-override-handler
|
||||
; See https://github.com/X16Community/x16-docs/blob/101759f3bfa5e6cce4e8c5a0b67cb0f2f1c6341e/X16%20Reference%20-%2003%20-%20Editor.md#custom-basin-petscii-code-override-handler
|
||||
%asm {{
|
||||
sei
|
||||
sta P8ZP_SCRATCH_REG
|
||||
|
@ -1256,7 +1256,7 @@ sub search_x16edit() -> ubyte {
|
|||
sub set_program_args(uword args_ptr, ubyte args_size) {
|
||||
; -- Set the inter-program arguments.
|
||||
; standardized way to pass arguments between programs is in ram bank 0, address $bf00-$bfff.
|
||||
; see https://github.com/X16Community/x16-docs/blob/master/X16%20Reference%20-%2007%20-%20Memory%20Map.md#bank-0
|
||||
; see https://github.com/X16Community/x16-docs/blob/101759f3bfa5e6cce4e8c5a0b67cb0f2f1c6341e/X16%20Reference%20-%2008%20-%20Memory%20Map.md#bank-0
|
||||
sys.push(getrambank())
|
||||
rambank(0)
|
||||
sys.memcopy(args_ptr, $bf00, args_size)
|
||||
|
@ -1268,7 +1268,7 @@ sub search_x16edit() -> ubyte {
|
|||
asmsub get_program_args(uword buffer @R0, ubyte buf_size @R1, bool binary @Pc) {
|
||||
; -- Retrieve the inter-program arguments. If binary=false, it treats them as a string (stops copying at first zero).
|
||||
; standardized way to pass arguments between programs is in ram bank 0, address $bf00-$bfff.
|
||||
; see https://github.com/X16Community/x16-docs/blob/a21a320aebec2c7b93f1bd90b97dcfd73fff4ad0/X16%20Reference%20-%2008%20-%20Memory%20Map.md#bank-0
|
||||
; see https://github.com/X16Community/x16-docs/blob/101759f3bfa5e6cce4e8c5a0b67cb0f2f1c6341e/X16%20Reference%20-%2008%20-%20Memory%20Map.md#bank-0
|
||||
%asm {{
|
||||
lda #0
|
||||
rol a
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; Somewhat experimental Vera FX support.
|
||||
; Docs:
|
||||
; https://github.com/X16Community/x16-docs/blob/master/X16%20Reference%20-%2010%20-%20VERA%20FX%20Reference.md
|
||||
; https://github.com/X16Community/x16-docs/blob/101759f3bfa5e6cce4e8c5a0b67cb0f2f1c6341e/X16%20Reference%20-%2010%20-%20VERA%20FX%20Reference.md
|
||||
; https://docs.google.com/document/d/1q34uWOiM3Be2pnaHRVgSdHySI-qsiQWPTo_gfE54PTg
|
||||
|
||||
verafx {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
; Emulator debug interface. (reflecting the Commander X16 emudbg library module)
|
||||
; Docs: https://github.com/X16Community/x16-emulator#emulator-io-registers
|
||||
; Docs: https://github.com/X16Community/x16-emulator/tree/d52f118ce893fa24c4ca021a0b8de46cb80e5ccf#emulator-io-registers
|
||||
|
||||
%import textio
|
||||
|
||||
|
|
|
@ -74,6 +74,13 @@ internal class LiteralsToAutoVars(private val program: Program, private val erro
|
|||
|
||||
override fun after(decl: VarDecl, parent: Node): Iterable<IAstModification> {
|
||||
if(decl.names.size>1) {
|
||||
|
||||
val fcallTarget = (decl.value as? IFunctionCall)?.target?.targetSubroutine(program)
|
||||
if(fcallTarget!=null && fcallTarget.returntypes.size>1) {
|
||||
errors.err("ambiguous multi-variable initialization. Use separate variable declaration and assignment(s) instead.", decl.value!!.position)
|
||||
return noModifications
|
||||
}
|
||||
|
||||
// note: the desugaring of a multi-variable vardecl has to be done here
|
||||
// and not in CodeDesugarer, that one is too late (identifiers can't be found otherwise)
|
||||
if(decl.datatype !in NumericDatatypesWithBoolean)
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
TODO
|
||||
====
|
||||
|
||||
can we make ubyte x,y = cbm.SCREEN() work? (sugar for ubyte x,y // x,y=cbm.SCREEN() ?)
|
||||
|
||||
...
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
%option no_sysinit
|
||||
|
||||
; The documentation for custom key handlers can be found here:
|
||||
; https://github.com/X16Community/x16-docs/blob/master/X16%20Reference%20-%2002%20-%20Editor.md#custom-keyboard-keynum-code-handler
|
||||
; https://github.com/X16Community/x16-docs/blob/101759f3bfa5e6cce4e8c5a0b67cb0f2f1c6341e/X16%20Reference%20-%2003%20-%20Editor.md#custom-keyboard-keynum-code-handler
|
||||
|
||||
main {
|
||||
|
||||
|
|
|
@ -4,8 +4,12 @@
|
|||
|
||||
main {
|
||||
sub start() {
|
||||
ubyte @shared x,y,z
|
||||
ubyte @shared k,l,m = 42
|
||||
uword @shared r,s,t = sys.progend()
|
||||
ubyte @shared x,y = multi()
|
||||
}
|
||||
|
||||
asmsub multi() -> ubyte @A, ubyte @Y {
|
||||
%asm {{
|
||||
rts
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue