Skip to content

Commit 470d62e

Browse files
committed
feat: screen/screen$ support
1 parent 239c028 commit 470d62e

37 files changed

Lines changed: 12715 additions & 12227 deletions

bin/basic.rom

2.31 KB
Binary file not shown.

howto/howto-crossdev-asm.zip

-3 Bytes
Binary file not shown.

howto/howto-crossdev-basic.zip

-3 Bytes
Binary file not shown.

howto/howto-update.zip

563 Bytes
Binary file not shown.

howto/update/sb01.bin

0 Bytes
Binary file not shown.

howto/update/sb02.bin

0 Bytes
Binary file not shown.

howto/update/sb03.bin

0 Bytes
Binary file not shown.

howto/update/sb04.bin

0 Bytes
Binary file not shown.

modules/hardware/data.asm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ EXTScreenRowOffsets .fill 128 * 2
8585
.section zeropage
8686

8787
;;
88-
; Current screen line address pointer.
88+
; Current screen line address for write operations.
8989
;
9090
; 16-bit pointer to the screen address marking the start of the current line.
9191
; This address is calculated from `EXTMemory` + row offset and is used for
92-
; fast character positioning and screen operations.
92+
; fast character positioning in screen write operations.
9393
;
9494
; \size 2 bytes
9595
; \note Located in zero page for efficient indirect addressing.
96-
; \see EXTMemory, EXTRow, EXTColumn, EXTScreenRowOffsets
96+
; \see EXTMemory, EXTRow, EXTColumn, EXTScreenRowOffsets, EXTReadAddress
9797
;;
9898
EXTAddress .fill 2
9999

modules/hardware/screen.asm

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
.section code
2+
3+
;;
4+
; Read character from screen at specified coordinates.
5+
;
6+
; Retrieves the character stored at the given row and column position on the
7+
; screen. Uses precomputed row offsets for efficient address calculation and
8+
; indirect addressing for memory access. No bounds checking is performed on
9+
; the coordinates; the caller must ensure that the row and column coordinates
10+
; are within valid ranges.
11+
;
12+
; \in A Row coordinate (0-based).
13+
; \in Y Column coordinate (0-based).
14+
; \out A Character at the specified screen position.
15+
; \sideeffects - Modifies `A` register and `zTemp0`.
16+
; \see EXTScreenRowOffsets, EXTMemory, zTemp0
17+
;;
18+
Export_EXTScreenAt:
19+
phy ; save column coordinate on stack
20+
21+
; lookup the corresponding row offset
22+
asl a ; multiply row index by 2 to get byte index
23+
tay ; `Y` holds the byte index of the row offset
24+
25+
lda #2 ; select text page
26+
sta $0001
27+
28+
; add row offset to the beginning of the text memory address,
29+
; store the result in `zTemp0`
30+
clc
31+
lda #<EXTMemory ; `A` = low byte of screen memory
32+
adc EXTScreenRowOffsets,y ; add the row offset
33+
sta zTemp0 ; store low byte of the line address
34+
35+
lda #>EXTMemory ; `A` = high byte of screen memory
36+
adc EXTScreenRowOffsets+1,y ; add the row offset
37+
sta zTemp0+1 ; store high byte of the line address
38+
39+
; read character from screen memory at (row, column)
40+
ply ; restore column index into `Y`
41+
lda (zTemp0),y ; zTemp0 + Y = character address
42+
43+
rts
44+
45+
.send code

0 commit comments

Comments
 (0)