Hi all!
I've written a little program which pastes some text to the screen by grabbing letters from a custom text sheet:
(https://lh3.googleusercontent.com/vEPP_560I9F8J64Bso0YYjKb_bI8MdbRzovsnD9wae6vDCcAeD7p_gFVPXF4b6GVt96e1e3Vyz6P6naUj-6zgMPBk2pdaHT-Sco3QHoe2FVheAP1lc2mnJlkPbdjl94NO-uRvxnB19KXJIyfu3dRGXv94hfsKtCS30GqtF6pIKtpt3ljPOV0gc2yBX5GGrMc44BtQE7tb5vxvUxF6FIpauh-GZc59YujOIgg22KyulYEgLtFWNI0gCD65UMxV3XyHKOYRzWP5u3U6uaMrlHAHJTJli8OTBQy_-H-CuoveYRw94_d1UxjHFdYRZi6ZQreGCJHldTDK511N25CgHdS2hkeqseiXowzi0RynOuhIYeyChzBuiPL0mFF2gMWG99soa3Ro9vYRk--ao-1KMAY-MzyerFXj61-XL4tbSp_0NOVOSjOm5JbbmCKQSqzZTMj_YnqfPux2CofWBhD36l04C3_UquBciquCLcO1LZpzKeo-uf2qZOhdfzUcjGJ4vz0IWAFJmV9KGzJkzN1PTFDFvrjDJejqNDyrqca5Quz0bT5B1zoLL-eFJK78iX7uP1fpU13oXN1jf0YyeoH2qNHg_oHMccZDxNwLfOrRSqAQOu0BZBgKnG_Q-LoL2QNwtjKvOkyramGPqCMRyusryyfj6OtuPuEj9mrOn68WQH8lQhg0S93P01covnyBspijQ=w723-h573-no?authuser=4)
It draws the text sheet to the upper left of the screen, then grabs letters from it using ASCII characters from a string matched to co-ordinates on the sheet, and stores the grabbed letter in a buffer. Finally, it prints the string elsewhere on the screen one at a time using the grabbed letter from the buffer.
It works exactly how I want it to, but it's about 800 lines of code and I'm wondering if it can maybe be trimmed down to something smaller? (Speed isn't an issue, it's fast enough as is for what I want it for). Do I need to print the sheet to the screen or maybe I can just read directly from the image file?
Also, I'd like to maybe try writing the text sheet to a hidden screen and just have the string text pasted on the visible screen, but my brain is a little fried after 3 days of figuring this out and I couldn't get it to work before, so any advice would be greatly appreciated.
Thanks all!
(Screen co-ordinates code is a 256 x 192 version of the Chibiakumas lesson)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; BITMAP TEXT GRABBER AND PASTER
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
org &1000
call SET_PALETTE
call SCREENSETUP
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; READ ASCII FROM STRING, COUNT LETTERS, AND MATCH ASCII CHARACTERS TO CO-ORDINATES ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ld hl,&0260 ; Load co-ordinates to 'hl' of where string text appears on screen
ld (TEXT_XY),hl ; Save to variable
ld hl,STRING_TEXT ; Load string
push hl
COUNTLETTERS: ; Count how many letters are in the string
ld a,(hl)
inc hl
push af
ld a,(LETTERCOUNT)
add 1
ld (LETTERCOUNT),a
pop af
or a
jr nz, COUNTLETTERS
pop hl
ld a,(LETTERCOUNT) ; Subtract 1 to get actual amount of letters sans "0" terminate
sub 1
ld (LETTERCOUNT),a
TEXT_WRITE: ; Load Ascii character from String
ld a,(hl)
inc hl
call TEXTMATCH ; Call the Match list to fetch co-ordinates
LOAD_TEXTGRABXY:
ld (TEXTGRAB_XY),de ; Load co-ordinates of Letter from text tile sheet
push hl
call TILESHEET_DRAWER ; Draw Sheet
call TILE_GRABBER ; Grab Letter
call TILE_PASTER ; Paste Letter
pop hl
ld bc,(TEXT_XY) ; Load location of Letter and add letter WIDTH...
ld a,b ; ...to place next letter to the right of the last one.
ld b,&02
add b
ld b,a
ld (TEXT_XY),bc
ld a,(LETTERCOUNT) ; Loop for how many letters are in the string
dec a
ld (LETTERCOUNT),a
or a
jr nz, TEXT_WRITE
lp ; Infinite loop to stop a return to BASIC
jp lp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; DRAW TEXT SHEET TO SCREEN ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TILESHEET_DRAWER:
;call SETSCREEN_4000 ; Set screen base to &4000 (Doesn't work!!!)
TEXTsheet_DRAW_ROUTINE: ; Text_DRAW Start
ld de,TEXT_SHEET
TEXTsheetPOSITION:
push de
ld bc,(TEXTSHEET_XY) ; Load X-POSITION
call GetScreenPos ; New plotting code
pop de
DRAWTEXTsheet_2SCREEN:
ld bc,(TEXTSHEET_WH)
TEXTsheetnextline: ; OUTER LOOP
push bc
push hl
TEXTsheetNextByte: ; INNER LOOP
ld a,(de) ; Source Byte
ld (hl),a ; Screen Destination
inc de ; INC Source (Sprite) Address
inc hl ; INC Dest (Screen) Address
; Repeat for next byte
djnz TEXTsheetNextByte ; INNER LOOP END
pop hl
call GetNextLine ; Scr Next Line (Alter HL to move down a line)
pop bc
dec c
jr nz, TEXTsheetnextline ; OUTER LOOP END ; Repeat for next line
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GRAB LETTER(S) FROM SCREEN ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TILE_GRABBER:
ld de,TILEBUFFER ; Buffer to store grabbed letter
ld bc,(TEXTGRAB_XY) ; Load co-ordinates of letter to grab
call GETSCREENPOS
ld bc,(TEXT_WH) ; WIDTH and HEIGHT of Letter to grab
GRAB_BACK_HEIGHT:
push bc
push hl
GRAB_BACK_WIDTH:
ld a,(hl) ; Read from screen - 'hl'
ld (de),a ; Store to buffer - 'de'
inc hl
inc de
djnz GRAB_BACK_WIDTH
pop hl
call GetNextLine
pop bc
dec c
jr nz, GRAB_BACK_HEIGHT
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; PASTE BUFFER TO SCREEN ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TILE_PASTER:
;call SETSCREEN_C000 ; Set screen base to &C000
TEXT_DRAW_ROUTINE: ; Text_DRAW Start
ld de,TILEBUFFER
TEXTPOSITION:
push de
ld bc,(TEXT_XY) ; Load X-POSITION
call GetScreenPos ; New plotting code
pop de
DRAWTEXT_2SCREEN:
ld bc,(TEXT_WH) ; WIDTH and HEIGHT of Letter to paste
TEXTnextline: ; OUTER LOOP
push bc
push hl
TEXTNextByte: ; INNER LOOP
ld a,(de) ; Source Byte
ld (hl),a ; Screen Destination
inc de ; INC Source (Sprite) Address
inc hl ; INC Dest (Screen) Address
; Repeat for next byte
djnz TEXTNextByte ; INNER LOOP END
pop hl
call GetNextLine
pop bc ; Scr Next Line (Alter HL to move down a line)
dec c
jr nz, TEXTnextline ; OUTER LOOP END ; Repeat for next line
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; VARIABLES AND STUFF ;;
;;;;;;;;;;;;;;;;;;;;;;;;;
SCREEN_BASE db &C0
SCREEN_BASE_JUMP dw &C040
SCREEN_BASE_JUMP2 dw &C050
TEXTSHEET_XY dw &0000 ; Where will text sheet appear on screen (always 0,0)
TEXTSHEET_WH dw &2020 ; WIDTH and HEIGHT of text sheet
TEXTGRAB_XY dw &0000 ; Location of letter on sheet
TEXT_XY dw &0250 ; Location of where printed text will appear on screen
TEXT_WH dw &0208 ; Size of Letter (always 8x8)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; GRAPHICS DATA, BUFFER, & STRING ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TEXT_SHEET: incbin "C:\Amstrad\Graphics\RAW\MISC\CHARSET_YELLOW.RAW"
TILEBUFFER: defs 64 ; Makes space for an 8x8 tile (64 bytes per tile, so space for 1 tile)
LETTERCOUNT db 0 ; Space for how many letters are in string
STRING_TEXT: db '"BOLLOCKS!!!" SAID KITSUNE.',0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; MATCH ASCII CHARACTER NUMBER TO LETTER CO-ORDINATE ON TILE SHEET (16 columns x 4 rows on sheet) ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
TEXTMATCH:
;;;;;;;;;;;;;;;;;;;;;;;;;;
; ROW 1 ;
;;;;;;;;;
LETTER_SPACE:
cp &20
jr nz,LETTER_EXCL
ld de,&0000
jp LOAD_TEXTGRABXY
LETTER_EXCL:
cp &21
jr nz,LETTER_QUOTE
ld de,&0200
jp LOAD_TEXTGRABXY
LETTER_QUOTE:
cp &22
jr nz,LETTER_HASH
ld de,&0400
jp LOAD_TEXTGRABXY
LETTER_HASH:
cp &23
jr nz,LETTER_DOLLAR
ld de,&0600
jp LOAD_TEXTGRABXY
LETTER_DOLLAR:
cp &24
jr nz,LETTER_PERCENT
ld de,&0800
jp LOAD_TEXTGRABXY
LETTER_PERCENT:
cp &25
jr nz,LETTER_AMPER
ld de,&0A00
jp LOAD_TEXTGRABXY
LETTER_AMPER:
cp &26
jr nz,LETTER_APOSTROPHE
ld de,&0C00
jp LOAD_TEXTGRABXY
LETTER_APOSTROPHE
cp &27
jr nz,LETTER_BRACKETSO
ld de, &0E00
jp LOAD_TEXTGRABXY
LETTER_BRACKETSO:
cp &28
jr nz,LETTER_BRACKETSC
ld de, &1000
jp LOAD_TEXTGRABXY
LETTER_BRACKETSC:
cp &29
jr nz,LETTER_STAR
ld de, &1200
jp LOAD_TEXTGRABXY
LETTER_STAR:
cp &2A
jr nz,LETTER_PLUS
ld de, &1400
jp LOAD_TEXTGRABXY
LETTER_PLUS:
cp &2B
jr nz,LETTER_COMMA
ld de, &1600
jp LOAD_TEXTGRABXY
LETTER_COMMA:
cp &2C
jr nz,LETTER_DASH
ld de, &1800
jp LOAD_TEXTGRABXY
LETTER_DASH:
cp &2D
jr nz,LETTER_FULLSTOP
ld de, &1A00
jp LOAD_TEXTGRABXY
LETTER_FULLSTOP:
cp &2E
jr nz,LETTER_FSLASH
ld de, &1C00
jp LOAD_TEXTGRABXY
LETTER_FSLASH:
cp &2F
jr nz,LETTER_0
ld de, &1E00
jp LOAD_TEXTGRABXY
;;;;;;;;;;;;;;;;;;;;;;;;;;
; ROW 2 ;
;;;;;;;;;
LETTER_0:
cp &30
jr nz,LETTER_1
ld de, &0008
jp LOAD_TEXTGRABXY
LETTER_1:
cp &31
jr nz,LETTER_2
ld de, &0208
jp LOAD_TEXTGRABXY
LETTER_2:
cp &32
jr nz,LETTER_3
ld de, &0408
jp LOAD_TEXTGRABXY
LETTER_3:
cp &33
jr nz,LETTER_4
ld de, &0608
jp LOAD_TEXTGRABXY
LETTER_4:
cp &34
jr nz,LETTER_5
ld de, &0808
jp LOAD_TEXTGRABXY
LETTER_5:
cp &35
jr nz,LETTER_6
ld de, &0A08
jp LOAD_TEXTGRABXY
LETTER_6:
cp &36
jr nz,LETTER_7
ld de, &0C08
jp LOAD_TEXTGRABXY
LETTER_7:
cp &37
jr nz,LETTER_8
ld de, &0E08
jp LOAD_TEXTGRABXY
LETTER_8:
cp &38
jr nz,LETTER_9
ld de, &1008
jp LOAD_TEXTGRABXY
LETTER_9:
cp &39
jr nz,LETTER_COLON
ld de, &1208
jp LOAD_TEXTGRABXY
LETTER_COLON:
cp &3A
jr nz,LETTER_SEMI
ld de, &1408
jp LOAD_TEXTGRABXY
LETTER_SEMI:
cp &3B
jr nz,LETTER_ARRL
ld de, &1608
jp LOAD_TEXTGRABXY
LETTER_ARRL:
cp &3C
jr nz,LETTER_EQUALS
ld de, &1808
jp LOAD_TEXTGRABXY
LETTER_EQUALS:
cp &3D
jr nz,LETTER_ARRR
ld de, &1A08
jp LOAD_TEXTGRABXY
LETTER_ARRR:
cp &3E
jr nz,LETTER_QUESTION
ld de, &1C08
jp LOAD_TEXTGRABXY
LETTER_QUESTION:
cp &3F
jr nz,LETTER_AT
ld de, &1E08
jp LOAD_TEXTGRABXY
;;;;;;;;;;;;;;;;;;;;;;;;;;
; ROW 3 ;
;;;;;;;;;
LETTER_AT:
cp &40
jr nz,LETTER_A
ld de, &000F
jp LOAD_TEXTGRABXY
LETTER_A:
cp &41
jr nz,LETTER_B
ld de, &020F
jp LOAD_TEXTGRABXY
LETTER_B:
cp &42
jr nz,LETTER_C
ld de, &040F
jp LOAD_TEXTGRABXY
LETTER_C:
cp &43
jr nz,LETTER_D
ld de, &060F
jp LOAD_TEXTGRABXY
LETTER_D:
cp &44
jr nz,LETTER_E
ld de, &080F
jp LOAD_TEXTGRABXY
LETTER_E:
cp &45
jr nz,LETTER_F
ld de, &0A0F
jp LOAD_TEXTGRABXY
LETTER_F:
cp &46
jr nz,LETTER_G
ld de, &0C0F
jp LOAD_TEXTGRABXY
LETTER_G:
cp &47
jr nz,LETTER_H
ld de, &0E0F
jp LOAD_TEXTGRABXY
LETTER_H:
cp &48
jr nz,LETTER_I
ld de, &100F
jp LOAD_TEXTGRABXY
LETTER_I:
cp &49
jr nz,LETTER_J
ld de, &120F
jp LOAD_TEXTGRABXY
LETTER_J:
cp &4A
jr nz,LETTER_K
ld de, &140F
jp LOAD_TEXTGRABXY
LETTER_K:
cp &4B
jr nz,LETTER_L
ld de, &160F
jp LOAD_TEXTGRABXY
LETTER_L:
cp &4C
jr nz,LETTER_M
ld de, &180F
jp LOAD_TEXTGRABXY
LETTER_M:
cp &4D
jr nz,LETTER_N
ld de, &1A0F
jp LOAD_TEXTGRABXY
LETTER_N:
cp &4E
jr nz,LETTER_O
ld de, &1C0F
jp LOAD_TEXTGRABXY
LETTER_O:
cp &4F
jr nz,LETTER_P
ld de, &1E0F
jp LOAD_TEXTGRABXY
;;;;;;;;;;;;;;;;;;;;;;;;;;
; ROW 4 ;
;;;;;;;;;
LETTER_P:
cp &50
jr nz,LETTER_Q
ld de, &0017
jp LOAD_TEXTGRABXY
LETTER_Q:
cp &51
jr nz,LETTER_R
ld de, &0217
jp LOAD_TEXTGRABXY
LETTER_R:
cp &52
jr nz,LETTER_S
ld de, &0417
jp LOAD_TEXTGRABXY
LETTER_S:
cp &53
jr nz,LETTER_T
ld de, &0617
jp LOAD_TEXTGRABXY
LETTER_T:
cp &54
jr nz,LETTER_U
ld de, &0817
jp LOAD_TEXTGRABXY
LETTER_U:
cp &55
jr nz,LETTER_V
ld de, &0A17
jp LOAD_TEXTGRABXY
LETTER_V:
cp &56
jr nz,LETTER_W
ld de, &0C17
jp LOAD_TEXTGRABXY
LETTER_W:
cp &57
jr nz,LETTER_X
ld de, &0E17
jp LOAD_TEXTGRABXY
LETTER_X:
cp &58
jr nz,LETTER_Y
ld de, &1017
jp LOAD_TEXTGRABXY
LETTER_Y:
cp &59
jr nz,LETTER_Z
ld de, &1217
jp LOAD_TEXTGRABXY
LETTER_Z:
cp &5A
jr nz,LETTER_SQBRACKETSO
ld de, &1417
jp LOAD_TEXTGRABXY
LETTER_SQBRACKETSO:
cp &5B
jr nz,LETTER_BSLASH
ld de, &1617
jp LOAD_TEXTGRABXY
LETTER_BSLASH:
cp &5C
jr nz,LETTER_SQBRACKETSC
ld de, &1817
jp LOAD_TEXTGRABXY
LETTER_SQBRACKETSC:
cp &5D
jr nz,LETTER_POUND
ld de, &1A17
jp LOAD_TEXTGRABXY
LETTER_POUND:
cp &5E
jr nz,LETTER_USCORE
ld de, &1C17
jp LOAD_TEXTGRABXY
LETTER_USCORE:
cp &5F
jr nz,LETTER_DONE
ld de, &1E17
jp LOAD_TEXTGRABXY
LETTER_DONE:
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SCREEN SETUP ;;
;;;;;;;;;;;;;;;;;;
SCREENSETUP:
call SET_CRTC_256
ScrWid256 EQU 1 ; Use 256 pixel wide mode (Value doesn't matter)
xor a
call &BC0E ; Screen mode 0
ld b,16 ; Colour Number
ld bc,&0000 ; Value of the border colour (&0000 = &0101 = blue)
call &BC38 ; &bc38 sets the border colour
; call SPLIT_SCREEN_PLUS
RET
SETSCREEN_C000: ; Sets screen base & jumps to &C000
ld a,&C0
ld (SCREEN_BASE),a
ld de,&C040
ld (SCREEN_BASE_JUMP),de
ld de,&C050
ld (SCREEN_BASE_JUMP2),de
RET
SETSCREEN_4000: ; Sets screen base & jumps to &4000
ld a,&40
ld (SCREEN_BASE),a
ld de,&4040
ld (SCREEN_BASE_JUMP),de
ld de,&4050
ld (SCREEN_BASE_JUMP2),de
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; SET CRTC ;;
;;;;;;;;;;;;;;
SET_CRTC_256:
ld hl,CRTC_VALS ; Send the CRTC values to the
ld bc,&BC00
SET_CRTC_VALS:
out (c),c ; Choose a register
inc b
ld a,(hl)
out (c),a ; Send the new value
dec b
inc hl
inc c
ld a,c
cp 14 ; When we get to 14, we've done all the registers
jr nz,SET_CRTC_VALS
RET
CRTC_VALS:
defb &3f ;63 ; R0 - Horizontal Total
defb &20 ;32 ; R1 - Horizontal Displayed (32 chars wide)
defb 42 ; R2 - Horizontal Sync Position (centralises screen)
defb &86 ; R3 - Horizontal and Vertical Sync Widths
defb 36 ; R4 - Vertical Total
defb 0 ; R5 - Vertical Adjust
defb 24 ; R6 - Vertical Displayed (24 chars tall)
defb 29 ; R7 - Vertical Sync Position (centralises screen)
defb 0 ; R8 - Interlace
defb 7 ; R9 - Max Raster
defb 0 ; R10 - Cursor (not used)
defb 0 ; R11 - Cursor (not used)
defb &30 ; R12 - Screen start (start at 0 | &10(16) = &4000| &20(32) = &8000 | &30(48) = &C000)
defb &0 ; R13 - Screen start
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; PALETTE ;;
;;;;;;;;;;;;;
SET_PALETTE:
ld hl,PENS_GAME
ld b,16 ; 4 pens for mode 1
xor a ; Initial pen index (Clear to start at 0)
SET_PENS:
push bc
push af
ld c,(hl) ; B,C = inks for pen. If they are the same then no flashing
ld b,c
inc hl
push hl
call &BC32 ; (Firmware)
pop hl
pop af
pop bc
inc a ; Increment pen index
djnz SET_PENS
RET
PENS_GAME: ; The inks for the pens
defb &02 ; Background (Also transparent colour 0)
defb &00 ; Black
defb &03 ; Dark Brown
defb &04 ; Purple
defb &0C ;12 ; Puke Green
defb &10 ;16 ; Skin Pink
defb &19 ;25 ; Skin Yellow
defb &01 ; Dark Blue
defb &0B ; Mid Blue
defb &14 ; Light Blue
defb &1A ; White
defb &06 ; Red
defb &0F ; Orange
defb &09 ; Dark Green
defb &13 ; Light Green
defb &0D ; Grey
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; PLOT SCREEN CO-ORDINATES ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GETSCREENPOS: ; Return memory pos in HL of screen co-ord B,C (X,Y)
push bc
ld b,0 ; Load B with 0 because we only want C
ld hl,SCREEN_ADDRESS_TABLE
add hl,bc ; We add twice, because each address has 2 bytes
add hl,bc
ld a,(hl)
inc l ; INC L not INC HL because we're byte aligned to 2
ld h,(hl)
ld l,a
pop bc
ld c,b ; Load the Xpos in ('b') into 'c'
ld a,(SCREEN_BASE) ; Our table is relative to 0 - so we need to add our screen base
ld b,a
add hl,bc ; This is so it can be used for alt screen buffers
ld (ScreenLinePos_Plus2-2),hl
RET
GETNEXTLINE:
push af
ld hl,(ScreenLinePos_Plus2-2)
ld a,h
add a,&08
ld h,a
bit 7,h ; This works if the screen is at &C000
; If it's an &8000 you need to change it to bit 6,h
jp nz,GetNextLineDone
push bc
ld bc,(SCREEN_BASE_JUMP) ; If we got here we need to jump back...
add hl,bc ; ...to the top of the screen - the command here will do that
pop bc
GetNextLineDone:
ld (ScreenLinePos_Plus2-2),hl
pop af
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Fast Version, no register protection ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GETNEXTLINEFAST:
ld de,&0000
ScreenLinePos_Plus2:
ld a,d ;Add &08 to H (each CPC line is &0800 bytes below the last)
add &08
ld d,a
; Every 8 lines we need to jump back to the top of the memory range to get the correct line
; The code below will check if we need to do this - yes it's annoying but that's just the way the CPC screen is!
bit 7,d ; Change this to bit 6,h if your screen is at &8000!
jp nz,GetNextLineDone2
ex de,hl
ld bc,(SCREEN_BASE_JUMP2) ; If we got here we need to jump back...
ex de,hl ; ... to the top of the screen - the command here will do that.
add hl,bc
GetNextLineDone2:
ld (ScreenLinePos_Plus2-2),de ;Back up the screen position for next time
RET
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This is the screen address table for 256 pixel wide screens ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 2
SCREEN_ADDRESS_TABLE:
defw &0000,&0800,&1000,&1800,&2000,&2800,&3000,&3800 ;
defw &0040,&0840,&1040,&1840,&2040,&2840,&3040,&3840 ;
defw &0080,&0880,&1080,&1880,&2080,&2880,&3080,&3880 ;
defw &00C0,&08C0,&10C0,&18C0,&20C0,&28C0,&30C0,&38C0 ;
defw &0100,&0900,&1100,&1900,&2100,&2900,&3100,&3900 ;
defw &0140,&0940,&1140,&1940,&2140,&2940,&3140,&3940 ;
defw &0180,&0980,&1180,&1980,&2180,&2980,&3180,&3980 ;
defw &01C0,&09C0,&11C0,&19C0,&21C0,&29C0,&31C0,&39C0 ;
defw &0200,&0A00,&1200,&1A00,&2200,&2A00,&3200,&3A00 ;
defw &0240,&0A40,&1240,&1A40,&2240,&2A40,&3240,&3A40 ;
defw &0280,&0A80,&1280,&1A80,&2280,&2A80,&3280,&3A80 ;
defw &02C0,&0AC0,&12C0,&1AC0,&22C0,&2AC0,&32C0,&3AC0 ;
defw &0300,&0B00,&1300,&1B00,&2300,&2B00,&3300,&3B00 ;
defw &0340,&0B40,&1340,&1B40,&2340,&2B40,&3340,&3B40 ;
defw &0380,&0B80,&1380,&1B80,&2380,&2B80,&3380,&3B80 ;
defw &03C0,&0BC0,&13C0,&1BC0,&23C0,&2BC0,&33C0,&3BC0;<<<<
defw &0400,&0C00,&1400,&1C00,&2400,&2C00,&3400,&3C00 ;
defw &0440,&0C40,&1440,&1C40,&2440,&2C40,&3440,&3C40 ;
defw &0480,&0C80,&1480,&1C80,&2480,&2C80,&3480,&3C80 ;
defw &04C0,&0CC0,&14C0,&1CC0,&24C0,&2CC0,&34C0,&3CC0 ;
defw &0500,&0D00,&1500,&1D00,&2500,&2D00,&3500,&3D00 ;
defw &0540,&0D40,&1540,&1D40,&2540,&2D40,&3540,&3D40 ;
defw &0580,&0D80,&1580,&1D80,&2580,&2D80,&3580,&3D80 ;
defw &05C0,&0DC0,&15C0,&1DC0,&25C0,&2DC0,&35C0,&3DC0 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; END OF LINE, CLU ;
;;;;;;;;;;;;;;;;;;;;
[/code]
A lookup table would definitely shorten TEXTMATCH and consequently your program.
Thanks for the reply. I had thought of trying that, but I've only just got the hang of LUTS and I'm unsure just exactly how to do the matching part between the ASCII value and the co-ordinates.
Each character corresponds to an address
Have a table of addresses aligned according to ASCII character. For example in your case
&0000, &0020, &0400 ...
Then calculate the ASCII value and go to grab it from the table at address base+(value-32)*2
Or even better notice that each consquent character in the same row has an offset of &200 and each row an offset of (#rownum-1)*&08 and calculate the value from the ASCII number, it's position in its row and the row number
Ok thanks. I think I get what you mean! :)
Quote from: Kitsune Mifune on 13:09, 05 December 20
I've written a little program which pastes some text to the screen by grabbing letters from a custom text sheet:
It looks like you've written two routines in one, being 1) a sprite grabber and 2) a routine to display some text based on the grabbed sprites.
Quote from: Kitsune Mifune on 13:09, 05 December 20
Do I need to print the sheet to the screen or maybe I can just read directly from the image file?
No, the screen memory is still memory - it's just that the bit of memory being displayed on the monitor is &C000 to &FFFF.
The best way to do it would be:
- Order your sprites in ASCII order, starting at 32 which is the first printable character (see attached mockup)
- Capture these sprites in order - remember, "capturing a sprite" is the same as drawing a sprite - you're only copying one part of memory (e.g. &C000) to another (e.g. &4000)
- Save the grabbed alphabet of sprites as a BIN or DEFB statements etc
Now you have all your captured sprites and you can write a routine to display them based on a text string:
- Load the sprites into memory or in assembler use the DEFBs
- Take the text string (HL) and load a character into A
- Subtract 32 from A because we don't use the first 32
- Multiply 32 by &20 to find the address of the sprite which correlates to the character you want to print on the screen
- Draw the sprite to the screen
- Repeat
Thanks for the reply redbox, and apologies for the late response.
Quote from: redbox on 16:33, 07 December 20No, the screen memory is still memory - it's just that the bit of memory being displayed on the monitor is &C000 to &FFFF.
Just to clarify - you are saying that I can just read the information from the memory position of the RAW graphics data? I've been trying to do that but I just can't for the life of me get it to work. It seems that it wants to be plotted/drawn first to "somewhere" using the plotting code, and THEN copied to the buffer. If I don't do that then I just get blocks of garbage with partial letters on the screen.
Apologies if I'm not explaining this very well.
Also Re your list, I have the sprite sheet ordered in ASCII from &20-&5F so that's ok, and I gather that you mean to chop out and store each letter individually for later use instead of just reading from the sheet one at a time like I'm doing now?
Once again, thank you everyone for the help
Quote from: Kitsune Mifune on 20:01, 09 December 20Just to clarify - you are saying that I can just read the information from the memory position of the RAW graphics data? I've been trying to do that but I just can't for the life of me get it to work.
Yes, you can. However, the CPC's screen data is displayed in a non-linear fashion (https://retrocomputing.stackexchange.com/questions/13625/why-did-the-amstrad-cpc-use-a-nonlinear-screen-memory-layout), where as most sprite data is stored in a linear way. Hence why you "grab" sprites - what you're doing is copying the screen data to another RAM location but storing it in a linear way to make it easier to display later.
Quote from: Kitsune Mifune on 20:01, 09 December 20I gather that you mean to chop out and store each letter individually for later use instead of just reading from the sheet one at a time like I'm doing now?
Exactly.
This article in CPC Attack explains sprites (https://archive.org/details/cpc-attack-magazine-04/page/n49/mode/2up) really well - it's on Page 50.
That's a great little article! Thanks.
I think I'm getting it now, so I'll have a fiddle today!
Once again, thank you for the help!
Quote from: Kitsune Mifune on 09:15, 11 December 20I think I'm getting it now, so I'll have a fiddle today!
You could always use a PC utility to grab the sprites, such as AMSprite (http://www.cpcwiki.eu/imgs/d/d2/AMSprite_setup.rar).
First, you cut your sprites individually:
(https://i.ibb.co/CB27pRd/font.png) (https://imgbb.com/)
(https://i.ibb.co/Y79YRmb/33.png) (https://imgbb.com/)
Then in the AMSprite application, you click on "Import and convert image to new sprite":
(https://i.ibb.co/2v4QDpj/00.png) (https://ibb.co/sKYG0XF)
Enter the parameters for the sprite:
(https://i.ibb.co/JBCx3VH/01.png) (https://ibb.co/f1Q8DfH)
Once all imported, you can then click on "Export to Assembly":
(https://i.ibb.co/6F6ctm3/02.png) (https://ibb.co/GRgfM0K)
This lists the sprites in defb (byte) format to be able to use in WinAPE and Maxam:
(https://i.ibb.co/F6ZqWkK/03.png) (https://ibb.co/R2r4SG9)
Once you have the sprites, you can then write a routine like the one I described earlier (and using the CPC Attack sprite routine) to print a string using them:
org &4000
nolist
run Start
; Setup screen and colours
.Start ld a,1 ; MODE 1
call &BC0E ; SCR SET MODE
call &BC14 ; SCR CLEAR
ld b,26 ; Palette colour
ld c,26
call &BC38 ; SCR SET BORDER
ld a,0 ; Pen number
ld b,26 ; Palette colour
ld c,26
call &BC32 ; SCR SET INK
ld a,1 ; Pen number
ld b,24 ; Palette colour
ld c,24
call &BC32 ; SCR SET INK
ld a,2 ; Pen number
ld b,15 ; Palette colour
ld c,15
call &BC32 ; SCR SET INK
ld a,3 ; Pen number
ld b,0 ; Palette colour
ld c,0
call &BC32 ; SCR SET INK
; Print the string using sprites
ld hl,String
call PrintString
.Loop jr Loop ; Infinite loop
; Subroutines
.PrintString ld a,(hl) ; Get character from string
or a ; Is it 0?
ret z ; Yes, then we're done ...
push hl ; ... otherwise print it
sub 32 ; Subtract 32 from ASCII number
ld de,SpriteData ; Start of sprite data
ld h,0 ; Reset h
ld l,a ; Load ASCII number into A
add hl,hl ; x 2
add hl,hl ; x 4
add hl,hl ; x 8
add hl,hl ; x 16 (bytes size of each sprite)
add hl,de ; Add to start address of sprite data
ld de,(ScrAddress) ; Get current screen address
ld b,8 ; Sprite is 8 lines high
ld c,2 ; And 2 bytes wide (MODE 1 = 8 pixels)
call Sprite ; Draw sprite
ld hl,(ScrAddress)
ld de,2 ; Add 2 bytes (8 pixels) to screen address
add hl,de
ld (ScrAddress),hl ; And store it again
pop hl
inc hl
jr PrintString ; Loop back
.Sprite push de ; Preserve screen address ...
push bc ; ... and the dimensions
ld b,0 ; BC now equals the width in bytes
ldir ; Copy the bytes
pop bc ; Get Back the dimensions
pop de ; And then the screen address
ex de,hl ; To move DE onto the next screen line ...
call NextLine ; ... we use the routine to move HL onto the ...
ex de,hl ; ... next line, but swap DE and HL either side
djnz Sprite ; If not all lines done, loop back
ret
.NextLine ld a,8
add a,h ; Add 8 to H (the high byte)
ld h,a
ret nc ; Return if no overflow
push de ; Otherwise preserve DE
ld de,&C050
add hl,de ; Add &C000+&50 to HL ...
pop de ; ... and get DE back again
ret
; Data
.String defb '"IT WORKS!!!" SAID KITSUNE.',0
.ScrAddress defw &C000
; Sprites
.SpriteData
.S32
defb &00,&00; line 0
defb &80,&00; line 1
defb &00,&00; line 2
defb &00,&00; line 3
defb &00,&00; line 4
defb &00,&00; line 5
defb &00,&00; line 6
defb &00,&00; line 7
.S33
defb &11,&CC; line 0
defb &23,&A6; line 1
defb &23,&A6; line 2
defb &23,&4C; line 3
defb &11,&88; line 4
defb &32,&4C; line 5
defb &23,&4C; line 6
defb &11,&88; line 7
.S34
defb &66,&CC; line 0
defb &DB,&A6; line 1
defb &9F,&2E; line 2
defb &66,&CC; line 3
defb &00,&00; line 4
defb &00,&00; line 5
defb &00,&00; line 6
defb &00,&00; line 7
.S35
defb &00,&00; line 0
defb &00,&00; line 1
defb &00,&00; line 2
defb &00,&00; line 3
defb &00,&00; line 4
defb &00,&00; line 5
defb &00,&00; line 6
defb &00,&00; line 7
.S36
defb &00,&00; line 0
defb &00,&00; line 1
defb &00,&00; line 2
defb &00,&00; line 3
defb &00,&00; line 4
defb &00,&00; line 5
defb &00,&00; line 6
defb &00,&00; line 7
.S37
defb &66,&66; line 0
defb &DB,&9F; line 1
defb &9F,&97; line 2
defb &76,&2E; line 3
defb &65,&6E; line 4
defb &8F,&DB; line 5
defb &9F,&9F; line 6
defb &66,&66; line 7
.S38
defb &00,&00; line 0
defb &00,&00; line 1
defb &00,&00; line 2
defb &00,&00; line 3
defb &00,&00; line 4
defb &00,&00; line 5
defb &00,&00; line 6
defb &00,&00; line 7
.S39
defb &11,&88; line 0
defb &32,&4C; line 1
defb &23,&4C; line 2
defb &23,&88; line 3
defb &11,&00; line 4
defb &00,&00; line 5
defb &00,&00; line 6
defb &00,&00; line 7
.S40
defb &11,&CC; line 0
defb &23,&C4; line 1
defb &32,&4C; line 2
defb &32,&88; line 3
defb &32,&88; line 4
defb &23,&4C; line 5
defb &23,&4C; line 6
defb &11,&CC; line 7
.S41
defb &33,&88; line 0
defb &32,&4C; line 1
defb &23,&C4; line 2
defb &11,&C4; line 3
defb &11,&C4; line 4
defb &23,&4C; line 5
defb &23,&4C; line 6
defb &33,&88; line 7
.S42
defb &11,&88; line 0
defb &23,&4C; line 1
defb &56,&2E; line 2
defb &BC,&1F; line 3
defb &56,&2E; line 4
defb &AD,&1F; line 5
defb &9F,&9F; line 6
defb &EE,&77; line 7
.S43
defb &00,&00; line 0
defb &11,&CC; line 1
defb &11,&C4; line 2
defb &77,&F7; line 3
defb &74,&97; line 4
defb &77,&7F; line 5
defb &11,&4C; line 6
defb &11,&CC; line 7
.S44
defb &00,&00; line 0
defb &00,&00; line 1
defb &00,&00; line 2
defb &11,&88; line 3
defb &32,&4C; line 4
defb &23,&4C; line 5
defb &11,&4C; line 6
defb &00,&CC; line 7
.S45
defb &00,&00; line 0
defb &00,&00; line 1
defb &00,&00; line 2
defb &77,&EE; line 3
defb &74,&2E; line 4
defb &77,&EE; line 5
defb &00,&00; line 6
defb &00,&00; line 7
.S46
defb &00,&00; line 0
defb &00,&00; line 1
defb &00,&00; line 2
defb &11,&88; line 3
defb &32,&4C; line 4
defb &23,&4C; line 5
defb &11,&88; line 6
defb &00,&00; line 7
.S47
defb &00,&66; line 0
defb &00,&9F; line 1
defb &11,&97; line 2
defb &32,&2E; line 3
defb &65,&4C; line 4
defb &8F,&88; line 5
defb &9F,&00; line 6
defb &66,&00; line 7
.S48
defb &77,&EE; line 0
defb &9E,&97; line 1
defb &BD,&9F; line 2
defb &BD,&7D; line 3
defb &BD,&BD; line 4
defb &9E,&D3; line 5
defb &8F,&1F; line 6
defb &77,&EE; line 7
.S49
defb &33,&CC; line 0
defb &56,&4C; line 1
defb &56,&4C; line 2
defb &76,&4C; line 3
defb &32,&4C; line 4
defb &FE,&7F; line 5
defb &BC,&D3; line 6
defb &FF,&FF; line 7
.S50
defb &FF,&EE; line 0
defb &BC,&97; line 1
defb &FF,&DB; line 2
defb &9E,&97; line 3
defb &BD,&FF; line 4
defb &BC,&D3; line 5
defb &8F,&1F; line 6
defb &77,&FF; line 7
.S51
defb &FF,&EE; line 0
defb &BC,&97; line 1
defb &FF,&DB; line 2
defb &23,&A6; line 3
defb &FF,&DB; line 4
defb &BC,&D3; line 5
defb &8F,&1F; line 6
defb &FF,&EE; line 7
.S52
defb &FF,&EE; line 0
defb &BD,&2E; line 1
defb &BD,&B7; line 2
defb &9E,&D3; line 3
defb &77,&B7; line 4
defb &11,&A6; line 5
defb &11,&2E; line 6
defb &11,&EE; line 7
.S53
defb &FF,&FF; line 0
defb &BC,&D3; line 1
defb &BD,&FF; line 2
defb &BC,&97; line 3
defb &FF,&DB; line 4
defb &BC,&97; line 5
defb &8F,&1F; line 6
defb &FF,&EE; line 7
.S54
defb &77,&EE; line 0
defb &9E,&A6; line 1
defb &BD,&EE; line 2
defb &BC,&97; line 3
defb &BD,&DB; line 4
defb &BC,&D3; line 5
defb &8F,&1F; line 6
defb &77,&EE; line 7
.S55
defb &FF,&FF; line 0
defb &BC,&D3; line 1
defb &FF,&DB; line 2
defb &23,&97; line 3
defb &56,&2E; line 4
defb &56,&4C; line 5
defb &56,&4C; line 6
defb &77,&CC; line 7
.S56
defb &77,&EE; line 0
defb &9E,&97; line 1
defb &BD,&DB; line 2
defb &56,&A6; line 3
defb &BD,&DB; line 4
defb &BC,&D3; line 5
defb &8F,&1F; line 6
defb &77,&EE; line 7
.S57
defb &77,&EE; line 0
defb &9E,&97; line 1
defb &BD,&DB; line 2
defb &9E,&D3; line 3
defb &77,&DB; line 4
defb &56,&D3; line 5
defb &47,&1F; line 6
defb &77,&EE; line 7
.S58
defb &11,&88; line 0
defb &32,&4C; line 1
defb &23,&4C; line 2
defb &11,&88; line 3
defb &32,&4C; line 4
defb &23,&4C; line 5
defb &11,&88; line 6
defb &00,&00; line 7
.S59
defb &11,&88; line 0
defb &32,&4C; line 1
defb &23,&4C; line 2
defb &11,&88; line 3
defb &32,&4C; line 4
defb &23,&4C; line 5
defb &11,&4C; line 6
defb &00,&CC; line 7
.S60
defb &00,&EE; line 0
defb &11,&6A; line 1
defb &23,&C4; line 2
defb &56,&88; line 3
defb &23,&C4; line 4
defb &11,&2E; line 5
defb &00,&EE; line 6
defb &00,&00; line 7
.S61
defb &00,&00; line 0
defb &77,&EE; line 1
defb &74,&2E; line 2
defb &77,&EE; line 3
defb &74,&2E; line 4
defb &77,&EE; line 5
defb &00,&00; line 6
defb &00,&00; line 7
.S62
defb &77,&00; line 0
defb &65,&88; line 1
defb &32,&4C; line 2
defb &11,&A6; line 3
defb &32,&4C; line 4
defb &47,&88; line 5
defb &77,&00; line 6
defb &00,&00; line 7
.S63
defb &FF,&EE; line 0
defb &BC,&97; line 1
defb &FF,&DB; line 2
defb &56,&97; line 3
defb &56,&EE; line 4
defb &33,&88; line 5
defb &56,&88; line 6
defb &33,&00; line 7
.S64
defb &77,&EE; line 0
defb &BC,&97; line 1
defb &DB,&9F; line 2
defb &EB,&5F; line 3
defb &EB,&97; line 4
defb &9F,&FF; line 5
defb &9E,&2E; line 6
defb &77,&EE; line 7
.S65
defb &77,&EE; line 0
defb &9E,&D3; line 1
defb &BD,&FD; line 2
defb &BC,&F1; line 3
defb &BD,&FD; line 4
defb &BD,&75; line 5
defb &9F,&57; line 6
defb &FF,&77; line 7
.S66
defb &FF,&EE; line 0
defb &BC,&D3; line 1
defb &BD,&BD; line 2
defb &BC,&E2; line 3
defb &BD,&BD; line 4
defb &BC,&D3; line 5
defb &8F,&1F; line 6
defb &FF,&EE; line 7
.S67
defb &77,&FF; line 0
defb &9E,&D3; line 1
defb &AD,&FF; line 2
defb &BD,&00; line 3
defb &AD,&FF; line 4
defb &9E,&D3; line 5
defb &8F,&1F; line 6
defb &77,&FF; line 7
.S68
defb &FF,&CC; line 0
defb &BC,&A6; line 1
defb &BD,&DB; line 2
defb &BD,&75; line 3
defb &BD,&BD; line 4
defb &BC,&D3; line 5
defb &8F,&1F; line 6
defb &FF,&EE; line 7
.S69
defb &77,&FF; line 0
defb &9E,&D3; line 1
defb &BD,&FF; line 2
defb &BC,&4C; line 3
defb &BD,&FF; line 4
defb &BC,&D3; line 5
defb &8F,&1F; line 6
defb &77,&FF; line 7
.S70
defb &77,&FF; line 0
defb &9E,&97; line 1
defb &BD,&FF; line 2
defb &BC,&4C; line 3
defb &BD,&CC; line 4
defb &BD,&00; line 5
defb &9F,&00; line 6
defb &FF,&00; line 7
.S71
defb &77,&FF; line 0
defb &9E,&D3; line 1
defb &BD,&FF; line 2
defb &BD,&9F; line 3
defb &BD,&FD; line 4
defb &9E,&D3; line 5
defb &8F,&1F; line 6
defb &77,&FF; line 7
.S72
defb &FF,&77; line 0
defb &BD,&57; line 1
defb &BD,&FD; line 2
defb &BC,&79; line 3
defb &BD,&FD; line 4
defb &BD,&75; line 5
defb &9F,&57; line 6
defb &FF,&77; line 7
.S73
defb &FF,&FF; line 0
defb &BC,&D3; line 1
defb &EF,&F7; line 2
defb &23,&C4; line 3
defb &23,&C4; line 4
defb &EF,&F7; line 5
defb &BC,&D3; line 6
defb &FF,&FF; line 7
.S74
defb &77,&FF; line 0
defb &47,&D3; line 1
defb &77,&DB; line 2
defb &EE,&DB; line 3
defb &9F,&DB; line 4
defb &9E,&D3; line 5
defb &8F,&1F; line 6
defb &77,&EE; line 7
.S75
defb &FF,&77; line 0
defb &BD,&BD; line 1
defb &BD,&5B; line 2
defb &BC,&A6; line 3
defb &BD,&5B; line 4
defb &BD,&BD; line 5
defb &9F,&BD; line 6
defb &FF,&FF; line 7
.S76
defb &FF,&00; line 0
defb &9F,&00; line 1
defb &BD,&00; line 2
defb &BD,&00; line 3
defb &BD,&FF; line 4
defb &BC,&97; line 5
defb &8F,&1F; line 6
defb &77,&FF; line 7
.S77
defb &77,&66; line 0
defb &8F,&9F; line 1
defb &BC,&5B; line 2
defb &AD,&B5; line 3
defb &BD,&7D; line 4
defb &BD,&FD; line 5
defb &9F,&57; line 6
defb &FF,&77; line 7
.S78
defb &77,&EE; line 0
defb &9E,&97; line 1
defb &BD,&9F; line 2
defb &BD,&75; line 3
defb &BD,&75; line 4
defb &BD,&75; line 5
defb &9F,&57; line 6
defb &FF,&77; line 7
.S79
defb &77,&EE; line 0
defb &9E,&97; line 1
defb &BD,&9F; line 2
defb &BD,&75; line 3
defb &BD,&BD; line 4
defb &9E,&D3; line 5
defb &8F,&1F; line 6
defb &77,&EE; line 7
.S80
defb &FF,&EE; line 0
defb &9E,&97; line 1
defb &BD,&DB; line 2
defb &BC,&97; line 3
defb &BD,&EE; line 4
defb &BD,&00; line 5
defb &9F,&00; line 6
defb &FF,&00; line 7
.S81
defb &77,&EE; line 0
defb &9E,&97; line 1
defb &BD,&9F; line 2
defb &BD,&7D; line 3
defb &BD,&97; line 4
defb &BC,&6A; line 5
defb &8F,&9F; line 6
defb &77,&77; line 7
.S82
defb &FF,&EE; line 0
defb &9E,&97; line 1
defb &BD,&DB; line 2
defb &BC,&A6; line 3
defb &BD,&DB; line 4
defb &BD,&BD; line 5
defb &9F,&9F; line 6
defb &FF,&FF; line 7
.S83
defb &77,&FF; line 0
defb &9E,&D3; line 1
defb &BD,&FF; line 2
defb &9E,&97; line 3
defb &FF,&DB; line 4
defb &BC,&D3; line 5
defb &8F,&1F; line 6
defb &FF,&EE; line 7
.S84
defb &FF,&FF; line 0
defb &BC,&D3; line 1
defb &EF,&F7; line 2
defb &23,&C4; line 3
defb &23,&C4; line 4
defb &23,&C4; line 5
defb &23,&4C; line 6
defb &33,&CC; line 7
.S85
defb &FF,&77; line 0
defb &9F,&57; line 1
defb &BD,&75; line 2
defb &BD,&75; line 3
defb &BD,&BD; line 4
defb &9E,&D3; line 5
defb &8F,&1F; line 6
defb &77,&EE; line 7
.S86
defb &FF,&77; line 0
defb &9F,&57; line 1
defb &BD,&75; line 2
defb &BD,&75; line 3
defb &AD,&BD; line 4
defb &9E,&5B; line 5
defb &47,&A6; line 6
defb &33,&CC; line 7
.S87
defb &FF,&77; line 0
defb &9F,&57; line 1
defb &BD,&FD; line 2
defb &BD,&7D; line 3
defb &BD,&F5; line 4
defb &9E,&5B; line 5
defb &8F,&9F; line 6
defb &77,&66; line 7
.S88
defb &FF,&77; line 0
defb &9F,&57; line 1
defb &AD,&BD; line 2
defb &56,&E2; line 3
defb &AD,&BD; line 4
defb &BD,&75; line 5
defb &9F,&57; line 6
defb &FF,&77; line 7
.S89
defb &FF,&77; line 0
defb &F9,&57; line 1
defb &E9,&FD; line 2
defb &BC,&F1; line 3
defb &FF,&FD; line 4
defb &BC,&D3; line 5
defb &8F,&1F; line 6
defb &FF,&EE; line 7
.S90
defb &FF,&FF; line 0
defb &BC,&D3; line 1
defb &EF,&A6; line 2
defb &32,&4C; line 3
defb &65,&7F; line 4
defb &BC,&D3; line 5
defb &8F,&1F; line 6
defb &FF,&FF; line 7
If you assemble and run, you should see:
(https://i.ibb.co/Xz8F5Dc/04.png) (https://ibb.co/2jNcMSG)
I've attached a ZIP to this post including all the files to have a play around with.
Quote from: redbox on 10:56, 14 December 20You could always use a PC utility to grab the sprites, such as AMSprite.
That's a wonderful tool, thank you. I have an image slicer given to me by Codetapper over on the EAB, but it's Amiga specific and I don't think it does exactly what AMsprite does, so that will come in very useful! :)
My routine is looking much nicer now. I've got rid of that big list and replaced it with a nice table, and I'm planning on adapting it to use with background tiles as well as text blocks so, it's all coming together!
Once again, thank you for all the help and advice. I think I would have been stuck otherwise!