Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
64 Char Print
#1
Stole this from the same source as the print42 one. [I believe Andrew Owen needs thanks for this!]

Doesn't quite work yet - but I might not have time to play with it before the move, so I thought I'd post it as is, in case someone else wants to play with it.

Issues:
Doesn't seem to like printing anything after the first line (out of memory error)
Not sure if the printat routine works. Ought to, though.

It's probably some simple screwup in the end of line routine or something pointing where it shouldn't after it prints.

(And posting it here means I can't lose it, even if I lose the computer!)

Code:
SUB printat64 (y as uByte, x as uByte)
   POKE @p64coords,x
   POKE @p64coords+1,y
END sub

SUB print64 (characters$ as String)
asm

LD L,(IX+4)
LD H,(IX+5) ; Get String address of characters$ into HL.

; Load BC with length of string, and move HL to point to first character.
        ld c, (hl)               ; 60020 78
        inc hl                   ; 60021 35
        ld b, (hl)               ; 60022 70
        inc hl                   ; 60023 35

; Test string length. If Zero, exit.
        ld a, c                  ; 60024 121
        or b                     ; 60025 176
        jp z, p64_END         ; 60026 200
        
      
examineChar:
        ld a, (hl)               ; Grab the character
        cp 128                   ; too high to print?
        jr nc, nextChar            ; then we go to next.
        
        cp 22                    ; Is this an AT?
        jr nz, newLine           ; If not, hop to newLine routine.
        ex de, hl                ; Swap DE and HL
        and a                    ; Clear Carry
        ld hl, 2                 ;  
        sbc hl, bc               ; Can we Shorten our string length by 2? If not then at (y,x) doesn't make sense.
        ex de, hl                ; Swap DE and HL back
        jp nc, p64_END        ; If we went negative, there wasn't anything to AT to, so we return.
        
        inc hl                   ; Onto our Y co-ordinate
        ld d, (hl)               ; And load it into D
        dec bc                   ; Shorten our remaining string counter.
        inc hl                   ; Onto the X Co-ordinate
        ld e, (hl)               ; Load it into E
        dec bc                   ; Shorten our remaining string counter
        call p64_test_X        ; Make xy legal 60051 205 53  235
        jr p64_eaa3              ; Go to save coords 60054 24  11

newLine:
        cp 13                    ; Is this a newline character? 60056 254 13
        jr nz, p64_isPrintable   ; If not, hop to testing to see if we can print this 60058 32  13
        ld de, (p64_coords)      ; Get coords 60060 237 91  68  235
        call p64_nxtLine         ; Go to next line.     ; 60064 205 58  235

p64_eaa3:
        ld (p64_coords), de    ; 60067 237 83  68  235
        jr nextChar              ; 60071 24  11
p64_isPrintable:
        cp 31                    ; Bigger than 31? 60073 254 31
        jr c, nextChar           ; If not, get the next one. 60075 56  7  
        push hl                  ; Save position 60077 229
        push bc                  ; Save Count   60078 197
        call p64_PrintChar       ; Call Print SubRoutine 60079 205 189 234
        pop bc                   ; Recover length count  60082 193
        pop hl                   ; Recover Position 60083 225
nextChar:
        inc hl                   ; Point to next character 60084 35
        dec bc                   ; Count off this character 60085 11
        ld a, b                  ; Did we run out? 60086 120
        or c                     ; 60087 177
        jr nz, examineChar       ; If not, examine the next one 60088 32  193
        jp p64_END               ; Otherwise hop to END. 60090 201

;p64_eabb:
;        defb "z$"                ;Original "basic" accessed routine used this variable.
        ;ld a, d                  ; 60091 122
        ;inc h                    ; 60092 36

;p64_eabd:
p64_PrintChar:
        exx                      ; 60093 217
        push hl                  ; Save HL' 60094 229
        exx                      ; 60095 217
        sub 32                   ; Take out 32 to convert ascii to position in charset 60096 214 32
        ld h, 0                  ; 60098 38  0  
        rra                      ; Divide by 2 60100 31
        ld l, a                  ; Put our halved value into HL 60101 111
        ld a, 240                ; Set our mask to LEFT side 60102 62  240
        jr nc, p64_eacc          ; If we didn't have a carry (even #), hop forward. 60104 48  2  
        ld a, 15                 ; If we were ab idd #, set our mask to RIGHT side instead 60106 62  15
p64_eacc:
        add hl, hl               ; 60108 41
        add hl, hl               ; 60109 41
        add hl, hl               ; Multiply our char number by 8 60110 41
        ld de, p64_charset       ; Get our Charset position 60111 17  70  235
        add hl, de               ; And add our character count, so we're now pointed at the first byte of the right character. 60114 25
        exx                      ; 60115 217
        ld de, (p64_coords)      ; 60116 237 91  68  235
        ex af, af'               ; 60120 8  
        call p64_loadAndTest     ; 60121 205 49  235
        ex af, af'               ; 60124 8  
        inc e                    ; 60125 28
        ld (p64_coords), de      ; Put position+1 into coords 60126 237 83  68  235
        dec e                    ; 60130 29
        ld b, a                  ; 60131 71
        rr e                     ; Divide X position by 2 60132 203 27
        ld c, 0                  ; 60134 14  0  
        rl c                     ; Bring carry flag into C (result of odd/even position) 60136 203 17
        and 1                    ; Mask out lowest bit in A 60138 230 1  
        xor c                    ; XOR with C (Matches position RightLeft with Char RightLeft) 60140 169
        ld c, a                  ; 60141 79
        jr z, p64_eaf6           ; If they are both the same, skip rotation. 60142 40  6  
        ld a, b                  ; 60144 120
        rrca                     ; 60145 15
        rrca                     ; 60146 15
        rrca                     ; 60147 15
        rrca                     ; 60148 15 ; Move the mask to the other half of the byte.
        ld b, a                  ; 60149 71
p64_eaf6:
        ld a, d                  ; Get Y coord 60150 122
        sra a                    ; 60151 203 47
        sra a                    ; 60153 203 47
        sra a                    ; Multiply by 8 60155 203 47
        add a, 88                ; 60157 198 88
        ld h, a                  ; Put high byte value for attribute into H. 60159 103
        ld a, d                  ; 60160 122
        and 7                    ; 60161 230 7  
        rrca                     ; 60163 15
        rrca                     ; 60164 15
        rrca                     ; 60165 15
        add a, e                 ; 60166 131
        ld l, a                  ; Put low byte for attribute into l 60167 111
        ld a, (23693)            ; Get permanent Colours from System Variable 60168 58  141 92
        ld (hl), a               ; Write new attribute 60171 119
        
        ld a, d                  ; 60172 122
        and 248                  ; 60173 230 248
        add a, 64                ; 60175 198 64
        ld h, a                  ; 60177 103
        ld a, b                  ; 60178 120
        cpl                      ; 60179 47
        ld e, a                  ; 60180 95
        exx                      ; 60181 217
        ld b, 8                  ; 60182 6   8  
p64_eb18:
        ld a, (hl)               ; 60184 126
        exx                      ; 60185 217
        bit 0, c                 ; 60186 203 65
        jr z, p64_eb22             ; 60188 40  4  
        rrca                     ; 60190 15
        rrca                     ; 60191 15
        rrca                     ; 60192 15
        rrca                     ; 60193 15
p64_eb22: and b                    ; 60194 160
        ld d, a                  ; 60195 87
        ld a, (hl)               ; 60196 126
        and e                    ; 60197 163
        or d                     ; 60198 178
        ld (hl), a               ; 60199 119
        inc h                    ; 60200 36
        exx                      ; 60201 217
        inc hl                   ; 60202 35
        djnz p64_eb18              ; 60203 16  235
        exx                      ; 60205 217
        pop hl                   ; 60206 225
        exx                      ; 60207 217
        ret                      ; 60208 201

p64_loadAndTest:
        ld de, (p64_coords)          ; 60209 237 91  68  235

; SubRoutine to go to legal character position. (60213)
p64_test_X:
        ld a, e                   ; Get column from e
        cp 64                     ; more than 64 ?
        jr c, p64_test_Y            ; If not, then jump over nextline
p64_nxtLine:
        inc d                     ; Move down 1
        ld e, 0                   ; reset x co-ord to zero  
p64_test_Y:
        ld a, d                 ; get Y co-ord
        cp 24                     ; Past 24?
        ret c                     ; Return if not.
        ld d, 0                   ; Rest y co-ord to top of screen.  
        ret                       ; Return.
end asm
p64coords:
asm
p64_coords:
       defb 64;  X Coordinate store  60228 64
       defb 23;  Y Coordinate Store 60229 23

p64_charset:         ; 60230
        
        DEFB 0,2,2,2,2,0,2,0                   ; Space !
        DEFB 0,80,82,7,2,7,2,0                 ; " #
        DEFB 0,37,113,66,114,20,117,32         ; $ %
        DEFB 0,34,84,32,96,80,96,0             ; & '
        DEFB 0,36,66,66,66,66,36,0             ; ( )
        DEFB 0,0,82,34,119,34,82,0             ; * +
        DEFB 0,0,0,0,7,32,32,64                ; , -
        DEFB 0,1,1,2,2,100,100,0               ; . /
        DEFB 0,34,86,82,82,82,39,0             ; 0 1
        DEFB 0,34,85,18,33,69,114,0            ; 2 3
        DEFB 0,87,84,118,17,21,18,0            ; 4 5
        DEFB 0,55,65,97,82,84,36,0             ; 6 7
        DEFB 0,34,85,37,83,85,34,0             ; 8 9
        DEFB 0,0,2,32,0,34,2,4                 ; : ;
        DEFB 0,0,16,39,64,39,16,0              ; < =
        DEFB 0,2,69,33,18,32,66,0              ; > ?
        DEFB 0,98,149,183,181,133,101,0        ; @ A     Changed from   ;0,2,37,87,117,85,53,0            
        DEFB 0,98,85,100,84,85,98,0            ; B C
        DEFB 0,103,84,86,84,84,103,0           ; D E
        DEFB 0,114,69,116,71,69,66,0           ; F G
        DEFB 0,87,82,114,82,82,87,0            ; H I
        DEFB 0,53,21,22,21,85,37,0             ; J K
        DEFB 0,69,71,71,69,69,117,0            ; L M
        DEFB 0,82,85,117,117,85,82,0           ; N O
        DEFB 0,98,85,85,103,71,67,0            ; P Q
        DEFB 0,98,85,82,97,85,82,0             ; R S
        DEFB 0,117,37,37,37,37,34,0            ; T U
        DEFB 0,85,85,85,87,39,37,0             ; V W
        DEFB 0,85,85,37,82,82,82,0             ; X Y
        DEFB 0,119,20,36,36,68,119,0           ; Z [
        DEFB 0,71,65,33,33,17,23,0             ; \ ]
        DEFB 0,32,112,32,32,32,47,0            ; ^ _
        DEFB 0,32,86,65,99,69,115,0            ; £ a
        DEFB 0,64,66,101,84,85,98,0            ; b c
        DEFB 0,16,18,53,86,84,35,0             ; d e
        DEFB 0,32,82,69,101,67,69,2            ; f g
        DEFB 0,66,64,102,82,82,87,0            ; h i
        DEFB 0,20,4,53,22,21,85,32             ; j k
        DEFB 0,64,69,71,71,85,37,0             ; l m
        DEFB 0,0,98,85,85,85,82,0              ; n o
        DEFB 0,0,99,85,85,99,65,65             ; p q
        DEFB 0,0,99,84,66,65,70,0              ; r s
        DEFB 0,64,117,69,69,85,34,0            ; t u
        DEFB 0,0,85,85,87,39,37,0              ; v w
        DEFB 0,0,85,85,35,81,85,2              ; x y
        DEFB 0,0,113,18,38,66,113,0            ; z {
        DEFB 0,32,36,34,35,34,36,0             ; | {
        DEFB 0,6,169,86,12,6,9,6               ; ~ (c)

        
p64_END:
end asm
end sub


DIM n,x,y as uInteger
CLS
FOR n=1 to 1000
y=rnd*23
x=rnd*63
printat64(y, x)
print64 ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"(n MOD 26 TO n MOD 26))
print at 23,0;n;"  y:";y;"  x:";x;"  L:";n MOD 26;":";"ABCDEFGHIJKLMNOPQRSTUVWXYZ"(n MOD 26 TO n MOD 26);" "

NEXT n
END
Reply
#2
Okay, I'm supposed to be doing other things.... but I'm not.

I played with the print64 thing (apparently I /can/ use my laptop for programming!), and I've improved it slightly and edited the post above.

Odd thing is - it works perfectly for the first 950 cycles, and then when called for the 951st time, writes all over the place. I'm quite baffled as to why at the moment.

Good news: --debug-memory is working and traps attempts to write where it shouldn't. Awesome job, Boriel.

Bad news: Why does this sub work 950 times and then break??????
Reply
#3
britlion Wrote:Stole this from the same source as the print42 one.

Doesn't quite work yet - but I might not have time to play with it before the move, so I thought I'd post it as is, in case someone else wants to play with it.

Issues:
Doesn't seem to like printing anything after the first line (out of memory error)
Not sure if the printat routine works. Ought to, though.

It's probably some simple screwup in the end of line routine or something pointing where it shouldn't after it prints.

(And posting it here means I can't lose it, even if I lose the computer!)

Code:
SUB printat64 (y as uByte, x as uByte)
   POKE @p64coords,x
   POKE @p64coords+1,y
END sub

SUB print64 (characters$ as String)
asm

LD L,(IX+4)
LD H,(IX+5) ; Get String address of characters$ into HL.

; Load BC with length of string, and move HL to point to first character.
        ld c, (hl)               ; 60020 78
        inc hl                   ; 60021 35
        ld b, (hl)               ; 60022 70
        inc hl                   ; 60023 35

; Test string length. If Zero, exit.
        ld a, c                  ; 60024 121
        or b                     ; 60025 176
        jp z, p64_END         ; 60026 200
        
      
examineChar:
        ld a, (hl)               ; Grab the character
        cp 128                   ; too high to print?
        jr nc, nextChar            ; then we go to next.
        
        cp 22                    ; Is this an AT?
        jr nz, newLine           ; If not, hop to newLine routine.
        ex de, hl                ; Swap DE and HL
        and a                    ; Clear Carry
        ld hl, 2                 ;  
        sbc hl, bc               ; Can we Shorten our string length by 2? If not then at (y,x) doesn't make sense.
        ex de, hl                ; Swap DE and HL back
        jp nc, p64_END        ; If we went negative, there wasn't anything to AT to, so we return.
        
        inc hl                   ; Onto our Y co-ordinate
        ld d, (hl)               ; And load it into D
        dec bc                   ; Shorten our remaining string counter.
        inc hl                   ; Onto the X Co-ordinate
        ld e, (hl)               ; Load it into E
        dec bc                   ; Shorten our remaining string counter
        call p64_test_X        ; Make xy legal 60051 205 53  235
        jr p64_eaa3              ; Go to save coords 60054 24  11

newLine:
        cp 13                    ; Is this a newline character? 60056 254 13
        jr nz, p64_isPrintable   ; If not, hop to testing to see if we can print this 60058 32  13
        ld de, (p64_coords)      ; Get coords 60060 237 91  68  235
        call p64_nxtLine         ; Go to next line.     ; 60064 205 58  235

p64_eaa3:
        ld (p64_coords), de    ; 60067 237 83  68  235
        jr nextChar              ; 60071 24  11
p64_isPrintable:
        cp 31                    ; Bigger than 31? 60073 254 31
        jr c, nextChar           ; If not, get the next one. 60075 56  7  
        push hl                  ; Save position 60077 229
        push bc                  ; Save Count   60078 197
        call p64_PrintChar       ; Call Print SubRoutine 60079 205 189 234
        pop bc                   ; Recover length count  60082 193
        pop hl                   ; Recover Position 60083 225
nextChar:
        inc hl                   ; Point to next character 60084 35
        dec bc                   ; Count off this character 60085 11
        ld a, b                  ; Did we run out? 60086 120
        or c                     ; 60087 177
        jr nz, examineChar       ; If not, examine the next one 60088 32  193
        jp p64_END               ; Otherwise hop to END. 60090 201

;p64_eabb:
;        defb "z$"                ;Original "basic" accessed routine used this variable.
        ;ld a, d                  ; 60091 122
        ;inc h                    ; 60092 36

;p64_eabd:
p64_PrintChar:
        exx                      ; 60093 217
        push hl                  ; Save HL' 60094 229
        exx                      ; 60095 217
        sub 32                   ; Take out 32 to convert ascii to position in charset 60096 214 32
        ld h, 0                  ; 60098 38  0  
        rra                      ; Divide by 2 60100 31
        ld l, a                  ; Put our halved value into HL 60101 111
        ld a, 240                ; Set our mask to LEFT side 60102 62  240
        jr nc, p64_eacc          ; If we didn't have a carry (even #), hop forward. 60104 48  2  
        ld a, 15                 ; If we were ab idd #, set our mask to RIGHT side instead 60106 62  15
p64_eacc:
        add hl, hl               ; 60108 41
        add hl, hl               ; 60109 41
        add hl, hl               ; Multiply our char number by 8 60110 41
        ld de, p64_charset       ; Get our Charset position 60111 17  70  235
        add hl, de               ; And add our character count, so we're now pointed at the first byte of the right character. 60114 25
        exx                      ; 60115 217
        ld de, (p64_coords)      ; 60116 237 91  68  235
        ex af, af'               ; 60120 8  
        call p64_loadAndTest     ; 60121 205 49  235
        ex af, af'               ; 60124 8  
        inc e                    ; 60125 28
        ld (p64_coords), de      ; Put position+1 into coords 60126 237 83  68  235
        dec e                    ; 60130 29
        ld b, a                  ; 60131 71
        rr e                     ; Divide X position by 2 60132 203 27
        ld c, 0                  ; 60134 14  0  
        rl c                     ; Bring carry flag into C (result of odd/even position) 60136 203 17
        and 1                    ; Mask out lowest bit in A 60138 230 1  
        xor c                    ; XOR with C (Matches position RightLeft with Char RightLeft) 60140 169
        ld c, a                  ; 60141 79
        jr z, p64_eaf6           ; If they are both the same, skip rotation. 60142 40  6  
        ld a, b                  ; 60144 120
        rrca                     ; 60145 15
        rrca                     ; 60146 15
        rrca                     ; 60147 15
        rrca                     ; 60148 15 ; Move the mask to the other half of the byte.
        ld b, a                  ; 60149 71
p64_eaf6:
        ld a, d                  ; Get Y coord 60150 122
        sra a                    ; 60151 203 47
        sra a                    ; 60153 203 47
        sra a                    ; Multiply by 8 60155 203 47
        add a, 88                ; 60157 198 88
        ld h, a                  ; Put high byte value for attribute into H. 60159 103
        ld a, d                  ; 60160 122
        and 7                    ; 60161 230 7  
        rrca                     ; 60163 15
        rrca                     ; 60164 15
        rrca                     ; 60165 15
        add a, e                 ; 60166 131
        ld l, a                  ; Put low byte for attribute into l 60167 111
        ld a, (23693)            ; Get permanent Colours from System Variable 60168 58  141 92
        ld (hl), a               ; Write new attribute 60171 119
        
        ld a, d                  ; 60172 122
        and 248                  ; 60173 230 248
        add a, 64                ; 60175 198 64
        ld h, a                  ; 60177 103
        ld a, b                  ; 60178 120
        cpl                      ; 60179 47
        ld e, a                  ; 60180 95
        exx                      ; 60181 217
        ld b, 8                  ; 60182 6   8  
p64_eb18:
        ld a, (hl)               ; 60184 126
        exx                      ; 60185 217
        bit 0, c                 ; 60186 203 65
        jr z, p64_eb22             ; 60188 40  4  
        rrca                     ; 60190 15
        rrca                     ; 60191 15
        rrca                     ; 60192 15
        rrca                     ; 60193 15
p64_eb22: and b                    ; 60194 160
        ld d, a                  ; 60195 87
        ld a, (hl)               ; 60196 126
        and e                    ; 60197 163
        or d                     ; 60198 178
        ld (hl), a               ; 60199 119
        inc h                    ; 60200 36
        exx                      ; 60201 217
        inc hl                   ; 60202 35
        djnz p64_eb18              ; 60203 16  235
        exx                      ; 60205 217
        pop hl                   ; 60206 225
        exx                      ; 60207 217
        ret                      ; 60208 201

p64_loadAndTest:
        ld de, (p64_coords)          ; 60209 237 91  68  235

; SubRoutine to go to legal character position. (60213)
p64_test_X:
        ld a, e                   ; Get column from e
        cp 64                     ; more than 64 ?
        jr c, p64_test_Y            ; If not, then jump over nextline
p64_nxtLine:
        inc d                     ; Move down 1
        ld e, 0                   ; reset x co-ord to zero  
p64_test_Y:
        ld a, d                 ; get Y co-ord
        cp 24                     ; Past 24?
        ret c                     ; Return if not.
        ld d, 0                   ; Rest y co-ord to top of screen.  
        ret                       ; Return.
end asm
p64coords:
asm
p64_coords:
       defb 64;  X Coordinate store  60228 64
       defb 23;  Y Coordinate Store 60229 23

p64_charset:         ; 60230
        
        DEFB 0,2,2,2,2,0,2,0                   ; Space !
        DEFB 0,80,82,7,2,7,2,0                 ; " #
        DEFB 0,37,113,66,114,20,117,32         ; $ %
        DEFB 0,34,84,32,96,80,96,0             ; & '
        DEFB 0,36,66,66,66,66,36,0             ; ( )
        DEFB 0,0,82,34,119,34,82,0             ; * +
        DEFB 0,0,0,0,7,32,32,64                ; , -
        DEFB 0,1,1,2,2,100,100,0               ; . /
        DEFB 0,34,86,82,82,82,39,0             ; 0 1
        DEFB 0,34,85,18,33,69,114,0            ; 2 3
        DEFB 0,87,84,118,17,21,18,0            ; 4 5
        DEFB 0,55,65,97,82,84,36,0             ; 6 7
        DEFB 0,34,85,37,83,85,34,0             ; 8 9
        DEFB 0,0,2,32,0,34,2,4                 ; : ;
        DEFB 0,0,16,39,64,39,16,0              ; < =
        DEFB 0,2,69,33,18,32,66,0              ; > ?
        DEFB 0,98,149,183,181,133,101,0        ; @ A     Changed from   ;0,2,37,87,117,85,53,0            
        DEFB 0,98,85,100,84,85,98,0            ; B C
        DEFB 0,103,84,86,84,84,103,0           ; D E
        DEFB 0,114,69,116,71,69,66,0           ; F G
        DEFB 0,87,82,114,82,82,87,0            ; H I
        DEFB 0,53,21,22,21,85,37,0             ; J K
        DEFB 0,69,71,71,69,69,117,0            ; L M
        DEFB 0,82,85,117,117,85,82,0           ; N O
        DEFB 0,98,85,85,103,71,67,0            ; P Q
        DEFB 0,98,85,82,97,85,82,0             ; R S
        DEFB 0,117,37,37,37,37,34,0            ; T U
        DEFB 0,85,85,85,87,39,37,0             ; V W
        DEFB 0,85,85,37,82,82,82,0             ; X Y
        DEFB 0,119,20,36,36,68,119,0           ; Z [
        DEFB 0,71,65,33,33,17,23,0             ; \ ]
        DEFB 0,32,112,32,32,32,47,0            ; ^ _
        DEFB 0,32,86,65,99,69,115,0            ; £ a
        DEFB 0,64,66,101,84,85,98,0            ; b c
        DEFB 0,16,18,53,86,84,35,0             ; d e
        DEFB 0,32,82,69,101,67,69,2            ; f g
        DEFB 0,66,64,102,82,82,87,0            ; h i
        DEFB 0,20,4,53,22,21,85,32             ; j k
        DEFB 0,64,69,71,71,85,37,0             ; l m
        DEFB 0,0,98,85,85,85,82,0              ; n o
        DEFB 0,0,99,85,85,99,65,65             ; p q
        DEFB 0,0,99,84,66,65,70,0              ; r s
        DEFB 0,64,117,69,69,85,34,0            ; t u
        DEFB 0,0,85,85,87,39,37,0              ; v w
        DEFB 0,0,85,85,35,81,85,2              ; x y
        DEFB 0,0,113,18,38,66,113,0            ; z {
        DEFB 0,32,36,34,35,34,36,0             ; | {
        DEFB 0,6,169,86,12,6,9,6               ; ~ (c)

        
p64_END:
end asm
end sub


DIM n,x,y as uInteger
CLS
FOR n=1 to 1000
y=rnd*23
x=rnd*63
printat64(y, x)
print64 ("ABCDEFGHIJKLMNOPQRSTUVWXYZ"(n MOD 26 TO n MOD 26))
print at 23,0;n;"  y:";y;"  x:";x;"  L:";n MOD 26;":";"ABCDEFGHIJKLMNOPQRSTUVWXYZ"(n MOD 26 TO n MOD 26);" "

NEXT n
END


please help
i cant make head or tail of this
this is 64 column printing?
for zx spectrum this means 4 pixels per character
this font is not proportional either?
is it impossible to use push to print a proportional font on the speccy screen - maybe using a 2kb third of screen buffer?

does your routine draw one character at a time and increment the address its printing to eight times in order to print one character? (or two characters if they are next to each other?) are m and W illegible like with tasword 2 - not the 128 version where you could use the original 32 column font without having to have your nose on the screen to read it?
Reply
#4
Hi Roger,

This routine has been fixed and included with the compiler as a .BAS library (download and install the compiler from the archive). Once installed see the library/print64.bas file.

To use the routine, simply use:
Code:
#include <print64.bas>

print64at(10, 10)
print64("Hello world!")
Reply
#5
btw, why am i getting this error message? what is '__MEM_FREE'?

Code:
guest@macbook_mint1 /mnt/sda4/tralha/emulation/zxspectrum/basic/BorielZxBasicCompiler $ zxb.py meus/pr64.bas -t -B -a && mv pr64.tap meus/ && fuse meus/pr64.tappr64.bas:287: Error: Undefined label '__MEM_FREE'

code used
Code:
#include <print64.bas>
printat64(10,10)
print64("Hello world!")

thanks
Reply
#6
I can't reproduce that error. ??
Which version are you using? (type zxb.py --version to find out)
Latest is 1.2.8-s758
Reply
#7
Code:
guest@macbook_mint1 ~ $ zxb.py --version
zxb.py 1.2.6-r1812
guest@macbook_mint1 ~ $

when i tried it, i thought i downloaded the latest version... :| - where from can i get it?
Reply
#8
From the download page: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive">http://www.boriel.com/wiki/en/index.php ... IC:Archive</a><!-- m -->
Reply
#9
done, thanks! i have a snippet at http://nitrofurano.altervista.org/retroc...xspectrum/
Reply
#10
Nice :!:
BTW, to speed up compilation, type
Code:
./zxb.py --version
for the 1st time in the same directory where zxb.py resides. This will create parsetab.py (and other) cache files.
The message "UMINUS" token not used (or the like) should not appear anymore and the compiler will run faster.
Reply
#11
thanks! Smile
Reply
#12
I got a few free hours, and since Einar Saukas on the WOS boards noted he'd slimmed down a 64 char print code, I decided it was time to work on this one a little. Much quicker to work on than the 64x32 version, since it fits in char lines nicely. This is only an updated 64x24 version.

I've updated the code - which is quite a lot smaller, and also slightly faster at <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Print64.bas">http://www.boriel.com/wiki/en/index.php ... rint64.bas</a><!-- m -->

(Boriel - you may want to update the compiler included version).

ToDO: Inverse (easy) and Bold (harder - needs second font) - which I'll do when I work out how to test what the status of those is!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)