13644
DEMO -> Divers
© _Public_Domain_ (2024)
 
 
 
Vintage Computing Christmas Challenge 2024
cpc
 
 

NOTICE / MANUAL

TXT (1)

NOTICE TEXTE n° 1 (28.43 Ko)

;3........41....assembler..Z80 Assembler......................Longshot / Logon System ;;======================================================================= ;; Vintage Computing Christmas Challenge 2024 (VC3 2024) ;; Amstrad CPC 6128 / Longshot (Logon System) ;; December 2024 ;; 41 bytes. ;; Christmas strings in the box ;; run from basic : memory &2d00:mode 0:load "vcc2024.bin":call #2d2b ;; or type : run "STUB" with the same content ;; For 464 or 664 model, update _firm_disprom equ. ;;======================================================================= _firm_disprom_464 equ #6eb _firm_disprom_664 equ #6ec _firm_disprom_6128 equ #6fc _firm_disprom equ _firm_disprom_6128 size_code equ end_code-start_code org_code equ #7f00-5 org org_code start_code ; on run (de=#2d2b, hl=#004x, a=0 bc=#20ff) ; #2d2b >> 1st charset "-+" exec_code ld hl,#8000+200 ; End of christmas_buffer+1 >> #8000+(20 bytes x 10 lines) fill_10lines ; ======================== ld bc,#14dc ; b=19+1 loop / c=200-1+21 (for lddr) ld a,h ; a=%10000000 (selector for 2nd char of charset) 8 bits+Carry fill_oneline ; ------------------------ dec l ; ptrbuf-- ZF=1 if l==0 rla ; rotate selector 9 bits ld (hl),d ; "-" or " " jr nc,select_2ndchar ; CF=0 first char ld (hl),e ; "+" or "!" select_2ndchar djnz fill_oneline ; complete line ; ------------------------ ld de,#2021 ; New current charset " !" ld (hl),d ; + 1 space jr nz,fill_10lines ; new line until hl=ptrbuf=#8000 (l=0 ZF=1) ; ======================== ld d,h ; d=msb ptrbuf dec hl ; ld e,200-1 ; Duplicate (9+1) lines to (1+9+1) lines ex de,hl lddr ld l,christmas_string ; h is ok. l on lsb string buffer rst #28 ; Display string & go back to Basic dw _firm_disprom ; christmas_string db #1f,10,#7f ; locate x=10 y=scroll down db #cd,"O",#cc,13,10 ; gift bow "\","O","/" christmas_buffer ; Buffer to build end_code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;5........42....assembler..Z80 Assembler......................Overflow org #2100 -#22; call #0901=de loop_Y ld h,#21 loop_knot ld a,(hl) call #BB5A dec l jr nz,loop_knot dec (hl); (#2100) counts Y ret z ld l,h; hl=#2121="! "+1 dec e jr nz,jr_Y ld e,d; =9 ld hl,#2B2D; "+-" jr_Y equ $ -1; #2B == dec hl ld bc,#100 +19; b counts X loop_X ld a,l djnz jr_X ld b,d; =9 ld a,h jr_X call #BB5A dec c jr nz,loop_X db #C3; jp #0Dxx=loop_Y db 19 +1; counts Y at org #2100 db #0D,#CC,"o",#CD,0,9,#1F - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;7........43....assembler..Z80 Assembler......................lightforce6128 NOLIST ;; Vintage Computing Christmas Challenge 2024 (VC3 2024) ;; ;; Object : Christmas Present ;; Category : Main Challenge ;; System : Amstrad CPC 6128 ;; Language : Z80 Assembler (WinAPE/Maxam) ;; Author : lightforce6128 ;; ;; Either run with WinAPE assembler (F3, then F9), ;; ;; or assemble with WinAPE assembler (F3, then Ctrl+F9) ;; optionally clear screen via CLS:LOCATE 1,22 ;; and execute via CALL 11529, ;; ;; or assemble with WinAPE assembler (F3, then Ctrl+F9) ;; save via SAVE "present.bin",B,11529,43 ;; load via MEMORY 11529:LOAD"present ;; optionally clear screen via CLS:LOCATE 1,22 ;; and execute via CALL 11529 ;; ;; The program itself does not clear the screen and it does not halt. ;; Both is allowed in the rules for this challenge, although both is ;; not quite user-friendly. ;; This special starting address moves parts of the program ;; to memory locations that allow to make special use of the ;; registers containing pointers to these memory locations. ;; It is checked in an assertion-like statement below. ORG &2D00 ;; Define some constants for OS access. CHR_LOCATE EQU 31 ;; also requires column and row LO_SIDE_CALL EQU &10 BASIC_PRINT_STRING EQU &C38B ;; call with RST LO_SIDE_CALL TXT_CURSOR_POSITION EQU &B726 TXT_OUTPUT EQU &BB5A ;; This entrypoint for execution directly from WinAPE assembler ;; sets some registers as they would be set if program had been ;; called from command line. This setup code is not counted for ;; size and is not saved to disk by the third starting option ;; as described in the header. It is removed from the shortened ;; version of the source code. RUN winapeAssemblerEntryPoint winapeAssemblerEntryPoint: LD BC,&20FF LD DE,&2D09 LD HL,&0045 ;; From here every byte is counted. binaryStart: ;; This is also the official starting point of this program ;; as reached by the command CALL 11529. callEntryPoint: ;; A:00 BC:20FF DE:2D09 HL:0045 IX:BFFE IY:0000 SP:BFF8 bow: ;; Define the control string to print the bow. ;; This is also a short nonsense code snippet ;; that does not interfere with the rest ;; of the program. But it sets up a needed ;; value in register H. DEFB CHR_LOCATE, 9, 1, "\O/" ;; RRA : ADD HL,BC : LD BC,&4F5C : CPL DEFB 0 ;; NOP ;; Check if this is placed at the right position. ;; Its memory address is later used also for ;; another purpose. bowExpected EQU "-"*256+9 IF bow-bowExpected PRINT "Wrong program location: Should be $bowExpected, but is $bow." STOP ENDIF ;; A:FF BC:4F5C DE:2D09 HL:2144 IX:BFFE IY:0000 SP:BFF8 ;; Print the bow. The system call will not alter register HL, ;; so it can be used below in a second role. EX DE,HL : RST LO_SIDE_CALL : DEFW BASIC_PRINT_STRING ;; A:FF BC:4F5C DE:2144 HL:2D09 IX:BFFE IY:0000 SP:BFF8 ;; Complete setting up of two small, two-element queues, ;; one with characters, one with step sizes. ;; HD:2D21 ("-!") LE:0901 LD E,1 ;; First draw all the horizontal lines with dashes, ;; then the vertical lines with exclamation marks, ;; and finally the corners with plus signs. characterLoop: LD B,18 columnLoop: LD C,18 rowLoop: ;; Position the cursor. Adjust the row to ;; keep space for the bow. INC C : LD (TXT_CURSOR_POSITION),BC : DEC C ;; Print the character stored in the front ;; element of queue HD. LD A,H : CALL TXT_OUTPUT ;; Use the front element of queue LE as row step size. LD A,C : SUB A,L : LD C,A JR NC,rowLoop ;; Use the second element of queue LE as column step size. LD A,B : SUB A,E : LD B,A JR NC,columnLoop ;; Shift both queues to update character and step sizes. ;; Fill up the queues with character "+" and step size 9. ;; initial : HD:2D21 ("-!") LE:0901 ;; first iteration : HD:212B ("!+") LE:0109 ;; second iteration : HD:2B2B ("++") LE:0909 ;; no change afterwards EX DE,HL : LD DE,"+"*256+9 JR characterLoop ;; Here counting of bytes end. binaryEnd: ;; Print out size and commands to save, load, and start program. IF1 binaryLength EQU binaryEnd - binaryStart PRINT PRINT 'address range: &binaryStart - &binaryEnd (&binaryLength bytes)' PRINT PRINT 'save with: SAVE"present.bin",B,&binaryStart,&binaryLength' PRINT 'load with: MEMORY &binaryStart:LOAD"present"' PRINT 'optionally clear screen: CLS:LOCATE 1,22' PRINT 'start with: CALL &callEntryPoint' ENDIF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;13.......46....assembler..Z80 Assembler......................SymbiosiS ;============================================================================== ; VINTAGE COMPUTING CHRISTMAS CHALLENGE 2024 (VC3 2024) ; platform - Amstrad CPC 6128 Plus ; language - Z80 assembly ; contributor - SYMBIOSIS ; credits - BSC (ideas), PRODATRON (code, ideas, optimization) ; date - December 2024 ;------------------------------------------------------------------------------ ; size - 46 bytes ;============================================================================== ;from Basic start with... ;MEMORY &13FE ;LOAD"XC24SYMB" ;CALL &13FF ;as the gift consists mainly of 1+8+1+8+1 characters in both dimensions, the ;idea of this approach is to shift two 9-bit patterns for both the rows and ;columns to find out if we hit a row, a column, a node or nothing (4 different ;combinations) ;the two leading row/column bits are used to create an index for selecting the ;correct character for each position ;to save one byte (RET) the text and data behind the code is arranged and ;placed in a way, that it can be reused as an endless loop txtout equ #bb5a adr_run equ 19*256+255 ;call address is #13ff and predefines DE; ;A=0, CF=0, D=row counter, E,CF=9bit row pattern adr_org equ #1f00-31 ;31 (see "len_sub") is the size until "txt_chars" ;which has to be placed at #1f00 org adr_org ld hl,txt_bow ;plot bow (H=#1f) gift1 rst #18 ;plot bow or just cr/lf dw rom_print ld bc,19*256+255 ;B=column counter, C,CF=9bit column pattern adc a ;build row index (A=rowbit9), CF=0 gift2 rla ;add column index (A=2*rowbit9+1*columnbit9) ld l,a ;HL=#1f0x ld a,(hl) ;load char from indexed table call txtout ;print it ld a,l ;restore A rra ;restore column CF from A, A=row index rr c ;move through column 9bit pattern djnz gift2 ;column loop rra ;restore row CF from A ld a,b ;A is 0 again rl e ;move through row 9bit pattern ld l,14 ;HL=#1f0e=txt_crlf dec d jr nz,gift1 ;row loop len_sub equ $-adr_org ;here the address is #1f00 txt_chars db "+","-","!"," " ;as opcodes this is dec hl;dec l;ld hl,x;jp #1f00 ;so this will just loop forever rom_print dw #c38b ;prints 0-terminated string at HL (6128 specific) db 0 txt_bow db #1f,9,25,"\o/" ;placing and plotting the bow txt_crlf db 13,10 ;CR/LF for both the bow and the rows ;(always followed by zeros) len_all equ $-adr_org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;18.......51....assembler..Z80 Assembler......................Arnolde of Leosoft ;============================================ ; Vintage Computing Christmas Challenge 2024 ;============================================ ; Submission by Arnolde of Leosoft ; "Je m'appelle boite" (I call myself box) ;============================================ ; Z80 Machine Code for Amstrad CPC, 51 bytes ;============================================ ; Main loop consists of fall-through calls to ; realize the 1-8-1-8-1 structure. It calls ; itself recusively to serve both for the ; line setup and the character output. ; Carry flag indicates recursion depth: ; set = line setup mode (outer loop) ; reset = char output mode (inner loop) ; Zero flag indicates if the current item is ; set = a single ; reset = an octuplet ; As the characters always cone in pairs, ; they are passed via DE ;============================================ ; To launch from Basic: ; MEMORY &5C1F ; LOAD "VCCC24.BIN",&5C20 ; CALL &5C20 ; or run the basic loader: ; RUN "VCCC24.BAS" ;============================================ org #5C20 ; input conditions: ; Carry is reset -> char mode enabled ; DE = #5C20 = "\ " ; draw bow call do_8e_1d ; output 8 spaces + "\" ld de,"/O" ; (#2F4F) call do_1e_1d ; output "O/" scf ; set line mode ; draw box loop: ; 1-8-1-8-1: call do_1d ; 1- call do_8e_1d ; -8-1- do_8e_1d: ; -8-1 ld b,7 ; will be inc'ed to 8 do_1e_1d: ld a,e ; load octuplet character inc b ; =1 if called directly repet: call do_it dec b ; not djnz because jr nz,repet ; we need zero flag do_1d: ld a,d ; load single character do_it: ; either... jp nc,#BB5A ; output character, or... ; set up next line ("outer loop") ccf ; set char output mode ld c,b ; backup outer counter ld de,#0A0D ; = LF-CR (newline) ld hl,"! " ; octuplet (#2120) jr nz,$+3 ; z set -> setup single: add hl,de ; = #2B2D = "+-" = single * call do_1e_1d ; go down one text line ** ex de,hl ; line chars -> de call loop ; output current char line ld b,c ; restore outer counter scf ; back to line mode ret ; *) Yes, "! " + #0A0D = "+-". Was that an ; intentional easter egg, Logiker? ; **) We can keep b as is, because even if ; b>1, the repeated character is CR ;============================================ ; \O/ ; +--------+--------+ ; ! MERRY ! ; ! CHRISTMAS ! ; ! AND A ! ; +--------+--------+ ; ! HAPPY ! ; ! NEW ! ; ! YEAR ! ; +--------+--------+ ;============================================ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;19.......52....assembler..MAXAM Z80 Assembler (ROM version)..TFM of FutureSoft TFM's "Zeige Geschenk" Programm für FutureOS auf CPC6128 oder 6128plus :-) Das Programm benötigt 52 Bytes im Speicher - Version 3 :-) ARNOR Z80 ASSEMBLER version 1.15 Page 001 00003 7F74 (7F74) ORG &7F74 ;Source Code 'GESCHENK.MAX' -> Assembliert in 52 Bytes 00004 NOLIST ;2024.12.12 00005 7F74 WRITE "-RUN-ME." ;Zeilen 52 / Code-Bytes 52 00006 00007 00008 ;OS-Variablen und OS-Funktionen 00009 00010 7F74 (FF22) OSRON_A EQU &FF22 00011 7F74 (FBFA) TERM_2 EQU &FBFA 00012 00013 00014 ;ZEIge GEschenk 00015 00016 7F74 69 ZEI_GE LD L,C 00016 7F75 CD FA FB CALL TERM_2 00017 00018 7F78 3E 0A LD A,&0A 00019 00020 7F7A 21 9B 7F ZGL LD HL,G_STR_2+&01 00021 00022 7F7D 77 LD (HL),A 00023 7F7E 2D DEC L 00024 7F7F CD FA FB CALL TERM_2 00025 00026 7F82 3E 13 LD A,&13 00027 7F84 18 F4 JR ZGL 00028 00029 00030 ;Zeichenketten 00031 00032 7F86 02 G_STR_1 DB &02 ;ROM Zeichensatz 00033 00034 7F87 0C DB &0C ;Cursor Heim 00035 00036 7F88 09 DB &09 ;Tabulator 00037 00038 7F89 5C 4F 2F 0E DB "\O/",&0E 00039 00040 7F8D 05 13 21 DB &05,&13,"!" ;Vertikal 19x "!" ausgeben 00041 00042 7F90 08 08 DB &08,&08 ;Cursor-Position +8 00043 7F92 05 13 21 DB &05,&13,"!" ;Vertikal 19x "!" ausgeben 00044 00045 7F95 08 08 DB &08,&08 ;Cursor-Position +8 00046 7F97 05 13 21 DB &05,&13,"!" ;Vertikal 19x "!" ausgeben 00047 00048 7F9A 1E 01 00 G_STR_2 DB &1E,&01,&00 00049 00050 7F9D 2B 07 08 00 DB "+",&07,&08,&00,"-" 7FA1 2D 00051 7FA2 2B 07 08 00 DB "+",&07,&08,&00,"-" 7FA6 2D 00052 7FA7 2B DB "+" 00053 Errors: 00000 Warnings: 00000 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;24.......54....assembler..Z80 Assembler......................Prodatron ;============================================================================== ; VINTAGE COMPUTING CHRISTMAS CHALLENGE 2024 (VC3 2024) ; platform - Amstrad CPC 6128 ; language - Z80 assembly ; contributor - PRODATRON ; date - December 2024 ;------------------------------------------------------------------------------ ; size - 54 bytes ;============================================================================== ;from Basic start with... ;MEMORY &5C1F ;LOAD"XC24PDT ;CALL &5C20 ;This approach divides the figure into many smaller and smaller building blocks ;that all build on each other. This is even used to draw the bow. ;It's not the shortest solution, but I still like the reduced building block ;idea. It's full of CALLs, and the Z80 doesn't support relative ones, otherwise ;it could be shorter. ;HL is completely unused, no idea, if it could be used for decreasing the size. txtout equ #bb5a de_org equ "\"*256+" " ;start/call address sets DE to "\ " (#5c20) org de_org call gift_linesub ;plot first bow part ld de,"/"*256+"o" ld b,1 call gift_chars ;plot second bow part call gift_linesep ;plot first of the three gift lines call gift_block ;plot upper gift part gift_block ;plot lower gift part ld c,8 gift_blockloop ld de,"!"*256+" " call gift_linefull dec c jr nz,gift_blockloop gift_linesep ld de,"+"*256+"-" gift_linefull rst #18 ;plots one full line (L=line, H=separator) dw rom_crlf ;cr/lf call gift_charsingle ;first char call gift_linesub ;first subline gift_linesub ld b,8 ;plots one subline (E=line, D=separator) gift_chars ld a,e gift_charloop call txtout djnz gift_charloop gift_charsingle ld a,d ;plots one char (D) jp txtout rom_crlf dw #c3e2 ;prints crlf (expects 0 behind it) totlen equ $-de_org - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;33.......62....assembler..Z80 Assembler......................Gallegux org #1300 ; de caracteres: db ' !-+' inicio ld hl, cadena ld b, 11 loop0 ld a, (hl) inc hl call #bb5a djnz loop0 ld c, d ;cont lin loop1 ld b, d ;cont col loop2 ld l, e ld a, b call check jr nz, next inc l next ld a, c call check jr nz, print_chr set 1,l print_chr ld a, (hl) call #bb5a djnz loop2 dec c jr nz, loop1 check cp 1 ret z cp 10 ret z cp d ret cadena: db 31, 24,1 ;3 locate db '\O/' ;3 lazo db 26, 15,33,1,24 ;5 ventana print $-caracteres - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;36.......63....assembler..Z80 Assembler......................Retropoke ; RETROPOKE PARTICIPATION CONCOURS VINTAGE COMPUTING CHRISMAS CHALLENGE 2024 ORG #BE00 ; MEMOIRE LIBRE DE #BDF7 A #BE3F ; DEBUT=#BE00 FIN=#BE3E TOTAL=63OCTETS LD B, #06 ; ON VA UTILISER LE CARACTERE DE CONTROLE (LOCATE) LD HL, DATA_NOEUD ; DANS UNE SUITE DE 6 OCTETS POUR AFFICHER LE NOEUD AFFICHER_NOEUD LD A, (HL) ; 'A' CONTIENT LE CARACTERE A AFFICHER INC HL ; 'HL' POINTE SUR LE CARACTERE SUIVANT CALL #BB5A ; VECTEUR QUI AFFICHE LE CARACTERE DJNZ, AFFICHER_NOEUD ; AFFICHER NOEUD... OK ; LD BC, #13FF ; 'C'= INDICATEUR DE SELECTION POUR LES LIGNES ; 'B'= NOMBRE DE LIGNE A FAIRE, SOIT(19) FAIRE_TOUTES_LES_LIGNES LD HL, #0B1A ; POSITION DE DEPART DU CADEAU 'H'= COLONNE 'L'= LIGNE CALL #BB75 ; VECTEUR EQUIVALENT A LOCATE 'H', 'L' LD HL, #2B2D ; PLACER DANS 'HL' LES CARACTERES DES LIGNES (1, 10 et 19) 'H'= "+" 'L'= "-" RRC C ; TOURNER 'C' VERS LA GAUCHE ET SI 'CARRY'<>1 ALORS JR C, CHOIX_LIGNE_OK ; PLACER DANS 'HL' LES AUTRES CARACTERES DES LIGNES (2 a 8) ET (11 a 18) LD HL, #2120 ; 'H'= "!" 'L'= " " CHOIX_LIGNE_OK LD E, 2 ; LA LIGNE "+--------" OU "! " SERA AFFICHEE 2 FOIS COPIAGE ; LD A, H ; 'A'= 1er CARACTERE A AFFICHER CALL #BB5A ; SOIT '+' SOIT '!' LD A, L ; 'A' CONTIENT SOIT "-" SOIT UN " " LD D, 8 ; 'D'= NOMBRE DE CARACTERES A AFFICHER ESPACE_MOINS CALL #BB5A ; AFFICHER UN "-" OU UN " " DEC D JR NZ, ESPACE_MOINS ; ET REPETER 8 FOIS LE MEME CARACTERE DEC E ; FAIRE UNE 2eme SERIE IDENTIQUES JR NZ, COPIAGE ; SOIT "+--------+--------" OU SOIT "! ! " LD A, H ; 'A'= "+" OU "!" CALL #BB5A ; AFFICHER LE DERNIER CARACTERE DE LA LIGNE DEC C ; REMETTRE L'INDICATEUR A JOUR DJNZ, FAIRE_TOUTES_LES_LIGNES ; ET FAIRE LES 19 LIGNES RET ; RETOURNER AU BASIC DATA_NOEUD ;; DONNEES EQU LOCATE 19, 26: PRINT CHR$(#CD);"o/" DB 31 ; LOCATE DB 19 ; COLONNE DB 26 ; LIGNE DB #CD ; \ DB "o" ; o DB "/" ; / ; ###################################### FIN ; TOTAL 63 OCTETS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;79.......85....assembler..Z80 Assembler......................issalig ; ============================================================================= ; Vintage Computing Christmas Challenge 2024 (VC³ 2024) ; Z80 assembly for Amstrad CPC ; desc. Draws a gift box. It uses a function to get the character from a set ; of 4 "+-! ". a=2*(row divby 9) + (col divby 9) ; comments. I tried to make it small but readable. Enjoy it! ; author. issalig ; date. 22/12/24 ; ============================================================================= ORG #8000 ; Program start address ; ============================================================================= ; Constants ; ============================================================================= PRINT_CHAR EQU #BB5A ; Firmware print routine CR EQU 13 ; Carriage return LF EQU 10 ; Line feed BOX_SIZE EQU 18 ; Size of the box DIV_VALUE EQU 9 ; Divisible value for pattern ; ============================================================================= ; Main Program ; ============================================================================= START: LD HL, RIBBON ; Print the decorative ribbon CALL PRINT_STR LD B, BOX_SIZE ; Initialize row counter LOOP_ROW: LD C, BOX_SIZE ; Initialize column counter LOOP_COL: LD A, B ; Get row CALL DIVBY9 ; divisible by 9 ADD A, A ; Multiply by 2 LD D, A ; Store result LD A, C ; Get column CALL DIVBY9 ; divisible by 9 ADD A, D ; a=2*(row divby 9) + (col divby 9) LD HL, CHARS ; Get character address ADD A, L ; Add offset LD L, A ; Update it LD A, (HL) ; Load character CALL PRINT_CHAR ; Print the character DEC C ; Next column JP P, LOOP_COL ; Continue if columns remain LD HL, CRLF ; Print newline CALL PRINT_STR DEC B ; Next row JP P, LOOP_ROW ; Continue if rows remain RET ; End program ; ============================================================================= ; Subroutines ; ============================================================================= ; ----------------------------------------------------------------------------- ; PRINT_STR - Print null-terminated string ; Input HL = Address of string ; Output None ; ----------------------------------------------------------------------------- PRINT_STR: LD A, (HL) ; Get character AND A ; Check for terminator RET Z ; Return if end of string CALL PRINT_CHAR ; Print character INC HL ; Next character JR PRINT_STR ; Continue printing ; ----------------------------------------------------------------------------- ; DIVBY9 - Compute if divisible by 9 ; Input A = value ; Output A = 0 if input mod 9 is 0, otherwise 1 ; ----------------------------------------------------------------------------- DIVBY9: CP DIV_VALUE ; Compare with 9 JR C, DIVBY9_LESS ; If A < 9 SUB DIV_VALUE ; Subtract 9 JR DIVBY9 ; Repeat until A < 9 DIVBY9_LESS: OR A; CP 0 ; Check if 0, OR A saves 1 byte JR Z, DIVBY9_ZERO ; If A = 0, return 0 LD A, 1 ; Else return 1 for non-zero results DIVBY9_ZERO: RET ; ============================================================================= ; Data Section ; ============================================================================= CHARS: DB '+-!' ; Pattern characters. use first space from ribbon to ; save 1 byte RIBBON: DB ' \O/' CRLF: DB CR, LF, 0 ; Newline. END ; ============================================================================= ; Cheatsheet for size reduction ; ============================================================================= ; CP 0 -> OR A ; LD A,0 -> XOR A ; CALL nn - RET -> JP NN ; JR -> JP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;133.....110....assembler..CP/M 8080 Assembler................DrSnuggles ORG 100H ; CP/M base of TPA (transient program area) LXI D,ST1 CALL PRI LXI D,ST2 CALL PRI CALL PR8 LXI D,ST2 CALL PRI CALL PR8 LXI D,ST2 CALL PRI RST 0 PR8: ; Loop 8 times MVI L,8 PL8: LXI D,ST3 CALL PRI DCR L RZ JMP PL8 PRI: ; wants string pointer in D PUSH L ; CP/M corrupts regs MVI C,9 ; BDOS function 9 (C_WRITESTR) - Output string CALL 5 ; BDOS function 5 (L_WRITE) - Printer output POP L ; Restore regs RET ST1:DB 4,0,' \O/',13,10,'$' ST2:DB '+--------+--------+ $' ST3:DB '! ! ! $' End: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;133.....110....assembler..Z80 Assembler......................DrSnuggles PrintChar EQU #BB5A ; A = CHAR, All regs are preserved StartAdress EQU #4000 ; it's relocateable ORG StartAdress WRITE DIRECT "A:VCCC2024.BIN" LD HL,ST1 CALL PrintString LD C,#2 Loop2: LD HL,ST2 CALL PrintString CALL PR8 DEC C JR Z,FinalLine JR Loop2 FinalLine: LD HL,ST2 CALL PrintString Endless: JR Endless PR8: LD B,#8 PL8: LD HL,ST3 CALL PrintString DEC B RET Z JR PL8 PrintString: LD A,(HL) CP 255 RET Z INC HL CALL PrintChar JR PrintString ST1:DB 4,0,' \O/',13,10,255 ST2:DB '+--------+--------+ ',255 ST3:DB '! ! ! ',255
 



Goto Top

CPC-POWER/CPCSOFTS, programmation par Kukulcan © 2007-2026 tous droits réservés.
Reproduction sans autorisation interdite. Tous les titres utilisés appartiennent à leurs propriétaires respectifs.
Hébergement Web, Mail et serveurs de jeux haute performance