A89: 7-level Grayscale
[Prev][Next][Index][Thread]
A89: 7-level Grayscale
Can someone try to help me understand
grayscale (greyscale?) with the attached file?? I've been trying at this
simple program all day...
include "doorsos.h"
include "graphlib.h"
include "userlib.h"
xdef _ti89
xdef _comment
xdef _main
_main:
jsr graphlib::gray7 ;switches to 7 grayscale mode
move.w #1,graphlib::choosescreen ;set all graphlib functions to grayscale
move.l graphlib::plane0,a1 ;address of the 1st bitplane (plane0)
jsr graphlib::clr_scr ;clears the first bitplane (main screen)
move.l graphlib::plane1,a1 ;address of the 2nd bitplane (plane1)
jsr graphlib::clr_scr ;clears the second bitplane
move.l graphlib::plane2,a1 ;address of the 3rd bitplane (plane2)
jsr graphlib::clr_scr ;clears the third bitplane
move.l graphlib::plane0,a0 ;address of the 1st bitplane
lea 1500(a0),a0 ;50th line (50 * 30 = 1500)
move.w #374,d0 ;why 374???
\loop1 move.l #$FFFFFFFF,(a0)+ ;why #$FFFFFFFF and not #$FFFF?
dbra d0,\loop1 ;374 times? why?
move.l graphlib::plane1,a0 ;address of the 2nd bitplane
lea 750(a0),a0 ;25th line (25 * 30 = 750)
move.w #374,d0
\loop2 move.w #$FFFF,(a0)+ ;put black over the next 25 lines
dbra d0,\loop2
move.l graphlib::plane1,a0 ;address of the 2nd bitplane
lea 2250(a0),a0 ;75th line (75 * 30 = 2250)
move.w #374,d0
\loop3 move.w #$FFFF,(a0)+ ;put black over the next 25 lines
dbra d0,\loop3
;leaving this out is the only way that this program will actually run on my 89... =(
; move.l graphlib::plane2,a0 ;address of the 3rd bitplane
; lea 360(a0),a0 ;12th line (12 * 30 = 360)
; move.w #374,d0
;\loop4 move.w #$FFFF,(a0)+ ;put black over the next 12 lines
; dbra d0,\loop4
; move.l graphlib::plane2,a0 ;address of the 3rd bitplane
; lea 1110(a0),a0 ;37th line (37 * 30 = 1110)
; move.w #374,d0
;\loop5 move.w #$FFFF,(a0)+ ;put black over the next 12 lines
; dbra d0,\loop5
; move.l graphlib::plane2,a0 ;address of the 3rd bitplane
; lea 1860(a0),a0 ;62th line (62 * 30 = 1860)
; move.w #374,d0
;\loop6 move.w #$FFFF,(a0)+ ;put black over the next 12 lines
; dbra d0,\loop6
; move.l graphlib::plane2,a0 ;address of the 3rd bitplane
; lea 2610(a0),a0 ;87th line (87 * 30 = 2610)
; move.w #374,d0
;\loop7 move.w #$FFFF,(a0)+ ;put black over the next 12 lines
; dbra d0,\loop7
;so we get:
;25 lines : white
;25 lines : low gray
;25 lines : dark gray
;25 lines : black
clr.w graphlib::choosescreen ;set all graphlib functions to Black and White mode
jsr userlib::idle_loop ;waits for a key
jsr graphlib::gray2 ;restores Black and White mode
rts
_comment dc.b "Gray4 test",0
end
Follow-Ups: