rutina custom loader

Soporte técnico sobre los lanzamientos de MojonTwins y comentarios sobre los güegos. Ofrecemos soporte técnico con Fourspriter, te ayudamos con ZX Basic o Z88DK, te damos pistas some cómo saltarse un bicho y cosas así.

Moderador: na_th_an

antoniovillena
Mensajes: 494
Registrado: Jue, 24 Oct 2013, 15:52

Re: rutina custom loader

Mensajepor antoniovillena » Mar, 18 Feb 2014, 01:07

De nada. Si quieres hacer cambios más complejos tendrás que ir buscándote un tutorial de ensamblador del Z80.
Avatar de Usuario
astromarinecorps
Mensajes: 28
Registrado: Sab, 15 Feb 2014, 17:52

Re: rutina custom loader

Mensajepor astromarinecorps » Mar, 18 Feb 2014, 01:16

no, solamente saber donde ubicar el cambio de color para el filo 2, y la parte donde se especifica que y donde se carga lo que viene despues, para poder incluir la rutina de carga previa al code de un juego, sino la rutina no sirve de nada, jajajaja. gracias, estoy echando un vistazo al curso de codigo maquina de microhobby... pero no veas...
antoniovillena
Mensajes: 494
Registrado: Jue, 24 Oct 2013, 15:52

Re: rutina custom loader

Mensajepor antoniovillena » Mar, 18 Feb 2014, 01:21

No sé lo que es el filo 2. En cuanto a la llamada, es sencillo:
$this->bbcode_second_pass_code('', '
ld ix, $4000
ld de, $1b00
scf
ld a, $ff
call L0556
')

En "ix" le decimos dónde se cargará (en pantalla) y en "de" cuántos bytes vamos a cargar (los que ocupan una pantalla).
Avatar de Usuario
astromarinecorps
Mensajes: 28
Registrado: Sab, 15 Feb 2014, 17:52

Re: rutina custom loader

Mensajepor astromarinecorps » Mar, 18 Feb 2014, 01:33

segun he entendido a parte de otras cosas hay 2 partes en esta rutina (ld edge 1 y ld edge 2) uno sería el borde primero clasico rojo y cyan y el otro el de los datos Amarillo y Azul oscuro, he conseguido cambiar el color pero ambos filos salen del mismo color pero ten en cuenta que esto está en la rutina LD-EDGE-1. Tendrías que crearte otra rutina idéntica pero con otros colores para distinguir el tono guía del resto de la carga, eso que me pusiste es lo que no entiendo y no se donde ubicarlo ni que poner, y de lo otro me referia a que la rutina hiciera un load""code y cargara el bloque del juego y lo ejecutara, que no hiciera un solo load""screen o que al menos no se quede colgada, y grabar esta rutina como code cargada y ejecutada en un cargador (con su load code y randomize) en donde yo pueda meter mis load, load screen y randomizes de otro bloque del juego. es decir: conseguir cambiar los 2 filos de carga, que solo esta rutina cambie los colores y nada mas, grabar esta rutina como code, y despues hacerme mi cargador: load "rutina" code rutina, randomize usr rutina, load "juego" code, randomize usr juego. No se si me he explicado
Avatar de Usuario
astromarinecorps
Mensajes: 28
Registrado: Sab, 15 Feb 2014, 17:52

Re: rutina custom loader

Mensajepor astromarinecorps » Mar, 18 Feb 2014, 02:49

ld ix, $4000
ld de, $1b00
scf
ld a, $ff
call L0556

ahora acabo de entender que 4000 es 16384 en hex y que 1b00 es 6912 en hex, he probado a poner la length y data de mi bloque pasado a hex y no me lo carga :bronca:
antoniovillena
Mensajes: 494
Registrado: Jue, 24 Oct 2013, 15:52

Re: rutina custom loader

Mensajepor antoniovillena » Mar, 18 Feb 2014, 03:11

Mira te voy a dar el código ya preparado, pero es lo mismo que te expliqué al principio.

$this->bbcode_second_pass_code('', '
org $8000-22
ld de, fin-1
di
defb $de, $c0, $37, $0e, $8f, $39, $96
ld hl, $5ccb+fin-start+21
ld bc, fin-start
lddr
jp $8000
start ld ix, $4000
ld de, $1b00
scf
ld a, $ff
call L0556
loop jr loop

;; SA/LD-RET
L053F: PUSH AF ; preserve accumulator throughout.
LD A,($5C48) ; fetch border colour from BORDCR.
AND $38 ; mask off paper bits.
RRCA ; rotate
RRCA ; to the
RRCA ; range 0-7.

OUT ($FE),A ; change the border colour.

LD A,$7F ; read from port address $7FFE the
IN A,($FE) ; row with the space key at outside.

RRA ; test for space key pressed.
EI ; enable interrupts
JR C,L0554 ; forward to SA/LD-END if not


;; REPORT-Da
L0552: RST 08H ; ERROR-1
DEFB $0C ; Error Report: BREAK - CONT repeats

; ---

;; SA/LD-END
L0554: POP AF ; restore the accumulator.
RET ; return.

; ------------------------------------
; Load header or block of information
; ------------------------------------
; This routine is used to load bytes and on entry A is set to $00 for a
; header or to $FF for data. IX points to the start of receiving location
; and DE holds the length of bytes to be loaded. If, on entry the carry flag
; is set then data is loaded, if reset then it is verified.

;; LD-BYTES
L0556: INC D ; reset the zero flag without disturbing carry.
EX AF,AF' ; preserve entry flags.
DEC D ; restore high byte of length.

DI ; disable interrupts

LD A,$0F ; make the border white and mic off.
OUT ($FE),A ; output to port.

LD HL,L053F ; Address: SA/LD-RET
PUSH HL ; is saved on stack as terminating routine.

; the reading of the EAR bit (D6) will always be preceded by a test of the
; space key (D0), so store the initial post-test state.

IN A,($FE) ; read the ear state - bit 6.
RRA ; rotate to bit 5.
AND $20 ; isolate this bit.
OR $02 ; combine with red border colour.
LD C,A ; and store initial state long-term in C.
CP A ; set the zero flag.

;

;; LD-BREAK
L056B: RET NZ ; return if at any time space is pressed.

;; LD-START
L056C: CALL L05E7 ; routine LD-EDGE-1
JR NC,L056B ; back to LD-BREAK with time out and no
; edge present on tape.

; but continue when a transition is found on tape.

LD HL,$0415 ; set up 16-bit outer loop counter for
; approx 1 second delay.

;; LD-WAIT
L0574: DJNZ L0574 ; self loop to LD-WAIT (for 256 times)

DEC HL ; decrease outer loop counter.
LD A,H ; test for
OR L ; zero.
JR NZ,L0574 ; back to LD-WAIT, if not zero, with zero in B.

; continue after delay with H holding zero and B also.
; sample 256 edges to check that we are in the middle of a lead-in section.

CALL L05E3 ; routine LD-EDGE-2
JR NC,L056B ; back to LD-BREAK
; if no edges at all.

;; LD-LEADER
L0580: LD B,$9C ; set timing value.
CALL L05E3 ; routine LD-EDGE-2
JR NC,L056B ; back to LD-BREAK if time-out

LD A,$C6 ; two edges must be spaced apart.
CP B ; compare
JR NC,L056C ; back to LD-START if too close together for a
; lead-in.

INC H ; proceed to test 256 edged sample.
JR NZ,L0580 ; back to LD-LEADER while more to do.

; sample indicates we are in the middle of a two or five second lead-in.
; Now test every edge looking for the terminal sync signal.

;; LD-SYNC
L058F: LD B,$C9 ; initial timing value in B.
CALL L05E7 ; routine LD-EDGE-1
JR NC,L056B ; back to LD-BREAK with time-out.

LD A,B ; fetch augmented timing value from B.
CP $D4 ; compare
JR NC,L058F ; back to LD-SYNC if gap too big, that is,
; a normal lead-in edge gap.

; but a short gap will be the sync pulse.
; in which case another edge should appear before B rises to $FF

CALL L05E7 ; routine LD-EDGE-1
RET NC ; return with time-out.

; proceed when the sync at the end of the lead-in is found.
; We are about to load data so change the border colours.

LD A,C ; fetch long-term mask from C
XOR $03 ; and make blue/yellow.

LD C,A ; store the new long-term byte.

LD H,$00 ; set up parity byte as zero.
LD B,$B0 ; timing.
JR L05C8 ; forward to LD-MARKER
; the loop mid entry point with the alternate
; zero flag reset to indicate first byte
; is discarded.

; --------------
; the loading loop loads each byte and is entered at the mid point.

;; LD-LOOP
L05A9: EX AF,AF' ; restore entry flags and type in A.
JR NZ,L05B3 ; forward to LD-FLAG if awaiting initial flag
; which is to be discarded.

JR NC,L05BD ; forward to LD-VERIFY if not to be loaded.

LD (IX+$00),L ; place loaded byte at memory location.
JR L05C2 ; forward to LD-NEXT

; ---

;; LD-FLAG
L05B3: RL C ; preserve carry (verify) flag in long-term
; state byte. Bit 7 can be lost.

XOR L ; compare type in A with first byte in L.
RET NZ ; return if no match e.g. CODE vs. DATA.

; continue when data type matches.

LD A,C ; fetch byte with stored carry
RRA ; rotate it to carry flag again
LD C,A ; restore long-term port state.

INC DE ; increment length ??
JR L05C4 ; forward to LD-DEC.
; but why not to location after ?

; ---
; for verification the byte read from tape is compared with that in memory.

;; LD-VERIFY
L05BD: LD A,(IX+$00) ; fetch byte from memory.
XOR L ; compare with that on tape
RET NZ ; return if not zero.

;; LD-NEXT
L05C2: INC IX ; increment byte pointer.

;; LD-DEC
L05C4: DEC DE ; decrement length.
EX AF,AF' ; store the flags.
LD B,$B2 ; timing.

; when starting to read 8 bits the receiving byte is marked with bit at right.
; when this is rotated out again then 8 bits have been read.

;; LD-MARKER
L05C8: LD L,$01 ; initialize as %00000001

;; LD-8-BITS
L05CA: CALL m05E3 ; routine LD-EDGE-2 increments B relative to
; gap between 2 edges.
RET NC ; return with time-out.

LD A,$CB ; the comparison byte.
CP B ; compare to incremented value of B.
; if B is higher then bit on tape was set.
; if <= then bit on tape is reset.

RL L ; rotate the carry bit into L.

LD B,$B0 ; reset the B timer byte.
JP NC,L05CA ; JUMP back to LD-8-BITS

; when carry set then marker bit has been passed out and byte is complete.

LD A,H ; fetch the running parity byte.
XOR L ; include the new byte.
LD H,A ; and store back in parity register.

LD A,D ; check length of
OR E ; expected bytes.
JR NZ,L05A9 ; back to LD-LOOP
; while there are more.

; when all bytes loaded then parity byte should be zero.

LD A,H ; fetch parity byte.
CP $01 ; set carry if zero.
RET ; return
; in no carry then error as checksum disagrees.

; -------------------------
; Check signal being loaded
; -------------------------
; An edge is a transition from one mic state to another.
; More specifically a change in bit 6 of value input from port $FE.
; Graphically it is a change of border colour, say, blue to yellow.
; The first entry point looks for two adjacent edges. The second entry point
; is used to find a single edge.
; The B register holds a count, up to 256, within which the edge (or edges)
; must be found. The gap between two edges will be more for a '1' than a '0'
; so the value of B denotes the state of the bit (two edges) read from tape.

; ->

;; LD-EDGE-2
L05E3: CALL L05E7 ; call routine LD-EDGE-1 below.
RET NC ; return if space pressed or time-out.
; else continue and look for another adjacent
; edge which together represent a bit on the
; tape.

; ->
; this entry point is used to find a single edge from above but also
; when detecting a read-in signal on the tape.

;; LD-EDGE-1
L05E7: LD A,$16 ; a delay value of twenty two.

;; LD-DELAY
L05E9: DEC A ; decrement counter
JR NZ,L05E9 ; loop back to LD-DELAY 22 times.

AND A ; clear carry.

;; LD-SAMPLE
L05ED: INC B ; increment the time-out counter.
RET Z ; return with failure when $FF passed.

LD A,$7F ; prepare to read keyboard and EAR port
IN A,($FE) ; row $7FFE. bit 6 is EAR, bit 0 is SPACE key.
RRA ; test outer key the space. (bit 6 moves to 5)
RET NC ; return if space pressed. >>>

XOR C ; compare with initial long-term state.
AND $20 ; isolate bit 5
JR Z,L05ED ; back to LD-SAMPLE if no edge.

; but an edge, a transition of the EAR bit, has been found so switch the
; long-term comparison byte containing both border colour and EAR bit.

LD A,C ; fetch comparison value.
CPL ; switch the bits
LD C,A ; and put back in C for long-term.
rrca
ld a, 1+8
jr c, bbbb
ld a, 2+8
bbbb:
OUT ($FE),A ; send to port to effect the change of colour.

SCF ; set carry flag signaling edge found within
; time allowed.
RET ; return.


;; LD-EDGE-2
m05E3: CALL m05E7 ; call routine LD-EDGE-1 below.
RET NC ; return if space pressed or time-out.
; else continue and look for another adjacent
; edge which together represent a bit on the
; tape.

; ->
; this entry point is used to find a single edge from above but also
; when detecting a read-in signal on the tape.

;; LD-EDGE-1
m05E7: LD A,$16 ; a delay value of twenty two.

;; LD-DELAY
m05E9: DEC A ; decrement counter
JR NZ,m05E9 ; loop back to LD-DELAY 22 times.

AND A ; clear carry.

;; LD-SAMPLE
m05ED: INC B ; increment the time-out counter.
RET Z ; return with failure when $FF passed.

LD A,$7F ; prepare to read keyboard and EAR port
IN A,($FE) ; row $7FFE. bit 6 is EAR, bit 0 is SPACE key.
RRA ; test outer key the space. (bit 6 moves to 5)
RET NC ; return if space pressed. >>>

XOR C ; compare with initial long-term state.
AND $20 ; isolate bit 5
JR Z,m05ED ; back to LD-SAMPLE if no edge.

; but an edge, a transition of the EAR bit, has been found so switch the
; long-term comparison byte containing both border colour and EAR bit.

LD A,C ; fetch comparison value.
CPL ; switch the bits
LD C,A ; and put back in C for long-term.

rrca
ld a, 3+8
jr c, cccc
ld a, 4+8
cccc:
OUT ($FE),A ; send to port to effect the change of colour.

SCF ; set carry flag signaling edge found within
; time allowed.
RET ; return.
fin
')

Como ayuda yo creo que ya está bien. Ya tendrías que ir aprendiendo por tu cuenta.
Avatar de Usuario
astromarinecorps
Mensajes: 28
Registrado: Sab, 15 Feb 2014, 17:52

Re: rutina custom loader

Mensajepor astromarinecorps » Mar, 18 Feb 2014, 14:30

entendido, gracias por todo, podeís cerrar el hilo.
antoniovillena
Mensajes: 494
Registrado: Jue, 24 Oct 2013, 15:52

Re: rutina custom loader

Mensajepor antoniovillena » Mar, 18 Feb 2014, 18:56

No hace falta cerrar el hilo, puede ser de utilidad para otra gente. También podemos ver por aquí los avances que vayas haciendo con tu rutina.
Avatar de Usuario
astromarinecorps
Mensajes: 28
Registrado: Sab, 15 Feb 2014, 17:52

Re: rutina custom loader

Mensajepor astromarinecorps » Mié, 19 Feb 2014, 01:46

dejo mi rutina casi terminada a falta de que algun conocedor me apunte algun dato sobre como conseguir que la rutina cargue un bloque a unos baudios especiales, en resumen poder modificar los parametros de carga por ejemplo estos son los de la carga menos rapida de "La Abadia del Crimen" pilot pulse lenght 2506, 1st syn pulses 1302,2nd syn pulses 1302,0 bit pulse len 1300,1 bit pulse len 2600,pilot tone 4095,last bits 8.
Adjuntos
modload.zip
(2.82 KiB) Descargado 336 veces
antoniovillena
Mensajes: 494
Registrado: Jue, 24 Oct 2013, 15:52

Re: rutina custom loader

Mensajepor antoniovillena » Mié, 19 Feb 2014, 02:05

Ten en cuenta que tienes que subir la velocidad tanto en el código como en el fichero de carga. El fichero de carga tiene que ser obligatoriamente .tzx o .wav, ya no te vale que sea .tap. Con GenTape puedes hacer usando un bloque de tipo "pure" (no puedes modificar la frecuencia/duración de tono guía) o de tipo "turbo" (puedes modificar la frecuencia/duración del tono guía.

He visto cómo en el TZX has metido un bloque BASIC. No tiene mucho sentido porque usas un cargador basic para cargar un cargador C/M. En total son 4 bloques de carga estándar (doble de tiempo) en lugar de 2.

Volver a “Ayuda”

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 62 invitados