adjusted options of library modules

This commit is contained in:
Irmen de Jong 2023-12-29 22:21:44 +01:00
parent d03ff1e4d0
commit 813007a5d8
12 changed files with 172 additions and 172 deletions

View File

@ -8,7 +8,7 @@
; so that the program itself can be larger without starting to overwrite the graphics memory.
graphics {
%option no_symbol_prefixing, ignore_unused
%option ignore_unused
const uword WIDTH = 320
const ubyte HEIGHT = 200
@ -175,11 +175,11 @@ graphics {
if separate_pixels {
%asm {{
lda pixaddr
lda p8v_pixaddr
sta P8ZP_SCRATCH_W1
lda pixaddr+1
lda p8v_pixaddr+1
sta P8ZP_SCRATCH_W1+1
ldy separate_pixels
ldy p8v_separate_pixels
lda hline_filled_right,y
eor #255
ldy #0
@ -193,23 +193,23 @@ graphics {
if length {
%asm {{
lda length
lda p8v_length
and #7
sta separate_pixels
lsr length+1
ror length
lsr length+1
ror length
lsr length+1
ror length
lda pixaddr
sta p8v_separate_pixels
lsr p8v_length+1
ror p8v_length
lsr p8v_length+1
ror p8v_length
lsr p8v_length+1
ror p8v_length
lda p8v_pixaddr
sta _modified+1
lda pixaddr+1
lda p8v_pixaddr+1
sta _modified+2
lda length
ora length+1
lda p8v_length
ora p8v_length+1
beq _zero
ldy length
ldy p8v_length
ldx #$ff
_modified stx $ffff ; modified
lda _modified+1
@ -221,7 +221,7 @@ _modified stx $ffff ; modified
+ dey
bne _modified
_zero
ldy separate_pixels
ldy p8v_separate_pixels
beq hline_zero2
lda _modified+1
sta P8ZP_SCRATCH_W1
@ -319,9 +319,9 @@ hline_zero2
inline asmsub plot(uword plotx @XY, ubyte ploty @A) clobbers (A, X, Y) {
%asm {{
stx graphics.internal_plotx
sty graphics.internal_plotx+1
jsr graphics.internal_plot
stx p8b_graphics.p8v_internal_plotx
sty p8b_graphics.p8v_internal_plotx+1
jsr p8b_graphics.p8s_internal_plot
}}
}
@ -333,11 +333,11 @@ hline_zero2
asmsub internal_plot(ubyte ploty @A) clobbers (A, X, Y) { ; internal_plotx is 16 bits 0 to 319... doesn't fit in a register
%asm {{
tay
lda internal_plotx+1
lda p8v_internal_plotx+1
sta P8ZP_SCRATCH_W2+1
lsr a ; 0
sta P8ZP_SCRATCH_W2
lda internal_plotx
lda p8v_internal_plotx
pha
and #7
tax
@ -365,7 +365,7 @@ _ormask .byte 128, 64, 32, 16, 8, 4, 2, 1
; the y lookup tables encodes this formula: BITMAP_ADDRESS + 320*(py>>3) + (py & 7) (y from 0..199)
; We use the 64tass syntax for range expressions to calculate this table on assembly time.
_plot_y_values := BITMAP_ADDRESS + 320*(range(200)>>3) + (range(200) & 7)
_plot_y_values := p8c_BITMAP_ADDRESS + 320*(range(200)>>3) + (range(200) & 7)
_y_lookup_lo .byte <_plot_y_values
_y_lookup_hi .byte >_plot_y_values
@ -375,9 +375,9 @@ _y_lookup_hi .byte >_plot_y_values
asmsub get_y_lookup(ubyte yy @Y) -> uword @AY {
%asm {{
lda internal_plot._y_lookup_lo,y
lda p8s_internal_plot._y_lookup_lo,y
pha
lda internal_plot._y_lookup_hi,y
lda p8s_internal_plot._y_lookup_hi,y
tay
pla
rts

View File

@ -3,7 +3,7 @@
; BMX Specification: https://cx16forum.com/forum/viewtopic.php?t=6945
%import diskio
%option no_symbol_prefixing, ignore_unused
%option ignore_unused
bmx {

View File

@ -2,6 +2,7 @@
; Docs: https://github.com/X16Community/x16-emulator#emulator-io-registers
emudbg {
%option ignore_unused
const uword EMU_BASE = $9fb0
@ -13,10 +14,14 @@ emudbg {
&ubyte EMU_RECORD_GIF = EMU_BASE + 5
&ubyte EMU_RECORD_WAV = EMU_BASE + 6
&ubyte EMU_CMDKEYS_DISABLED = EMU_BASE + 7
&ubyte EMU_CPUCLK_L = EMU_BASE + 8 ; write: reset cpu clock to 0
&ubyte EMU_CPUCLK_M = EMU_BASE + 9 ; write: outputs "User debug 1: $xx"
&ubyte EMU_CPUCLK_H = EMU_BASE + 10 ; write: outputs "User debug 2: $xx"
&ubyte EMU_CPUCLK_U = EMU_BASE + 11 ; write: outputs as character to console
&ubyte EMU_CPUCLK_L = EMU_BASE + 8
&ubyte EMU_CPUCLK_M = EMU_BASE + 9
&ubyte EMU_CPUCLK_H = EMU_BASE + 10
&ubyte EMU_CPUCLK_U = EMU_BASE + 11
&ubyte EMU_CPUCLK_RESET = EMU_BASE + 8 ; write: reset cpu clock to 0
&ubyte EMU_DBGOUT1 = EMU_BASE + 9 ; write: outputs "User debug 1: $xx"
&ubyte EMU_DBGOUT2 = EMU_BASE + 10 ; write: outputs "User debug 2: $xx"
&ubyte EMU_CHROUT = EMU_BASE + 11 ; write: outputs as character to console
; 12 is unused for now
&ubyte EMU_KEYMAP = EMU_BASE + 13
&ubyte EMU_EMU_DETECT1 = EMU_BASE + 14
@ -45,16 +50,16 @@ emudbg {
sub console_chrout(ubyte char) {
; note: make sure the character is in Iso encoding.
if is_emulator()
EMU_CPUCLK_U = char
EMU_CHROUT = char
}
sub console_value1(ubyte value) {
if is_emulator()
EMU_CPUCLK_M = value
EMU_DBGOUT1 = value
}
sub console_value2(ubyte value) {
if is_emulator()
EMU_CPUCLK_H = value
EMU_DBGOUT2 = value
}
}

View File

@ -24,7 +24,7 @@
gfx2 {
%option no_symbol_prefixing, ignore_unused
%option ignore_unused
; read-only control variables:
ubyte active_mode = 0
@ -141,8 +141,8 @@ gfx2 {
; lores 256c
position(xx, yy)
%asm {{
lda color
ldx length+1
lda p8v_color
ldx p8v_length+1
beq +
ldy #0
- sta cx16.VERA_DATA0
@ -150,7 +150,7 @@ gfx2 {
bne -
dex
bne -
+ ldy length ; remaining
+ ldy p8v_length ; remaining
beq +
- sta cx16.VERA_DATA0
dey
@ -180,7 +180,7 @@ gfx2 {
sta cx16.VERA_ADDR_L
lda cx16.r0+1
sta cx16.VERA_ADDR_M
ldx xx
ldx p8v_xx
}}
repeat length {
@ -189,8 +189,8 @@ gfx2 {
and #3
tay
lda cx16.VERA_DATA0
and gfx2.plot.mask4c,y
ora colorbits,y
and p8b_gfx2.p8s_plot.p8v_mask4c,y
ora p8v_colorbits,y
sta cx16.VERA_DATA0
cpy #%00000011 ; next vera byte?
bne ++
@ -232,9 +232,9 @@ gfx2 {
position(xx,yy)
cx16.VERA_ADDR_H = cx16.VERA_ADDR_H & %00000111 | (14<<4)
%asm {{
ldy lheight
ldy p8v_lheight
beq +
lda color
lda p8v_color
- sta cx16.VERA_DATA0
dey
bne -
@ -260,8 +260,8 @@ gfx2 {
repeat lheight {
%asm {{
lda cx16.VERA_DATA0
and mask
ora color
and p8v_mask
ora p8v_color
sta cx16.VERA_DATA1
}}
}
@ -534,7 +534,7 @@ gfx2 {
sta cx16.VERA_ADDR_M
lda cx16.r0
sta cx16.VERA_ADDR_L
lda color
lda p8v_color
sta cx16.VERA_DATA0
}}
}
@ -558,9 +558,9 @@ gfx2 {
lda cx16.r0L
sta cx16.VERA_ADDR_L
ldy cx16.r2L ; xbits
lda mask4c,y
lda p8v_mask4c,y
and cx16.VERA_DATA0
ora color
ora p8v_color
sta cx16.VERA_DATA0
}}
}
@ -605,10 +605,10 @@ gfx2 {
sta cx16.VERA_ADDR_L
lda cx16.VERA_DATA0
pha
lda xx
lda p8v_xx
and #3
tay
lda gfx2.plot.shift4c,y
lda p8b_gfx2.p8s_plot.p8v_shift4c,y
tay
pla
cpy #0
@ -651,21 +651,21 @@ gfx2 {
;; cx16.r12L++
%asm {{
ldy cx16.r12L
lda sxl
sta stack_xl_lsb,y
lda sxl+1
sta stack_xl_msb,y
lda sxr
sta stack_xr_lsb,y
lda sxr+1
sta stack_xr_msb,y
lda sy
sta stack_y_lsb,y
lda sy+1
sta stack_y_msb,y
lda p8v_sxl
sta p8v_stack_xl_lsb,y
lda p8v_sxl+1
sta p8v_stack_xl_msb,y
lda p8v_sxr
sta p8v_stack_xr_lsb,y
lda p8v_sxr+1
sta p8v_stack_xr_msb,y
lda p8v_sy
sta p8v_stack_y_lsb,y
lda p8v_sy+1
sta p8v_stack_y_msb,y
ldy cx16.r12L
lda sdy
sta stack_dy,y
lda p8v_sdy
sta p8v_stack_dy,y
inc cx16.r12L
}}
}
@ -679,21 +679,21 @@ gfx2 {
%asm {{
dec cx16.r12L
ldy cx16.r12L
lda stack_xl_lsb,y
sta x1
lda stack_xl_msb,y
sta x1+1
lda stack_xr_lsb,y
sta x2
lda stack_xr_msb,y
sta x2+1
lda stack_y_lsb,y
sta yy
lda stack_y_msb,y
sta yy+1
lda p8v_stack_xl_lsb,y
sta p8v_x1
lda p8v_stack_xl_msb,y
sta p8v_x1+1
lda p8v_stack_xr_lsb,y
sta p8v_x2
lda p8v_stack_xr_msb,y
sta p8v_x2+1
lda p8v_stack_y_lsb,y
sta p8v_yy
lda p8v_stack_y_msb,y
sta p8v_yy+1
ldy cx16.r12L
lda stack_dy,y
sta dy
lda p8v_stack_dy,y
sta p8v_dy
}}
yy+=dy
}
@ -852,7 +852,7 @@ skip:
position(xx,yy)
yy++
%asm {{
ldx color
ldx p8v_color
lda cx16.VERA_DATA1
sta P8ZP_SCRATCH_B1
ldy #8

View File

@ -14,7 +14,7 @@
graphics {
%option no_symbol_prefixing, ignore_unused
%option ignore_unused
romsub $feff = FB_cursor_position2() clobbers(A,X,Y) ; alias for the normal FB_cursor_position() call but reuses existing r0 and r1
@ -158,7 +158,7 @@ graphics {
inline asmsub plot(uword plotx @R0, uword ploty @R1) clobbers(A, X, Y) {
%asm {{
jsr cx16.FB_cursor_position
lda graphics.stroke_color
lda p8b_graphics.p8v_stroke_color
jsr cx16.FB_set_pixel
}}
}

View File

@ -11,7 +11,7 @@
monogfx {
%option no_symbol_prefixing, ignore_unused
%option ignore_unused
; read-only control variables:
uword width = 0
@ -107,11 +107,11 @@ monogfx {
; just use 2 byte writes with shifted mask
position2(xx,yy,true)
%asm {{
ldy length
lda masked_ends,y
ldy p8v_length
lda p8v_masked_ends,y
sta cx16.r0L ; save left byte
stz P8ZP_SCRATCH_B1
lda xx
lda p8v_xx
and #7
beq +
tay
@ -122,10 +122,10 @@ monogfx {
bne -
sta cx16.r0L ; new left byte
+
lda dont_stipple_flag
lda p8v_dont_stipple_flag
bne _dontstipple
; determine stipple pattern
lda yy
lda p8v_yy
and #1
beq +
lda #%10101010
@ -139,7 +139,7 @@ monogfx {
and P8ZP_SCRATCH_REG
sta P8ZP_SCRATCH_B1
_dontstipple
lda draw
lda p8v_draw
beq _clear
lda cx16.r0L ; left byte
ora cx16.VERA_DATA1
@ -184,34 +184,34 @@ _clear
separate_pixels = lsb(length) & 7
xx += length & $fff8
%asm {{
lsr length+1
ror length
lsr length+1
ror length
lsr length+1
ror length
lda draw
lsr p8v_length+1
ror p8v_length
lsr p8v_length+1
ror p8v_length
lsr p8v_length+1
ror p8v_length
lda p8v_draw
bne +
ldy #0 ; black
bra _loop
+ lda dont_stipple_flag
+ lda p8v_dont_stipple_flag
beq _stipple
ldy #255 ; don't stipple
bra _loop
_stipple lda yy
_stipple lda p8v_yy
and #1 ; determine stipple pattern to use
bne +
ldy #%01010101
bra _loop
+ ldy #%10101010
_loop lda length
ora length+1
_loop lda p8v_length
ora p8v_length+1
beq _done
sty cx16.VERA_DATA0
lda length
lda p8v_length
bne +
dec length+1
+ dec length
dec p8v_length+1
+ dec p8v_length
bra _loop
_done
}}
@ -554,9 +554,9 @@ _done
if draw {
; solid color or perhaps stipple
%asm {{
lda xx
eor yy
ora dont_stipple_flag
lda p8v_xx
eor p8v_yy
ora p8v_dont_stipple_flag
and #1
}}
if_nz {
@ -575,7 +575,7 @@ _done
sub prepare() {
%asm {{
lda xx
lda p8v_xx
and #7
pha ; xbits
}}
@ -587,12 +587,12 @@ _done
%asm {{
stz cx16.VERA_CTRL
stz cx16.VERA_ADDR_H
lda xx+1
lda p8v_xx+1
sta cx16.VERA_ADDR_M
lda xx
lda p8v_xx
sta cx16.VERA_ADDR_L
ply ; xbits
lda maskbits,y
lda p8v_maskbits,y
}}
}
}
@ -608,7 +608,7 @@ _done
sub pget(uword @zp xx, uword yy) -> ubyte {
%asm {{
lda xx
lda p8v_xx
and #7
pha ; xbits
}}
@ -621,12 +621,12 @@ _done
%asm {{
stz cx16.VERA_CTRL
stz cx16.VERA_ADDR_H
lda xx+1
lda p8v_xx+1
sta cx16.VERA_ADDR_M
lda xx
lda p8v_xx
sta cx16.VERA_ADDR_L
ply ; xbits
lda plot.maskbits,y
lda p8s_plot.p8v_maskbits,y
and cx16.VERA_DATA0
beq +
lda #1
@ -662,21 +662,21 @@ _done
;; cx16.r12L++
%asm {{
ldy cx16.r12L
lda sxl
sta stack_xl_lsb,y
lda sxl+1
sta stack_xl_msb,y
lda sxr
sta stack_xr_lsb,y
lda sxr+1
sta stack_xr_msb,y
lda sy
sta stack_y_lsb,y
lda sy+1
sta stack_y_msb,y
lda p8v_sxl
sta p8v_stack_xl_lsb,y
lda p8v_sxl+1
sta p8v_stack_xl_msb,y
lda p8v_sxr
sta p8v_stack_xr_lsb,y
lda p8v_sxr+1
sta p8v_stack_xr_msb,y
lda p8v_sy
sta p8v_stack_y_lsb,y
lda p8v_sy+1
sta p8v_stack_y_msb,y
ldy cx16.r12L
lda sdy
sta stack_dy,y
lda p8v_sdy
sta p8v_stack_dy,y
inc cx16.r12L
}}
}
@ -690,21 +690,21 @@ _done
%asm {{
dec cx16.r12L
ldy cx16.r12L
lda stack_xl_lsb,y
sta x1
lda stack_xl_msb,y
sta x1+1
lda stack_xr_lsb,y
sta x2
lda stack_xr_msb,y
sta x2+1
lda stack_y_lsb,y
sta yy
lda stack_y_msb,y
sta yy+1
lda p8v_stack_xl_lsb,y
sta p8v_x1
lda p8v_stack_xl_msb,y
sta p8v_x1+1
lda p8v_stack_xr_lsb,y
sta p8v_x2
lda p8v_stack_xr_msb,y
sta p8v_x2+1
lda p8v_stack_y_lsb,y
sta p8v_yy
lda p8v_stack_y_msb,y
sta p8v_yy+1
ldy cx16.r12L
lda stack_dy,y
sta dy
lda p8v_stack_dy,y
sta p8v_dy
}}
yy+=dy
}
@ -797,7 +797,7 @@ skip:
cx16.vaddr_autoincr(charset_bank, chardataptr, 0, 1)
%asm {{
; pre-shift the bits
lda text.xx
lda p8s_text.p8v_xx
and #7
sta P8ZP_SCRATCH_B1
ldy #0
@ -810,9 +810,9 @@ skip:
ror P8ZP_SCRATCH_REG
dex
bne -
+ sta char_bitmap_bytes_left,y
+ sta p8v_char_bitmap_bytes_left,y
lda P8ZP_SCRATCH_REG
sta char_bitmap_bytes_right,y
sta p8v_char_bitmap_bytes_right,y
iny
cpy #8
bne --
@ -823,7 +823,7 @@ skip:
if draw {
%asm {{
ldy #0
- lda char_bitmap_bytes_left,y
- lda p8v_char_bitmap_bytes_left,y
ora cx16.VERA_DATA1
sta cx16.VERA_DATA0
iny
@ -833,7 +833,7 @@ skip:
} else {
%asm {{
ldy #0
- lda char_bitmap_bytes_left,y
- lda p8v_char_bitmap_bytes_left,y
eor #255
and cx16.VERA_DATA1
sta cx16.VERA_DATA0
@ -849,7 +849,7 @@ skip:
if draw {
%asm {{
ldy #0
- lda char_bitmap_bytes_right,y
- lda p8v_char_bitmap_bytes_right,y
ora cx16.VERA_DATA1
sta cx16.VERA_DATA0
iny
@ -859,7 +859,7 @@ skip:
} else {
%asm {{
ldy #0
- lda char_bitmap_bytes_right,y
- lda p8v_char_bitmap_bytes_right,y
eor #255
and cx16.VERA_DATA1
sta cx16.VERA_DATA0

View File

@ -3,7 +3,7 @@
; The first 16 colors can be restored to their default with set_default16()
palette {
%option no_symbol_prefixing, ignore_unused
%option ignore_unused
uword vera_palette_ptr

View File

@ -1,7 +1,7 @@
%import syslib
psg {
%option no_symbol_prefixing, ignore_unused
%option ignore_unused
; $1F9C0 - $1F9FF 16 blocks of 4 PSG registers (16 voices)
; 00 frequency word LSB

View File

@ -7,6 +7,8 @@
; note: collision mask is not supported here yet.
sprites {
%option ignore_unused
const ubyte SIZE_8 = 0
const ubyte SIZE_16 = 1
const ubyte SIZE_32 = 2

View File

@ -7,7 +7,7 @@
monogfx {
%option no_symbol_prefixing, ignore_unused
%option ignore_unused
; read-only control variables:
uword width = 0

View File

@ -17,6 +17,7 @@ main {
angley+=215
anglez+=453
sys.waitvsync()
sys.waitvsync()
}
}

View File

@ -1,29 +1,21 @@
%import math
%import string
%import emudbg
%import palette
%import floats
%import textio
%zeropage dontuse
main {
sub start() {
uword @shared x = 65535
word @shared y = x as word
txt.print_w(y)
txt.nl()
txt.print_w(x as word)
txt.nl()
word @shared x2 = -1
uword @shared y2 = x2 as uword
txt.print_uw(y2)
txt.nl()
txt.print_uw(x2 as uword)
txt.nl()
txt.print_uw(shiftluw1())
emudbg.console_value1(123)
emudbg.console_value2(99)
emudbg.console_chrout('@')
emudbg.console_chrout('h')
emudbg.console_chrout('e')
emudbg.console_chrout('l')
emudbg.console_chrout('l')
emudbg.console_chrout('o')
emudbg.console_chrout('\n')
}
; sub shiftluw1() -> uword {
; uword q = $a49f
; return (q << 1) & 65535 as uword
; }
}