Возвращаясь к предыдущему посту: решил сделать 256б из программы на Бейсике. Естественно, понадобились некоторые процедуры, решение нашлось:
org $4000
start
; ******************************
; CIO equates
; ******************************
ICHID equ $0340
ICDNO equ $0341
ICCOM equ $0342
ICSTA equ $0343
ICBAL equ $0344
ICBAH equ $0345
ICPTL equ $0346
ICPTH equ $0347
ICBLL equ $0348
ICBLH equ $0349
ICAX1 equ $034A
ICAX2 equ $034B
CIOV equ $E456
; ******************************
; Other equates needed
; ******************************
COLOR0 equ $02C4
COLCRS equ $55
ROWCRS equ $54
ATACHR equ $02FB
STORE1 equ $CC
STOCOL equ $CD
start
; ******************************
; CIO equates
; ******************************
ICHID equ $0340
ICDNO equ $0341
ICCOM equ $0342
ICSTA equ $0343
ICBAL equ $0344
ICBAH equ $0345
ICPTL equ $0346
ICPTH equ $0347
ICBLL equ $0348
ICBLH equ $0349
ICAX1 equ $034A
ICAX2 equ $034B
CIOV equ $E456
; ******************************
; Other equates needed
; ******************************
COLOR0 equ $02C4
COLCRS equ $55
ROWCRS equ $54
ATACHR equ $02FB
STORE1 equ $CC
STOCOL equ $CD
; code
lda #10 ; setup mode
jsr GRAFIC
lda #1
jsr COLOR ; set color 1
lda #10 ; setup mode
jsr GRAFIC
lda #1
jsr COLOR ; set color 1
lda #$CF
sta 705 ; color 1 as green
lda #0
ldx #0
ldy #0
jsr PLOT ; X=low byte X,A=High byte X,Y - position Y
ldx #70
lda #0
ldy #70
jsr DRAWTO
jmp *
; ******************************
; The SETCOLOR routine
; ******************************
; Before calling this routine,
; the registers should be set
; just like the BASIC SETCOLOR:
; SETCOLOR color,hue,luminance
; stored respectively in
; X reg.,accumulator,Y reg.
SETCOL
ASL A ; Need to multiply
ASL A ; hue by 16, and
ASL A ; add it to lumimance.
ASL A ; Now hue is * 16
STA STORE1 ; temporarily
TYA ; So we can add
CLC ; Before adding
ADC STORE1 ; Now have sum
STA COLOR0,X ; Actual SETCOLOR
RTS ; All done
; ******************************
; The COLOR command
; ******************************
; For these routines, we will
; simply store the current COLOR
; in STOCOL, so the COLOR
; command simply requires that
; the accumulator hold the value
; "n" in the command COLOR n
COLOR
STA STOCOL ; That's it!
RTS ; All done
; ******************************
; The GRAPHICS command
; ******************************
; The "n" parameter of
; a GRAPHICS n command will be
; passed to this routine in the
; accumulator
GRAFIC
PHA ; Store on stack
LDX #$60 ; IOCB6 for screen
LDA #$C ; CLOSE command
STA ICCOM,X ; in command byte
JSR CIOV ; Do the CLOSE
LDX #$60 ; The screen again
LDA #3 ; OPEN command
STA ICCOM,X ; in command byte
LDA #NAME&255 ; Name is "S:"
STA ICBAL,X ; Low byte
LDA #NAME/256 ; High byte
STA ICBAH,X
PLA ; Get GRAPHICS n
STA ICAX2,X ; Graphics mode
AND #$F0 ; Get high 4 bits
EOR #$10 ; Flip high bit
ORA #$C ; Read or write
STA ICAX1,X ; n+16, n+32 etc.
JSR CIOV ; Setup GRAPHICS n
RTS ; All done
; ******************************
; The POSITION command
; ******************************
; Identical to the BASIC
; POSITION X,Y command.
; Since X may be greater than
; 255 in GRAPHICS 8, we need to
; use the accumulator for the
; high byte of X.
POSITN
STX COLCRS ; Low byte of X
STA COLCRS+1 ; High byte of X
STY ROWCRS ; Y position
RTS ; All done
; ******************************
; The PLOT command
; ******************************
; We'll use the X,Y, and A just
; like in the POSITION command.
PLOT
JSR POSITN ; To store info
LDX #$60 ; For the screen
LDA #$B ; Put record
STA ICCOM,X ; Command byte
LDA #0 ; Special case of
STA ICBLL,X ; I/O using the
STA ICBLH,X ; accumulator
LDA STOCOL ; Get COLOR to use
JSR CIOV ; Plot the point
RTS ; All done
; ******************************
; The DRAWTO command
; ******************************
; We'll use the X,Y, and A just
; like in the POSITION command
DRAWTO
JSR POSITN ; To store info
LDA STOCOL ; Get COLOR
STA ATACHR ; Keep CIO happy
LDX #$60 ; The screen again
LDA #$11 ; For DRAWTO
STA ICCOM,X ; Command byte
LDA #$C ; As in XIO
STA ICAX1,X ; Auxiliary 1
LDA #0 ; Clear
STA ICAX2,X ; Auxiliary 2
JSR CIOV ; Draw the line
RTS ; All done
; ******************************
; The FILL command
; ******************************
; We'll use the X,Y, and A just
; like in the POSITION command.
; This is similar to DRAWTO
FILL
JSR POSITN ; To store info
LDA STOCOL ; Get COLOR
STA ATACHR ; Keep CIO happy
LDX #$60 ; The screen again
LDA #$12 ; For FILL
STA ICCOM,X ; Command byte
LDA #$C ; As in XIO
STA ICAX1,X ; Auxiliary 1
LDA #0 ; Clear
STA ICAX2,X ; Auxiliary 2
JSR CIOV ; FILL the area
RTS ; All done
; ******************************
; The LOCATE command
; ******************************
; We'll use the X,Y, and A just
; like in the POSITION command
; and the accumulator will
; contain the LOCATEd color
LOCATE
JSR POSITN ; To store info
LDX #$60 ; The screen again
LDA #7 ; Get record
STA ICCOM,X ; Command byte
LDA #0 ; Special case of
STA ICBLL,X ; data transfer
STA ICBLH,X ; in accumulator
JSR CIOV ; Do the LOCATE
RTS ; All done
; ******************************
; The screen's name
; ******************************
NAME ;.BYTE "S:",$9B
dta c'S:',$9B
;-------------------------------------------------------------
run start
Здесь включен режим 10 из Бейсика, рисуется линия цветом 1, цвет задается зеленым.
Другой вариант:
lda #8 ; open graphics 8 mode (320x200)
jsr $ef9c ; openmode=$ef9c
Только после включения режима процедуры не заработали.
А где 256б ? готовый релиз появится позже.
Комментарии
Отправить комментарий