Little things in life... .BIG BRAIN
CRAZY ALEX & ANDY Inc.
Hi our dear readers, as you know, our
life. We will describe how various little things that are constantly
fly out of your head.
----------------------------------------------------------------
; writing a value to the port.
Aircraft LD, port address (full)
LD A, data
0UT (C),A
----------------------------------------------------------------
; transferring memory chunks
LD HL, from (address)
LD DE, where (address)
LD sun, how much (length)LDIR
----------------------------------------------------------------
; switching memory segments
LD A, segment number + 1b
LD VS,327b5
0UT (C),A
There are 8 segments in total in SPECCY, each 1b kb.
2 - segment is the area from address 327b8 with a length of 1b384
5 - segment is an area from address 1b384 1b384 long
all segments are connected from address 49152.
It is advisable to click segments with full port addressing (as
written here) otherwise the owners may throw bricks at you
SC0RPI0N's.
----------------------------------------------------------------
; group readingsectors from disk
LD B, number of sectors
LD HL, memory load address
LD C,05; "read sector group" command
LD DE,(#5CF4) ; current track/sector, in this version
; taken from the TR-DOS system variable.
CALL #3D13
----------------------------------------------------------------
; memory card
ROM - from address 00000 to 1b383
high resolution display - from 1b384 to 22527
attribute screen - from 22528 to 23295
printer buffer - from 2329b to 23551
BASIC system variables - from 23552 to 23733
TR-DOS system variables - from 23734 to 238bb
beginning of the BASIC program - 238b7
----------------------------------------------------------------
; key pollingSPECCY keyboard layout
┌─────────────────── ────────────────────┐
│ cleared bit │▒▒
├───┬───┬───┬───┬───╖ ───┬───┬───┬───┬───┤▒▒
│D0 │D1 │D2 │D3 │D4 ║D4 │D3 │D2 │D1 │D0 │▒▒
╔═╦═════╪═══╪═══╪═══╪═══╪═══ ╬═══╪═══╪═══╪═══╪═══╪═════╦═╗
║П║#F7FE│ 1 │ 2 │ 3 │ 4 │ 5 ║ b │ 7 │ 8 │ 9 │ 0 │#EFFE║П║▒▒
║ ║─────┼───┼───┼───┼───┼─── ╫───┼───┼───┼───┼───┼─────╢ ║▒▒
║0║#FBFE│ Q │ W │ E │ R │ T ║ Y │ U │ I │ 0 │ P │#DFFE║0║▒▒
║ ║─────┼───┼───┼───┼───┼─── ╫───┼───┼───┼───┼───┼─────╢ ║▒▒
║P║#FDFE│ A │ S │ D │ F │ G ║ N │ J │ K │ L │ EN│#BFFE║P║▒▒
║ ║─────┼───┼───┼───┼───┼─── ╫───┼───┼───┼───┼───┼─────╢ ║▒▒
║Т║#FEFE│ CS│ Z │ Х │ С │ V ║ В │ N │ М │ SS│ SP│#7FFE║Т║▒▒
╚═╩═════╧═══╧═══╧═══╧═══╧═══╩ ═══╧═══╧═══╧═══╧═══╧═════╩═╝▒▒
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
If the button is in the depressed state, then the bit is set to
one, and if pressed, then, accordingly, to zero.survey
LD Sun,#7FFE
IN A, (C)
BIT 0.A
JP Z, the address to which the program will go when pressed
to space.
; pressing any key (including CAPS and SYMB0L SHIFT)
M1 X0R A
IN A,(#FE)
CPL
AND 31
JR Z,M1
......... KEY PRESSED
----------------------------------------------------------------
; clearing the screen
LD HL,1b384 OR LD HL,23295
LD DE,1b385 LDDE,23294
LD VS, b911 LD VS, b911
LD (HL),0 LD (HL),0
LDIR LDDR
----------------------------------------------------------------
; converting pixel addresses to attribute addresses
LD HL, address on screen
LD A,H
AND #18
RRCA
RRCA
RRCA
0R #58
LD H,A
at the output in HL - address in attributes
; converting attribute addresses to pixel addresses
LD HL, attribute address
LD A,HRRCA
RRCA
RRCA
AND #18
0R #40
LD Н,А
at the exit to HL - address on the screen
----------------------------------------------------------------
; getting an address on the screen by a given column and row
LD B, column
LD C, row
LD A,C
AND #18
0R #40
LD H,A
LD A,C
AND 7
0R A
RRA
RRARRA
RRA
ADD A, B
LD L,A
at the exit to HL - address on the screen
----------------------------------------------------------------
; bottom line address on screen
at the entrance to HL - address on the screen
at the output in HL - the address of the next line
INCH INC N
LD A,H
AND 7
RET NZ
LD A,L
ADD A,32
LD L,A
RET C
LD A,H
SUB 8LD H,A
RET
; top line address on screen
at the entrance to HL - address on the screen
at the output in HL - the address of the next line
DECH LD A,H
DEC N
AND 7
RET NZ
LD A,L
SUB 32
LD L,A
RET C
LD A,H
ADD A,8
LD H,A
RET
----------------------------------------------------------------
;procedure for calculating a track/sector based on the offset in sectors from
relative to the given track/sector
at the input: DE - current track/sector
HL - number of skipped sectors
output: DE - calculation result
at the input: DE - current track/sector
HL - number of skipped sectors
output: DE - calculation result
CALC LD Sun,#10
LD A,D
ADD HL,DE
LD D,A
M1 AND A
SBC HL,VS
JR C,M2
INC D
JRM1
M2 ADD HL,VS
LD E,L
RET
----------------------------------------------------------------
P.S: We hope that these little things will make life easier for someone...
****************************************************************
Share your thoughts about the article