#include "ti-85.h" ;header file that contains macros .org 0 ;sets program counter to 0 .db "3DViewer v1.5 by Alan B.",0 ;the name BEGXCOORD = $80DF XCOORD = $80E0 ;\keep these two together, okay YCOORD = $80E1 ;/ GRAPHMEM = $80E4 GRAM1 = $80E6 GRAM2 = $80E8 WHICHGRAM = $80EA ;0,1,2 OFFSET = $80ED BITNUM = $80EF DEPTH = $80F0 RANDNUM = $80F1 RANDBIT = $80F2 NAMEBUFFER = $80F3 ;8 bytes COUNTER = $80FB MEMFREE = $80FC CURSGRAM1 = $80FD ;\keep these two together, okay CURSGRAM2 = $80FE ;/ STEREOIND = $80FF ;\keep these two together, okay MAXIND = $8100 ;/ BOXDEPTH = $8101 BOXTOP = $8102 ;y varialbe of top of box ;++++++++++++++++++++++++++++ ;++Editing screen variables++ ;++++++++++++++++++++++++++++ ;XCOORD=x coordinate in editing screen [0-127] (byte)* ;YCOORD=y coordinate in editing screen [0-63] (byte)* ;GRAM1=address in program for stereogram1 [wherever in mem] (word)* ;GRAM2=address in program for stereogram2 [right after stereogram1] (word)* ;WHICHGRAM=address that is being used [1 or 2] (byte)* ;OFFSET=offset of pixel in memory [0-896] (word)* ;++++++++++++++++++++++++++++ ;++Viewing screen variables++ ;++++++++++++++++++++++++++++ ;BEGXCOORD=beginning x coordinate in viewing screen [0-15] (byte)* ;XCOORD=movable x coordinate in viewing screen [0-127] (byte)* ;YCOORD=y coordinate in viewing screen [0-63] (byte)* ;GRAPHMEM=place in graphics memory to store [$8641-$8A41] (word)* ;OFFSET=offset in both stereogram1 and 2 [0-896] (word)* ;BITNUM=value to check in stereogram1 and 2 [1,2,4,8,16,32,64,128] (byte)* ;DEPTH=depth of the next pixel to place [14-16] (byte)* ;RANDNUM=random pointer used to get random number [0-21] (byte)* ;RANDBIT=random number [0 or 1] (byte)* ld hl,ZS_BITS ;this sets bit 0 of ZS_BITS set 0,(hl) ;do this if you store any variables ld a,4 ;so that FIND_PIXEL routine can out (5),a ;be used later ld hl,($8BE5) ld de,($8BE1) or a sbc hl,de ld a,h and %11111000 or a ld (MEMFREE),a jr z,screen ld hl,($8BE1) ;now so if it's ever used, it's there temp stereogram ld de,($8BE1) inc de ld a,0 ld b,128 makenewstereo2: push bc ld (hl),a ld bc,13 ldir ld a,$C0 ld (de),a ld a,$00 inc de ld (de),a inc de push de pop hl inc de pop bc sub a ld (STEREOIND),a djnz makenewstereo2 ;++++++++++++++++++++++++++++++++++++ ;++++++++++++++++++++++++++++++++++++ ;++This displays the opening screen++ ;++++++++++++++++++++++++++++++++++++ ;++++++++++++++++++++++++++++++++++++ screen: ld a,r ;this is all a litle mixup for the random table and %00011110 ;contains number 0-30 ld c,a ld b,0 ld hl,(PROGRAM_ADDR) ;\ ld de,rnumbers ; }get this thing again add hl,de ;/ add hl,bc ;puts an offset in it so it's really random ld c,(hl) ;c holds first one startrandom2: inc hl ;this routine moves all the bytes ld b,(hl) ;one byte to the left dec hl ;I'm not gonna explain it all ld (hl),b inc hl inc hl ld a,(hl) cp $FF jr startrandom3 dec hl jr startrandom2 startrandom3: dec hl ld (hl),c ;c is put in last spot------------------\ ROM_CALL(CLEARLCD) ;CLEAR ld hl,(PROGRAM_ADDR) ;\ ld de,graphic ; }this finds the graphic "3D" add hl,de ;/ ld de,$FC20 ;this is where we want it to appear ld bc,$0004 ;the byte counter for ldir putgraphic: ldir ;ldir-loads hl to de until bc=0 ex de,hl ;exchange contents cause changing de ld bc,$000C ;add 13 so it's at the next line add hl,bc ;in video memory ex de,hl ;switch them back ld a,e ;so we can compare to see if cp $F0 ;it is all done JUMP_Z(lineundertitle) ;if so, go there ld bc,$0004 ;if not, set byte counter and go back JUMP_(putgraphic) ;to the beginning of the loop lineundertitle: ld hl,$FD20 ;this is the place we want to put line ld a,$FF ;FFh=11111111b, bitmap ld (hl),a ld de,$FD21 ld bc,15 ldir ld hl,$FD20 ld de,$FF64 ld bc,12 ldir ld a,%10000000 ld hl,$FF74 ld b,9 ld de,$0010 lineundertitle2: ld (hl),a add hl,de djnz lineundertitle2 ld a,%00000010 ld hl,$FC08 ld b,18 ld de,$0010 lineundertitle3: ld (hl),a add hl,de djnz lineundertitle3 words: ld bc,$0501 ;this is the place we want to display ld ($800C),bc ; _x_y in order in ($800C) ld hl,(PROGRAM_ADDR) ; ld de,title ;you've seen this before add hl,de ROM_CALL(D_ZT_STR) ;this displays the phrase ld bc,$014B ld ($8333),bc ROM_CALL(D_ZM_STR) push hl ld a,(STEREOIND) push af CALL_(findstereos) pop af ld (STEREOIND),a CALL_(showstereoname) pop hl ld bc,$1526 ;coordinates ld ($8333),bc ;into the menutext cursor ($8333) ROM_CALL(D_ZM_STR) ;display menutext ld bc,$0304 ;same ld ($800C),bc ;same ROM_CALL(D_ZT_STR) ;\/ ld bc,$2B16 ld ($8333),bc ROM_CALL(D_ZM_STR) ld bc,$3829 ;\/ ld ($8333),bc ;\/ ROM_CALL(D_ZM_STR) ;\/ ld a, waitforkey: call GET_KEY ;checks keystroke cp K_RIGHT JUMP_Z(changestereor) cp K_LEFT JUMP_Z(changestereol) cp K_F1 ;goes to JUMP_Z(makepicture) ;makepicture cp K_F2 ;or JUMP_Z(viewpicture) ;viewpicture cp K_F3 ;No, No... ret z ;don't leave cp K_EXIT ;exit and f3 do the same thing ret z JUMP_(waitforkey) ;gives them another chance changestereor: ld hl,(STEREOIND) ;this gets MAXIND too ld a,l cp h jr z,changer2 inc a ld (STEREOIND),a CALL_(showstereoname) jr waitforkey changer2: sub a ld (STEREOIND),a CALL_(showstereoname) jr waitforkey changestereol: ld a,(STEREOIND) or a jr z,changel2 dec a ld (STEREOIND),a CALL_(showstereoname) jr waitforkey changel2: ld a,(MAXIND) ld (STEREOIND),a CALL_(showstereoname) jr waitforkey findstereos: sub a ld (STEREOIND),a ld hl,$FA6F findstereos2: ld de,($8BE5) call CP_HL_DE jr z,alldonestereos ld a,(hl) cp $0c jr z,foundone dec hl dec hl dec hl ld c,(hl) inc c ld b,0 or a sbc hl,bc jr findstereos2 foundone: dec hl ld e,(hl) dec hl ld d,(hl) ex de,hl inc hl inc hl inc hl ld a,(hl) inc hl ld b,(hl) add a,b cp $77 jr z,foundone2 ex de,hl dec hl ld c,(hl) inc c ld b,0 or a sbc hl,bc ;hl contains next vat entry jr findstereos2 foundone2: inc hl dec de push de push hl push de ld a,(STEREOIND) rlca rlca ld c,a ld b,0 ld hl,(PROGRAM_ADDR) ld de,stereodata add hl,de add hl,bc pop bc ld (hl),c inc hl ld (hl),b pop bc inc hl ld (hl),c inc hl ld (hl),b ld hl,STEREOIND inc (hl) pop hl ld c,(hl) inc c ld b,0 or a sbc hl,bc ;hl contains next vat entry jr findstereos2 alldonestereos: ld hl,(PROGRAM_ADDR) ld de,newstereo add hl,de push hl ld a,(STEREOIND) rlca rlca ld c,a ld b,0 ld hl,(PROGRAM_ADDR) ld de,stereodata add hl,de add hl,bc pop bc ld (hl),c inc hl ld (hl),b inc hl ld bc,($8BE1) ld (hl),c inc hl ld (hl),b ld a,(STEREOIND) ld (MAXIND),a ret showstereoname: ld bc,$084E ld ($8333),bc ld a,$20 ld b,$30 clearspace: push bc push af ROM_CALL(M_CHARPUT) pop af pop bc djnz clearspace ld bc,$0850 ld ($8333),bc ld a,$cf ROM_CALL(M_CHARPUT) ld a,(STEREOIND) rlca rlca ld c,a ld b,0 ld hl,(PROGRAM_ADDR) ld de,stereodata add hl,de add hl,bc call LD_HL_MHL ld b,(hl) dec hl ld de,NAMEBUFFER push bc showstereoname2: ld a,(hl) ld (de),a dec hl inc de djnz showstereoname2 pop bc ld hl,NAMEBUFFER ROM_CALL(D_LM_STR) ld a,$20 ROM_CALL(M_CHARPUT) ld a,$05 ROM_CALL(M_CHARPUT) ret ;+++++++++++++++++++++++++++++++++++++++++++ ;+++++++++++++++++++++++++++++++++++++++++++ ;++This is the start of the editing screen++ ;+++++++++++++++++++++++++++++++++++++++++++ ;+++++++++++++++++++++++++++++++++++++++++++ makepicture: ld a,(STEREOIND) rlca rlca ld c,a ld b,0 ld hl,(PROGRAM_ADDR) ld de,stereodata add hl,de add hl,bc inc hl inc hl ;now it's at address call LD_HL_MHL push hl ;\puts in bc pop bc ;/ ld de,($8BE1) or a sbc hl,de ld a,(MEMFREE) ld e,a ld d,0 add hl,de ld a,l or h or a JUMP_Z(nomemfornew) push bc pop hl ld (GRAM1),hl ld de,$0400 add hl,de ld (GRAM2),hl ld a,0 ;the first stereogram is in use ld (WHICHGRAM),a ld a,$38 ;$38=56d center of screen 56*2=112 +16=128 ld (XCOORD),a ;look at the top for the definitions ld a,$20 ;20h=32d ld (YCOORD),a ;y coordinate ld a,$70 ld (COUNTER),a ROM_CALL(CLEARLCD) ld a,$88 ld hl,$8700 ld (hl),a ld de,$8701 ld bc,$00FF ldir ld hl,(PROGRAM_ADDR) ld de,introut add hl,de ld de,$8888 ld bc,introutend+1-introut ldir ld a,$87 ld i,a im 2 CALL_(putcursor) checktheloop: call GET_KEY ;CHECKS KEY FOR ALL OF THE NEXT THINGS cp K_EXIT ; \/ JUMP_Z(leave) ; \/ cp K_UP JUMP_Z(upgo) cp K_DOWN JUMP_Z(downgo) cp K_LEFT JUMP_Z(leftgo) cp K_RIGHT JUMP_Z(rightgo) cp K_PLUS JUMP_Z(upcontrast) cp K_MINUS JUMP_Z(downcontrast) cp K_STAR JUMP_Z(upcounter) cp K_SLASH JUMP_Z(downcounter) cp K_F1 JUMP_Z(F1press) cp K_F2 JUMP_Z(F2press) cp K_F3 JUMP_Z(F3press) cp K_F4 JUMP_Z(F4press) cp K_CLEAR JUMP_Z(clearall) cp K_GRAPH JUMP_Z(boxfill) jr checktheloop ;returns to check loop again nomemfornew: ld hl,$FC00 nomemfornew2: ld a,(hl) cpl ld (hl),a inc hl ld a,h or l or a jr nz,nomemfornew2 ld hl,$0400 ld ($800C),hl ld hl,nomemstring ld de,(PROGRAM_ADDR) add hl,de ROM_CALL(D_ZT_STR) ld b,$FF loopynomem: halt djnz loopynomem JUMP_(screen) ;+++++++++++++++++++++++++++++++++++++++++++ ;++Different things to do during the cycle++ ;+++++++++++++++++++++++++++++++++++++++++++ upgo: ld a,(YCOORD) ;y coordinate cp $3F ;if it's at the top, go back JUMP_Z(checktheloop) ;to checktheloop push af CALL_(removecursor) pop af inc a ;or move up ld (YCOORD),a ;and load the new coordinate CALL_(putcursor) JUMP_(checktheloop) ;and go back downgo: ld a,(YCOORD) ;exactly the same, diff #'s cp 0 JUMP_Z(checktheloop) push af CALL_(removecursor) pop af dec a ld (YCOORD),a CALL_(putcursor) JUMP_(checktheloop) leftgo: ld a,(XCOORD) ;like I said cp 0 JUMP_Z(checktheloop) push af CALL_(removecursor) pop af dec a ld (XCOORD),a CALL_(putcursor) JUMP_(checktheloop) rightgo: ;again ld a,(XCOORD) cp $6F JUMP_Z(checktheloop) push af CALL_(removecursor) pop af inc a ld (XCOORD),a CALL_(putcursor) JUMP_(checktheloop) upcounter: ld a,(COUNTER) inc a ld (COUNTER),a JUMP_(checktheloop) downcounter: ld a,(COUNTER) dec a ld (COUNTER),a JUMP_(checktheloop) leave: im 1 CALL_(removecursor) JUMP_(screen) upcontrast: ld a,($8007) ;$8007 is current contrast inc a ;move up two, will move down one later inc a ld ($8007),a ;load into current contrast out (2),a ;and the port downcontrast: ;;;the upcontrast continues through here ld a,($8007) ;gets current contrast dec a ;moves down one ld ($8007),a ;and moves back into address out (2),a ;and port JUMP_(checktheloop) ;go back ;you can't read from port 2 ;if you just try moveing up one, it don't go clearall: ld hl,(GRAM1) ld de,(GRAM1) inc de ld a,0 ld b,128 clearall2: push bc ld (hl),a ld bc,13 ldir ld a,$C0 ld (de),a sub a inc de ld (de),a inc de push de pop hl inc de pop bc djnz clearall2 ld hl,$0000 ld (CURSGRAM1),hl CALL_(putcursor) JUMP_(checktheloop) F1press: CALL_(getoffset) ld hl,CURSGRAM1 CALL_(putoff) ld hl,CURSGRAM2 CALL_(putoff) JUMP_(checktheloop) F2press: CALL_(getoffset) ld hl,CURSGRAM1 CALL_(putoff) ld hl,CURSGRAM2 CALL_(puton) JUMP_(checktheloop) F3press: CALL_(getoffset) ld hl,CURSGRAM1 CALL_(puton) ld hl,CURSGRAM2 CALL_(putoff) JUMP_(checktheloop) F4press: CALL_(getoffset) ld hl,CURSGRAM1 CALL_(puton) ld hl,CURSGRAM2 CALL_(puton) JUMP_(checktheloop) puton: ld a,(BITNUM) or (hl) ld (hl),a ret putoff: ld a,(BITNUM) cpl and (hl) ld (hl),a ret putcursor: CALL_(getoffset) push af ld de,(GRAM1) add hl,de ld a,(hl) ld (CURSGRAM1),a ld de,$0400 add hl,de ld a,(hl) ld (CURSGRAM2),a pop af push af xor (hl) ld (hl),a or a sbc hl,de pop af xor (hl) ld (hl),a ret removecursor: CALL_(getoffset) ld a,(CURSGRAM1) ld de,(GRAM1) add hl,de ld (hl),a ld a,(CURSGRAM2) ld de,$0400 add hl,de ld (hl),a ret boxfill: CALL_(removecursor) ;interrupts still running though CALL_(finddepth) ;normal finddepth ld a,(DEPTH) ld (BOXDEPTH),a ;top left corner defines depth ld hl,(XCOORD) ;includes ycoord dec h ;dec ycoord inc l ;inc xcoord ld (XCOORD),hl ;new ones ld a,h ld (BOXTOP),a linefill: CALL_(getoffset) ;good thing to do first, sets BITNUM and OFFSET CALL_(finddepth) ld a,(DEPTH) ;of current pixel ld hl,BOXDEPTH cp (hl) jr z,donelinefill ld a,(hl) ;hl BOXDEPTH ld hl,(GRAM2) ld de,(OFFSET) add hl,de rra ;checks GRAM2 info into carry flag push af ;this is for a push af ;this is for falgs CALL_C(puton) pop af CALL_NC(putoff) ld de,$0400 or a ;scf \ ccf sbc hl,de pop af ;saved a from one rotation rra ;do again for GRAM1 push af ;for flags CALL_C(puton) pop af CALL_NC(putoff) ld a,(YCOORD) or a ;checks to see if ycoord at bottom jr z,donelinefill dec a ;dec ycoord for next pixel ld (YCOORD),a jr linefill donelinefill: ld a,(XCOORD) cp $6F jr z,doneboxfill inc a ld (XCOORD),a ld a,(BOXTOP) ld (YCOORD),a CALL_(getoffset) ;good thing to do first, sets BITNUM and OFFSET CALL_(finddepth) ld a,(DEPTH) ;of current pixel ld hl,BOXDEPTH cp (hl) jr z,doneboxfill jr linefill doneboxfill: ld a,(BOXTOP) inc a ld (YCOORD),a CALL_(putcursor) JUMP_(checktheloop) ;+++++++++++++++++++++++++++++++++++++++++++ ;+++++++++++++++++++++++++++++++++++++++++++ ;++This is the start of the viewing screen++ ;+++++++++++++++++++++++++++++++++++++++++++ ;+++++++++++++++++++++++++++++++++++++++++++ viewpicture: ld a,(STEREOIND) rlca rlca ld c,a ld b,0 ld hl,(PROGRAM_ADDR) ld de,stereodata add hl,de add hl,bc inc hl inc hl ;now it's at address call LD_HL_MHL push hl ;\puts in bc pop bc ;/ ld de,($8BE1) or a sbc hl,de ld a,(MEMFREE) ld e,a ld d,0 add hl,de ld a,l or h or a JUMP_Z(nomemfornew) push bc pop hl ld (GRAM1),hl ld de,$0400 add hl,de ld (GRAM2),hl ROM_CALL(CLEARLCD) ;clears ld a,$00 ;clears the x coordinates ld (BEGXCOORD),a ;both ld (XCOORD),a ;both ld a,$3F ;this is the y coordinate ld (YCOORD),a ;in correct spot ld bc,$0000 ;offset is zero right now ld (OFFSET),bc ;into there ld a,$80 ;$80=10000000b, first bit to check depth ld (BITNUM),a ;into theere ld a,$00 ;random pointer is zero right now ld (RANDNUM),a ;into there CALL_(random) ;go get the first random number loopdeloop: ld a,(XCOORD) ;the x coord ld b,a ;in b ld a,(YCOORD) ;the y coord ld c,a ;in c ROM_CALL(FIND_PIXEL) ;find correct pixel ld d,a ;hold in d ld bc,$FC00 ;start video mem add hl,bc ;add offset from find pixel ld (GRAPHMEM),hl ;place in video mem to store ld a,(RANDBIT) ;is the random number from last called cp 0 ;if zero CALL_Z(makeoffpixel) ;go to routine to display white pixel ld a,(RANDBIT) ;get again cp 0 ;if not zero CALL_NZ(makeonpixel) ;go to routine to display black pixel CALL_(getoffset) CALL_(finddepth) ;find the depth, not needed first time thru ld a,(XCOORD) ;get movable x coord ld b,$10 ;add 16(jump 2 bytes, repetition pattern) add a,b ;right here ld (XCOORD),a ;load it back ld a,(DEPTH) ;the depth ld b,a ;into b ld a,(XCOORD) ;the x coord in a sub b ;subtract so higher depth is moved to left ld (XCOORD),a ;and load back ld b,$80 ;$80=10000000 and b ;if b's high bit is set cp 0 ;that would make this not equal CALL_NZ(resetbit) ;so you go here ld a,(BEGXCOORD) ;if the x coord is 16 cp $10 ;two bytes and their repeats done with CALL_Z(resetline) ;go to next line ld a,(YCOORD) ;if the y coord has moved from 0 to FF cp $FF ;checked here JUMP_Z(thatsit) ;stop it cause it's done JUMP_(loopdeloop) ;or continue makeoffpixel: ld hl,(GRAPHMEM) ;place in video mem ld a,$FF ;wish there was a not function sbc a,d ;for that ;d is bit from find_pixel and (hl) ;and it ld (hl),a ;load it ret ;return makeonpixel: ld hl,(GRAPHMEM) ;place in video mem ld a,d ;put d into a or (hl) ;or it with hl ld (hl),a ;then load ret ;return resetbit: ld a,(BEGXCOORD) ;beginning x coord inc a ;increment it *the bit to test is different ld (BEGXCOORD),a ;load it into *later on in finddepth ld (XCOORD),a ;beginnning and moving x coords CALL_(random) ;get a new random number ret ;and return resetline: ld a,$00 ;\ ld (BEGXCOORD),a ; }set x coords completely to 0 ld (XCOORD),a ;/ ld a,(YCOORD) ;get y dec a ;dec to next line ld (YCOORD),a ;and load back ret ;return thatsit: ld hl,$FC00 ;\ ld de,$8641 ; \moves stereogram in video mem to ld bc,$0400 ; /graphx mem to store ldir ;/ timetolook: call GET_KEY ;checks keys cp K_EXIT JUMP_Z(screen) ;press exit, go to beginning screen cp K_PLUS JUMP_Z(contrastup) cp K_MINUS JUMP_Z(contrastdown) JUMP_(timetolook) ;or continues contrastup: ld a,($8007) ;need two different sets of contrast change inc a ;cause jumps to different place afterwards inc a ;\/ ld ($8007),a ;\/ out (2),a ;\/ contrastdown: ;\/ ld a,($8007) ;\/ dec a ;\/ ld ($8007),a ;\/ out (2),a ;\/ JUMP_(timetolook) ;__ ;+++++++++++++++++++++++++++++++++++++ ;++This is the random number routine++ ;+++++++++++++++++++++++++++++++++++++ random: ld hl,(PROGRAM_ADDR) ;\ ld de,rnumbers ; }get address for random numbers 0 to 46 add hl,de ;/ ld a,(RANDNUM) ;use current random pointer ;starts at 0 ld c,a ;to put ld b,0 ;in bc add hl,bc ;and add up the whole thing ld a,(hl) ;get new pointer pointed to by old pointer cp $FF ;if gets to be 0 which is final number jr z,mixupbytes ;mix up the bytes ld (RANDNUM),a ;load the new pointer and %00000001 ld (RANDBIT),a ;is new random number ret ;return mixupbytes: ld hl,(PROGRAM_ADDR) ;\ ld de,rnumbers ; }get this thing again add hl,de ;/ ld c,(hl) ;c holds first one mixupbytes2: inc hl ;this routine moves all the bytes ld b,(hl) ;one byte to the left dec hl ;I'm not gonna explain it all ld (hl),b inc hl inc hl ld a,(hl) cp $FF jr z,mixupbytes3 dec hl jr mixupbytes2 mixupbytes3: dec hl ld (hl),c ;c is put in last spot------------------\ ld a,0 ; | ld (RANDNUM),a ;0 is new pointer | jr random ;goes back to beginning to rerandom it | rnumbers: ;| .db 6,3,9,10,21,15,17,1,18,16,11,13,20,29,23 ;| .db 2,4,5,7,8,12,14,19,22,25,24,27,28,26,30 ;\/-------------/ .db 31,33,32,35,45,34,38,36,39,40,41,42,43,44,37,46,$FF ;took out 25 ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ; getoffset + ;Input: + ; (XCOORD)=x coordinate + ; (YCOORD)=y coordinate + ;Output: + ; (BITNUM)=bit number of pixel + ; (OFFSET)=offset of pixel in stereogram1 and 2 + ;++++++++++++++++++++++++++++++++++++++++++++++++++++++++ getoffset: ;kinda like change depth from editing screen ld a,(XCOORD) ld b,a ld a,(YCOORD) ld c,a ROM_CALL(FIND_PIXEL) ld (BITNUM),a ld (OFFSET),hl ret ;+++++++++++++++++++++++++++++++++++++++++ ;++This is the routine to find the depth++ ;+++++++++++++++++++++++++++++++++++++++++ finddepth: CALL_(getoffset) ld c,0 ld hl,(GRAM1) ;\ ; }move stuff, add offset and stereogram1 ld de,(OFFSET) ; / add hl,de ;/ ld a,(BITNUM) ;bit to test and (hl) ;and to see if bit in mem is set ld b,a sub a ;a is zero sub b ;sub b(zero or nonzer) from 0 rl c ;rotate carry into c ld de,$0400 add hl,de ;get to next stereogram ld a,(BITNUM) and (hl) ld b,a sub a sub b rl c ;c = %000000(bit from gram 1)(bit from gram 2) = 0,1,2 or 3 ld a,c ld (DEPTH),a ret ;words converted to numbers by compiler ;++++++++++++++++++++++++++++++++ \/ ;++These are phrases to display++ KEY~~~~~.db "string",$0A,$00 ;++++++++++++++++++++++++++++++++ /\ /\ /\ title: ;tells compiler string of numbers| | .db "Viewer",0 ; | 00 terminate stuff: ; immediate number .db "Stereogram:",0 version: .db "v1.5-(6/25/97)",0 myname: .db "By: ",$0A,"lan ",$0B,"ailey",0 myemail: .db "",0 choices: .db "F1-Edit F2-View F3-Quit",0 displaystuff: .db "x=",0 .db "y=",0 .db 'w','e','N' newstereo: .db $03 nomemstring: .db "Get More Mem!",0 ;++++++++++++++++++++++++++ ;++Stores different stuff++ ;++++++++++++++++++++++++++ numberstring: .db $00,$00,$00 introut: ex af,af' exx ld a,(WHICHGRAM) or a ;cp 0 jr z,disp2 rra ;makes 2->1, 1->0 ld (WHICHGRAM),a ld hl,(GRAM1) ld de,$FC00 ld bc,$0400 ldir jr introut2 disp2: set 1,a ;a was zero, so now 2 ld (WHICHGRAM),a ld hl,(GRAM2) ld de,$FC00 ld bc,$0400 ldir nop ;a little timing fix introut2: ld a,(COUNTER) ld b,a introutloop: nop nop nop djnz introutloop exx ex af,af' jp $38 introutend: graphic: .db %00001111,%11000000,%01111100,%00000000 .db %00000001,%11110000,%00111111,%00000000 .db %00000000,%01111000,%00110011,%10000000 .db %00000000,%00111000,%00111001,%11000000 .db %00000000,%01111000,%00111000,%11000000 .db %00000001,%11110011,%00111000,%11000000 .db %00000111,%11000011,%10111000,%11000000 .db %00000001,%11110011,%00111000,%11000000 .db %00000000,%01111000,%00111000,%11000000 .db %00000000,%00111000,%00111001,%11000000 .db %00000000,%01111000,%00110011,%10000000 .db %00000001,%11110000,%00111111,%00000000 .db %00001111,%11000000,%01111100,%00000000 stereodata: .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .dw $0000,$0000 .end ;Comments prevent TASM to say "No END directive before EOF"