''*************************************** ''* VGA Render Driver v1.001 * ''* (C) Jim Bagley * ''*************************************** VAR long cogs[6] PUB start(params) | i repeat i from 0 to long[params][12]-1 long[params][0]:=i long[params][2]:=long[params][9]+(i*(256+8)) cogs[i]:=cognew(@entry,params)+1 repeat 1000 PUB stop(params) | i repeat i from 0 to long[params][12]-1 if cogs[i] cogstop(i) dat org 0 entry mov t1,PAR rdbyte cognum,t1 add t1,#4 rdword imageptr,t1 add t1,#4 rdword pixelbase,t1 add t1,#4 rdword screenptr,t1 add t1,#4 rdword charsptr,t1 add t1,#4 rdword sprptr,t1 add t1,#4 rdword sprchr,t1 add t1,#4 rdword sprnum,t1 add t1,#12 rdword lineptr,t1 add t1,#8 rdbyte cognums,t1 :restart mov linenum,cognum :loop mov pixelptr,pixelbase ' sub pixelptr,#4 'don't need to subtract 4, as display starts 4 pixels in. mov chrptr,linenum and chrptr,#7 shl chrptr,#2 add chrptr,charsptr mov scrptr,linenum shr scrptr,#3 shl scrptr,#6+1 add scrptr,screenptr mov t1,#64 :xlp rdword t2,scrptr add scrptr,#2 add t2,chrptr rdlong t3,t2 add pixelptr,#4 wrlong t3,pixelptr djnz t1,#:xlp mov t2,sprptr mov t1,sprnum tjz t1,#:wait :sprlp rdword t4,t2 add t2,#2 mov t6,linenum rdword t3,t2 add t2,#2 add t6,#8 rdword t5,t2 add t2,#2 add t5,sprchr and t3,#255 sub t6,t3 wc,wz if_b jmp #:skpspr cmp t6,#8 wc,wz if_ae jmp #:skpspr shl t6,#2 add t6,t5 and t4,#511 ' add t4,#4 cmp t4,#256+4 wc,wz if_ae jmp #:skpspr rdlong t5,t6 add t4,pixelbase mov t7,t5 and t7,#255 wz if_nz wrbyte t5,t4 add t4,#1 shr t5,#8 mov t7,t5 and t7,#255 wz if_nz wrbyte t5,t4 add t4,#1 shr t5,#8 mov t7,t5 and t7,#255 wz if_nz wrbyte t5,t4 add t4,#1 shr t5,#8 mov t7,t5 and t7,#255 wz if_nz wrbyte t5,t4 :skpspr rdlong t5,lineptr cmp t5,linenum wz if_z jmp #:toolate djnz t1,#:sprlp :wait rdlong t1,lineptr cmp t1,linenum wz if_nz jmp #:wait :toolate add linenum,cognums cmp linenum,#240 wc,wz if_b jmp #:loop jmp #:restart xffff long $ffff pixelbase res 1 pixelptr res 1 cognum res 1 cognums res 1 linenum res 1 lineptr res 1 t1 res 1 t2 res 1 t3 res 1 t4 res 1 t5 res 1 t6 res 1 t7 res 1 imageptr res 1 screenptr res 1 scrptr res 1 charsptr res 1 chrptr res 1 sprptr res 1 sprnum res 1 sprchr res 1 fit 496