Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 6 additions & 57 deletions src/lib/arch/zxnext/runtime/SP/CharLeft.asm
Original file line number Diff line number Diff line change
@@ -1,59 +1,8 @@
; ----------------------------------------------------------------
; This file is released under the MIT License
;
; CharLeft
; Alvin Albrecht 2002
;

;INCLUDE "SPconfig.def"
;XLIB SPCharLeft

; Char Left
;
; Adjusts screen address HL to move one character to the left
; on the display. Start of line wraps to the previous row.
;
; enter: HL = valid screen address
; Carry reset
; exit : Carry = moved off screen
; HL = moves one character left, with line wrap
; used : AF, HL

;IF !DISP_HIRES

push namespace core

SP.CharLeft:
ld a,l
dec l
or a
ret nz
ld a,h
sub $08
ld h,a
cp $40
ret

pop namespace


;ELSE

;.SPCharLeft
; ld a,h
; xor $20
; ld h,a
; cp $58
; ccf
; ret nc
; ld a,l
; dec l
; or a
; ret nz
; ld a,h
; sub $08
; ld h,a
; and $18
; cp $18
; ccf
; ret
; Copyleft (k) 2008
; by Jose Rodriguez-Rosa (a.k.a. Boriel) <https://www.boriel.com>
; ----------------------------------------------------------------

; ENDIF
#include once [arch:zx48k] <SP/CharLeft.asm>
58 changes: 6 additions & 52 deletions src/lib/arch/zxnext/runtime/SP/CharRight.asm
Original file line number Diff line number Diff line change
@@ -1,54 +1,8 @@
; ----------------------------------------------------------------
; This file is released under the MIT License
;
; CharRight
; Alvin Albrecht 2002
;

;INCLUDE "SPconfig.def"
;XLIB SPCharRight

; Char Right
;
; Adjusts screen address HL to move one character to the right
; on the display. End of line wraps to the next row.
;
; enter: HL = valid screen address
; Carry reset
; exit : Carry = moved off screen
; HL = moves one character right, with line wrap
; used : AF, HL

;IF !DISP_HIRES

push namespace core

SP.CharRight:
inc l
ret nz
ld a,8
add a,h
ld h,a
cp $58
ccf
ret

pop namespace


;ELSE

;.SPCharRight
; ld a,h
; xor $20
; ld h,a
; cp $58
; ret nc
; inc l
; ret nz
; ld a,8
; add a,h
; ld h,a
; cp $58
; ccf
; ret
; Copyleft (k) 2008
; by Jose Rodriguez-Rosa (a.k.a. Boriel) <https://www.boriel.com>
; ----------------------------------------------------------------

; ENDIF
#include once [arch:zx48k] <SP/CharRight.asm>
66 changes: 6 additions & 60 deletions src/lib/arch/zxnext/runtime/SP/GetScrnAddr.asm
Original file line number Diff line number Diff line change
@@ -1,62 +1,8 @@
; ----------------------------------------------------------------
; This file is released under the MIT License
;
; GetScrnAddr
; Alvin Albrecht 2002
;

; Get Screen Address
;
; Computes the screen address given a valid pixel coordinate.
; (0,0) is located at the top left corner of the screen.
;
; enter: h = y coord
; l = x coord
; In hi-res mode, Carry is most significant bit of x coord (0..511 pixels)
; exit : de = screen address, b = pixel mask
; uses : af, b, de, hl

push namespace core
PROC
LOCAL rotloop, norotate

SPGetScrnAddr:
ld a,h
and $07
ld d,a
ld a,h
rra
rra
rra
and $18
or d
ld d,a

ld a,l
and $07
ld b,a
ld a,$80
jr z, norotate

rotloop:
rra
djnz rotloop

norotate:
ld b,a
srl l
srl l
srl l
ld a,h
rla
rla
and $e0
or l
ld e,a
ld hl, (SCREEN_ADDR)
add hl, de
ex de, hl
ret

ENDP
pop namespace
; Copyleft (k) 2008
; by Jose Rodriguez-Rosa (a.k.a. Boriel) <https://www.boriel.com>
; ----------------------------------------------------------------

#include once <sysvars.asm>
#include once [arch:zx48k] <SP/GetScrnAddr.asm>
61 changes: 6 additions & 55 deletions src/lib/arch/zxnext/runtime/SP/PixelDown.asm
Original file line number Diff line number Diff line change
@@ -1,57 +1,8 @@
; ----------------------------------------------------------------
; This file is released under the MIT License
;
; PixelDown
; Alvin Albrecht 2002
;

; Pixel Down
;
; Adjusts screen address HL to move one pixel down in the display.
; (0,0) is located at the top left corner of the screen.
;
; enter: HL = valid screen address
; exit : Carry = moved off screen
; Carry'= moved off current cell (needs ATTR update)
; HL = moves one pixel down
; used : AF, HL

push namespace core

SP.PixelDown:
PROC
LOCAL leave

push de
ld de, (SCREEN_ADDR)
or a
sbc hl, de
inc h
ld a,h
and $07
jr nz, leave
scf ; Sets carry on F', which flags ATTR must be updated
ex af, af'
ld a,h
sub $08
ld h,a
ld a,l
add a,$20
ld l,a
jr nc, leave
ld a,h
add a,$08
ld h,a
cp $19 ; carry = 0 => Out of screen
jr c, leave ; returns if out of screen
ccf
pop de
ret

leave:
add hl, de ; This always sets Carry = 0
pop de
ret

ENDP
pop namespace
; Copyleft (k) 2008
; by Jose Rodriguez-Rosa (a.k.a. Boriel) <https://www.boriel.com>
; ----------------------------------------------------------------

#include once <sysvars.asm>
#include once [arch:zx48k] <SP/PixelDown.asm>
56 changes: 6 additions & 50 deletions src/lib/arch/zxnext/runtime/SP/PixelLeft.asm
Original file line number Diff line number Diff line change
@@ -1,52 +1,8 @@
; ----------------------------------------------------------------
; This file is released under the MIT License
;
; PixelLeft
; Jose Rodriguez 2012
;

; PixelLeft
;
; Adjusts screen address HL and Pixel bit A to move one pixel to the left
; on the display. Start of line set Carry (Out of Screen)
;
; enter: HL = valid screen address
; A = Bit Set
; exit : Carry = moved off screen
; Carry' Set if moved off current ATTR CELL
; HL = moves one character left, if needed
; A = Bit Set with new pixel pos.
; used : AF, HL


push namespace core

SP.PixelLeft:
PROC

LOCAL leave

push de
ld de, (SCREEN_ADDR)
or a
sbc hl, de ; This always sets Carry = 0

rlca ; Sets new pixel bit 1 to the right
jr nc, leave
ex af, af' ; Signal in C' we've moved off current ATTR cell
ld a,l
dec a
ld l,a
cp 32 ; Carry if in screen
ccf
ld a, 1

leave: ; Sets screen offset back again
push af
add hl, de
pop af
pop de
ret

ENDP
pop namespace
; Copyleft (k) 2008
; by Jose Rodriguez-Rosa (a.k.a. Boriel) <https://www.boriel.com>
; ----------------------------------------------------------------

#include once <sysvars.asm>
#include once [arch:zx48k] <SP/PixelLeft.asm>
57 changes: 6 additions & 51 deletions src/lib/arch/zxnext/runtime/SP/PixelRight.asm
Original file line number Diff line number Diff line change
@@ -1,53 +1,8 @@
; ----------------------------------------------------------------
; This file is released under the MIT License
;
; PixelRight
; Jose Rodriguez 2012
;


; PixelRight
;
; Adjusts screen address HL and Pixel bit A to move one pixel to the left
; on the display. Start of line set Carry (Out of Screen)
;
; enter: HL = valid screen address
; A = Bit Set
; exit : Carry = moved off screen
; Carry' Set if moved off current ATTR CELL
; HL = moves one character left, if needed
; A = Bit Set with new pixel pos.
; used : AF, HL


push namespace core

SP.PixelRight:
PROC

LOCAL leave

push de
ld de, (SCREEN_ADDR)
or a
sbc hl, de ; This always sets Carry = 0

rrca ; Sets new pixel bit 1 to the right
jr nc, leave
ex af, af' ; Signal in C' we've moved off current ATTR cell
ld a, l
inc a
ld l, a
cp 32 ; Carry if IN screen
ccf
ld a, 80h

leave: ; Sets screen offset back again
push af
add hl, de
pop af
pop de
ret

ENDP
pop namespace
; Copyleft (k) 2008
; by Jose Rodriguez-Rosa (a.k.a. Boriel) <https://www.boriel.com>
; ----------------------------------------------------------------

#include once <sysvars.asm>
#include once [arch:zx48k] <SP/PixelRight.asm>
Loading