Classic Computer Magazine Archive PROGRAM LISTING: 83-11/DRAWTEXT.ASM


0100 ; SCREEN DISPLAY SUBROUTINE
0110 ; OUTPUT GR.2 CHARACTERS IN GR.6
0120 ;
0130 ; COPYRIGHT (C) 1983 ROBERT FREEDMAN
0140 ;
0150 ; CALL WITH THE FOLLOWING FROM BASIC
0160 ; ASM=USR(ADR(D6$),ADR(LINE$),LEN(LINE$),PX,PY)
0170 ; PX= X DISPLACEMENT+1, PY=Y DISPLACEMENT+1
0180 ;
0190  *=$630 ; RELOCATABLE
0200 ADRSTR = $CB
0210 SCRMEM = $604
0220 SCRWRK = $CF
0230 LENGTH = $600
0240 XPOS = $601
0250 YPOS = $602
0260 TEMP = $603
0270 OFFSET = $CD
0280 ;
0290  PLA
0300  PLA
0310  STA ADRSTR+1
0320  PLA
0330  STA ADRSTR
0340  PLA
0350  PLA
0360  STA LENGTH
0370  PLA
0380  PLA
0390  STA XPOS
0400  DEC XPOS
0410  PLA
0420  PLA
0430  STA YPOS
0440  DEC YPOS
0450  LDA 560 ; DISPLAY LIST LO
0460  STA $CF ; TEMP ZPAGE LOC
0470  LDA 561 ; DL HI
0480  STA $D0
0490  LDY #4  ; OFFSET FOR SCREEN RAM
0500  LDA ($CF),Y ; GET SCREEN RAM LO
0510  STA SCRMEM  ; TO PAGE 6
0520  INY
0530  LDA ($CF),Y ; GET SCREEN RAM HI
0540  STA SCRMEM+1
0550 ;
0560 ; FIND WHERE TO START OUTPUT
0570 ;
0580  LDY YPOS     ; HOW FAR DOWN
0590  BEQ GOON     ; 1ST LINE?
0600 LOOP CLC   ; GET READY FOR ADD
0610  LDA SCRMEM ; BEGIN OF SCR RAM
0620  ADC #20 ; EACH LINE 20 LONG
0630  STA SCRMEM
0640  BCC NEXT ; CARRY?
0650  INC SCRMEM+1 ; YES
0660 NEXT DEY ; DECREMENT COUNTER
0670  BNE LOOP ; CONTINUE MULTIPLY
0680 GOON CLC ; 1 MORE ADD
0690  LDA SCRMEM ; CURRENTLY ON 1ST BYTE OF LINE
0700  ADC XPOS ; X OFFSET
0710  STA SCRMEM
0720  BCC N1 ; CARRY?
0730  INC SCRMEM+1 ; YES
0740 ;
0750 ; FIND BITMAP OF CHARACTER
0760 ;
0770 N1 LDA #00 ; CLEAR TEMP
0780  STA TEMP
0790 NEXT1 LDY TEMP ; COUNTER OF LETTERS OUTPUT
0800  CPY LENGTH ; END?
0810  BCS END ; YES (TEMP >= LENGTH)
0820  LDA #00 ; CLEAR HI OFFSET
0830  STA OFFSET+1
0840  LDA ($CB),Y ; GET LETTER
0850  SEC ; GET READY FOR SUBTRACTION
0860  SBC #32 ; CONVERT TO INTERNAL CODE
0870  STA OFFSET ; OFFSET INTO BIT-MAP TABLE
0880  CLC ; CLEAR FOR X8 MULTIPLACTION
0890  ASL OFFSET ; DO MULTIPLACTION - 16 BIT, X8
0900  ROL OFFSET+1
0910  ASL OFFSET
0920  ROL OFFSET+1
0930  ASL OFFSET
0940  ROL OFFSET+1
0950  LDA OFFSET+1 ; ADD $E000 TO OFFSET
0960  ORA #$E0 ; THIS IS AN ADD!
0970  STA OFFSET+1
0980 ;
0990 ; OUTPUT TO SCREEN
1000 ;
1010  LDA SCRMEM
1020  STA SCRWRK ; TEMP REG FOR OUTPUT
1030  LDA SCRMEM+1
1040  STA SCRWRK+1 ; TEMP REG HI
1050  LDY #00 ; CLEAR Y REG
1060  LDX #6 ; OUTPUT 8 CHAR
1070 OUTPUT LDA (OFFSET),Y ; BITMAP #1
1080  STA (SCRWRK),Y ; OUTPUT #1
1090  INC OFFSET ; NEXT BIT MAP
1100  BNE N2 ; CROSS PAGE BOUNDARY?
1110  INC OFFSET+1 ; YES
1120 N2 CLC  ; CLEAR FOR ADD
1130  LDA SCRWRK ; CURRENT SCREEN LINE
1140  ADC #20 ; NEXT LINE
1150  STA SCRWRK
1160  BCC N3 ; CARRY?
1170  INC SCRWRK+1 ; YES
1180 N3 DEX ; ONE MORE DONE
1190  BPL OUTPUT ; ALL 8 OUTPUT? NO -
1200 ;
1210 ;NEXT LETTER
1220 ;
1230  INC TEMP ; NEXT LETTER
1240  INC SCRMEM ; NEXT SCREEN LOCATION
1250  BNE N4 ; PAGE BOUNDARY?
1260  INC SCRMEM+1 ; YES
1270 N4 SEC  ; SET CARRY
1280  BCS NEXT1 ; MAKE CODE RELOCATABLE ( I COULD KILL FOR BAW (BRANCH ALWAYS))
1290 END RTS ; THATS ALL FOLKS

Back to previous page