Diferencias
Muestra las diferencias entre dos versiones de la página.
Ambos lados, revisión anterior Revisión previa Próxima revisión | Revisión previa | ||
cursos:ensamblador:rutinas_save_load [19-01-2024 07:59] – sromero | cursos:ensamblador:rutinas_save_load [19-01-2024 11:58] (actual) – sromero | ||
---|---|---|---|
Línea 139: | Línea 139: | ||
</ | </ | ||
- | Este comando BASIC salvaría (SAVE), un total de 2 bytes (2) de datos (CODE), empezando en 0 (0) a cinta. En resumen, salvaría el contenido de la dirección de memoria | + | Este comando BASIC salvaría (SAVE), un total de 2 bytes (2) de datos (CODE), empezando en 0 (0) a cinta. En resumen, salvaría el contenido de la dirección de memoria |
< | < | ||
Línea 173: | Línea 173: | ||
| ff | f3 af | a3 | | | ff | f3 af | a3 | | ||
- | En este caso el byte flag es 0xFF (bloque de tipo " | + | En este caso el byte flag es $FF (bloque de tipo " |
\\ | \\ | ||
Línea 189: | Línea 189: | ||
| IX | Dirección inicio de memoria donde almacenar los datos que se van a cargar. | | | IX | Dirección inicio de memoria donde almacenar los datos que se van a cargar. | | ||
| DE | Longitud del bloque de datos a cargar. | | | DE | Longitud del bloque de datos a cargar. | | ||
- | | A | Flag Byte, normalmente | + | | A | Flag Byte, normalmente |
| CF (CarryFlag) | 1=LOAD, 0=VERIFY | | | CF (CarryFlag) | 1=LOAD, 0=VERIFY | | ||
Línea 203: | Línea 203: | ||
<code z80> | <code z80> | ||
- | scf ; Set Carry Flag -> CF=1 -> LOAD | + | scf |
- | ld a, 255 | + | ld a, $ff ; A = $FF (cargar datos) |
- | ld ix, 16384 | + | ld ix, 16384 ; Destino del load = 16384 |
- | ld de, 6912 ; Tamaño a cargar = 6912 | + | ld de, 6912 |
- | call 1366 ; Llamamos a la rutina de carga | + | call 1366 |
</ | </ | ||
Línea 213: | Línea 213: | ||
<code z80> | <code z80> | ||
- | scf | + | scf ; Set Carry Flag (LOAD) |
- | ld a, 255 ; A = 0xFF (cargar datos) | + | ld a, $ff |
- | ld ix, 32768 ; Destino de la carga | + | ld ix, 32768 |
- | ld de, 12000 ; Nuestro " | + | ld de, 12000 |
- | call $0556 ; Recordemos que 0556h = 1366d | + | call $0556 |
- | jp 32768 ; Saltamos al programa código máquina cargado | + | jp 32768 |
</ | </ | ||
Línea 230: | Línea 230: | ||
| IX | Dirección inicio de memoria de los datos que se van a grabar. | | | IX | Dirección inicio de memoria de los datos que se van a grabar. | | ||
| DE | Longitud del bloque de datos a grabar (se grabarán los datos desde IX a IX+DE). | | | DE | Longitud del bloque de datos a grabar (se grabarán los datos desde IX a IX+DE). | | ||
- | | A | Flag Byte, 0x00 para grabar cabeceras o 0xFF (255) para grabar datos. | | + | | A | Flag Byte, $00 para grabar cabeceras o $FF (255) para grabar datos. | |
| CF (CarryFlag) | 0 (SAVE) | | | CF (CarryFlag) | 0 (SAVE) | | ||
Línea 249: | Línea 249: | ||
scf ; Set Carry Flag -> CF=1 -> LOAD | scf ; Set Carry Flag -> CF=1 -> LOAD | ||
- | ld a, 255 ; A = 0xFF (cargar datos) | + | ld a, $ff ; A = $FF (cargar datos) |
ld ix, direccion_destino | ld ix, direccion_destino | ||
ld de, tamaño_a_cargar | ld de, tamaño_a_cargar | ||
Línea 372: | Línea 372: | ||
scf ; Set Carry Flag -> CF=1 -> LOAD | scf ; Set Carry Flag -> CF=1 -> LOAD | ||
- | ld a, 255 ; A = 0xFF (cargar datos) | + | ld a, $ff ; A = $FF (cargar datos) |
ld ix, 16384 ; Destino del load = 16384 | ld ix, 16384 ; Destino del load = 16384 | ||
- | ld de, 6912 ; Tamaño a cargar = 6912 | + | ld de, 6912 ; Tamaño a cargar = 6912 bytes |
call 1366 ; Llamamos a la rutina de carga | call 1366 ; Llamamos a la rutina de carga | ||
Línea 419: | Línea 419: | ||
El código comentado está extraído del documento "//The Complete Spectrum ROM Disassembly//", | El código comentado está extraído del documento "//The Complete Spectrum ROM Disassembly//", | ||
- | <code z80> | + | <code z80> |
; THE ' | ; THE ' | ||
; This subroutine is called to LOAD the header information (from 07BE) | ; This subroutine is called to LOAD the header information (from 07BE) | ||
Línea 425: | Línea 425: | ||
0556 LD-BYTES: | 0556 LD-BYTES: | ||
inc | inc | ||
- | ; cannot hold +FF.) | + | ; cannot hold $FF.) |
- | ex af,a'f' | + | ex af, af' |
- | ; header and +FF for a block of | + | ; header and $FF for a block of |
; data. | ; data. | ||
; The carry flag is reset for | ; The carry flag is reset for | ||
Línea 436: | Línea 436: | ||
di ; The maskable interrupt is now | di ; The maskable interrupt is now | ||
; disabled. | ; disabled. | ||
- | ld a,+0F ; The border is made WHITE. | + | ld a,$0f ; The border is made WHITE. |
- | | + | |
- | ld hl,+053F ; Preload the machine stack | + | ld hl,$053f ; Preload the machine stack |
push hl ; with the address - SA/LD-ret. | push hl ; with the address - SA/LD-ret. | ||
- | | + | |
rra ; Rotate the byte obtained but | rra ; Rotate the byte obtained but | ||
- | | + | |
- | | + | |
ld c,a ; Store the value in the C register. - | ld c,a ; Store the value in the C register. - | ||
- | ; (+22 for ' | + | ; ($22 for ' |
; - the present EAR state.) | ; - the present EAR state.) | ||
cp a ; Set the zero flag. | cp a ; Set the zero flag. | ||
Línea 455: | Línea 455: | ||
; being pressed. | ; being pressed. | ||
056C LD-START | 056C LD-START | ||
- | jr nc,056B, | + | jr nc,056b, |
; approx. 14,000 T states. But if | ; approx. 14,000 T states. But if | ||
; an ' | ; an ' | ||
Línea 463: | Línea 463: | ||
; that the signal is still pulsing. | ; that the signal is still pulsing. | ||
- | ld hl,+0415 ; The length of this waiting | + | ld hl,$0415 ; The length of this waiting |
0574 LD-WAIT | 0574 LD-WAIT | ||
dec | dec | ||
Línea 470: | Línea 470: | ||
jr nz, | jr nz, | ||
call 05E3, | call 05E3, | ||
- | jr nc,056B, | + | jr nc,056b, |
; period. | ; period. | ||
; Now accept only a ' | ; Now accept only a ' | ||
- | 0580 LD-LEADER | + | 0580 LD-LEADER |
call 05E3, | call 05E3, | ||
jr nc, | jr nc, | ||
; period. | ; period. | ||
- | ld a,+C6 ; However the edges must have | + | ld a,$c6 ; However the edges must have |
cp b ; been found within about | cp b ; been found within about | ||
- | jr nc,056C, | + | jr nc,056c, |
inc | inc | ||
jr nz, | jr nz, | ||
Línea 488: | Línea 488: | ||
; After the leader come the ' | ; After the leader come the ' | ||
- | 058F LD-SYNC | + | 058F LD-SYNC |
call 05E7, | call 05E7, | ||
- | jr nc,056B, | + | jr nc,056b, |
ld a,b ; together - these will be the | ld a,b ; together - these will be the | ||
- | CP | + | CP |
- | jr nc,058F, | + | jr nc,058f, |
- | call 05E7, | + | call 05e7, |
ret | ret | ||
; (Return carry flag reset.) | ; (Return carry flag reset.) | ||
Línea 502: | Línea 502: | ||
ld a,c ; The border colours from now | ld a,c ; The border colours from now | ||
- | XOR +03 ; on will be BLUE & YELLOW. | + | XOR $03 ; on will be BLUE & YELLOW. |
ld c,a | ld c,a | ||
- | ld h,+00 ; Initialise the ' | + | ld h,$00 ; Initialise the ' |
; byte to zero. | ; byte to zero. | ||
- | ld b,+B0 ; Set the timing constant for the | + | ld b,$b0 ; Set the timing constant for the |
; flag byte. | ; flag byte. | ||
jr 05C8, | jr 05C8, | ||
Línea 516: | Línea 516: | ||
; the last byte is the ' | ; the last byte is the ' | ||
- | 05A9 LD-LOOP | + | 05A9 LD-LOOP |
jr nz, | jr nz, | ||
; handling the first byte. | ; handling the first byte. | ||
Línea 548: | Línea 548: | ||
05C2 LD-NEXT | 05C2 LD-NEXT | ||
- | 05C4 LD-dec | + | 05C4 LD-dec |
- | ex af,a'f' | + | ex af,af' |
- | ld b,+B2 ; Set the timing constant. | + | ld b,$b2 ; Set the timing constant. |
- | 05C8 LD-MARKER | + | 05C8 LD-MARKER |
; from a ' | ; from a ' | ||
Línea 560: | Línea 560: | ||
ret | ret | ||
; exceeded. (Carry flag reset.) | ; exceeded. (Carry flag reset.) | ||
- | ld a,+CB ; Compare the length against | + | ld a,$cb ; Compare the length against |
; approx. 2,400 T states; resetting | ; approx. 2,400 T states; resetting | ||
cp b ; the carry flag for a ' | cp b ; the carry flag for a ' | ||
Línea 566: | Línea 566: | ||
rl l ; Include the new bit in the L | rl l ; Include the new bit in the L | ||
; register. | ; register. | ||
- | ld b,+B0 ; Set the timing constant for the | + | ld b,$b0 ; Set the timing constant for the |
; next bit. | ; next bit. | ||
jp nc, | jp nc, | ||
Línea 583: | Línea 583: | ||
ld a,h ; Fetch the ' | ld a,h ; Fetch the ' | ||
; byte. | ; byte. | ||
- | CP | + | CP |
ret ; if the value is zero. | ret ; if the value is zero. | ||
; (Carry flag reset if in error.) | ; (Carry flag reset if in error.) | ||
Línea 602: | Línea 602: | ||
ret | ret | ||
; is an error. | ; is an error. | ||
- | 05E7 LD-EDGE-1 | + | 05E7 LD-EDGE-1 |
05E9 LD-DELAY | 05E9 LD-DELAY | ||
jr nz, | jr nz, | ||
Línea 613: | Línea 613: | ||
ret | ret | ||
; ' | ; ' | ||
- | ld a,+7F ; Read from port +7FFE. | + | ld a,$7F ; Read from port $7FFE. |
- | IN A,(+FE) ; i.e. BREAK & EAR. | + | IN A,($fe) ; i.e. BREAK & EAR. |
rra ; Shift the byte. | rra ; Shift the byte. | ||
ret | ret | ||
; if BREAK was pressed. | ; if BREAK was pressed. | ||
xor | xor | ||
- | AND +20 ; 'last edge-type'; | + | AND $20 ; 'last edge-type'; |
jr z, | jr z, | ||
Línea 628: | Línea 628: | ||
cpl ; and border colour. | cpl ; and border colour. | ||
ld c,a | ld c,a | ||
- | AND +07 ; Keep only the border colour. | + | AND $07 ; Keep only the border colour. |
- | OR | + | OR |
- | OUT (+FE),A ; Change the border colour (RED/ | + | OUT ($fe),A ; Change the border colour (RED/ |
; CYAN or BLUE/ | ; CYAN or BLUE/ | ||
scf ; Signal the successful search | scf ; Signal the successful search | ||
Línea 641: | Línea 641: | ||
; allowance is made for ten additional passes through the sampling loop. | ; allowance is made for ten additional passes through the sampling loop. | ||
; The search is thereby for the next edge to be found within, roughly, | ; The search is thereby for the next edge to be found within, roughly, | ||
- | ; 1,100 T states (465 + 10 * 58 + overhead). This will prove successful | + | ; 1,100 T states (465 $ 10 * 58 $ overhead). This will prove successful |
; for the sync ' | ; for the sync ' | ||
</ | </ | ||
+ | |||
+ | |||
\\ | \\ | ||
===== Ficheros ===== | ===== Ficheros ===== |