Acá estoy '¡chalao perdio!' seguir el código de ese titán llamado Syx (ya me veo a Mauri pensando/diciendo: "Pisha, pero si son tres Outs de naaaá!!"). Así que me gustaría preguntarle algunas cosillas al respecto. Sea usted bueno conmigo, caballero, tanto en la forma de expresar ciertas cosas que son nuevas para mi como en lo de preguntar ciertas cosas, pero es que llevo un buen tiempo liado con la comprensión del código. ¡Asias!
¡Hay que ver lo ordenadito que programas!, tío.
Código: Seleccionar todo
ORG $1180
; ---------------------------------------------------------------------------
inicio
; Tomamos el control del sistema
DI
IM 1
LD HL,$C9FB ; EI ($FB) + RET ($C9)
LD ($0038),HL ; Habría un retardo de 4 NOPs al responder a las interrupciones
LD SP,inicio ; Inicializamos la pila
EI
Código: Seleccionar todo
; ---------------------------------------------------------------------------
; Esperamos el refresco vertical
; ---------------------------------------------------------------------------
espera_refresco
LD B,HIGH PPI_B
.bucle_espera_refresco
IN A,(C)
RRA
JR NC,.bucle_espera_refresco
RET
Veo que lees en en A el 'contenido' de la puerta/puerto (C) sin haber primero especificado un valor para C, es como si supieses al
empezar el programa que valor va a tener. ¿Puedes aclararlo?.
Código: Seleccionar todo
; Tintas a negro
LD C,INK + NEGRO
XOR A
.bucle_apagon
OUT (C),A
OUT (C),C
INC A
CP $11
JR NZ,.bucle_apagon
Código: Seleccionar todo
; Dimensiones y centrado de la pantalla para el CRTC
LD HL,valores_crtc
LD A,6
LD BC,$BDBE ; (>CRTC_SELECT + 1) * 256 + (>CRTC_WRITE + 1) VASM Syntax Rulez!!! :P
.bucle_define_pantalla
OUTI
LD B,C
OUTI
DEC A
JR NZ,.bucle_define_pantalla
RET
valores_crtc
DEFB REG_01,ANCHO_PANTALLA_CRTC
DEFB REG_06,ALTO_PANTALLA_CRTC
DEFB REG_02,DESPLAZAMIENTO_HORIZONTAL ; POKE &11D1,&32
DEFB REG_07,DESPLAZAMIENTO_VERTICAL ; POKE &11D3,&24
DEFB REG_0C,VRAM_P2 + VRAM32
DEFB REG_0D,OFFSET_PANTALLA_CRTC
Consultando dicha información me encuentro esto:
The CRTC has a total of 18 8-bit registers controlling all aspects of the video timings.
It's clock frequency on the Amstrad CPC/Plus is 1MHz (so the CRTC updates itself every microsecond).
Four I/O ports are assigned to it :
&BC00 (Write only): to select an internal register.
&BD00 (Write only): to write to the currently selected internal register.
&BE00 (Read only) : to read the Status register (only available on CRTC type 1).
&BF00 (Read only) : to read the value of the currently selected internal register (but not all of them can be read)
Y viendo lo que pusiste en BASIC en el propio artículo:
Código: Seleccionar todo
OUT &BDBE,1: OUT &BEBE,48: REM R1 = 48
OUT &BDBE,6: OUT &BEBE,34: REM R6 = 34
OUT &BDBE,2: OUT &BEBE,50: REM R2 = 50
OUT &BDBE,7: OUT &BEBE,35: REM R7 = 36
OUT &BDBE,12:OUT &BEBE,35:REM R12 = 44
OUT &BDBE,13:OUT &BEBE,35:REM R13 = 16
Un saludaco.